From 26756c820ab57bbbaffa40827700bdfef96b2091 Mon Sep 17 00:00:00 2001 From: Robert Mosolgo Date: Mon, 8 Feb 2016 10:33:16 -0800 Subject: [PATCH 1/3] refactor(ServerRendering) simpler server rendering assets --- README.md | 7 +- Rakefile | 2 +- .../development-with-addons/react-server.js | 3088 +---------------- .../react-source/development/react-server.js | 936 +---- lib/generators/react/install_generator.rb | 5 + lib/generators/templates/server_rendering.js | 6 + .../server_rendering/sprockets_renderer.rb | 2 +- react-builds/package.json | 22 +- react-builds/react-server-with-addons.js | 9 - react-builds/react-server.js | 4 - .../assets/javascripts/server_rendering.js | 3 + test/generators/install_generator_test.rb | 8 + .../server_rendering/exec_js_renderer_test.rb | 3 +- .../sprockets_renderer_test.rb | 2 +- 14 files changed, 161 insertions(+), 3936 deletions(-) create mode 100644 lib/generators/templates/server_rendering.js delete mode 100644 react-builds/react-server-with-addons.js create mode 100644 test/dummy/app/assets/javascripts/server_rendering.js diff --git a/README.md b/README.md index d286f4bd1..6afb4338e 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ where you will put your components //= require react_ujs //= require components ``` +- create a `server_rendering.js` manifest file ## Usage @@ -177,8 +178,8 @@ _(It will also be mounted by the UJS on page load.)_ There are some requirements for this to work: -- `react-rails` must load your code. By convention, it uses `components.js`, which was created -by the install task. This file must include your components _and_ their dependencies (eg, Underscore.js). +- `react-rails` must load your code. By convention, it uses `server_rendering.js`, which was created +by the install task. This file must include React, ReactDOMServer, your components _and_ their dependencies (eg, Underscore.js). - Your components must be accessible in the global scope. If you are using `.js.jsx.coffee` files then the wrapper function needs to be taken into account: @@ -202,7 +203,7 @@ MyApp::Application.configure do config.react.server_renderer_timeout ||= 20 # seconds config.react.server_renderer = React::ServerRendering::SprocketsRenderer config.react.server_renderer_options = { - files: ["react-server.js", "components.js"], # files to load for prerendering + files: ["server_rendering.js"], # files to load for prerendering replay_console: true, # if true, console.* will be replayed client-side } end diff --git a/Rakefile b/Rakefile index d3cebf244..325577675 100644 --- a/Rakefile +++ b/Rakefile @@ -34,7 +34,7 @@ namespace :react do # With addons: copy_react_asset("#{environment}/react-browser-with-addons.js", "#{environment}-with-addons/react.js") - copy_react_asset("#{environment}/react-server-with-addons.js", "#{environment}-with-addons/react-server.js") + copy_react_asset("#{environment}/react-server.js", "#{environment}-with-addons/react-server.js") addons = %w( addons-clone-with-props diff --git a/lib/assets/react-source/development-with-addons/react-server.js b/lib/assets/react-source/development-with-addons/react-server.js index 51fdfbc7c..1af2bcdd7 100644 --- a/lib/assets/react-source/development-with-addons/react-server.js +++ b/lib/assets/react-source/development-with-addons/react-server.js @@ -44,84 +44,14 @@ /* 0 */ /***/ function(module, exports, __webpack_require__) { - var React = __webpack_require__(183); - var ReactDOM = __webpack_require__(184); var ReactDOMServer = __webpack_require__(186); - React.addons = __webpack_require__(185); - - window.React = React; - window.ReactDOM = ReactDOM; window.ReactDOMServer = ReactDOMServer; /***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__(2); - -/***/ }, -/* 2 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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. - * - * @typechecks static-only - * @providesModule cloneWithProps - */ - - 'use strict'; - - var ReactElement = __webpack_require__(4); - var ReactPropTransferer = __webpack_require__(8); - - var keyOf = __webpack_require__(11); - var warning = __webpack_require__(12); - - var CHILDREN_PROP = keyOf({ children: null }); - - var didDeprecatedWarn = false; - - /** - * Sometimes you want to change the props of a child passed to you. Usually - * this is to add a CSS class. - * - * @param {ReactElement} child child element you'd like to clone - * @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 (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)) { - newProps.children = child.props.children; - } - - // 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; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, +/* 1 */, +/* 2 */, /* 3 */ /***/ function(module, exports) { @@ -589,119 +519,7 @@ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) /***/ }, -/* 8 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * 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 ReactPropTransferer - */ - - 'use strict'; - - var assign = __webpack_require__(6); - var emptyFunction = __webpack_require__(9); - var joinClasses = __webpack_require__(10); - - /** - * Creates a transfer strategy that will merge prop values using the supplied - * `mergeStrategy`. If a prop was previously unset, this just sets it. - * - * @param {function} mergeStrategy - * @return {function} - */ - function createTransferStrategy(mergeStrategy) { - return function (props, key, value) { - if (!props.hasOwnProperty(key)) { - props[key] = value; - } else { - props[key] = mergeStrategy(props[key], value); - } - }; - } - - 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. - return assign({}, b, a); - }); - - /** - * Transfer strategies dictate how props are transferred by `transferPropsTo`. - * NOTE: if you add any more exceptions to this list you should be sure to - * update `cloneWithProps()` accordingly. - */ - var TransferStrategies = { - /** - * Never transfer `children`. - */ - children: emptyFunction, - /** - * Transfer the `className` prop by merging them. - */ - className: createTransferStrategy(joinClasses), - /** - * Transfer the `style` prop (which is an object) by merging them. - */ - style: transferStrategyMerge - }; - - /** - * Mutates the first argument by transferring the properties from the second - * argument. - * - * @param {object} props - * @param {object} newProps - * @return {object} - */ - function transferInto(props, newProps) { - for (var thisKey in newProps) { - if (!newProps.hasOwnProperty(thisKey)) { - continue; - } - - var transferStrategy = TransferStrategies[thisKey]; - - if (transferStrategy && TransferStrategies.hasOwnProperty(thisKey)) { - transferStrategy(props, thisKey, newProps[thisKey]); - } else if (!props.hasOwnProperty(thisKey)) { - props[thisKey] = newProps[thisKey]; - } - } - return props; - } - - /** - * ReactPropTransferer are capable of transferring props to another component - * using a `transferPropsTo` method. - * - * @class ReactPropTransferer - */ - var ReactPropTransferer = { - - /** - * Merge two props objects using TransferStrategies. - * - * @param {object} oldProps original props (they take precedence) - * @param {object} newProps new props to merge in - * @return {object} a new object containing both sets of props merged. - */ - mergeProps: function (oldProps, newProps) { - return transferInto(assign({}, oldProps), newProps); - } - - }; - - module.exports = ReactPropTransferer; - -/***/ }, +/* 8 */, /* 9 */ /***/ function(module, exports) { @@ -745,50 +563,7 @@ module.exports = emptyFunction; /***/ }, -/* 10 */ -/***/ function(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} 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; - -/***/ }, +/* 10 */, /* 11 */ /***/ function(module, exports) { @@ -892,82 +667,8 @@ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) /***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__(14).create; - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 ReactChildren = __webpack_require__(15); - var ReactElement = __webpack_require__(4); - - var emptyFunction = __webpack_require__(9); - var invariant = __webpack_require__(17); - var warning = __webpack_require__(12); - - /** - * 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 an array. - */ - - 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 (typeof object !== 'object' || !object || Array.isArray(object)) { - 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)) { - process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined; - return object; - } - - !(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) { - 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; - } - } - ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument); - } - - return result; - } - }; - - module.exports = ReactFragment; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, +/* 13 */, +/* 14 */, /* 15 */ /***/ function(module, exports, __webpack_require__) { @@ -1307,7 +1008,7 @@ * will remain to ensure logic does not differ in production. */ - function invariant(condition, format, a, b, c, d, e, f) { + var invariant = function (condition, format, a, b, c, d, e, f) { if (process.env.NODE_ENV !== 'production') { if (format === undefined) { throw new Error('invariant requires an error message argument'); @@ -1321,16 +1022,15 @@ } else { var args = [a, b, c, d, e, f]; var argIndex = 0; - error = new Error(format.replace(/%s/g, function () { + error = new Error('Invariant Violation: ' + 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; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) @@ -1918,16 +1618,14 @@ module.exports = getIteratorFn; /***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__(23); - -/***/ }, -/* 23 */ +/* 22 */, +/* 23 */, +/* 24 */, +/* 25 */, +/* 26 */ /***/ function(module, exports, __webpack_require__) { - /** + /* WEBPACK VAR INJECTION */(function(process) {/** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * @@ -1935,287 +1633,56 @@ * 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. * - * @typechecks - * @providesModule ReactCSSTransitionGroup + * @providesModule ReactDOMTextComponent + * @typechecks static-only */ 'use strict'; - var React = __webpack_require__(24); + var DOMChildrenOperations = __webpack_require__(27); + var DOMPropertyOperations = __webpack_require__(40); + var ReactComponentBrowserEnvironment = __webpack_require__(43); + var ReactMount = __webpack_require__(45); var assign = __webpack_require__(6); - - var ReactTransitionGroup = __webpack_require__(165); - var ReactCSSTransitionGroupChild = __webpack_require__(167); - - 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: ReactCSSTransitionGroupChild.propTypes.name, - - transitionAppear: React.PropTypes.bool, - transitionEnter: React.PropTypes.bool, - transitionLeave: React.PropTypes.bool, - transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'), - transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'), - transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave') - }, - - getDefaultProps: function () { - return { - transitionAppear: false, - transitionEnter: true, - transitionLeave: true - }; - }, - - _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 React.createElement(ReactCSSTransitionGroupChild, { - 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 - }, child); - }, - - render: function () { - return React.createElement(ReactTransitionGroup, assign({}, this.props, { childFactory: this._wrapChild })); - } - }); - - module.exports = ReactCSSTransitionGroup; - -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { + var escapeTextContentForBrowser = __webpack_require__(39); + var setTextContent = __webpack_require__(38); + var validateDOMNesting = __webpack_require__(81); /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. + * Text nodes violate a couple assumptions that React makes about components: * - * 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. + * - When mounting text into the DOM, adjacent text nodes are merged. + * - Text nodes cannot be assigned a React root ID. + * + * This component is used to wrap strings in elements so that they can undergo + * the same reconciliation that is applied to elements. + * + * TODO: Investigate representing React components in the DOM with text nodes. * - * @providesModule React + * @class ReactDOMTextComponent + * @extends ReactComponent + * @internal */ + var ReactDOMTextComponent = function (props) { + // This constructor and its argument is currently used by mocks. + }; - 'use strict'; - - var ReactDOM = __webpack_require__(25); - var ReactDOMServer = __webpack_require__(155); - var ReactIsomorphic = __webpack_require__(159); - - var assign = __webpack_require__(6); - var deprecated = __webpack_require__(164); + assign(ReactDOMTextComponent.prototype, { - // `version` will be added here by ReactIsomorphic. - var React = {}; + /** + * @param {ReactText} text + * @internal + */ + construct: function (text) { + // TODO: This is really a ReactText (ReactNode), not a ReactElement + this._currentElement = text; + this._stringText = '' + text; - 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.__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; - -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 ReactDOM - */ - - /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ - - 'use strict'; - - var ReactCurrentOwner = __webpack_require__(5); - var ReactDOMTextComponent = __webpack_require__(26); - var ReactDefaultInjection = __webpack_require__(82); - var ReactInstanceHandles = __webpack_require__(19); - var ReactMount = __webpack_require__(45); - var ReactPerf = __webpack_require__(36); - var ReactReconciler = __webpack_require__(62); - var ReactUpdates = __webpack_require__(66); - var ReactVersion = __webpack_require__(153); - - var findDOMNode = __webpack_require__(101); - var renderSubtreeIntoContainer = __webpack_require__(154); - var warning = __webpack_require__(12); - - 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 - }); - } - - if (process.env.NODE_ENV !== 'production') { - var ExecutionEnvironment = __webpack_require__(29); - 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'); - } - } - - // 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: ' + '') : 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; - } - } - } - } - - module.exports = React; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 26 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 ReactDOMTextComponent - * @typechecks static-only - */ - - 'use strict'; - - var DOMChildrenOperations = __webpack_require__(27); - var DOMPropertyOperations = __webpack_require__(40); - var ReactComponentBrowserEnvironment = __webpack_require__(43); - var ReactMount = __webpack_require__(45); - - var assign = __webpack_require__(6); - var escapeTextContentForBrowser = __webpack_require__(39); - var setTextContent = __webpack_require__(38); - var validateDOMNesting = __webpack_require__(81); - - /** - * Text nodes violate a couple assumptions that React makes about components: - * - * - When mounting text into the DOM, adjacent text nodes are merged. - * - Text nodes cannot be assigned a React root ID. - * - * This component is used to wrap strings in elements so that they can undergo - * the same reconciliation that is applied to elements. - * - * TODO: Investigate representing React components in the DOM with text nodes. - * - * @class ReactDOMTextComponent - * @extends ReactComponent - * @internal - */ - var ReactDOMTextComponent = function (props) { - // This constructor and its argument is currently used by mocks. - }; - - assign(ReactDOMTextComponent.prototype, { - - /** - * @param {ReactText} text - * @internal - */ - construct: function (text) { - // TODO: This is really a ReactText (ReactNode), not a ReactElement - this._currentElement = text; - this._stringText = '' + text; - - // Properties - this._rootNodeID = null; - this._mountIndex = 0; - }, + // Properties + this._rootNodeID = null; + this._mountIndex = 0; + }, /** * Creates the markup for this text node. This node is not intended to have @@ -11331,8 +10798,8 @@ */ // autoCapitalize and autoCorrect are supported in Mobile Safari for // keyboard hints. - autoCapitalize: MUST_USE_ATTRIBUTE, - autoCorrect: MUST_USE_ATTRIBUTE, + autoCapitalize: null, + autoCorrect: null, // autoSave allows WebKit/Blink to persist values of input fields on page reloads autoSave: null, // color is for Safari mask-icon link @@ -11363,7 +10830,9 @@ httpEquiv: 'http-equiv' }, DOMPropertyNames: { + autoCapitalize: 'autocapitalize', autoComplete: 'autocomplete', + autoCorrect: 'autocorrect', autoFocus: 'autofocus', autoPlay: 'autoplay', autoSave: 'autosave', @@ -14015,7 +13484,7 @@ var value = LinkedValueUtils.getValue(props); if (value != null) { - updateOptions(this, Boolean(props.multiple), value); + updateOptions(this, props, value); } } } @@ -17050,14 +16519,11 @@ * @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. + * The activeElement will be null only if the document or document body is not yet defined. */ 'use strict'; @@ -17065,6 +16531,7 @@ if (typeof document === 'undefined') { return null; } + try { return document.activeElement || document.body; } catch (e) { @@ -18804,9 +18271,7 @@ 'setValueForProperty': 'update attribute', 'setValueForAttribute': 'update attribute', 'deleteValueForProperty': 'remove attribute', - 'setValueForStyles': 'update styles', - 'replaceNodeWithMarkup': 'replace', - 'updateTextContent': 'set textContent' + 'dangerouslyReplaceNodeWithMarkupByID': 'replace' }; function getTotalTime(measurements) { @@ -18998,24 +18463,19 @@ 'use strict'; var performance = __webpack_require__(152); - - var performanceNow; + var curPerformance = 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.now) { - performanceNow = function () { - return performance.now(); - }; - } else { - performanceNow = function () { - return Date.now(); - }; + if (!curPerformance || !curPerformance.now) { + curPerformance = Date; } + var performanceNow = curPerformance.now.bind(curPerformance); + module.exports = performanceNow; /***/ }, @@ -19066,27 +18526,7 @@ module.exports = '0.14.6'; /***/ }, -/* 154 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * 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 = __webpack_require__(45); - - module.exports = ReactMount.renderSubtreeIntoContainer; - -/***/ }, +/* 154 */, /* 155 */ /***/ function(module, exports, __webpack_require__) { @@ -19327,2377 +18767,33 @@ module.exports = ReactServerRenderingTransaction; /***/ }, -/* 159 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 = __webpack_require__(15); - var ReactComponent = __webpack_require__(130); - var ReactClass = __webpack_require__(129); - var ReactDOMFactories = __webpack_require__(160); - var ReactElement = __webpack_require__(4); - var ReactElementValidator = __webpack_require__(161); - var ReactPropTypes = __webpack_require__(117); - var ReactVersion = __webpack_require__(153); - - var assign = __webpack_require__(6); - var onlyChild = __webpack_require__(163); - - 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; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 160 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 = __webpack_require__(4); - var ReactElementValidator = __webpack_require__(161); - - var mapObject = __webpack_require__(162); - - /** - * 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; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 161 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 ReactElementValidator - */ - - /** - * ReactElementValidator provides a wrapper around a element factory - * which validates the props passed to the element. This is intended to be - * used only in DEV and could be replaced by a static type checker for languages - * that support it. - */ - - 'use strict'; - - var ReactElement = __webpack_require__(4); - var ReactPropTypeLocations = __webpack_require__(76); - var ReactPropTypeLocationNames = __webpack_require__(77); - var ReactCurrentOwner = __webpack_require__(5); - - var canDefineProperty = __webpack_require__(7); - var getIteratorFn = __webpack_require__(21); - var invariant = __webpack_require__(17); - var warning = __webpack_require__(12); - - function getDeclarationErrorAddendum() { - if (ReactCurrentOwner.current) { - var name = ReactCurrentOwner.current.getName(); - if (name) { - return ' Check the render method of `' + name + '`.'; - } - } - return ''; - } - - /** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - var ownerHasKeyUseWarning = {}; - - var loggedTypeFailures = {}; - - /** - * 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 - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ - function validateExplicitKey(element, parentType) { - if (!element._store || element._store.validated || element.key != null) { - return; - } - element._store.validated = true; - - var addenda = getAddendaForKeyUse('uniqueKey', element, parentType); - if (addenda === null) { - // we already showed the warning - return; - } - 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} 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 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[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. - 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; - } - - /** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @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]; - if (ReactElement.isValidElement(child)) { - validateExplicitKey(child, parentType); - } - } - } 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. - if (iteratorFn) { - if (iteratorFn !== node.entries) { - var iterator = iteratorFn.call(node); - var step; - while (!(step = iterator.next()).done) { - if (ReactElement.isValidElement(step.value)) { - validateExplicitKey(step.value, parentType); - } - } - } - } - } - } - - /** - * Assert that the props are valid - * - * @param {string} componentName Name of the component for error messages. - * @param {object} propTypes Map of prop name to a ReactPropType - * @param {object} props - * @param {string} location e.g. "prop", "context", "child context" - * @private - */ - function checkPropTypes(componentName, propTypes, props, location) { - for (var propName in propTypes) { - if (propTypes.hasOwnProperty(propName)) { - var error; - // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - !(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); - } 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(); - process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined; - } - } - } - } - - /** - * Given an element, validate that its props follow the propTypes definition, - * provided by the type. - * - * @param {ReactElement} element - */ - function validatePropTypes(element) { - var componentClass = element.type; - if (typeof componentClass !== 'function') { - return; - } - var name = componentClass.displayName || componentClass.name; - if (componentClass.propTypes) { - checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop); - } - if (typeof componentClass.getDefaultProps === 'function') { - 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 = { - - 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. - 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); - - // The result can be nullish if a mock or a custom function is used. - // TODO: Drop this when these are no longer allowed as the type argument. - if (element == null) { - 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); - // Legacy hook TODO: Warn if this is accessed - validatedFactory.type = type; - - if (process.env.NODE_ENV !== 'production') { - if (canDefineProperty) { - Object.defineProperty(validatedFactory, 'type', { - enumerable: false, - 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; - } - }); - } - } - - return validatedFactory; - }, - - 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); - } - validatePropTypes(newElement); - return newElement; - } - - }; - - module.exports = ReactElementValidator; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 162 */ -/***/ function(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; - -/***/ }, -/* 163 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 onlyChild - */ - 'use strict'; - - var ReactElement = __webpack_require__(4); - - var invariant = __webpack_require__(17); - - /** - * Returns the first child in a collection of children and verifies that there - * is only one child in the collection. The current implementation of this - * function assumes that a single child gets passed without a wrapper, but the - * purpose of this helper function is to abstract away the particular structure - * of children. - * - * @param {?object} children Child collection structure. - * @return {ReactComponent} The first and only `ReactComponent` contained in the - * structure. - */ - function onlyChild(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; - } - - module.exports = onlyChild; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 164 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 = __webpack_require__(6); - var warning = __webpack_require__(12); - - /** - * 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; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 165 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * 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 ReactTransitionGroup - */ - - 'use strict'; - - var React = __webpack_require__(24); - var ReactTransitionChildMapping = __webpack_require__(166); - - var assign = __webpack_require__(6); - var emptyFunction = __webpack_require__(9); - - var ReactTransitionGroup = React.createClass({ - displayName: 'ReactTransitionGroup', - - propTypes: { - component: React.PropTypes.any, - childFactory: React.PropTypes.func - }, - - getDefaultProps: function () { - return { - component: 'span', - childFactory: emptyFunction.thatReturnsArgument - }; - }, - - getInitialState: function () { - return { - children: ReactTransitionChildMapping.getChildMapping(this.props.children) - }; - }, - - componentWillMount: function () { - this.currentlyTransitioningKeys = {}; - this.keysToEnter = []; - this.keysToLeave = []; - }, - - componentDidMount: function () { - var initialChildMapping = this.state.children; - for (var key in initialChildMapping) { - if (initialChildMapping[key]) { - this.performAppear(key); - } - } - }, - - componentWillReceiveProps: function (nextProps) { - var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children); - var prevChildMapping = this.state.children; - - this.setState({ - children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping) - }); - - var key; - - for (key in nextChildMapping) { - var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(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]) { - this.keysToLeave.push(key); - } - } - - // If we want to someday check for reordering, we could do it here. - }, - - componentDidUpdate: function () { - var keysToEnter = this.keysToEnter; - this.keysToEnter = []; - keysToEnter.forEach(this.performEnter); - - var keysToLeave = this.keysToLeave; - this.keysToLeave = []; - keysToLeave.forEach(this.performLeave); - }, - - performAppear: function (key) { - this.currentlyTransitioningKeys[key] = true; - - var component = this.refs[key]; - - if (component.componentWillAppear) { - component.componentWillAppear(this._handleDoneAppearing.bind(this, key)); - } else { - this._handleDoneAppearing(key); - } - }, - - _handleDoneAppearing: function (key) { - var component = this.refs[key]; - if (component.componentDidAppear) { - component.componentDidAppear(); - } - - delete this.currentlyTransitioningKeys[key]; - - var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children); - - if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { - // This was removed before it had fully appeared. Remove it. - this.performLeave(key); - } - }, - - performEnter: function (key) { - this.currentlyTransitioningKeys[key] = true; - - var component = this.refs[key]; - - if (component.componentWillEnter) { - component.componentWillEnter(this._handleDoneEntering.bind(this, key)); - } else { - this._handleDoneEntering(key); - } - }, - - _handleDoneEntering: function (key) { - var component = this.refs[key]; - if (component.componentDidEnter) { - component.componentDidEnter(); - } - - delete this.currentlyTransitioningKeys[key]; - - var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children); - - if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { - // This was removed before it had fully entered. Remove it. - this.performLeave(key); - } - }, - - performLeave: function (key) { - this.currentlyTransitioningKeys[key] = true; - - var component = this.refs[key]; - if (component.componentWillLeave) { - component.componentWillLeave(this._handleDoneLeaving.bind(this, key)); - } else { - // Note that this is somewhat dangerous b/c it calls setState() - // again, effectively mutating the component before all the work - // is done. - this._handleDoneLeaving(key); - } - }, - - _handleDoneLeaving: function (key) { - var component = this.refs[key]; - - if (component.componentDidLeave) { - component.componentDidLeave(); - } - - delete this.currentlyTransitioningKeys[key]; - - 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 { - this.setState(function (state) { - var newChildren = assign({}, state.children); - delete newChildren[key]; - return { children: newChildren }; - }); - } - }, - - render: function () { - // TODO: we could get rid of the need for the wrapper node - // by cloning a single child - var childrenToRender = []; - for (var key in this.state.children) { - var child = this.state.children[key]; - if (child) { - // You may need to apply reactive updates to a child as it is leaving. - // The normal React way to do it won't work since the child will have - // 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(React.cloneElement(this.props.childFactory(child), { ref: key, key: key })); - } - } - return React.createElement(this.props.component, this.props, childrenToRender); - } - }); - - module.exports = ReactTransitionGroup; - -/***/ }, -/* 166 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * 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. - * - * @typechecks static-only - * @providesModule ReactTransitionChildMapping - */ - - 'use strict'; - - var flattenChildren = __webpack_require__(123); - - var ReactTransitionChildMapping = { - /** - * Given `this.props.children`, return an object mapping key to child. Just - * simple syntactic sugar around flattenChildren(). - * - * @param {*} children `this.props.children` - * @return {object} Mapping of key to child - */ - getChildMapping: function (children) { - if (!children) { - return children; - } - return flattenChildren(children); - }, - - /** - * When you're adding or removing children some may be added or removed in the - * same render pass. We want to show *both* since we want to simultaneously - * animate elements in and out. This function takes a previous set of keys - * and a new set of keys and merges them with its best guess of the correct - * ordering. In the future we may expose some of the utilities in - * ReactMultiChild to make this easy, but for now React itself does not - * directly have this concept of the union of prevChildren and nextChildren - * so we implement it here. - * - * @param {object} prev prev children as returned from - * `ReactTransitionChildMapping.getChildMapping()`. - * @param {object} next next children as returned from - * `ReactTransitionChildMapping.getChildMapping()`. - * @return {object} a key set that contains all keys in `prev` and all keys - * in `next` in a reasonable order. - */ - mergeChildMappings: function (prev, next) { - prev = prev || {}; - next = next || {}; - - function getValueForKey(key) { - if (next.hasOwnProperty(key)) { - return next[key]; - } else { - return prev[key]; - } - } - - // For each key of `next`, the list of keys to insert before that key in - // the combined list - var nextKeysPending = {}; - - var pendingKeys = []; - for (var prevKey in prev) { - if (next.hasOwnProperty(prevKey)) { - if (pendingKeys.length) { - nextKeysPending[prevKey] = pendingKeys; - pendingKeys = []; - } - } else { - pendingKeys.push(prevKey); - } - } - - var i; - var childMapping = {}; - for (var nextKey in next) { - if (nextKeysPending.hasOwnProperty(nextKey)) { - for (i = 0; i < nextKeysPending[nextKey].length; i++) { - var pendingNextKey = nextKeysPending[nextKey][i]; - childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey); - } - } - childMapping[nextKey] = getValueForKey(nextKey); - } - - // Finally, add the keys which didn't appear before any key in `next` - for (i = 0; i < pendingKeys.length; i++) { - childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]); - } - - return childMapping; - } - }; - - module.exports = ReactTransitionChildMapping; - -/***/ }, -/* 167 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * 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. - * - * @typechecks - * @providesModule ReactCSSTransitionGroupChild - */ - - 'use strict'; - - var React = __webpack_require__(24); - var ReactDOM = __webpack_require__(25); - - var CSSCore = __webpack_require__(168); - var ReactTransitionEvents = __webpack_require__(169); - - var onlyChild = __webpack_require__(163); - - // 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 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 - }, - - transition: function (animationType, finishCallback, userSpecifiedDelay) { - var node = ReactDOM.findDOMNode(this); - - if (!node) { - if (finishCallback) { - finishCallback(); - } - return; - } - - 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) { - if (e && e.target !== node) { - return; - } - - clearTimeout(timeout); - - CSSCore.removeClass(node, className); - CSSCore.removeClass(node, activeClassName); - - ReactTransitionEvents.removeEndEventListener(node, endListener); - - // Usually this optional callback is used for informing an owner of - // a leave animation and telling it to remove the child. - if (finishCallback) { - finishCallback(); - } - }; - - CSSCore.addClass(node, className); - - // Need to do this to actually trigger a transition. - this.queueClass(activeClassName); - - // 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) { - this.classNameQueue.push(className); - - if (!this.timeout) { - this.timeout = setTimeout(this.flushClassNameQueue, TICK); - } - }, - - flushClassNameQueue: function () { - if (this.isMounted()) { - this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this))); - } - this.classNameQueue.length = 0; - this.timeout = null; - }, - - componentWillMount: function () { - this.classNameQueue = []; - this.transitionTimeouts = []; - }, - - componentWillUnmount: function () { - if (this.timeout) { - clearTimeout(this.timeout); - } - this.transitionTimeouts.forEach(function (timeout) { - clearTimeout(timeout); - }); - }, - - componentWillAppear: function (done) { - if (this.props.appear) { - this.transition('appear', done, this.props.appearTimeout); - } else { - done(); - } - }, - - componentWillEnter: function (done) { - if (this.props.enter) { - this.transition('enter', done, this.props.enterTimeout); - } else { - done(); - } - }, - - componentWillLeave: function (done) { - if (this.props.leave) { - this.transition('leave', done, this.props.leaveTimeout); - } else { - done(); - } - }, - - render: function () { - return onlyChild(this.props.children); - } - }); - - module.exports = ReactCSSTransitionGroupChild; - -/***/ }, -/* 168 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 = __webpack_require__(17); - - /** - * 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) ? process.env.NODE_ENV !== '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) ? process.env.NODE_ENV !== '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) ? process.env.NODE_ENV !== '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; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 169 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * 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 ReactTransitionEvents - */ - - 'use strict'; - - var ExecutionEnvironment = __webpack_require__(29); - - /** - * EVENT_NAME_MAP is used to determine which event fired when a - * transition/animation ends, based on the style property used to - * define that event. - */ - var EVENT_NAME_MAP = { - transitionend: { - 'transition': 'transitionend', - 'WebkitTransition': 'webkitTransitionEnd', - 'MozTransition': 'mozTransitionEnd', - 'OTransition': 'oTransitionEnd', - 'msTransition': 'MSTransitionEnd' - }, - - animationend: { - 'animation': 'animationend', - 'WebkitAnimation': 'webkitAnimationEnd', - 'MozAnimation': 'mozAnimationEnd', - 'OAnimation': 'oAnimationEnd', - 'msAnimation': 'MSAnimationEnd' - } - }; - - var endEvents = []; - - function detectEvents() { - var testEl = document.createElement('div'); - var style = testEl.style; - - // On some platforms, in particular some releases of Android 4.x, - // the un-prefixed "animation" and "transition" properties are defined on the - // style object but the events that fire will still be prefixed, so we need - // to check if the un-prefixed events are useable, and if not remove them - // from the map - if (!('AnimationEvent' in window)) { - delete EVENT_NAME_MAP.animationend.animation; - } - - if (!('TransitionEvent' in window)) { - delete EVENT_NAME_MAP.transitionend.transition; - } - - for (var baseEventName in EVENT_NAME_MAP) { - var baseEvents = EVENT_NAME_MAP[baseEventName]; - for (var styleName in baseEvents) { - if (styleName in style) { - endEvents.push(baseEvents[styleName]); - break; - } - } - } - } - - if (ExecutionEnvironment.canUseDOM) { - detectEvents(); - } - - // We use the raw {add|remove}EventListener() call because EventListener - // does not know how to remove event listeners and we really should - // clean up. Also, these events are not triggered in older browsers - // so we should be A-OK here. - - function addEventListener(node, eventName, eventListener) { - node.addEventListener(eventName, eventListener, false); - } - - function removeEventListener(node, eventName, eventListener) { - node.removeEventListener(eventName, eventListener, false); - } - - var ReactTransitionEvents = { - 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) { - addEventListener(node, endEvent, eventListener); - }); - }, - - removeEndEventListener: function (node, eventListener) { - if (endEvents.length === 0) { - return; - } - endEvents.forEach(function (endEvent) { - removeEventListener(node, endEvent, eventListener); - }); - } - }; - - module.exports = ReactTransitionEvents; - -/***/ }, -/* 170 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__(171); - -/***/ }, -/* 171 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * 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 LinkedStateMixin - * @typechecks static-only - */ - - 'use strict'; - - var ReactLink = __webpack_require__(172); - var ReactStateSetters = __webpack_require__(173); - - /** - * A simple mixin around ReactLink.forState(). - */ - var LinkedStateMixin = { - /** - * Create a ReactLink that's linked to part of this component's state. The - * ReactLink will have the current value of this.state[key] and will call - * setState() when a change is requested. - * - * @param {string} key state key to update. Note: you may want to use keyOf() - * 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)); - } - }; - - module.exports = LinkedStateMixin; - -/***/ }, -/* 172 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * 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 ReactLink - * @typechecks static-only - */ - - 'use strict'; - - /** - * ReactLink encapsulates a common pattern in which a component wants to modify - * a prop received from its parent. ReactLink allows the parent to pass down a - * value coupled with a callback that, when invoked, expresses an intent to - * modify that value. For example: - * - * React.createClass({ - * getInitialState: function() { - * return {value: ''}; - * }, - * render: function() { - * var valueLink = new ReactLink(this.state.value, this._handleValueChange); - * return ; - * }, - * _handleValueChange: function(newValue) { - * this.setState({value: newValue}); - * } - * }); - * - * We have provided some sugary mixins to make the creation and - * consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin. - */ - - var React = __webpack_require__(24); - - /** - * @param {*} value current value of the link - * @param {function} requestChange callback to request a change - */ - function ReactLink(value, requestChange) { - this.value = value; - this.requestChange = requestChange; - } - - /** - * Creates a PropType that enforces the ReactLink API and optionally checks the - * type of the value being passed inside the link. Example: - * - * MyComponent.propTypes = { - * tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number) - * } - */ - function createLinkTypeChecker(linkType) { - var shapes = { - value: typeof linkType === 'undefined' ? React.PropTypes.any.isRequired : linkType.isRequired, - requestChange: React.PropTypes.func.isRequired - }; - return React.PropTypes.shape(shapes); - } - - ReactLink.PropTypes = { - link: createLinkTypeChecker - }; - - module.exports = ReactLink; - -/***/ }, -/* 173 */ -/***/ function(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 ReactStateSetters - */ - - 'use strict'; - - var ReactStateSetters = { - /** - * Returns a function that calls the provided function, and uses the result - * of that to set the component's state. - * - * @param {ReactCompositeComponent} component - * @param {function} funcReturningState Returned callback uses this to - * determine how to update state. - * @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) { - var partialState = funcReturningState.call(component, a, b, c, d, e, f); - if (partialState) { - component.setState(partialState); - } - }; - }, - - /** - * Returns a single-argument callback that can be used to update a single - * key in the component's state. - * - * Note: this is memoized function, which makes it inexpensive to call. - * - * @param {ReactCompositeComponent} component - * @param {string} key The key in the state that you should update. - * @return {function} callback of 1 argument which calls setState() with - * the provided keyName and callback argument. - */ - createStateKeySetter: function (component, key) { - // Memoize the setters. - var cache = component.__keySetters || (component.__keySetters = {}); - return cache[key] || (cache[key] = createStateKeySetter(component, key)); - } - }; - - function createStateKeySetter(component, key) { - // Partial state is allocated outside of the function closure so it can be - // reused with every call, avoiding memory allocation when this function - // is called. - var partialState = {}; - return function stateKeySetter(value) { - partialState[key] = value; - component.setState(partialState); - }; - } - - ReactStateSetters.Mixin = { - /** - * Returns a function that calls the provided function, and uses the result - * of that to set the component's state. - * - * For example, these statements are equivalent: - * - * this.setState({x: 1}); - * this.createStateSetter(function(xValue) { - * return {x: xValue}; - * })(1); - * - * @param {function} funcReturningState Returned callback uses this to - * determine how to update state. - * @return {function} callback that when invoked uses funcReturningState to - * determined the object literal to setState. - */ - createStateSetter: function (funcReturningState) { - return ReactStateSetters.createStateSetter(this, funcReturningState); - }, - - /** - * Returns a single-argument callback that can be used to update a single - * key in the component's state. - * - * For example, these statements are equivalent: - * - * this.setState({x: 1}); - * this.createStateKeySetter('x')(1); - * - * Note: this is memoized function, which makes it inexpensive to call. - * - * @param {string} key The key in the state that you should update. - * @return {function} callback of 1 argument which calls setState() with - * the provided keyName and callback argument. - */ - createStateKeySetter: function (key) { - return ReactStateSetters.createStateKeySetter(this, key); - } - }; - - module.exports = ReactStateSetters; - -/***/ }, -/* 174 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__(149); - -/***/ }, -/* 175 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__(176); - -/***/ }, -/* 176 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * 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 ReactComponentWithPureRenderMixin - */ - - 'use strict'; - - var shallowCompare = __webpack_require__(177); - - /** - * If your React component's render function is "pure", e.g. it will render the - * same result given the same props and state, provide this Mixin for a - * considerable performance boost. - * - * Most React components have pure render functions. - * - * Example: - * - * var ReactComponentWithPureRenderMixin = - * require('ReactComponentWithPureRenderMixin'); - * React.createClass({ - * mixins: [ReactComponentWithPureRenderMixin], - * - * render: function() { - * return
foo
; - * } - * }); - * - * Note: This only checks shallow equality for props and state. If these contain - * complex data structures this mixin may have false-negatives for deeper - * differences. Only mixin to components which have simple props and state, or - * use `forceUpdate()` when you know deep data structures have changed. - */ - var ReactComponentWithPureRenderMixin = { - shouldComponentUpdate: function (nextProps, nextState) { - return shallowCompare(this, nextProps, nextState); - } - }; - - module.exports = ReactComponentWithPureRenderMixin; - -/***/ }, -/* 177 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * 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 = __webpack_require__(124); - - /** - * 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; - -/***/ }, -/* 178 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__(179); - -/***/ }, -/* 179 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 ReactTestUtils - */ - - 'use strict'; - - var EventConstants = __webpack_require__(47); - var EventPluginHub = __webpack_require__(48); - var EventPropagators = __webpack_require__(84); - var React = __webpack_require__(24); - var ReactDOM = __webpack_require__(25); - var ReactElement = __webpack_require__(4); - var ReactBrowserEventEmitter = __webpack_require__(46); - var ReactCompositeComponent = __webpack_require__(74); - var ReactInstanceHandles = __webpack_require__(19); - var ReactInstanceMap = __webpack_require__(59); - var ReactMount = __webpack_require__(45); - var ReactUpdates = __webpack_require__(66); - var SyntheticEvent = __webpack_require__(88); - - var assign = __webpack_require__(6); - var emptyObject = __webpack_require__(69); - var findDOMNode = __webpack_require__(101); - var invariant = __webpack_require__(17); - - var topLevelTypes = EventConstants.topLevelTypes; - - function Event(suffix) {} - - /** - * @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) { - 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 ReactDOM.render(instance, div); - }, - - isElement: function (element) { - return ReactElement.isValidElement(element); - }, - - isElementOfType: function (inst, convenienceConstructor) { - return ReactElement.isValidElement(inst) && inst.type === convenienceConstructor; - }, - - isDOMComponent: function (inst) { - return !!(inst && inst.nodeType === 1 && inst.tagName); - }, - - isDOMComponentElement: function (inst) { - return !!(inst && ReactElement.isValidElement(inst) && !!inst.tagName); - }, - - 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) { - if (!ReactTestUtils.isCompositeComponent(inst)) { - return false; - } - var internalInstance = ReactInstanceMap.get(inst); - var constructor = internalInstance._currentElement.type; - - return constructor === type; - }, - - 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'; - }, - - isCompositeComponentElementWithType: function (inst, type) { - var internalInstance = ReactInstanceMap.get(inst); - var constructor = internalInstance._currentElement.type; - - return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type); - }, - - getRenderedChildOfCompositeComponent: function (inst) { - if (!ReactTestUtils.isCompositeComponent(inst)) { - return null; - } - var internalInstance = ReactInstanceMap.get(inst); - return internalInstance._renderedComponent.getPublicInstance(); - }, - - findAllInRenderedTree: function (inst, test) { - if (!inst) { - return []; - } - !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 {array} an array of all the matches. - */ - 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; - }); - }, - - /** - * Like scryRenderedDOMComponentsWithClass but expects there to be one result, - * and returns that one result, or throws exception if there is any other - * number of matches besides one. - * @return {!ReactDOMComponent} The one match. - */ - 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); - } - return all[0]; - }, - - /** - * Finds all instance of components in the rendered tree that are DOM - * components with the tag name matching `tagName`. - * @return {array} an array of all the matches. - */ - scryRenderedDOMComponentsWithTag: function (root, tagName) { - return ReactTestUtils.findAllInRenderedTree(root, function (inst) { - return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase(); - }); - }, - - /** - * Like scryRenderedDOMComponentsWithTag but expects there to be one result, - * and returns that one result, or throws exception if there is any other - * number of matches besides one. - * @return {!ReactDOMComponent} The one match. - */ - 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); - } - return all[0]; - }, - - /** - * Finds all instances of components with type equal to `componentType`. - * @return {array} an array of all the matches. - */ - scryRenderedComponentsWithType: function (root, componentType) { - return ReactTestUtils.findAllInRenderedTree(root, function (inst) { - return ReactTestUtils.isCompositeComponentWithType(inst, componentType); - }); - }, - - /** - * Same as `scryRenderedComponentsWithType` but expects there to be one result - * and returns that one result, or throws exception if there is any other - * number of matches besides one. - * @return {!ReactComponent} The one match. - */ - 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 + ' (found ' + all.length + ')'); - } - return all[0]; - }, - - /** - * Pass a mocked component module to this method to augment it with - * useful methods that allow it to be used as a dummy React component. - * Instead of rendering as usual, the component will become a simple - *
containing any provided children. - * - * @param {object} module the mock function object exported from a - * module that defines the component to be mocked - * @param {?string} mockTagName optional dummy root tag name to return - * from render method (overrides - * module.mockTagName if provided) - * @return {object} the ReactTestUtils object (for chaining) - */ - mockComponent: function (module, mockTagName) { - mockTagName = mockTagName || module.mockTagName || 'div'; - - 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 occurred - * on an `Element` node. - * @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) { - fakeNativeEvent.target = node; - ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent); - }, - - /** - * Simulates a top level event being dispatched from a raw event that occurred - * on the `ReactDOMComponent` `comp`. - * @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, findDOMNode(comp), fakeNativeEvent); - }, - - nativeTouchData: function (x, y) { - return { - touches: [{ pageX: x, pageY: y }] - }; - }, - - createRenderer: function () { - return new ReactShallowRenderer(); - }, - - Simulate: null, - SimulateNative: {} - }; - - /** - * @class ReactShallowRenderer - */ - var ReactShallowRenderer = function () { - this._instance = null; - }; - - ReactShallowRenderer.prototype.getRenderOutput = function () { - return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null; - }; - - var NoopInternalComponent = function (element) { - this._renderedOutput = element; - this._currentElement = element; - }; - - NoopInternalComponent.prototype = { - - mountComponent: function () {}, - - receiveComponent: function (element) { - this._renderedOutput = element; - this._currentElement = element; - }, - - unmountComponent: function () {}, - - getPublicInstance: function () { - return null; - } - }; - - var ShallowComponentWrapper = function () {}; - assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, { - _instantiateReactComponent: function (element) { - return new NoopInternalComponent(element); - }, - _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; - - if (!context) { - context = emptyObject; - } - var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false); - this._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) { - this._instance.receiveComponent(element, transaction, context); - } else { - var rootID = ReactInstanceHandles.createReactRootID(); - var instance = new ShallowComponentWrapper(element.type); - instance.construct(element); - - instance.mountComponent(rootID, transaction, context); - - this._instance = instance; - } - }; - - /** - * Exports: - * - * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)` - * - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)` - * - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)` - * - ... (All keys from event plugin `eventTypes` objects) - */ - function makeSimulator(eventType) { - return function (domComponentOrNode, eventData) { - var node; - if (ReactTestUtils.isDOMComponent(domComponentOrNode)) { - 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(dispatchConfig, ReactMount.getID(node), fakeNativeEvent, node); - assign(event, eventData); - - if (dispatchConfig.phasedRegistrationNames) { - EventPropagators.accumulateTwoPhaseDispatches(event); - } else { - EventPropagators.accumulateDirectDispatches(event); - } - - ReactUpdates.batchedUpdates(function () { - EventPluginHub.enqueueEvents(event); - EventPluginHub.processEventQueue(true); - }); - }; - } - - function buildSimulators() { - ReactTestUtils.Simulate = {}; - - var eventType; - for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) { - /** - * @param {!Element|ReactDOMComponent} domComponentOrNode - * @param {?object} eventData Fake event data to use in SyntheticEvent. - */ - ReactTestUtils.Simulate[eventType] = makeSimulator(eventType); - } - } - - // Rebuild ReactTestUtils.Simulate whenever event plugins are injected - var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder; - EventPluginHub.injection.injectEventPluginOrder = function () { - oldInjectEventPluginOrder.apply(this, arguments); - buildSimulators(); - }; - var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName; - EventPluginHub.injection.injectEventPluginsByName = function () { - oldInjectEventPlugins.apply(this, arguments); - buildSimulators(); - }; - - buildSimulators(); - - /** - * Exports: - * - * - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)` - * - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)` - * - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)` - * - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)` - * - ... (All keys from `EventConstants.topLevelTypes`) - * - * Note: Top level event types are a subset of the entire set of handler types - * (which include a broader set of "synthetic" events). For example, onDragDone - * is a synthetic event. Except when testing an event plugin or React's event - * handling code specifically, you probably want to use ReactTestUtils.Simulate - * to dispatch synthetic events. - */ - - function makeNativeSimulator(eventType) { - 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) { - // Will allow on actual dom nodes. - ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent); - } - }; - } - - 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; - /** - * @param {!Element|ReactDOMComponent} domComponentOrNode - * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent. - */ - ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType); - }); - - module.exports = ReactTestUtils; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 180 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__(165); - -/***/ }, -/* 181 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__(182); - -/***/ }, -/* 182 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 update - */ - - /* global hasOwnProperty:true */ - - 'use strict'; - - var assign = __webpack_require__(6); - var keyOf = __webpack_require__(11); - var invariant = __webpack_require__(17); - var hasOwnProperty = ({}).hasOwnProperty; - - function shallowCopy(x) { - if (Array.isArray(x)) { - return x.concat(); - } else if (x && typeof x === 'object') { - return assign(new x.constructor(), x); - } else { - return x; - } - } - - 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_SET[command] = true; - }); - - function invariantArrayCase(value, spec, command) { - !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]; - !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) { - !(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)) { - !(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]; - } - - var nextValue = shallowCopy(value); - - if (hasOwnProperty.call(spec, COMMAND_MERGE)) { - var mergeObj = spec[COMMAND_MERGE]; - !(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) { - nextValue.push(item); - }); - } - - if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) { - invariantArrayCase(value, spec, COMMAND_UNSHIFT); - spec[COMMAND_UNSHIFT].forEach(function (item) { - nextValue.unshift(item); - }); - } - - if (hasOwnProperty.call(spec, COMMAND_SPLICE)) { - !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)) { - !(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); - } - - for (var k in spec) { - if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) { - nextValue[k] = update(value[k], spec[k]); - } - } - - return nextValue; - } - - module.exports = update; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 183 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - module.exports = __webpack_require__(24); - - -/***/ }, -/* 184 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - module.exports = __webpack_require__(25); - - -/***/ }, -/* 185 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {var addons = {}; - addons.TransitionGroup = __webpack_require__(180); - addons.CSSTransitionGroup = __webpack_require__(22); - addons.LinkedStateMixin = __webpack_require__(170); - addons.cloneWithProps = __webpack_require__(1); - addons.createFragment = __webpack_require__(13); - addons.update = __webpack_require__(181); - addons.PureRenderMixin = __webpack_require__(175); - - if (process.env.NODE_ENV !== "production") { - addons.TestUtils = __webpack_require__(178); - addons.Perf = __webpack_require__(174); - } - - module.exports = addons; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, +/* 159 */, +/* 160 */, +/* 161 */, +/* 162 */, +/* 163 */, +/* 164 */, +/* 165 */, +/* 166 */, +/* 167 */, +/* 168 */, +/* 169 */, +/* 170 */, +/* 171 */, +/* 172 */, +/* 173 */, +/* 174 */, +/* 175 */, +/* 176 */, +/* 177 */, +/* 178 */, +/* 179 */, +/* 180 */, +/* 181 */, +/* 182 */, +/* 183 */, +/* 184 */, +/* 185 */, /* 186 */ /***/ function(module, exports, __webpack_require__) { diff --git a/lib/assets/react-source/development/react-server.js b/lib/assets/react-source/development/react-server.js index 3f20412ad..1af2bcdd7 100644 --- a/lib/assets/react-source/development/react-server.js +++ b/lib/assets/react-source/development/react-server.js @@ -44,12 +44,8 @@ /* 0 */ /***/ function(module, exports, __webpack_require__) { - var React = __webpack_require__(183); - var ReactDOM = __webpack_require__(184); var ReactDOMServer = __webpack_require__(186); - window.React = React; - window.ReactDOM = ReactDOM; window.ReactDOMServer = ReactDOMServer; @@ -1012,7 +1008,7 @@ * will remain to ensure logic does not differ in production. */ - function invariant(condition, format, a, b, c, d, e, f) { + var invariant = function (condition, format, a, b, c, d, e, f) { if (process.env.NODE_ENV !== 'production') { if (format === undefined) { throw new Error('invariant requires an error message argument'); @@ -1026,16 +1022,15 @@ } else { var args = [a, b, c, d, e, f]; var argIndex = 0; - error = new Error(format.replace(/%s/g, function () { + error = new Error('Invariant Violation: ' + 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; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) @@ -1625,149 +1620,8 @@ /***/ }, /* 22 */, /* 23 */, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * 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 React - */ - - 'use strict'; - - var ReactDOM = __webpack_require__(25); - var ReactDOMServer = __webpack_require__(155); - var ReactIsomorphic = __webpack_require__(159); - - var assign = __webpack_require__(6); - var deprecated = __webpack_require__(164); - - // `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.__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; - -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 ReactDOM - */ - - /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ - - 'use strict'; - - var ReactCurrentOwner = __webpack_require__(5); - var ReactDOMTextComponent = __webpack_require__(26); - var ReactDefaultInjection = __webpack_require__(82); - var ReactInstanceHandles = __webpack_require__(19); - var ReactMount = __webpack_require__(45); - var ReactPerf = __webpack_require__(36); - var ReactReconciler = __webpack_require__(62); - var ReactUpdates = __webpack_require__(66); - var ReactVersion = __webpack_require__(153); - - var findDOMNode = __webpack_require__(101); - var renderSubtreeIntoContainer = __webpack_require__(154); - var warning = __webpack_require__(12); - - 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 - }); - } - - if (process.env.NODE_ENV !== 'production') { - var ExecutionEnvironment = __webpack_require__(29); - 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'); - } - } - - // 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: ' + '') : 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; - } - } - } - } - - module.exports = React; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, +/* 24 */, +/* 25 */, /* 26 */ /***/ function(module, exports, __webpack_require__) { @@ -10944,8 +10798,8 @@ */ // autoCapitalize and autoCorrect are supported in Mobile Safari for // keyboard hints. - autoCapitalize: MUST_USE_ATTRIBUTE, - autoCorrect: MUST_USE_ATTRIBUTE, + autoCapitalize: null, + autoCorrect: null, // autoSave allows WebKit/Blink to persist values of input fields on page reloads autoSave: null, // color is for Safari mask-icon link @@ -10976,7 +10830,9 @@ httpEquiv: 'http-equiv' }, DOMPropertyNames: { + autoCapitalize: 'autocapitalize', autoComplete: 'autocomplete', + autoCorrect: 'autocorrect', autoFocus: 'autofocus', autoPlay: 'autoplay', autoSave: 'autosave', @@ -13628,7 +13484,7 @@ var value = LinkedValueUtils.getValue(props); if (value != null) { - updateOptions(this, Boolean(props.multiple), value); + updateOptions(this, props, value); } } } @@ -16663,14 +16519,11 @@ * @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. + * The activeElement will be null only if the document or document body is not yet defined. */ 'use strict'; @@ -16678,6 +16531,7 @@ if (typeof document === 'undefined') { return null; } + try { return document.activeElement || document.body; } catch (e) { @@ -18417,9 +18271,7 @@ 'setValueForProperty': 'update attribute', 'setValueForAttribute': 'update attribute', 'deleteValueForProperty': 'remove attribute', - 'setValueForStyles': 'update styles', - 'replaceNodeWithMarkup': 'replace', - 'updateTextContent': 'set textContent' + 'dangerouslyReplaceNodeWithMarkupByID': 'replace' }; function getTotalTime(measurements) { @@ -18611,24 +18463,19 @@ 'use strict'; var performance = __webpack_require__(152); - - var performanceNow; + var curPerformance = 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.now) { - performanceNow = function () { - return performance.now(); - }; - } else { - performanceNow = function () { - return Date.now(); - }; + if (!curPerformance || !curPerformance.now) { + curPerformance = Date; } + var performanceNow = curPerformance.now.bind(curPerformance); + module.exports = performanceNow; /***/ }, @@ -18679,27 +18526,7 @@ module.exports = '0.14.6'; /***/ }, -/* 154 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * 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 = __webpack_require__(45); - - module.exports = ReactMount.renderSubtreeIntoContainer; - -/***/ }, +/* 154 */, /* 155 */ /***/ function(module, exports, __webpack_require__) { @@ -18940,705 +18767,12 @@ module.exports = ReactServerRenderingTransaction; /***/ }, -/* 159 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 = __webpack_require__(15); - var ReactComponent = __webpack_require__(130); - var ReactClass = __webpack_require__(129); - var ReactDOMFactories = __webpack_require__(160); - var ReactElement = __webpack_require__(4); - var ReactElementValidator = __webpack_require__(161); - var ReactPropTypes = __webpack_require__(117); - var ReactVersion = __webpack_require__(153); - - var assign = __webpack_require__(6); - var onlyChild = __webpack_require__(163); - - 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; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 160 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 = __webpack_require__(4); - var ReactElementValidator = __webpack_require__(161); - - var mapObject = __webpack_require__(162); - - /** - * 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; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 161 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 ReactElementValidator - */ - - /** - * ReactElementValidator provides a wrapper around a element factory - * which validates the props passed to the element. This is intended to be - * used only in DEV and could be replaced by a static type checker for languages - * that support it. - */ - - 'use strict'; - - var ReactElement = __webpack_require__(4); - var ReactPropTypeLocations = __webpack_require__(76); - var ReactPropTypeLocationNames = __webpack_require__(77); - var ReactCurrentOwner = __webpack_require__(5); - - var canDefineProperty = __webpack_require__(7); - var getIteratorFn = __webpack_require__(21); - var invariant = __webpack_require__(17); - var warning = __webpack_require__(12); - - function getDeclarationErrorAddendum() { - if (ReactCurrentOwner.current) { - var name = ReactCurrentOwner.current.getName(); - if (name) { - return ' Check the render method of `' + name + '`.'; - } - } - return ''; - } - - /** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - var ownerHasKeyUseWarning = {}; - - var loggedTypeFailures = {}; - - /** - * 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 - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ - function validateExplicitKey(element, parentType) { - if (!element._store || element._store.validated || element.key != null) { - return; - } - element._store.validated = true; - - var addenda = getAddendaForKeyUse('uniqueKey', element, parentType); - if (addenda === null) { - // we already showed the warning - return; - } - 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} 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 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[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. - 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; - } - - /** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @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]; - if (ReactElement.isValidElement(child)) { - validateExplicitKey(child, parentType); - } - } - } 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. - if (iteratorFn) { - if (iteratorFn !== node.entries) { - var iterator = iteratorFn.call(node); - var step; - while (!(step = iterator.next()).done) { - if (ReactElement.isValidElement(step.value)) { - validateExplicitKey(step.value, parentType); - } - } - } - } - } - } - - /** - * Assert that the props are valid - * - * @param {string} componentName Name of the component for error messages. - * @param {object} propTypes Map of prop name to a ReactPropType - * @param {object} props - * @param {string} location e.g. "prop", "context", "child context" - * @private - */ - function checkPropTypes(componentName, propTypes, props, location) { - for (var propName in propTypes) { - if (propTypes.hasOwnProperty(propName)) { - var error; - // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - !(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); - } 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(); - process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined; - } - } - } - } - - /** - * Given an element, validate that its props follow the propTypes definition, - * provided by the type. - * - * @param {ReactElement} element - */ - function validatePropTypes(element) { - var componentClass = element.type; - if (typeof componentClass !== 'function') { - return; - } - var name = componentClass.displayName || componentClass.name; - if (componentClass.propTypes) { - checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop); - } - if (typeof componentClass.getDefaultProps === 'function') { - 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 = { - - 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. - 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); - - // The result can be nullish if a mock or a custom function is used. - // TODO: Drop this when these are no longer allowed as the type argument. - if (element == null) { - 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); - // Legacy hook TODO: Warn if this is accessed - validatedFactory.type = type; - - if (process.env.NODE_ENV !== 'production') { - if (canDefineProperty) { - Object.defineProperty(validatedFactory, 'type', { - enumerable: false, - 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; - } - }); - } - } - - return validatedFactory; - }, - - 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); - } - validatePropTypes(newElement); - return newElement; - } - - }; - - module.exports = ReactElementValidator; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 162 */ -/***/ function(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; - -/***/ }, -/* 163 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 onlyChild - */ - 'use strict'; - - var ReactElement = __webpack_require__(4); - - var invariant = __webpack_require__(17); - - /** - * Returns the first child in a collection of children and verifies that there - * is only one child in the collection. The current implementation of this - * function assumes that a single child gets passed without a wrapper, but the - * purpose of this helper function is to abstract away the particular structure - * of children. - * - * @param {?object} children Child collection structure. - * @return {ReactComponent} The first and only `ReactComponent` contained in the - * structure. - */ - function onlyChild(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; - } - - module.exports = onlyChild; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, -/* 164 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * 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 = __webpack_require__(6); - var warning = __webpack_require__(12); - - /** - * 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; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) - -/***/ }, +/* 159 */, +/* 160 */, +/* 161 */, +/* 162 */, +/* 163 */, +/* 164 */, /* 165 */, /* 166 */, /* 167 */, @@ -19657,24 +18791,8 @@ /* 180 */, /* 181 */, /* 182 */, -/* 183 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - module.exports = __webpack_require__(24); - - -/***/ }, -/* 184 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - module.exports = __webpack_require__(25); - - -/***/ }, +/* 183 */, +/* 184 */, /* 185 */, /* 186 */ /***/ function(module, exports, __webpack_require__) { diff --git a/lib/generators/react/install_generator.rb b/lib/generators/react/install_generator.rb index 97cf5ab69..a36b6e2f8 100644 --- a/lib/generators/react/install_generator.rb +++ b/lib/generators/react/install_generator.rb @@ -48,6 +48,11 @@ def create_components create_file components_file, components_js end + def create_server_rendering + file_path = 'app/assets/javascripts/server_rendering.js' + template("server_rendering.js", file_path) + end + private def manifest diff --git a/lib/generators/templates/server_rendering.js b/lib/generators/templates/server_rendering.js new file mode 100644 index 000000000..daeff03c2 --- /dev/null +++ b/lib/generators/templates/server_rendering.js @@ -0,0 +1,6 @@ +//= require react +//= require react-server +//= require ./components +// +// By default, this file is loaded for server-side rendering. +// It should require your components and any dependencies. diff --git a/lib/react/server_rendering/sprockets_renderer.rb b/lib/react/server_rendering/sprockets_renderer.rb index 86a0b13d9..3a48c94be 100644 --- a/lib/react/server_rendering/sprockets_renderer.rb +++ b/lib/react/server_rendering/sprockets_renderer.rb @@ -13,7 +13,7 @@ class SprocketsRenderer < ExecJSRenderer def initialize(options={}) @replay_console = options.fetch(:replay_console, true) - filenames = options.fetch(:files, ["react-server.js", "components.js"]) + filenames = options.fetch(:files, ["server_rendering.js"]) js_code = CONSOLE_POLYFILL.dup filenames.each do |filename| diff --git a/react-builds/package.json b/react-builds/package.json index d2c05ad7f..5f1803ce6 100644 --- a/react-builds/package.json +++ b/react-builds/package.json @@ -4,17 +4,17 @@ "description": "Prepares react-rails asset files", "main": "react.js", "dependencies": { - "react": "^0.14.3", - "react-addons-clone-with-props": "^0.14.3", - "react-addons-create-fragment": "^0.14.3", - "react-addons-css-transition-group": "^0.14.3", - "react-addons-linked-state-mixin": "^0.14.3", - "react-addons-perf": "^0.14.3", - "react-addons-pure-render-mixin": "^0.14.3", - "react-addons-test-utils": "^0.14.3", - "react-addons-transition-group": "^0.14.3", - "react-addons-update": "^0.14.3", - "react-dom": "^0.14.3", + "react": "^0.14.6", + "react-addons-clone-with-props": "^0.14.6", + "react-addons-create-fragment": "^0.14.6", + "react-addons-css-transition-group": "^0.14.6", + "react-addons-linked-state-mixin": "^0.14.6", + "react-addons-perf": "^0.14.6", + "react-addons-pure-render-mixin": "^0.14.6", + "react-addons-test-utils": "^0.14.6", + "react-addons-transition-group": "^0.14.6", + "react-addons-update": "^0.14.6", + "react-dom": "^0.14.6", "webpack": "^1.12.2" } } diff --git a/react-builds/react-server-with-addons.js b/react-builds/react-server-with-addons.js deleted file mode 100644 index 538f1d6b5..000000000 --- a/react-builds/react-server-with-addons.js +++ /dev/null @@ -1,9 +0,0 @@ -var React = require("react"); -var ReactDOM = require("react-dom"); -var ReactDOMServer = require("react-dom/server"); - -React.addons = require("./addons-object.js"); - -window.React = React; -window.ReactDOM = ReactDOM; -window.ReactDOMServer = ReactDOMServer; diff --git a/react-builds/react-server.js b/react-builds/react-server.js index b428896c3..f42f03c39 100644 --- a/react-builds/react-server.js +++ b/react-builds/react-server.js @@ -1,7 +1,3 @@ -var React = require("react"); -var ReactDOM = require("react-dom"); var ReactDOMServer = require("react-dom/server"); -window.React = React; -window.ReactDOM = ReactDOM; window.ReactDOMServer = ReactDOMServer; diff --git a/test/dummy/app/assets/javascripts/server_rendering.js b/test/dummy/app/assets/javascripts/server_rendering.js new file mode 100644 index 000000000..6528ce946 --- /dev/null +++ b/test/dummy/app/assets/javascripts/server_rendering.js @@ -0,0 +1,3 @@ +//= require react +//= require react-server +//= require ./components diff --git a/test/generators/install_generator_test.rb b/test/generators/install_generator_test.rb index a54ef35cf..72595769c 100644 --- a/test/generators/install_generator_test.rb +++ b/test/generators/install_generator_test.rb @@ -62,6 +62,14 @@ def copy_directory(dir) assert_application_file_modified end + test "creates server_rendering.js with default requires" do + run_generator + server_rendering_file_path = "app/assets/javascripts/server_rendering.js" + assert_file server_rendering_file_path, %r{//= require react\n} + assert_file server_rendering_file_path, %r{//= require react-server\n} + assert_file server_rendering_file_path, %r{//= require ./components\n} + end + def init_application_js(content) FileUtils.mkdir_p destination_root + '/app/assets/javascripts/' File.write destination_root + '/app/assets/javascripts/application.js', content diff --git a/test/react/server_rendering/exec_js_renderer_test.rb b/test/react/server_rendering/exec_js_renderer_test.rb index 82aa978a0..e65c7544d 100644 --- a/test/react/server_rendering/exec_js_renderer_test.rb +++ b/test/react/server_rendering/exec_js_renderer_test.rb @@ -14,9 +14,10 @@ class ExecJSRendererTest < ActiveSupport::TestCase setup do + react_source = Rails.application.assets["react.js"].to_s react_server_source = Rails.application.assets["react-server.js"].to_s todo_component_source = Rails.application.assets["components/Todo.js"].to_s - code = react_server_source + todo_component_source + code = react_source + react_server_source + todo_component_source @renderer = React::ServerRendering::ExecJSRenderer.new(code: code) end diff --git a/test/react/server_rendering/sprockets_renderer_test.rb b/test/react/server_rendering/sprockets_renderer_test.rb index 3e4695c07..fdfd15ade 100644 --- a/test/react/server_rendering/sprockets_renderer_test.rb +++ b/test/react/server_rendering/sprockets_renderer_test.rb @@ -47,7 +47,7 @@ class SprocketsRendererTest < ActiveSupport::TestCase end test '.new accepts any filenames' do - limited_renderer = React::ServerRendering::SprocketsRenderer.new(files: ["react-server.js", "components/Todo.js"]) + limited_renderer = React::ServerRendering::SprocketsRenderer.new(files: ["react.js", "react-server.js", "components/Todo.js"]) assert_match(/get a real job<\/li>/, limited_renderer.render("Todo", {todo: "get a real job"}, nil)) err = assert_raises React::ServerRendering::PrerenderError do limited_renderer.render("TodoList", {todos: []}, nil) From 6fe8c19b2ffcf810cdf5bbfd70015c4d27fd1582 Mon Sep 17 00:00:00 2001 From: Robert Mosolgo Date: Sun, 21 Feb 2016 20:26:22 -0500 Subject: [PATCH 2/3] feat(ServerRendering) generate an initializer to precompile the manifest; support --skip-server-rendering --- README.md | 2 +- lib/generators/react/install_generator.rb | 16 +++++++++++++--- .../templates/react_server_rendering.rb | 2 ++ test/generators/install_generator_test.rb | 12 ++++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 lib/generators/templates/react_server_rendering.rb diff --git a/README.md b/README.md index 6afb4338e..f4c8cbb45 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ where you will put your components //= require react_ujs //= require components ``` -- create a `server_rendering.js` manifest file +- create a `server_rendering.js` manifest file and precompile it with `config/initializers/react_server_rendering.rb`. (Use `--skip-server-rendering` if you don't want this.) ## Usage diff --git a/lib/generators/react/install_generator.rb b/lib/generators/react/install_generator.rb index a36b6e2f8..7653e4fc4 100644 --- a/lib/generators/react/install_generator.rb +++ b/lib/generators/react/install_generator.rb @@ -11,9 +11,16 @@ class InstallGenerator < ::Rails::Generators::Base default: false, desc: 'Skip Git keeps' + class_option :skip_server_rendering, + type: :boolean, + default: false, + desc: "Don't generate server_rendering.js or config/initializers/react_server_rendering.rb" + def create_directory empty_directory 'app/assets/javascripts/components' - create_file 'app/assets/javascripts/components/.gitkeep' unless options[:skip_git] + if !options[:skip_git] + create_file 'app/assets/javascripts/components/.gitkeep' + end end def inject_react @@ -49,8 +56,11 @@ def create_components end def create_server_rendering - file_path = 'app/assets/javascripts/server_rendering.js' - template("server_rendering.js", file_path) + return if options[:skip_server_rendering] + manifest_path = "app/assets/javascripts/server_rendering.js" + template("server_rendering.js", manifest_path) + initializer_path = "config/initializers/react_server_rendering.rb" + template("react_server_rendering.rb", initializer_path) end private diff --git a/lib/generators/templates/react_server_rendering.rb b/lib/generators/templates/react_server_rendering.rb new file mode 100644 index 000000000..4d09c78b2 --- /dev/null +++ b/lib/generators/templates/react_server_rendering.rb @@ -0,0 +1,2 @@ +# To render React components in production, precompile the server rendering manifest: +Rails.application.config.assets.precompile += ["server_rendering.js"] diff --git a/test/generators/install_generator_test.rb b/test/generators/install_generator_test.rb index 72595769c..550726de4 100644 --- a/test/generators/install_generator_test.rb +++ b/test/generators/install_generator_test.rb @@ -70,6 +70,18 @@ def copy_directory(dir) assert_file server_rendering_file_path, %r{//= require ./components\n} end + test "creates server rendering initializer" do + run_generator + initializer_path = "config/initializers/react_server_rendering.rb" + assert_file(initializer_path, %r{Rails.application.config.assets.precompile \+= \["server_rendering.js"\]}) + end + + test "skipping server rendering" do + run_generator %w(--skip-server-rendering) + assert_no_file "config/initializers/react_server_rendering.rb" + assert_no_file "app/assets/javascripts/server_rendering.js" + end + def init_application_js(content) FileUtils.mkdir_p destination_root + '/app/assets/javascripts/' File.write destination_root + '/app/assets/javascripts/application.js', content From 81cc0c9f2d4ce45952c665b6da46152769b718d5 Mon Sep 17 00:00:00 2001 From: Robert Mosolgo Date: Mon, 22 Feb 2016 22:00:43 -0500 Subject: [PATCH 3/3] Use the existing build files --- Rakefile | 2 +- .../development-with-addons/react-server.js | 3092 ++++++++++++++++- .../react-source/development/react-server.js | 936 ++++- lib/generators/templates/server_rendering.js | 1 - react-builds/package.json | 22 +- react-builds/react-server-with-addons.js | 9 + react-builds/react-server.js | 4 + .../assets/javascripts/server_rendering.js | 1 - test/generators/install_generator_test.rb | 1 - .../server_rendering/exec_js_renderer_test.rb | 3 +- .../sprockets_renderer_test.rb | 2 +- 11 files changed, 3934 insertions(+), 139 deletions(-) create mode 100644 react-builds/react-server-with-addons.js diff --git a/Rakefile b/Rakefile index 325577675..d3cebf244 100644 --- a/Rakefile +++ b/Rakefile @@ -34,7 +34,7 @@ namespace :react do # With addons: copy_react_asset("#{environment}/react-browser-with-addons.js", "#{environment}-with-addons/react.js") - copy_react_asset("#{environment}/react-server.js", "#{environment}-with-addons/react-server.js") + copy_react_asset("#{environment}/react-server-with-addons.js", "#{environment}-with-addons/react-server.js") addons = %w( addons-clone-with-props diff --git a/lib/assets/react-source/development-with-addons/react-server.js b/lib/assets/react-source/development-with-addons/react-server.js index 1af2bcdd7..51fdfbc7c 100644 --- a/lib/assets/react-source/development-with-addons/react-server.js +++ b/lib/assets/react-source/development-with-addons/react-server.js @@ -44,14 +44,84 @@ /* 0 */ /***/ function(module, exports, __webpack_require__) { + var React = __webpack_require__(183); + var ReactDOM = __webpack_require__(184); var ReactDOMServer = __webpack_require__(186); + React.addons = __webpack_require__(185); + + window.React = React; + window.ReactDOM = ReactDOM; window.ReactDOMServer = ReactDOMServer; /***/ }, -/* 1 */, -/* 2 */, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(2); + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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. + * + * @typechecks static-only + * @providesModule cloneWithProps + */ + + 'use strict'; + + var ReactElement = __webpack_require__(4); + var ReactPropTransferer = __webpack_require__(8); + + var keyOf = __webpack_require__(11); + var warning = __webpack_require__(12); + + var CHILDREN_PROP = keyOf({ children: null }); + + var didDeprecatedWarn = false; + + /** + * Sometimes you want to change the props of a child passed to you. Usually + * this is to add a CSS class. + * + * @param {ReactElement} child child element you'd like to clone + * @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 (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)) { + newProps.children = child.props.children; + } + + // 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; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, /* 3 */ /***/ function(module, exports) { @@ -519,7 +589,119 @@ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) /***/ }, -/* 8 */, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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 ReactPropTransferer + */ + + 'use strict'; + + var assign = __webpack_require__(6); + var emptyFunction = __webpack_require__(9); + var joinClasses = __webpack_require__(10); + + /** + * Creates a transfer strategy that will merge prop values using the supplied + * `mergeStrategy`. If a prop was previously unset, this just sets it. + * + * @param {function} mergeStrategy + * @return {function} + */ + function createTransferStrategy(mergeStrategy) { + return function (props, key, value) { + if (!props.hasOwnProperty(key)) { + props[key] = value; + } else { + props[key] = mergeStrategy(props[key], value); + } + }; + } + + 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. + return assign({}, b, a); + }); + + /** + * Transfer strategies dictate how props are transferred by `transferPropsTo`. + * NOTE: if you add any more exceptions to this list you should be sure to + * update `cloneWithProps()` accordingly. + */ + var TransferStrategies = { + /** + * Never transfer `children`. + */ + children: emptyFunction, + /** + * Transfer the `className` prop by merging them. + */ + className: createTransferStrategy(joinClasses), + /** + * Transfer the `style` prop (which is an object) by merging them. + */ + style: transferStrategyMerge + }; + + /** + * Mutates the first argument by transferring the properties from the second + * argument. + * + * @param {object} props + * @param {object} newProps + * @return {object} + */ + function transferInto(props, newProps) { + for (var thisKey in newProps) { + if (!newProps.hasOwnProperty(thisKey)) { + continue; + } + + var transferStrategy = TransferStrategies[thisKey]; + + if (transferStrategy && TransferStrategies.hasOwnProperty(thisKey)) { + transferStrategy(props, thisKey, newProps[thisKey]); + } else if (!props.hasOwnProperty(thisKey)) { + props[thisKey] = newProps[thisKey]; + } + } + return props; + } + + /** + * ReactPropTransferer are capable of transferring props to another component + * using a `transferPropsTo` method. + * + * @class ReactPropTransferer + */ + var ReactPropTransferer = { + + /** + * Merge two props objects using TransferStrategies. + * + * @param {object} oldProps original props (they take precedence) + * @param {object} newProps new props to merge in + * @return {object} a new object containing both sets of props merged. + */ + mergeProps: function (oldProps, newProps) { + return transferInto(assign({}, oldProps), newProps); + } + + }; + + module.exports = ReactPropTransferer; + +/***/ }, /* 9 */ /***/ function(module, exports) { @@ -563,7 +745,50 @@ module.exports = emptyFunction; /***/ }, -/* 10 */, +/* 10 */ +/***/ function(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} 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; + +/***/ }, /* 11 */ /***/ function(module, exports) { @@ -667,8 +892,82 @@ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) /***/ }, -/* 13 */, -/* 14 */, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(14).create; + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 ReactChildren = __webpack_require__(15); + var ReactElement = __webpack_require__(4); + + var emptyFunction = __webpack_require__(9); + var invariant = __webpack_require__(17); + var warning = __webpack_require__(12); + + /** + * 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 an array. + */ + + 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 (typeof object !== 'object' || !object || Array.isArray(object)) { + 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)) { + process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined; + return object; + } + + !(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) { + 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; + } + } + ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument); + } + + return result; + } + }; + + module.exports = ReactFragment; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { @@ -1008,7 +1307,7 @@ * will remain to ensure logic does not differ in production. */ - var invariant = function (condition, format, a, b, c, d, e, f) { + function invariant(condition, format, a, b, c, d, e, f) { if (process.env.NODE_ENV !== 'production') { if (format === undefined) { throw new Error('invariant requires an error message argument'); @@ -1022,15 +1321,16 @@ } else { var args = [a, b, c, d, e, f]; var argIndex = 0; - error = new Error('Invariant Violation: ' + format.replace(/%s/g, function () { + 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; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) @@ -1618,14 +1918,16 @@ module.exports = getIteratorFn; /***/ }, -/* 22 */, -/* 23 */, -/* 24 */, -/* 25 */, -/* 26 */ +/* 22 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process) {/** + module.exports = __webpack_require__(23); + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * @@ -1633,59 +1935,290 @@ * 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 ReactDOMTextComponent - * @typechecks static-only + * @typechecks + * @providesModule ReactCSSTransitionGroup */ 'use strict'; - var DOMChildrenOperations = __webpack_require__(27); - var DOMPropertyOperations = __webpack_require__(40); - var ReactComponentBrowserEnvironment = __webpack_require__(43); - var ReactMount = __webpack_require__(45); + var React = __webpack_require__(24); var assign = __webpack_require__(6); - var escapeTextContentForBrowser = __webpack_require__(39); - var setTextContent = __webpack_require__(38); - var validateDOMNesting = __webpack_require__(81); + + var ReactTransitionGroup = __webpack_require__(165); + var ReactCSSTransitionGroupChild = __webpack_require__(167); + + 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: ReactCSSTransitionGroupChild.propTypes.name, + + transitionAppear: React.PropTypes.bool, + transitionEnter: React.PropTypes.bool, + transitionLeave: React.PropTypes.bool, + transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'), + transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'), + transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave') + }, + + getDefaultProps: function () { + return { + transitionAppear: false, + transitionEnter: true, + transitionLeave: true + }; + }, + + _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 React.createElement(ReactCSSTransitionGroupChild, { + 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 + }, child); + }, + + render: function () { + return React.createElement(ReactTransitionGroup, assign({}, this.props, { childFactory: this._wrapChild })); + } + }); + + module.exports = ReactCSSTransitionGroup; + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { /** - * Text nodes violate a couple assumptions that React makes about components: - * - * - When mounting text into the DOM, adjacent text nodes are merged. - * - Text nodes cannot be assigned a React root ID. - * - * This component is used to wrap strings in elements so that they can undergo - * the same reconciliation that is applied to elements. + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. * - * TODO: Investigate representing React components in the DOM with text nodes. + * 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. * - * @class ReactDOMTextComponent - * @extends ReactComponent - * @internal + * @providesModule React */ - var ReactDOMTextComponent = function (props) { - // This constructor and its argument is currently used by mocks. - }; - assign(ReactDOMTextComponent.prototype, { + 'use strict'; - /** - * @param {ReactText} text - * @internal - */ - construct: function (text) { - // TODO: This is really a ReactText (ReactNode), not a ReactElement - this._currentElement = text; - this._stringText = '' + text; + var ReactDOM = __webpack_require__(25); + var ReactDOMServer = __webpack_require__(155); + var ReactIsomorphic = __webpack_require__(159); - // Properties - this._rootNodeID = null; - this._mountIndex = 0; - }, + var assign = __webpack_require__(6); + var deprecated = __webpack_require__(164); - /** - * Creates the markup for this text node. This node is not intended to have + // `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.__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; + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 ReactDOM + */ + + /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ + + 'use strict'; + + var ReactCurrentOwner = __webpack_require__(5); + var ReactDOMTextComponent = __webpack_require__(26); + var ReactDefaultInjection = __webpack_require__(82); + var ReactInstanceHandles = __webpack_require__(19); + var ReactMount = __webpack_require__(45); + var ReactPerf = __webpack_require__(36); + var ReactReconciler = __webpack_require__(62); + var ReactUpdates = __webpack_require__(66); + var ReactVersion = __webpack_require__(153); + + var findDOMNode = __webpack_require__(101); + var renderSubtreeIntoContainer = __webpack_require__(154); + var warning = __webpack_require__(12); + + 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 + }); + } + + if (process.env.NODE_ENV !== 'production') { + var ExecutionEnvironment = __webpack_require__(29); + 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'); + } + } + + // 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: ' + '') : 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; + } + } + } + } + + module.exports = React; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 ReactDOMTextComponent + * @typechecks static-only + */ + + 'use strict'; + + var DOMChildrenOperations = __webpack_require__(27); + var DOMPropertyOperations = __webpack_require__(40); + var ReactComponentBrowserEnvironment = __webpack_require__(43); + var ReactMount = __webpack_require__(45); + + var assign = __webpack_require__(6); + var escapeTextContentForBrowser = __webpack_require__(39); + var setTextContent = __webpack_require__(38); + var validateDOMNesting = __webpack_require__(81); + + /** + * Text nodes violate a couple assumptions that React makes about components: + * + * - When mounting text into the DOM, adjacent text nodes are merged. + * - Text nodes cannot be assigned a React root ID. + * + * This component is used to wrap strings in elements so that they can undergo + * the same reconciliation that is applied to elements. + * + * TODO: Investigate representing React components in the DOM with text nodes. + * + * @class ReactDOMTextComponent + * @extends ReactComponent + * @internal + */ + var ReactDOMTextComponent = function (props) { + // This constructor and its argument is currently used by mocks. + }; + + assign(ReactDOMTextComponent.prototype, { + + /** + * @param {ReactText} text + * @internal + */ + construct: function (text) { + // TODO: This is really a ReactText (ReactNode), not a ReactElement + this._currentElement = text; + this._stringText = '' + text; + + // Properties + this._rootNodeID = null; + this._mountIndex = 0; + }, + + /** + * Creates the markup for this text node. This node is not intended to have * any features besides containing text content. * * @param {string} rootID DOM ID of the root node. @@ -10798,8 +11331,8 @@ */ // 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 @@ -10830,9 +11363,7 @@ httpEquiv: 'http-equiv' }, DOMPropertyNames: { - autoCapitalize: 'autocapitalize', autoComplete: 'autocomplete', - autoCorrect: 'autocorrect', autoFocus: 'autofocus', autoPlay: 'autoplay', autoSave: 'autosave', @@ -13484,7 +14015,7 @@ var value = LinkedValueUtils.getValue(props); if (value != null) { - updateOptions(this, props, value); + updateOptions(this, Boolean(props.multiple), value); } } } @@ -16519,11 +17050,14 @@ * @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. + * The activeElement will be null only if the document or document body is not + * yet defined. */ 'use strict'; @@ -16531,7 +17065,6 @@ if (typeof document === 'undefined') { return null; } - try { return document.activeElement || document.body; } catch (e) { @@ -18271,7 +18804,9 @@ 'setValueForProperty': 'update attribute', 'setValueForAttribute': 'update attribute', 'deleteValueForProperty': 'remove attribute', - 'dangerouslyReplaceNodeWithMarkupByID': 'replace' + 'setValueForStyles': 'update styles', + 'replaceNodeWithMarkup': 'replace', + 'updateTextContent': 'set textContent' }; function getTotalTime(measurements) { @@ -18463,19 +18998,24 @@ 'use strict'; var performance = __webpack_require__(152); - var curPerformance = performance; + + 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 (!curPerformance || !curPerformance.now) { - curPerformance = Date; + if (performance.now) { + performanceNow = function () { + return performance.now(); + }; + } else { + performanceNow = function () { + return Date.now(); + }; } - var performanceNow = curPerformance.now.bind(curPerformance); - module.exports = performanceNow; /***/ }, @@ -18526,7 +19066,27 @@ module.exports = '0.14.6'; /***/ }, -/* 154 */, +/* 154 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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 = __webpack_require__(45); + + module.exports = ReactMount.renderSubtreeIntoContainer; + +/***/ }, /* 155 */ /***/ function(module, exports, __webpack_require__) { @@ -18767,33 +19327,2377 @@ module.exports = ReactServerRenderingTransaction; /***/ }, -/* 159 */, -/* 160 */, -/* 161 */, -/* 162 */, -/* 163 */, -/* 164 */, -/* 165 */, -/* 166 */, -/* 167 */, -/* 168 */, -/* 169 */, -/* 170 */, -/* 171 */, -/* 172 */, -/* 173 */, -/* 174 */, -/* 175 */, -/* 176 */, -/* 177 */, -/* 178 */, -/* 179 */, -/* 180 */, -/* 181 */, -/* 182 */, -/* 183 */, -/* 184 */, -/* 185 */, +/* 159 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 = __webpack_require__(15); + var ReactComponent = __webpack_require__(130); + var ReactClass = __webpack_require__(129); + var ReactDOMFactories = __webpack_require__(160); + var ReactElement = __webpack_require__(4); + var ReactElementValidator = __webpack_require__(161); + var ReactPropTypes = __webpack_require__(117); + var ReactVersion = __webpack_require__(153); + + var assign = __webpack_require__(6); + var onlyChild = __webpack_require__(163); + + 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; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 160 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 = __webpack_require__(4); + var ReactElementValidator = __webpack_require__(161); + + var mapObject = __webpack_require__(162); + + /** + * 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; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 161 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 ReactElementValidator + */ + + /** + * ReactElementValidator provides a wrapper around a element factory + * which validates the props passed to the element. This is intended to be + * used only in DEV and could be replaced by a static type checker for languages + * that support it. + */ + + 'use strict'; + + var ReactElement = __webpack_require__(4); + var ReactPropTypeLocations = __webpack_require__(76); + var ReactPropTypeLocationNames = __webpack_require__(77); + var ReactCurrentOwner = __webpack_require__(5); + + var canDefineProperty = __webpack_require__(7); + var getIteratorFn = __webpack_require__(21); + var invariant = __webpack_require__(17); + var warning = __webpack_require__(12); + + function getDeclarationErrorAddendum() { + if (ReactCurrentOwner.current) { + var name = ReactCurrentOwner.current.getName(); + if (name) { + return ' Check the render method of `' + name + '`.'; + } + } + return ''; + } + + /** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ + var ownerHasKeyUseWarning = {}; + + var loggedTypeFailures = {}; + + /** + * 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 + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. + * + * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. + */ + function validateExplicitKey(element, parentType) { + if (!element._store || element._store.validated || element.key != null) { + return; + } + element._store.validated = true; + + var addenda = getAddendaForKeyUse('uniqueKey', element, parentType); + if (addenda === null) { + // we already showed the warning + return; + } + 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} 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 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[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. + 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; + } + + /** + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @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]; + if (ReactElement.isValidElement(child)) { + validateExplicitKey(child, parentType); + } + } + } 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. + if (iteratorFn) { + if (iteratorFn !== node.entries) { + var iterator = iteratorFn.call(node); + var step; + while (!(step = iterator.next()).done) { + if (ReactElement.isValidElement(step.value)) { + validateExplicitKey(step.value, parentType); + } + } + } + } + } + } + + /** + * Assert that the props are valid + * + * @param {string} componentName Name of the component for error messages. + * @param {object} propTypes Map of prop name to a ReactPropType + * @param {object} props + * @param {string} location e.g. "prop", "context", "child context" + * @private + */ + function checkPropTypes(componentName, propTypes, props, location) { + for (var propName in propTypes) { + if (propTypes.hasOwnProperty(propName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + !(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); + } 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(); + process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined; + } + } + } + } + + /** + * Given an element, validate that its props follow the propTypes definition, + * provided by the type. + * + * @param {ReactElement} element + */ + function validatePropTypes(element) { + var componentClass = element.type; + if (typeof componentClass !== 'function') { + return; + } + var name = componentClass.displayName || componentClass.name; + if (componentClass.propTypes) { + checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop); + } + if (typeof componentClass.getDefaultProps === 'function') { + 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 = { + + 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. + 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); + + // The result can be nullish if a mock or a custom function is used. + // TODO: Drop this when these are no longer allowed as the type argument. + if (element == null) { + 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); + // Legacy hook TODO: Warn if this is accessed + validatedFactory.type = type; + + if (process.env.NODE_ENV !== 'production') { + if (canDefineProperty) { + Object.defineProperty(validatedFactory, 'type', { + enumerable: false, + 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; + } + }); + } + } + + return validatedFactory; + }, + + 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); + } + validatePropTypes(newElement); + return newElement; + } + + }; + + module.exports = ReactElementValidator; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 162 */ +/***/ function(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; + +/***/ }, +/* 163 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 onlyChild + */ + 'use strict'; + + var ReactElement = __webpack_require__(4); + + var invariant = __webpack_require__(17); + + /** + * Returns the first child in a collection of children and verifies that there + * is only one child in the collection. The current implementation of this + * function assumes that a single child gets passed without a wrapper, but the + * purpose of this helper function is to abstract away the particular structure + * of children. + * + * @param {?object} children Child collection structure. + * @return {ReactComponent} The first and only `ReactComponent` contained in the + * structure. + */ + function onlyChild(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; + } + + module.exports = onlyChild; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 164 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 = __webpack_require__(6); + var warning = __webpack_require__(12); + + /** + * 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; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 165 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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 ReactTransitionGroup + */ + + 'use strict'; + + var React = __webpack_require__(24); + var ReactTransitionChildMapping = __webpack_require__(166); + + var assign = __webpack_require__(6); + var emptyFunction = __webpack_require__(9); + + var ReactTransitionGroup = React.createClass({ + displayName: 'ReactTransitionGroup', + + propTypes: { + component: React.PropTypes.any, + childFactory: React.PropTypes.func + }, + + getDefaultProps: function () { + return { + component: 'span', + childFactory: emptyFunction.thatReturnsArgument + }; + }, + + getInitialState: function () { + return { + children: ReactTransitionChildMapping.getChildMapping(this.props.children) + }; + }, + + componentWillMount: function () { + this.currentlyTransitioningKeys = {}; + this.keysToEnter = []; + this.keysToLeave = []; + }, + + componentDidMount: function () { + var initialChildMapping = this.state.children; + for (var key in initialChildMapping) { + if (initialChildMapping[key]) { + this.performAppear(key); + } + } + }, + + componentWillReceiveProps: function (nextProps) { + var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children); + var prevChildMapping = this.state.children; + + this.setState({ + children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping) + }); + + var key; + + for (key in nextChildMapping) { + var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(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]) { + this.keysToLeave.push(key); + } + } + + // If we want to someday check for reordering, we could do it here. + }, + + componentDidUpdate: function () { + var keysToEnter = this.keysToEnter; + this.keysToEnter = []; + keysToEnter.forEach(this.performEnter); + + var keysToLeave = this.keysToLeave; + this.keysToLeave = []; + keysToLeave.forEach(this.performLeave); + }, + + performAppear: function (key) { + this.currentlyTransitioningKeys[key] = true; + + var component = this.refs[key]; + + if (component.componentWillAppear) { + component.componentWillAppear(this._handleDoneAppearing.bind(this, key)); + } else { + this._handleDoneAppearing(key); + } + }, + + _handleDoneAppearing: function (key) { + var component = this.refs[key]; + if (component.componentDidAppear) { + component.componentDidAppear(); + } + + delete this.currentlyTransitioningKeys[key]; + + var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children); + + if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { + // This was removed before it had fully appeared. Remove it. + this.performLeave(key); + } + }, + + performEnter: function (key) { + this.currentlyTransitioningKeys[key] = true; + + var component = this.refs[key]; + + if (component.componentWillEnter) { + component.componentWillEnter(this._handleDoneEntering.bind(this, key)); + } else { + this._handleDoneEntering(key); + } + }, + + _handleDoneEntering: function (key) { + var component = this.refs[key]; + if (component.componentDidEnter) { + component.componentDidEnter(); + } + + delete this.currentlyTransitioningKeys[key]; + + var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children); + + if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { + // This was removed before it had fully entered. Remove it. + this.performLeave(key); + } + }, + + performLeave: function (key) { + this.currentlyTransitioningKeys[key] = true; + + var component = this.refs[key]; + if (component.componentWillLeave) { + component.componentWillLeave(this._handleDoneLeaving.bind(this, key)); + } else { + // Note that this is somewhat dangerous b/c it calls setState() + // again, effectively mutating the component before all the work + // is done. + this._handleDoneLeaving(key); + } + }, + + _handleDoneLeaving: function (key) { + var component = this.refs[key]; + + if (component.componentDidLeave) { + component.componentDidLeave(); + } + + delete this.currentlyTransitioningKeys[key]; + + 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 { + this.setState(function (state) { + var newChildren = assign({}, state.children); + delete newChildren[key]; + return { children: newChildren }; + }); + } + }, + + render: function () { + // TODO: we could get rid of the need for the wrapper node + // by cloning a single child + var childrenToRender = []; + for (var key in this.state.children) { + var child = this.state.children[key]; + if (child) { + // You may need to apply reactive updates to a child as it is leaving. + // The normal React way to do it won't work since the child will have + // 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(React.cloneElement(this.props.childFactory(child), { ref: key, key: key })); + } + } + return React.createElement(this.props.component, this.props, childrenToRender); + } + }); + + module.exports = ReactTransitionGroup; + +/***/ }, +/* 166 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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. + * + * @typechecks static-only + * @providesModule ReactTransitionChildMapping + */ + + 'use strict'; + + var flattenChildren = __webpack_require__(123); + + var ReactTransitionChildMapping = { + /** + * Given `this.props.children`, return an object mapping key to child. Just + * simple syntactic sugar around flattenChildren(). + * + * @param {*} children `this.props.children` + * @return {object} Mapping of key to child + */ + getChildMapping: function (children) { + if (!children) { + return children; + } + return flattenChildren(children); + }, + + /** + * When you're adding or removing children some may be added or removed in the + * same render pass. We want to show *both* since we want to simultaneously + * animate elements in and out. This function takes a previous set of keys + * and a new set of keys and merges them with its best guess of the correct + * ordering. In the future we may expose some of the utilities in + * ReactMultiChild to make this easy, but for now React itself does not + * directly have this concept of the union of prevChildren and nextChildren + * so we implement it here. + * + * @param {object} prev prev children as returned from + * `ReactTransitionChildMapping.getChildMapping()`. + * @param {object} next next children as returned from + * `ReactTransitionChildMapping.getChildMapping()`. + * @return {object} a key set that contains all keys in `prev` and all keys + * in `next` in a reasonable order. + */ + mergeChildMappings: function (prev, next) { + prev = prev || {}; + next = next || {}; + + function getValueForKey(key) { + if (next.hasOwnProperty(key)) { + return next[key]; + } else { + return prev[key]; + } + } + + // For each key of `next`, the list of keys to insert before that key in + // the combined list + var nextKeysPending = {}; + + var pendingKeys = []; + for (var prevKey in prev) { + if (next.hasOwnProperty(prevKey)) { + if (pendingKeys.length) { + nextKeysPending[prevKey] = pendingKeys; + pendingKeys = []; + } + } else { + pendingKeys.push(prevKey); + } + } + + var i; + var childMapping = {}; + for (var nextKey in next) { + if (nextKeysPending.hasOwnProperty(nextKey)) { + for (i = 0; i < nextKeysPending[nextKey].length; i++) { + var pendingNextKey = nextKeysPending[nextKey][i]; + childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey); + } + } + childMapping[nextKey] = getValueForKey(nextKey); + } + + // Finally, add the keys which didn't appear before any key in `next` + for (i = 0; i < pendingKeys.length; i++) { + childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]); + } + + return childMapping; + } + }; + + module.exports = ReactTransitionChildMapping; + +/***/ }, +/* 167 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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. + * + * @typechecks + * @providesModule ReactCSSTransitionGroupChild + */ + + 'use strict'; + + var React = __webpack_require__(24); + var ReactDOM = __webpack_require__(25); + + var CSSCore = __webpack_require__(168); + var ReactTransitionEvents = __webpack_require__(169); + + var onlyChild = __webpack_require__(163); + + // 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 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 + }, + + transition: function (animationType, finishCallback, userSpecifiedDelay) { + var node = ReactDOM.findDOMNode(this); + + if (!node) { + if (finishCallback) { + finishCallback(); + } + return; + } + + 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) { + if (e && e.target !== node) { + return; + } + + clearTimeout(timeout); + + CSSCore.removeClass(node, className); + CSSCore.removeClass(node, activeClassName); + + ReactTransitionEvents.removeEndEventListener(node, endListener); + + // Usually this optional callback is used for informing an owner of + // a leave animation and telling it to remove the child. + if (finishCallback) { + finishCallback(); + } + }; + + CSSCore.addClass(node, className); + + // Need to do this to actually trigger a transition. + this.queueClass(activeClassName); + + // 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) { + this.classNameQueue.push(className); + + if (!this.timeout) { + this.timeout = setTimeout(this.flushClassNameQueue, TICK); + } + }, + + flushClassNameQueue: function () { + if (this.isMounted()) { + this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this))); + } + this.classNameQueue.length = 0; + this.timeout = null; + }, + + componentWillMount: function () { + this.classNameQueue = []; + this.transitionTimeouts = []; + }, + + componentWillUnmount: function () { + if (this.timeout) { + clearTimeout(this.timeout); + } + this.transitionTimeouts.forEach(function (timeout) { + clearTimeout(timeout); + }); + }, + + componentWillAppear: function (done) { + if (this.props.appear) { + this.transition('appear', done, this.props.appearTimeout); + } else { + done(); + } + }, + + componentWillEnter: function (done) { + if (this.props.enter) { + this.transition('enter', done, this.props.enterTimeout); + } else { + done(); + } + }, + + componentWillLeave: function (done) { + if (this.props.leave) { + this.transition('leave', done, this.props.leaveTimeout); + } else { + done(); + } + }, + + render: function () { + return onlyChild(this.props.children); + } + }); + + module.exports = ReactCSSTransitionGroupChild; + +/***/ }, +/* 168 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 = __webpack_require__(17); + + /** + * 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) ? process.env.NODE_ENV !== '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) ? process.env.NODE_ENV !== '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) ? process.env.NODE_ENV !== '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; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 169 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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 ReactTransitionEvents + */ + + 'use strict'; + + var ExecutionEnvironment = __webpack_require__(29); + + /** + * EVENT_NAME_MAP is used to determine which event fired when a + * transition/animation ends, based on the style property used to + * define that event. + */ + var EVENT_NAME_MAP = { + transitionend: { + 'transition': 'transitionend', + 'WebkitTransition': 'webkitTransitionEnd', + 'MozTransition': 'mozTransitionEnd', + 'OTransition': 'oTransitionEnd', + 'msTransition': 'MSTransitionEnd' + }, + + animationend: { + 'animation': 'animationend', + 'WebkitAnimation': 'webkitAnimationEnd', + 'MozAnimation': 'mozAnimationEnd', + 'OAnimation': 'oAnimationEnd', + 'msAnimation': 'MSAnimationEnd' + } + }; + + var endEvents = []; + + function detectEvents() { + var testEl = document.createElement('div'); + var style = testEl.style; + + // On some platforms, in particular some releases of Android 4.x, + // the un-prefixed "animation" and "transition" properties are defined on the + // style object but the events that fire will still be prefixed, so we need + // to check if the un-prefixed events are useable, and if not remove them + // from the map + if (!('AnimationEvent' in window)) { + delete EVENT_NAME_MAP.animationend.animation; + } + + if (!('TransitionEvent' in window)) { + delete EVENT_NAME_MAP.transitionend.transition; + } + + for (var baseEventName in EVENT_NAME_MAP) { + var baseEvents = EVENT_NAME_MAP[baseEventName]; + for (var styleName in baseEvents) { + if (styleName in style) { + endEvents.push(baseEvents[styleName]); + break; + } + } + } + } + + if (ExecutionEnvironment.canUseDOM) { + detectEvents(); + } + + // We use the raw {add|remove}EventListener() call because EventListener + // does not know how to remove event listeners and we really should + // clean up. Also, these events are not triggered in older browsers + // so we should be A-OK here. + + function addEventListener(node, eventName, eventListener) { + node.addEventListener(eventName, eventListener, false); + } + + function removeEventListener(node, eventName, eventListener) { + node.removeEventListener(eventName, eventListener, false); + } + + var ReactTransitionEvents = { + 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) { + addEventListener(node, endEvent, eventListener); + }); + }, + + removeEndEventListener: function (node, eventListener) { + if (endEvents.length === 0) { + return; + } + endEvents.forEach(function (endEvent) { + removeEventListener(node, endEvent, eventListener); + }); + } + }; + + module.exports = ReactTransitionEvents; + +/***/ }, +/* 170 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(171); + +/***/ }, +/* 171 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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 LinkedStateMixin + * @typechecks static-only + */ + + 'use strict'; + + var ReactLink = __webpack_require__(172); + var ReactStateSetters = __webpack_require__(173); + + /** + * A simple mixin around ReactLink.forState(). + */ + var LinkedStateMixin = { + /** + * Create a ReactLink that's linked to part of this component's state. The + * ReactLink will have the current value of this.state[key] and will call + * setState() when a change is requested. + * + * @param {string} key state key to update. Note: you may want to use keyOf() + * 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)); + } + }; + + module.exports = LinkedStateMixin; + +/***/ }, +/* 172 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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 ReactLink + * @typechecks static-only + */ + + 'use strict'; + + /** + * ReactLink encapsulates a common pattern in which a component wants to modify + * a prop received from its parent. ReactLink allows the parent to pass down a + * value coupled with a callback that, when invoked, expresses an intent to + * modify that value. For example: + * + * React.createClass({ + * getInitialState: function() { + * return {value: ''}; + * }, + * render: function() { + * var valueLink = new ReactLink(this.state.value, this._handleValueChange); + * return ; + * }, + * _handleValueChange: function(newValue) { + * this.setState({value: newValue}); + * } + * }); + * + * We have provided some sugary mixins to make the creation and + * consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin. + */ + + var React = __webpack_require__(24); + + /** + * @param {*} value current value of the link + * @param {function} requestChange callback to request a change + */ + function ReactLink(value, requestChange) { + this.value = value; + this.requestChange = requestChange; + } + + /** + * Creates a PropType that enforces the ReactLink API and optionally checks the + * type of the value being passed inside the link. Example: + * + * MyComponent.propTypes = { + * tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number) + * } + */ + function createLinkTypeChecker(linkType) { + var shapes = { + value: typeof linkType === 'undefined' ? React.PropTypes.any.isRequired : linkType.isRequired, + requestChange: React.PropTypes.func.isRequired + }; + return React.PropTypes.shape(shapes); + } + + ReactLink.PropTypes = { + link: createLinkTypeChecker + }; + + module.exports = ReactLink; + +/***/ }, +/* 173 */ +/***/ function(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 ReactStateSetters + */ + + 'use strict'; + + var ReactStateSetters = { + /** + * Returns a function that calls the provided function, and uses the result + * of that to set the component's state. + * + * @param {ReactCompositeComponent} component + * @param {function} funcReturningState Returned callback uses this to + * determine how to update state. + * @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) { + var partialState = funcReturningState.call(component, a, b, c, d, e, f); + if (partialState) { + component.setState(partialState); + } + }; + }, + + /** + * Returns a single-argument callback that can be used to update a single + * key in the component's state. + * + * Note: this is memoized function, which makes it inexpensive to call. + * + * @param {ReactCompositeComponent} component + * @param {string} key The key in the state that you should update. + * @return {function} callback of 1 argument which calls setState() with + * the provided keyName and callback argument. + */ + createStateKeySetter: function (component, key) { + // Memoize the setters. + var cache = component.__keySetters || (component.__keySetters = {}); + return cache[key] || (cache[key] = createStateKeySetter(component, key)); + } + }; + + function createStateKeySetter(component, key) { + // Partial state is allocated outside of the function closure so it can be + // reused with every call, avoiding memory allocation when this function + // is called. + var partialState = {}; + return function stateKeySetter(value) { + partialState[key] = value; + component.setState(partialState); + }; + } + + ReactStateSetters.Mixin = { + /** + * Returns a function that calls the provided function, and uses the result + * of that to set the component's state. + * + * For example, these statements are equivalent: + * + * this.setState({x: 1}); + * this.createStateSetter(function(xValue) { + * return {x: xValue}; + * })(1); + * + * @param {function} funcReturningState Returned callback uses this to + * determine how to update state. + * @return {function} callback that when invoked uses funcReturningState to + * determined the object literal to setState. + */ + createStateSetter: function (funcReturningState) { + return ReactStateSetters.createStateSetter(this, funcReturningState); + }, + + /** + * Returns a single-argument callback that can be used to update a single + * key in the component's state. + * + * For example, these statements are equivalent: + * + * this.setState({x: 1}); + * this.createStateKeySetter('x')(1); + * + * Note: this is memoized function, which makes it inexpensive to call. + * + * @param {string} key The key in the state that you should update. + * @return {function} callback of 1 argument which calls setState() with + * the provided keyName and callback argument. + */ + createStateKeySetter: function (key) { + return ReactStateSetters.createStateKeySetter(this, key); + } + }; + + module.exports = ReactStateSetters; + +/***/ }, +/* 174 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(149); + +/***/ }, +/* 175 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(176); + +/***/ }, +/* 176 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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 ReactComponentWithPureRenderMixin + */ + + 'use strict'; + + var shallowCompare = __webpack_require__(177); + + /** + * If your React component's render function is "pure", e.g. it will render the + * same result given the same props and state, provide this Mixin for a + * considerable performance boost. + * + * Most React components have pure render functions. + * + * Example: + * + * var ReactComponentWithPureRenderMixin = + * require('ReactComponentWithPureRenderMixin'); + * React.createClass({ + * mixins: [ReactComponentWithPureRenderMixin], + * + * render: function() { + * return
foo
; + * } + * }); + * + * Note: This only checks shallow equality for props and state. If these contain + * complex data structures this mixin may have false-negatives for deeper + * differences. Only mixin to components which have simple props and state, or + * use `forceUpdate()` when you know deep data structures have changed. + */ + var ReactComponentWithPureRenderMixin = { + shouldComponentUpdate: function (nextProps, nextState) { + return shallowCompare(this, nextProps, nextState); + } + }; + + module.exports = ReactComponentWithPureRenderMixin; + +/***/ }, +/* 177 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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 = __webpack_require__(124); + + /** + * 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; + +/***/ }, +/* 178 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(179); + +/***/ }, +/* 179 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 ReactTestUtils + */ + + 'use strict'; + + var EventConstants = __webpack_require__(47); + var EventPluginHub = __webpack_require__(48); + var EventPropagators = __webpack_require__(84); + var React = __webpack_require__(24); + var ReactDOM = __webpack_require__(25); + var ReactElement = __webpack_require__(4); + var ReactBrowserEventEmitter = __webpack_require__(46); + var ReactCompositeComponent = __webpack_require__(74); + var ReactInstanceHandles = __webpack_require__(19); + var ReactInstanceMap = __webpack_require__(59); + var ReactMount = __webpack_require__(45); + var ReactUpdates = __webpack_require__(66); + var SyntheticEvent = __webpack_require__(88); + + var assign = __webpack_require__(6); + var emptyObject = __webpack_require__(69); + var findDOMNode = __webpack_require__(101); + var invariant = __webpack_require__(17); + + var topLevelTypes = EventConstants.topLevelTypes; + + function Event(suffix) {} + + /** + * @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) { + 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 ReactDOM.render(instance, div); + }, + + isElement: function (element) { + return ReactElement.isValidElement(element); + }, + + isElementOfType: function (inst, convenienceConstructor) { + return ReactElement.isValidElement(inst) && inst.type === convenienceConstructor; + }, + + isDOMComponent: function (inst) { + return !!(inst && inst.nodeType === 1 && inst.tagName); + }, + + isDOMComponentElement: function (inst) { + return !!(inst && ReactElement.isValidElement(inst) && !!inst.tagName); + }, + + 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) { + if (!ReactTestUtils.isCompositeComponent(inst)) { + return false; + } + var internalInstance = ReactInstanceMap.get(inst); + var constructor = internalInstance._currentElement.type; + + return constructor === type; + }, + + 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'; + }, + + isCompositeComponentElementWithType: function (inst, type) { + var internalInstance = ReactInstanceMap.get(inst); + var constructor = internalInstance._currentElement.type; + + return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type); + }, + + getRenderedChildOfCompositeComponent: function (inst) { + if (!ReactTestUtils.isCompositeComponent(inst)) { + return null; + } + var internalInstance = ReactInstanceMap.get(inst); + return internalInstance._renderedComponent.getPublicInstance(); + }, + + findAllInRenderedTree: function (inst, test) { + if (!inst) { + return []; + } + !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 {array} an array of all the matches. + */ + 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; + }); + }, + + /** + * Like scryRenderedDOMComponentsWithClass but expects there to be one result, + * and returns that one result, or throws exception if there is any other + * number of matches besides one. + * @return {!ReactDOMComponent} The one match. + */ + 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); + } + return all[0]; + }, + + /** + * Finds all instance of components in the rendered tree that are DOM + * components with the tag name matching `tagName`. + * @return {array} an array of all the matches. + */ + scryRenderedDOMComponentsWithTag: function (root, tagName) { + return ReactTestUtils.findAllInRenderedTree(root, function (inst) { + return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase(); + }); + }, + + /** + * Like scryRenderedDOMComponentsWithTag but expects there to be one result, + * and returns that one result, or throws exception if there is any other + * number of matches besides one. + * @return {!ReactDOMComponent} The one match. + */ + 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); + } + return all[0]; + }, + + /** + * Finds all instances of components with type equal to `componentType`. + * @return {array} an array of all the matches. + */ + scryRenderedComponentsWithType: function (root, componentType) { + return ReactTestUtils.findAllInRenderedTree(root, function (inst) { + return ReactTestUtils.isCompositeComponentWithType(inst, componentType); + }); + }, + + /** + * Same as `scryRenderedComponentsWithType` but expects there to be one result + * and returns that one result, or throws exception if there is any other + * number of matches besides one. + * @return {!ReactComponent} The one match. + */ + 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 + ' (found ' + all.length + ')'); + } + return all[0]; + }, + + /** + * Pass a mocked component module to this method to augment it with + * useful methods that allow it to be used as a dummy React component. + * Instead of rendering as usual, the component will become a simple + *
containing any provided children. + * + * @param {object} module the mock function object exported from a + * module that defines the component to be mocked + * @param {?string} mockTagName optional dummy root tag name to return + * from render method (overrides + * module.mockTagName if provided) + * @return {object} the ReactTestUtils object (for chaining) + */ + mockComponent: function (module, mockTagName) { + mockTagName = mockTagName || module.mockTagName || 'div'; + + 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 occurred + * on an `Element` node. + * @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) { + fakeNativeEvent.target = node; + ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent); + }, + + /** + * Simulates a top level event being dispatched from a raw event that occurred + * on the `ReactDOMComponent` `comp`. + * @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, findDOMNode(comp), fakeNativeEvent); + }, + + nativeTouchData: function (x, y) { + return { + touches: [{ pageX: x, pageY: y }] + }; + }, + + createRenderer: function () { + return new ReactShallowRenderer(); + }, + + Simulate: null, + SimulateNative: {} + }; + + /** + * @class ReactShallowRenderer + */ + var ReactShallowRenderer = function () { + this._instance = null; + }; + + ReactShallowRenderer.prototype.getRenderOutput = function () { + return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null; + }; + + var NoopInternalComponent = function (element) { + this._renderedOutput = element; + this._currentElement = element; + }; + + NoopInternalComponent.prototype = { + + mountComponent: function () {}, + + receiveComponent: function (element) { + this._renderedOutput = element; + this._currentElement = element; + }, + + unmountComponent: function () {}, + + getPublicInstance: function () { + return null; + } + }; + + var ShallowComponentWrapper = function () {}; + assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, { + _instantiateReactComponent: function (element) { + return new NoopInternalComponent(element); + }, + _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; + + if (!context) { + context = emptyObject; + } + var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false); + this._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) { + this._instance.receiveComponent(element, transaction, context); + } else { + var rootID = ReactInstanceHandles.createReactRootID(); + var instance = new ShallowComponentWrapper(element.type); + instance.construct(element); + + instance.mountComponent(rootID, transaction, context); + + this._instance = instance; + } + }; + + /** + * Exports: + * + * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)` + * - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)` + * - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)` + * - ... (All keys from event plugin `eventTypes` objects) + */ + function makeSimulator(eventType) { + return function (domComponentOrNode, eventData) { + var node; + if (ReactTestUtils.isDOMComponent(domComponentOrNode)) { + 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(dispatchConfig, ReactMount.getID(node), fakeNativeEvent, node); + assign(event, eventData); + + if (dispatchConfig.phasedRegistrationNames) { + EventPropagators.accumulateTwoPhaseDispatches(event); + } else { + EventPropagators.accumulateDirectDispatches(event); + } + + ReactUpdates.batchedUpdates(function () { + EventPluginHub.enqueueEvents(event); + EventPluginHub.processEventQueue(true); + }); + }; + } + + function buildSimulators() { + ReactTestUtils.Simulate = {}; + + var eventType; + for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) { + /** + * @param {!Element|ReactDOMComponent} domComponentOrNode + * @param {?object} eventData Fake event data to use in SyntheticEvent. + */ + ReactTestUtils.Simulate[eventType] = makeSimulator(eventType); + } + } + + // Rebuild ReactTestUtils.Simulate whenever event plugins are injected + var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder; + EventPluginHub.injection.injectEventPluginOrder = function () { + oldInjectEventPluginOrder.apply(this, arguments); + buildSimulators(); + }; + var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName; + EventPluginHub.injection.injectEventPluginsByName = function () { + oldInjectEventPlugins.apply(this, arguments); + buildSimulators(); + }; + + buildSimulators(); + + /** + * Exports: + * + * - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)` + * - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)` + * - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)` + * - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)` + * - ... (All keys from `EventConstants.topLevelTypes`) + * + * Note: Top level event types are a subset of the entire set of handler types + * (which include a broader set of "synthetic" events). For example, onDragDone + * is a synthetic event. Except when testing an event plugin or React's event + * handling code specifically, you probably want to use ReactTestUtils.Simulate + * to dispatch synthetic events. + */ + + function makeNativeSimulator(eventType) { + 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) { + // Will allow on actual dom nodes. + ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent); + } + }; + } + + 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; + /** + * @param {!Element|ReactDOMComponent} domComponentOrNode + * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent. + */ + ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType); + }); + + module.exports = ReactTestUtils; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 180 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(165); + +/***/ }, +/* 181 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(182); + +/***/ }, +/* 182 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 update + */ + + /* global hasOwnProperty:true */ + + 'use strict'; + + var assign = __webpack_require__(6); + var keyOf = __webpack_require__(11); + var invariant = __webpack_require__(17); + var hasOwnProperty = ({}).hasOwnProperty; + + function shallowCopy(x) { + if (Array.isArray(x)) { + return x.concat(); + } else if (x && typeof x === 'object') { + return assign(new x.constructor(), x); + } else { + return x; + } + } + + 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_SET[command] = true; + }); + + function invariantArrayCase(value, spec, command) { + !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]; + !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) { + !(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)) { + !(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]; + } + + var nextValue = shallowCopy(value); + + if (hasOwnProperty.call(spec, COMMAND_MERGE)) { + var mergeObj = spec[COMMAND_MERGE]; + !(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) { + nextValue.push(item); + }); + } + + if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) { + invariantArrayCase(value, spec, COMMAND_UNSHIFT); + spec[COMMAND_UNSHIFT].forEach(function (item) { + nextValue.unshift(item); + }); + } + + if (hasOwnProperty.call(spec, COMMAND_SPLICE)) { + !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)) { + !(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); + } + + for (var k in spec) { + if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) { + nextValue[k] = update(value[k], spec[k]); + } + } + + return nextValue; + } + + module.exports = update; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 183 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = __webpack_require__(24); + + +/***/ }, +/* 184 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = __webpack_require__(25); + + +/***/ }, +/* 185 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {var addons = {}; + addons.TransitionGroup = __webpack_require__(180); + addons.CSSTransitionGroup = __webpack_require__(22); + addons.LinkedStateMixin = __webpack_require__(170); + addons.cloneWithProps = __webpack_require__(1); + addons.createFragment = __webpack_require__(13); + addons.update = __webpack_require__(181); + addons.PureRenderMixin = __webpack_require__(175); + + if (process.env.NODE_ENV !== "production") { + addons.TestUtils = __webpack_require__(178); + addons.Perf = __webpack_require__(174); + } + + module.exports = addons; + + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, /* 186 */ /***/ function(module, exports, __webpack_require__) { diff --git a/lib/assets/react-source/development/react-server.js b/lib/assets/react-source/development/react-server.js index 1af2bcdd7..3f20412ad 100644 --- a/lib/assets/react-source/development/react-server.js +++ b/lib/assets/react-source/development/react-server.js @@ -44,8 +44,12 @@ /* 0 */ /***/ function(module, exports, __webpack_require__) { + var React = __webpack_require__(183); + var ReactDOM = __webpack_require__(184); var ReactDOMServer = __webpack_require__(186); + window.React = React; + window.ReactDOM = ReactDOM; window.ReactDOMServer = ReactDOMServer; @@ -1008,7 +1012,7 @@ * will remain to ensure logic does not differ in production. */ - var invariant = function (condition, format, a, b, c, d, e, f) { + function invariant(condition, format, a, b, c, d, e, f) { if (process.env.NODE_ENV !== 'production') { if (format === undefined) { throw new Error('invariant requires an error message argument'); @@ -1022,15 +1026,16 @@ } else { var args = [a, b, c, d, e, f]; var argIndex = 0; - error = new Error('Invariant Violation: ' + format.replace(/%s/g, function () { + 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; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) @@ -1620,8 +1625,149 @@ /***/ }, /* 22 */, /* 23 */, -/* 24 */, -/* 25 */, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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 React + */ + + 'use strict'; + + var ReactDOM = __webpack_require__(25); + var ReactDOMServer = __webpack_require__(155); + var ReactIsomorphic = __webpack_require__(159); + + var assign = __webpack_require__(6); + var deprecated = __webpack_require__(164); + + // `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.__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; + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 ReactDOM + */ + + /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ + + 'use strict'; + + var ReactCurrentOwner = __webpack_require__(5); + var ReactDOMTextComponent = __webpack_require__(26); + var ReactDefaultInjection = __webpack_require__(82); + var ReactInstanceHandles = __webpack_require__(19); + var ReactMount = __webpack_require__(45); + var ReactPerf = __webpack_require__(36); + var ReactReconciler = __webpack_require__(62); + var ReactUpdates = __webpack_require__(66); + var ReactVersion = __webpack_require__(153); + + var findDOMNode = __webpack_require__(101); + var renderSubtreeIntoContainer = __webpack_require__(154); + var warning = __webpack_require__(12); + + 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 + }); + } + + if (process.env.NODE_ENV !== 'production') { + var ExecutionEnvironment = __webpack_require__(29); + 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'); + } + } + + // 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: ' + '') : 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; + } + } + } + } + + module.exports = React; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, /* 26 */ /***/ function(module, exports, __webpack_require__) { @@ -10798,8 +10944,8 @@ */ // 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 @@ -10830,9 +10976,7 @@ httpEquiv: 'http-equiv' }, DOMPropertyNames: { - autoCapitalize: 'autocapitalize', autoComplete: 'autocomplete', - autoCorrect: 'autocorrect', autoFocus: 'autofocus', autoPlay: 'autoplay', autoSave: 'autosave', @@ -13484,7 +13628,7 @@ var value = LinkedValueUtils.getValue(props); if (value != null) { - updateOptions(this, props, value); + updateOptions(this, Boolean(props.multiple), value); } } } @@ -16519,11 +16663,14 @@ * @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. + * The activeElement will be null only if the document or document body is not + * yet defined. */ 'use strict'; @@ -16531,7 +16678,6 @@ if (typeof document === 'undefined') { return null; } - try { return document.activeElement || document.body; } catch (e) { @@ -18271,7 +18417,9 @@ 'setValueForProperty': 'update attribute', 'setValueForAttribute': 'update attribute', 'deleteValueForProperty': 'remove attribute', - 'dangerouslyReplaceNodeWithMarkupByID': 'replace' + 'setValueForStyles': 'update styles', + 'replaceNodeWithMarkup': 'replace', + 'updateTextContent': 'set textContent' }; function getTotalTime(measurements) { @@ -18463,19 +18611,24 @@ 'use strict'; var performance = __webpack_require__(152); - var curPerformance = performance; + + 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 (!curPerformance || !curPerformance.now) { - curPerformance = Date; + if (performance.now) { + performanceNow = function () { + return performance.now(); + }; + } else { + performanceNow = function () { + return Date.now(); + }; } - var performanceNow = curPerformance.now.bind(curPerformance); - module.exports = performanceNow; /***/ }, @@ -18526,7 +18679,27 @@ module.exports = '0.14.6'; /***/ }, -/* 154 */, +/* 154 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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 = __webpack_require__(45); + + module.exports = ReactMount.renderSubtreeIntoContainer; + +/***/ }, /* 155 */ /***/ function(module, exports, __webpack_require__) { @@ -18767,12 +18940,705 @@ module.exports = ReactServerRenderingTransaction; /***/ }, -/* 159 */, -/* 160 */, -/* 161 */, -/* 162 */, -/* 163 */, -/* 164 */, +/* 159 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 = __webpack_require__(15); + var ReactComponent = __webpack_require__(130); + var ReactClass = __webpack_require__(129); + var ReactDOMFactories = __webpack_require__(160); + var ReactElement = __webpack_require__(4); + var ReactElementValidator = __webpack_require__(161); + var ReactPropTypes = __webpack_require__(117); + var ReactVersion = __webpack_require__(153); + + var assign = __webpack_require__(6); + var onlyChild = __webpack_require__(163); + + 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; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 160 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 = __webpack_require__(4); + var ReactElementValidator = __webpack_require__(161); + + var mapObject = __webpack_require__(162); + + /** + * 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; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 161 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 ReactElementValidator + */ + + /** + * ReactElementValidator provides a wrapper around a element factory + * which validates the props passed to the element. This is intended to be + * used only in DEV and could be replaced by a static type checker for languages + * that support it. + */ + + 'use strict'; + + var ReactElement = __webpack_require__(4); + var ReactPropTypeLocations = __webpack_require__(76); + var ReactPropTypeLocationNames = __webpack_require__(77); + var ReactCurrentOwner = __webpack_require__(5); + + var canDefineProperty = __webpack_require__(7); + var getIteratorFn = __webpack_require__(21); + var invariant = __webpack_require__(17); + var warning = __webpack_require__(12); + + function getDeclarationErrorAddendum() { + if (ReactCurrentOwner.current) { + var name = ReactCurrentOwner.current.getName(); + if (name) { + return ' Check the render method of `' + name + '`.'; + } + } + return ''; + } + + /** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ + var ownerHasKeyUseWarning = {}; + + var loggedTypeFailures = {}; + + /** + * 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 + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. + * + * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. + */ + function validateExplicitKey(element, parentType) { + if (!element._store || element._store.validated || element.key != null) { + return; + } + element._store.validated = true; + + var addenda = getAddendaForKeyUse('uniqueKey', element, parentType); + if (addenda === null) { + // we already showed the warning + return; + } + 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} 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 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[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. + 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; + } + + /** + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @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]; + if (ReactElement.isValidElement(child)) { + validateExplicitKey(child, parentType); + } + } + } 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. + if (iteratorFn) { + if (iteratorFn !== node.entries) { + var iterator = iteratorFn.call(node); + var step; + while (!(step = iterator.next()).done) { + if (ReactElement.isValidElement(step.value)) { + validateExplicitKey(step.value, parentType); + } + } + } + } + } + } + + /** + * Assert that the props are valid + * + * @param {string} componentName Name of the component for error messages. + * @param {object} propTypes Map of prop name to a ReactPropType + * @param {object} props + * @param {string} location e.g. "prop", "context", "child context" + * @private + */ + function checkPropTypes(componentName, propTypes, props, location) { + for (var propName in propTypes) { + if (propTypes.hasOwnProperty(propName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + !(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); + } 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(); + process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined; + } + } + } + } + + /** + * Given an element, validate that its props follow the propTypes definition, + * provided by the type. + * + * @param {ReactElement} element + */ + function validatePropTypes(element) { + var componentClass = element.type; + if (typeof componentClass !== 'function') { + return; + } + var name = componentClass.displayName || componentClass.name; + if (componentClass.propTypes) { + checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop); + } + if (typeof componentClass.getDefaultProps === 'function') { + 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 = { + + 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. + 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); + + // The result can be nullish if a mock or a custom function is used. + // TODO: Drop this when these are no longer allowed as the type argument. + if (element == null) { + 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); + // Legacy hook TODO: Warn if this is accessed + validatedFactory.type = type; + + if (process.env.NODE_ENV !== 'production') { + if (canDefineProperty) { + Object.defineProperty(validatedFactory, 'type', { + enumerable: false, + 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; + } + }); + } + } + + return validatedFactory; + }, + + 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); + } + validatePropTypes(newElement); + return newElement; + } + + }; + + module.exports = ReactElementValidator; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 162 */ +/***/ function(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; + +/***/ }, +/* 163 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 onlyChild + */ + 'use strict'; + + var ReactElement = __webpack_require__(4); + + var invariant = __webpack_require__(17); + + /** + * Returns the first child in a collection of children and verifies that there + * is only one child in the collection. The current implementation of this + * function assumes that a single child gets passed without a wrapper, but the + * purpose of this helper function is to abstract away the particular structure + * of children. + * + * @param {?object} children Child collection structure. + * @return {ReactComponent} The first and only `ReactComponent` contained in the + * structure. + */ + function onlyChild(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; + } + + module.exports = onlyChild; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 164 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * 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 = __webpack_require__(6); + var warning = __webpack_require__(12); + + /** + * 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; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, /* 165 */, /* 166 */, /* 167 */, @@ -18791,8 +19657,24 @@ /* 180 */, /* 181 */, /* 182 */, -/* 183 */, -/* 184 */, +/* 183 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = __webpack_require__(24); + + +/***/ }, +/* 184 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = __webpack_require__(25); + + +/***/ }, /* 185 */, /* 186 */ /***/ function(module, exports, __webpack_require__) { diff --git a/lib/generators/templates/server_rendering.js b/lib/generators/templates/server_rendering.js index daeff03c2..78bd57a30 100644 --- a/lib/generators/templates/server_rendering.js +++ b/lib/generators/templates/server_rendering.js @@ -1,4 +1,3 @@ -//= require react //= require react-server //= require ./components // diff --git a/react-builds/package.json b/react-builds/package.json index 5f1803ce6..d2c05ad7f 100644 --- a/react-builds/package.json +++ b/react-builds/package.json @@ -4,17 +4,17 @@ "description": "Prepares react-rails asset files", "main": "react.js", "dependencies": { - "react": "^0.14.6", - "react-addons-clone-with-props": "^0.14.6", - "react-addons-create-fragment": "^0.14.6", - "react-addons-css-transition-group": "^0.14.6", - "react-addons-linked-state-mixin": "^0.14.6", - "react-addons-perf": "^0.14.6", - "react-addons-pure-render-mixin": "^0.14.6", - "react-addons-test-utils": "^0.14.6", - "react-addons-transition-group": "^0.14.6", - "react-addons-update": "^0.14.6", - "react-dom": "^0.14.6", + "react": "^0.14.3", + "react-addons-clone-with-props": "^0.14.3", + "react-addons-create-fragment": "^0.14.3", + "react-addons-css-transition-group": "^0.14.3", + "react-addons-linked-state-mixin": "^0.14.3", + "react-addons-perf": "^0.14.3", + "react-addons-pure-render-mixin": "^0.14.3", + "react-addons-test-utils": "^0.14.3", + "react-addons-transition-group": "^0.14.3", + "react-addons-update": "^0.14.3", + "react-dom": "^0.14.3", "webpack": "^1.12.2" } } diff --git a/react-builds/react-server-with-addons.js b/react-builds/react-server-with-addons.js new file mode 100644 index 000000000..538f1d6b5 --- /dev/null +++ b/react-builds/react-server-with-addons.js @@ -0,0 +1,9 @@ +var React = require("react"); +var ReactDOM = require("react-dom"); +var ReactDOMServer = require("react-dom/server"); + +React.addons = require("./addons-object.js"); + +window.React = React; +window.ReactDOM = ReactDOM; +window.ReactDOMServer = ReactDOMServer; diff --git a/react-builds/react-server.js b/react-builds/react-server.js index f42f03c39..b428896c3 100644 --- a/react-builds/react-server.js +++ b/react-builds/react-server.js @@ -1,3 +1,7 @@ +var React = require("react"); +var ReactDOM = require("react-dom"); var ReactDOMServer = require("react-dom/server"); +window.React = React; +window.ReactDOM = ReactDOM; window.ReactDOMServer = ReactDOMServer; diff --git a/test/dummy/app/assets/javascripts/server_rendering.js b/test/dummy/app/assets/javascripts/server_rendering.js index 6528ce946..689430aa7 100644 --- a/test/dummy/app/assets/javascripts/server_rendering.js +++ b/test/dummy/app/assets/javascripts/server_rendering.js @@ -1,3 +1,2 @@ -//= require react //= require react-server //= require ./components diff --git a/test/generators/install_generator_test.rb b/test/generators/install_generator_test.rb index 550726de4..809862a13 100644 --- a/test/generators/install_generator_test.rb +++ b/test/generators/install_generator_test.rb @@ -65,7 +65,6 @@ def copy_directory(dir) test "creates server_rendering.js with default requires" do run_generator server_rendering_file_path = "app/assets/javascripts/server_rendering.js" - assert_file server_rendering_file_path, %r{//= require react\n} assert_file server_rendering_file_path, %r{//= require react-server\n} assert_file server_rendering_file_path, %r{//= require ./components\n} end diff --git a/test/react/server_rendering/exec_js_renderer_test.rb b/test/react/server_rendering/exec_js_renderer_test.rb index e65c7544d..82aa978a0 100644 --- a/test/react/server_rendering/exec_js_renderer_test.rb +++ b/test/react/server_rendering/exec_js_renderer_test.rb @@ -14,10 +14,9 @@ class ExecJSRendererTest < ActiveSupport::TestCase setup do - react_source = Rails.application.assets["react.js"].to_s react_server_source = Rails.application.assets["react-server.js"].to_s todo_component_source = Rails.application.assets["components/Todo.js"].to_s - code = react_source + react_server_source + todo_component_source + code = react_server_source + todo_component_source @renderer = React::ServerRendering::ExecJSRenderer.new(code: code) end diff --git a/test/react/server_rendering/sprockets_renderer_test.rb b/test/react/server_rendering/sprockets_renderer_test.rb index fdfd15ade..3e4695c07 100644 --- a/test/react/server_rendering/sprockets_renderer_test.rb +++ b/test/react/server_rendering/sprockets_renderer_test.rb @@ -47,7 +47,7 @@ class SprocketsRendererTest < ActiveSupport::TestCase end test '.new accepts any filenames' do - limited_renderer = React::ServerRendering::SprocketsRenderer.new(files: ["react.js", "react-server.js", "components/Todo.js"]) + limited_renderer = React::ServerRendering::SprocketsRenderer.new(files: ["react-server.js", "components/Todo.js"]) assert_match(/get a real job<\/li>/, limited_renderer.render("Todo", {todo: "get a real job"}, nil)) err = assert_raises React::ServerRendering::PrerenderError do limited_renderer.render("TodoList", {todos: []}, nil)