diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-11-27 01:37:36 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-11-27 01:37:36 +0100 |
commit | 021e209ce0fbfa5fa993ad43e8167a29a759d120 (patch) | |
tree | e0afdac43998757fea5ef2dd29de38968f2b4cce /libmproxy/web/static/js | |
parent | ed8249023fb7c0d429b9278c63b51ac071700987 (diff) | |
download | mitmproxy-021e209ce0fbfa5fa993ad43e8167a29a759d120.tar.gz mitmproxy-021e209ce0fbfa5fa993ad43e8167a29a759d120.tar.bz2 mitmproxy-021e209ce0fbfa5fa993ad43e8167a29a759d120.zip |
web: update dependencies
Diffstat (limited to 'libmproxy/web/static/js')
-rw-r--r-- | libmproxy/web/static/js/vendor.js | 10210 |
1 files changed, 4395 insertions, 5815 deletions
diff --git a/libmproxy/web/static/js/vendor.js b/libmproxy/web/static/js/vendor.js index c4a12946..bdb525fc 100644 --- a/libmproxy/web/static/js/vendor.js +++ b/libmproxy/web/static/js/vendor.js @@ -15976,23 +15976,68 @@ return jQuery; }.call(this)); /** - * React (with addons) v0.11.1 + * React (with addons) v0.12.1 */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.React=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.React=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule ReactWithAddons + */ + +/** + * This module exists purely in the open source project, and is meant as a way + * to create a separate standalone build of React. This build has "addons", or + * functionality we've built and think might be useful but doesn't have a good + * place to live inside React core. + */ + +"use strict"; + +var LinkedStateMixin = _dereq_("./LinkedStateMixin"); +var React = _dereq_("./React"); +var ReactComponentWithPureRenderMixin = + _dereq_("./ReactComponentWithPureRenderMixin"); +var ReactCSSTransitionGroup = _dereq_("./ReactCSSTransitionGroup"); +var ReactTransitionGroup = _dereq_("./ReactTransitionGroup"); +var ReactUpdates = _dereq_("./ReactUpdates"); + +var cx = _dereq_("./cx"); +var cloneWithProps = _dereq_("./cloneWithProps"); +var update = _dereq_("./update"); + +React.addons = { + CSSTransitionGroup: ReactCSSTransitionGroup, + LinkedStateMixin: LinkedStateMixin, + PureRenderMixin: ReactComponentWithPureRenderMixin, + TransitionGroup: ReactTransitionGroup, + + batchedUpdates: ReactUpdates.batchedUpdates, + classSet: cx, + cloneWithProps: cloneWithProps, + update: update +}; + +if ("production" !== "development") { + React.addons.Perf = _dereq_("./ReactDefaultPerf"); + React.addons.TestUtils = _dereq_("./ReactTestUtils"); +} + +module.exports = React; + +},{"./LinkedStateMixin":25,"./React":31,"./ReactCSSTransitionGroup":34,"./ReactComponentWithPureRenderMixin":39,"./ReactDefaultPerf":56,"./ReactTestUtils":86,"./ReactTransitionGroup":90,"./ReactUpdates":91,"./cloneWithProps":113,"./cx":118,"./update":159}],2:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule AutoFocusMixin * @typechecks static-only @@ -16012,21 +16057,14 @@ var AutoFocusMixin = { module.exports = AutoFocusMixin; -},{"./focusNode":120}],2:[function(_dereq_,module,exports){ +},{"./focusNode":125}],3:[function(_dereq_,module,exports){ /** * Copyright 2013 Facebook, Inc. + * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule BeforeInputEventPlugin * @typechecks static-only @@ -16084,6 +16122,9 @@ var eventTypes = { // Track characters inserted via keypress and composition events. var fallbackChars = null; +// Track whether we've ever handled a keypress on the space key. +var hasSpaceKeypress = false; + /** * Return whether a native keypress event is assumed to be a command. * This is required because Firefox fires `keypress` events for key commands @@ -16153,7 +16194,8 @@ var BeforeInputEventPlugin = { return; } - chars = String.fromCharCode(which); + hasSpaceKeypress = true; + chars = SPACEBAR_CHAR; break; case topLevelTypes.topTextInput: @@ -16161,8 +16203,9 @@ var BeforeInputEventPlugin = { chars = nativeEvent.data; // If it's a spacebar character, assume that we have already handled - // it at the keypress level and bail immediately. - if (chars === SPACEBAR_CHAR) { + // it at the keypress level and bail immediately. Android Chrome + // doesn't give us keycodes, so we need to blacklist it. + if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { return; } @@ -16236,21 +16279,14 @@ var BeforeInputEventPlugin = { module.exports = BeforeInputEventPlugin; -},{"./EventConstants":16,"./EventPropagators":21,"./ExecutionEnvironment":22,"./SyntheticInputEvent":98,"./keyOf":141}],3:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPropagators":22,"./ExecutionEnvironment":23,"./SyntheticInputEvent":101,"./keyOf":147}],4:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 @@ -16336,7 +16372,7 @@ var CSSCore = { * * @param {DOMNode|DOMWindow} element the element to set the class on * @param {string} className the CSS className - * @returns {boolean} true if the element has the class, false if not + * @return {boolean} true if the element has the class, false if not */ hasClass: function(element, className) { ("production" !== "development" ? invariant( @@ -16353,21 +16389,14 @@ var CSSCore = { module.exports = CSSCore; -},{"./invariant":134}],4:[function(_dereq_,module,exports){ +},{"./invariant":140}],5:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule CSSProperty */ @@ -16476,21 +16505,14 @@ var CSSProperty = { module.exports = CSSProperty; -},{}],5:[function(_dereq_,module,exports){ +},{}],6:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule CSSPropertyOperations * @typechecks static-only @@ -16499,15 +16521,43 @@ module.exports = CSSProperty; "use strict"; var CSSProperty = _dereq_("./CSSProperty"); +var ExecutionEnvironment = _dereq_("./ExecutionEnvironment"); +var camelizeStyleName = _dereq_("./camelizeStyleName"); var dangerousStyleValue = _dereq_("./dangerousStyleValue"); var hyphenateStyleName = _dereq_("./hyphenateStyleName"); var memoizeStringOnly = _dereq_("./memoizeStringOnly"); +var warning = _dereq_("./warning"); var processStyleName = memoizeStringOnly(function(styleName) { return hyphenateStyleName(styleName); }); +var styleFloatAccessor = 'cssFloat'; +if (ExecutionEnvironment.canUseDOM) { + // IE8 only supports accessing cssFloat (standard) as styleFloat + if (document.documentElement.style.cssFloat === undefined) { + styleFloatAccessor = 'styleFloat'; + } +} + +if ("production" !== "development") { + var warnedStyleNames = {}; + + var warnHyphenatedStyleName = function(name) { + if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { + return; + } + + warnedStyleNames[name] = true; + ("production" !== "development" ? warning( + false, + 'Unsupported style property ' + name + '. Did you mean ' + + camelizeStyleName(name) + '?' + ) : null); + }; +} + /** * Operations for dealing with CSS properties. */ @@ -16531,6 +16581,11 @@ var CSSPropertyOperations = { if (!styles.hasOwnProperty(styleName)) { continue; } + if ("production" !== "development") { + if (styleName.indexOf('-') > -1) { + warnHyphenatedStyleName(styleName); + } + } var styleValue = styles[styleName]; if (styleValue != null) { serialized += processStyleName(styleName) + ':'; @@ -16553,7 +16608,15 @@ var CSSPropertyOperations = { if (!styles.hasOwnProperty(styleName)) { continue; } + if ("production" !== "development") { + if (styleName.indexOf('-') > -1) { + warnHyphenatedStyleName(styleName); + } + } var styleValue = dangerousStyleValue(styleName, styles[styleName]); + if (styleName === 'float') { + styleName = styleFloatAccessor; + } if (styleValue) { style[styleName] = styleValue; } else { @@ -16575,21 +16638,14 @@ var CSSPropertyOperations = { module.exports = CSSPropertyOperations; -},{"./CSSProperty":4,"./dangerousStyleValue":115,"./hyphenateStyleName":132,"./memoizeStringOnly":143}],6:[function(_dereq_,module,exports){ +},{"./CSSProperty":5,"./ExecutionEnvironment":23,"./camelizeStyleName":112,"./dangerousStyleValue":119,"./hyphenateStyleName":138,"./memoizeStringOnly":149,"./warning":160}],7:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule CallbackQueue */ @@ -16598,8 +16654,8 @@ module.exports = CSSPropertyOperations; var PooledClass = _dereq_("./PooledClass"); +var assign = _dereq_("./Object.assign"); var invariant = _dereq_("./invariant"); -var mixInto = _dereq_("./mixInto"); /** * A specialized pseudo-event module to help keep track of components waiting to @@ -16617,7 +16673,7 @@ function CallbackQueue() { this._contexts = null; } -mixInto(CallbackQueue, { +assign(CallbackQueue.prototype, { /** * Enqueues a callback to be invoked when `notifyAll` is invoked. @@ -16680,21 +16736,14 @@ PooledClass.addPoolingTo(CallbackQueue); module.exports = CallbackQueue; -},{"./PooledClass":28,"./invariant":134,"./mixInto":147}],7:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./PooledClass":30,"./invariant":140}],8:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ChangeEventPlugin */ @@ -17069,21 +17118,14 @@ var ChangeEventPlugin = { module.exports = ChangeEventPlugin; -},{"./EventConstants":16,"./EventPluginHub":18,"./EventPropagators":21,"./ExecutionEnvironment":22,"./ReactUpdates":87,"./SyntheticEvent":96,"./isEventSupported":135,"./isTextInputElement":137,"./keyOf":141}],8:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPluginHub":19,"./EventPropagators":22,"./ExecutionEnvironment":23,"./ReactUpdates":91,"./SyntheticEvent":99,"./isEventSupported":141,"./isTextInputElement":143,"./keyOf":147}],9:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ClientReactRootIndex * @typechecks @@ -17101,21 +17143,14 @@ var ClientReactRootIndex = { module.exports = ClientReactRootIndex; -},{}],9:[function(_dereq_,module,exports){ +},{}],10:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule CompositionEventPlugin * @typechecks static-only @@ -17367,21 +17402,14 @@ var CompositionEventPlugin = { module.exports = CompositionEventPlugin; -},{"./EventConstants":16,"./EventPropagators":21,"./ExecutionEnvironment":22,"./ReactInputSelection":63,"./SyntheticCompositionEvent":94,"./getTextContentAccessor":129,"./keyOf":141}],10:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPropagators":22,"./ExecutionEnvironment":23,"./ReactInputSelection":65,"./SyntheticCompositionEvent":97,"./getTextContentAccessor":135,"./keyOf":147}],11:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DOMChildrenOperations * @typechecks static-only @@ -17489,9 +17517,9 @@ var DOMChildrenOperations = { 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + - 'nesting <p> or <a> tags, or using non-SVG elements in an <svg> '+ - 'parent. Try inspecting the child nodes of the element with React ' + - 'ID `%s`.', + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements '+ + 'in an <svg> parent. Try inspecting the child nodes of the element ' + + 'with React ID `%s`.', updatedIndex, parentID ) : invariant(updatedChild)); @@ -17547,21 +17575,14 @@ var DOMChildrenOperations = { module.exports = DOMChildrenOperations; -},{"./Danger":13,"./ReactMultiChildUpdateTypes":69,"./getTextContentAccessor":129,"./invariant":134}],11:[function(_dereq_,module,exports){ +},{"./Danger":14,"./ReactMultiChildUpdateTypes":72,"./getTextContentAccessor":135,"./invariant":140}],12:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DOMProperty * @typechecks static-only @@ -17573,6 +17594,10 @@ module.exports = DOMChildrenOperations; var invariant = _dereq_("./invariant"); +function checkMask(value, bitmask) { + return (value & bitmask) === bitmask; +} + var DOMPropertyInjection = { /** * Mapping from normalized, camelcased property names to a configuration that @@ -17659,19 +17684,19 @@ var DOMPropertyInjection = { var propConfig = Properties[propName]; DOMProperty.mustUseAttribute[propName] = - propConfig & DOMPropertyInjection.MUST_USE_ATTRIBUTE; + checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE); DOMProperty.mustUseProperty[propName] = - propConfig & DOMPropertyInjection.MUST_USE_PROPERTY; + checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY); DOMProperty.hasSideEffects[propName] = - propConfig & DOMPropertyInjection.HAS_SIDE_EFFECTS; + checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS); DOMProperty.hasBooleanValue[propName] = - propConfig & DOMPropertyInjection.HAS_BOOLEAN_VALUE; + checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE); DOMProperty.hasNumericValue[propName] = - propConfig & DOMPropertyInjection.HAS_NUMERIC_VALUE; + checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE); DOMProperty.hasPositiveNumericValue[propName] = - propConfig & DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE; + checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE); DOMProperty.hasOverloadedBooleanValue[propName] = - propConfig & DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE; + checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE); ("production" !== "development" ? invariant( !DOMProperty.mustUseAttribute[propName] || @@ -17847,21 +17872,14 @@ var DOMProperty = { module.exports = DOMProperty; -},{"./invariant":134}],12:[function(_dereq_,module,exports){ +},{"./invariant":140}],13:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DOMPropertyOperations * @typechecks static-only @@ -17988,10 +18006,17 @@ var DOMPropertyOperations = { } else if (shouldIgnoreValue(name, value)) { this.deleteValueForProperty(node, name); } else if (DOMProperty.mustUseAttribute[name]) { + // `setAttribute` with objects becomes only `[object]` in IE8/9, + // ('' + value) makes it output the correct toString()-value. node.setAttribute(DOMProperty.getAttributeName[name], '' + value); } else { var propName = DOMProperty.getPropertyName[name]; - if (!DOMProperty.hasSideEffects[name] || node[propName] !== value) { + // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the + // property type before comparing; only `value` does and is string. + if (!DOMProperty.hasSideEffects[name] || + ('' + node[propName]) !== ('' + value)) { + // Contrary to `setAttribute`, object properties are properly + // `toString`ed by IE8/9. node[propName] = value; } } @@ -18027,7 +18052,7 @@ var DOMPropertyOperations = { propName ); if (!DOMProperty.hasSideEffects[name] || - node[propName] !== defaultValue) { + ('' + node[propName]) !== defaultValue) { node[propName] = defaultValue; } } @@ -18042,21 +18067,14 @@ var DOMPropertyOperations = { module.exports = DOMPropertyOperations; -},{"./DOMProperty":11,"./escapeTextForBrowser":118,"./memoizeStringOnly":143,"./warning":158}],13:[function(_dereq_,module,exports){ +},{"./DOMProperty":12,"./escapeTextForBrowser":123,"./memoizeStringOnly":149,"./warning":160}],14:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule Danger * @typechecks static-only @@ -18105,9 +18123,10 @@ var Danger = { dangerouslyRenderMarkup: function(markupList) { ("production" !== "development" ? invariant( ExecutionEnvironment.canUseDOM, - 'dangerouslyRenderMarkup(...): Cannot render markup in a Worker ' + - 'thread. This is likely a bug in the framework. Please report ' + - 'immediately.' + 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + + 'thread. Make sure `window` and `document` are available globally ' + + 'before requiring React when unit testing or use ' + + 'React.renderToString for server rendering.' ) : invariant(ExecutionEnvironment.canUseDOM)); var nodeName; var markupByNodeName = {}; @@ -18211,8 +18230,9 @@ var Danger = { ("production" !== "development" ? invariant( ExecutionEnvironment.canUseDOM, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + - 'worker thread. This is likely a bug in the framework. Please report ' + - 'immediately.' + 'worker thread. Make sure `window` and `document` are available ' + + 'globally before requiring React when unit testing or use ' + + 'React.renderToString for server rendering.' ) : invariant(ExecutionEnvironment.canUseDOM)); ("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup)); ("production" !== "development" ? invariant( @@ -18231,21 +18251,14 @@ var Danger = { module.exports = Danger; -},{"./ExecutionEnvironment":22,"./createNodesFromMarkup":113,"./emptyFunction":116,"./getMarkupWrap":126,"./invariant":134}],14:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23,"./createNodesFromMarkup":117,"./emptyFunction":121,"./getMarkupWrap":132,"./invariant":140}],15:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DefaultEventPluginOrder */ @@ -18278,21 +18291,14 @@ var DefaultEventPluginOrder = [ module.exports = DefaultEventPluginOrder; -},{"./keyOf":141}],15:[function(_dereq_,module,exports){ +},{"./keyOf":147}],16:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EnterLeaveEventPlugin * @typechecks static-only @@ -18425,21 +18431,14 @@ var EnterLeaveEventPlugin = { module.exports = EnterLeaveEventPlugin; -},{"./EventConstants":16,"./EventPropagators":21,"./ReactMount":67,"./SyntheticMouseEvent":100,"./keyOf":141}],16:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPropagators":22,"./ReactMount":70,"./SyntheticMouseEvent":103,"./keyOf":147}],17:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EventConstants */ @@ -18504,8 +18503,22 @@ var EventConstants = { module.exports = EventConstants; -},{"./keyMirror":140}],17:[function(_dereq_,module,exports){ +},{"./keyMirror":146}],18:[function(_dereq_,module,exports){ /** + * Copyright 2013-2014 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * * @providesModule EventListener * @typechecks */ @@ -18578,21 +18591,14 @@ var EventListener = { module.exports = EventListener; -},{"./emptyFunction":116}],18:[function(_dereq_,module,exports){ +},{"./emptyFunction":121}],19:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EventPluginHub */ @@ -18602,11 +18608,9 @@ module.exports = EventListener; var EventPluginRegistry = _dereq_("./EventPluginRegistry"); var EventPluginUtils = _dereq_("./EventPluginUtils"); -var accumulate = _dereq_("./accumulate"); +var accumulateInto = _dereq_("./accumulateInto"); var forEachAccumulated = _dereq_("./forEachAccumulated"); var invariant = _dereq_("./invariant"); -var isEventSupported = _dereq_("./isEventSupported"); -var monitorCodeUse = _dereq_("./monitorCodeUse"); /** * Internal store for event listeners @@ -18740,15 +18744,6 @@ var EventPluginHub = { registrationName, typeof listener ) : invariant(!listener || typeof listener === 'function')); - if ("production" !== "development") { - // IE8 has no API for event capturing and the `onScroll` event doesn't - // bubble. - if (registrationName === 'onScroll' && - !isEventSupported('scroll', true)) { - monitorCodeUse('react_no_scroll_event'); - console.warn('This browser doesn\'t support the `onScroll` event'); - } - } var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); bankForRegistrationName[id] = listener; @@ -18817,7 +18812,7 @@ var EventPluginHub = { nativeEvent ); if (extractedEvents) { - events = accumulate(events, extractedEvents); + events = accumulateInto(events, extractedEvents); } } } @@ -18833,7 +18828,7 @@ var EventPluginHub = { */ enqueueEvents: function(events) { if (events) { - eventQueue = accumulate(eventQueue, events); + eventQueue = accumulateInto(eventQueue, events); } }, @@ -18870,21 +18865,14 @@ var EventPluginHub = { module.exports = EventPluginHub; -},{"./EventPluginRegistry":19,"./EventPluginUtils":20,"./accumulate":106,"./forEachAccumulated":121,"./invariant":134,"./isEventSupported":135,"./monitorCodeUse":148}],19:[function(_dereq_,module,exports){ +},{"./EventPluginRegistry":20,"./EventPluginUtils":21,"./accumulateInto":109,"./forEachAccumulated":126,"./invariant":140}],20:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EventPluginRegistry * @typechecks static-only @@ -19155,21 +19143,14 @@ var EventPluginRegistry = { module.exports = EventPluginRegistry; -},{"./invariant":134}],20:[function(_dereq_,module,exports){ +},{"./invariant":140}],21:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EventPluginUtils */ @@ -19381,21 +19362,14 @@ var EventPluginUtils = { module.exports = EventPluginUtils; -},{"./EventConstants":16,"./invariant":134}],21:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./invariant":140}],22:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EventPropagators */ @@ -19405,7 +19379,7 @@ module.exports = EventPluginUtils; var EventConstants = _dereq_("./EventConstants"); var EventPluginHub = _dereq_("./EventPluginHub"); -var accumulate = _dereq_("./accumulate"); +var accumulateInto = _dereq_("./accumulateInto"); var forEachAccumulated = _dereq_("./forEachAccumulated"); var PropagationPhases = EventConstants.PropagationPhases; @@ -19436,8 +19410,9 @@ function accumulateDirectionalDispatches(domID, upwards, event) { var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured; var listener = listenerAtPhase(domID, event, phase); if (listener) { - event._dispatchListeners = accumulate(event._dispatchListeners, listener); - event._dispatchIDs = accumulate(event._dispatchIDs, domID); + event._dispatchListeners = + accumulateInto(event._dispatchListeners, listener); + event._dispatchIDs = accumulateInto(event._dispatchIDs, domID); } } @@ -19469,8 +19444,9 @@ function accumulateDispatches(id, ignoredDirection, event) { var registrationName = event.dispatchConfig.registrationName; var listener = getListener(id, registrationName); if (listener) { - event._dispatchListeners = accumulate(event._dispatchListeners, listener); - event._dispatchIDs = accumulate(event._dispatchIDs, id); + event._dispatchListeners = + accumulateInto(event._dispatchListeners, listener); + event._dispatchIDs = accumulateInto(event._dispatchIDs, id); } } } @@ -19526,21 +19502,14 @@ var EventPropagators = { module.exports = EventPropagators; -},{"./EventConstants":16,"./EventPluginHub":18,"./accumulate":106,"./forEachAccumulated":121}],22:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPluginHub":19,"./accumulateInto":109,"./forEachAccumulated":126}],23:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ExecutionEnvironment */ @@ -19578,21 +19547,14 @@ var ExecutionEnvironment = { module.exports = ExecutionEnvironment; -},{}],23:[function(_dereq_,module,exports){ +},{}],24:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule HTMLDOMPropertyConfig */ @@ -19637,6 +19599,7 @@ var HTMLDOMPropertyConfig = { * Standard Properties */ accept: null, + acceptCharset: null, accessKey: null, action: null, allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, @@ -19651,6 +19614,7 @@ var HTMLDOMPropertyConfig = { cellSpacing: null, charSet: MUST_USE_ATTRIBUTE, checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, + classID: MUST_USE_ATTRIBUTE, // To set className on SVG elements, it's necessary to use .setAttribute; // this works on HTML elements too in all browsers except IE8. Conveniently, // IE8 doesn't support SVG and so we can simply use the attribute in @@ -19686,10 +19650,12 @@ var HTMLDOMPropertyConfig = { id: MUST_USE_PROPERTY, label: null, lang: null, - list: null, + list: MUST_USE_ATTRIBUTE, loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, + manifest: MUST_USE_ATTRIBUTE, max: null, maxLength: MUST_USE_ATTRIBUTE, + media: MUST_USE_ATTRIBUTE, mediaGroup: null, method: null, min: null, @@ -19697,6 +19663,7 @@ var HTMLDOMPropertyConfig = { muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, name: null, noValidate: HAS_BOOLEAN_VALUE, + open: null, pattern: null, placeholder: null, poster: null, @@ -19710,18 +19677,17 @@ var HTMLDOMPropertyConfig = { rowSpan: null, sandbox: null, scope: null, - scrollLeft: MUST_USE_PROPERTY, scrolling: null, - scrollTop: MUST_USE_PROPERTY, seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, shape: null, size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, + sizes: MUST_USE_ATTRIBUTE, span: HAS_POSITIVE_NUMERIC_VALUE, spellCheck: null, src: null, srcDoc: MUST_USE_PROPERTY, - srcSet: null, + srcSet: MUST_USE_ATTRIBUTE, start: HAS_NUMERIC_VALUE, step: null, style: null, @@ -19745,6 +19711,7 @@ var HTMLDOMPropertyConfig = { property: null // Supports OG in meta tags }, DOMAttributeNames: { + acceptCharset: 'accept-charset', className: 'class', htmlFor: 'for', httpEquiv: 'http-equiv' @@ -19766,21 +19733,14 @@ var HTMLDOMPropertyConfig = { module.exports = HTMLDOMPropertyConfig; -},{"./DOMProperty":11,"./ExecutionEnvironment":22}],24:[function(_dereq_,module,exports){ +},{"./DOMProperty":12,"./ExecutionEnvironment":23}],25:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 @@ -19814,21 +19774,14 @@ var LinkedStateMixin = { module.exports = LinkedStateMixin; -},{"./ReactLink":65,"./ReactStateSetters":81}],25:[function(_dereq_,module,exports){ +},{"./ReactLink":68,"./ReactStateSetters":85}],26:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule LinkedValueUtils * @typechecks static-only @@ -19975,21 +19928,14 @@ var LinkedValueUtils = { module.exports = LinkedValueUtils; -},{"./ReactPropTypes":75,"./invariant":134}],26:[function(_dereq_,module,exports){ +},{"./ReactPropTypes":79,"./invariant":140}],27:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule LocalEventTrapMixin */ @@ -19998,7 +19944,7 @@ module.exports = LinkedValueUtils; var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter"); -var accumulate = _dereq_("./accumulate"); +var accumulateInto = _dereq_("./accumulateInto"); var forEachAccumulated = _dereq_("./forEachAccumulated"); var invariant = _dereq_("./invariant"); @@ -20014,7 +19960,8 @@ var LocalEventTrapMixin = { handlerBaseName, this.getDOMNode() ); - this._localEventListeners = accumulate(this._localEventListeners, listener); + this._localEventListeners = + accumulateInto(this._localEventListeners, listener); }, // trapCapturedEvent would look nearly identical. We don't implement that @@ -20029,21 +19976,14 @@ var LocalEventTrapMixin = { module.exports = LocalEventTrapMixin; -},{"./ReactBrowserEventEmitter":31,"./accumulate":106,"./forEachAccumulated":121,"./invariant":134}],27:[function(_dereq_,module,exports){ +},{"./ReactBrowserEventEmitter":33,"./accumulateInto":109,"./forEachAccumulated":126,"./invariant":140}],28:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule MobileSafariClickEventPlugin * @typechecks static-only @@ -20094,21 +20034,61 @@ var MobileSafariClickEventPlugin = { module.exports = MobileSafariClickEventPlugin; -},{"./EventConstants":16,"./emptyFunction":116}],28:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./emptyFunction":121}],29:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule Object.assign + */ + +// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign + +function assign(target, sources) { + if (target == null) { + throw new TypeError('Object.assign target cannot be null or undefined'); + } + + var to = Object(target); + var hasOwnProperty = Object.prototype.hasOwnProperty; + + for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) { + var nextSource = arguments[nextIndex]; + if (nextSource == null) { + continue; + } + + var from = Object(nextSource); + + // We don't currently support accessors nor proxies. Therefore this + // copy cannot throw. If we ever supported this then we must handle + // exceptions and side-effects. We don't support symbols so they won't + // be transferred. + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + } + + return to; +}; + +module.exports = assign; + +},{}],30:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule PooledClass */ @@ -20215,21 +20195,14 @@ var PooledClass = { module.exports = PooledClass; -},{"./invariant":134}],29:[function(_dereq_,module,exports){ +},{"./invariant":140}],31:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 */ @@ -20243,11 +20216,13 @@ var ReactComponent = _dereq_("./ReactComponent"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); var ReactContext = _dereq_("./ReactContext"); var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); +var ReactElementValidator = _dereq_("./ReactElementValidator"); var ReactDOM = _dereq_("./ReactDOM"); var ReactDOMComponent = _dereq_("./ReactDOMComponent"); var ReactDefaultInjection = _dereq_("./ReactDefaultInjection"); var ReactInstanceHandles = _dereq_("./ReactInstanceHandles"); +var ReactLegacyElement = _dereq_("./ReactLegacyElement"); var ReactMount = _dereq_("./ReactMount"); var ReactMultiChild = _dereq_("./ReactMultiChild"); var ReactPerf = _dereq_("./ReactPerf"); @@ -20255,10 +20230,30 @@ var ReactPropTypes = _dereq_("./ReactPropTypes"); var ReactServerRendering = _dereq_("./ReactServerRendering"); var ReactTextComponent = _dereq_("./ReactTextComponent"); +var assign = _dereq_("./Object.assign"); +var deprecated = _dereq_("./deprecated"); var onlyChild = _dereq_("./onlyChild"); ReactDefaultInjection.inject(); +var createElement = ReactElement.createElement; +var createFactory = ReactElement.createFactory; + +if ("production" !== "development") { + createElement = ReactElementValidator.createElement; + createFactory = ReactElementValidator.createFactory; +} + +// TODO: Drop legacy elements once classes no longer export these factories +createElement = ReactLegacyElement.wrapCreateElement( + createElement +); +createFactory = ReactLegacyElement.wrapCreateFactory( + createFactory +); + +var render = ReactPerf.measure('React', 'render', ReactMount.render); + var React = { Children: { map: ReactChildren.map, @@ -20272,25 +20267,58 @@ var React = { EventPluginUtils.useTouchEvents = shouldUseTouch; }, createClass: ReactCompositeComponent.createClass, - createDescriptor: function(type, props, children) { - var args = Array.prototype.slice.call(arguments, 1); - return type.apply(null, args); - }, + createElement: createElement, + createFactory: createFactory, constructAndRenderComponent: ReactMount.constructAndRenderComponent, constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID, - renderComponent: ReactPerf.measure( + render: render, + renderToString: ReactServerRendering.renderToString, + renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup, + unmountComponentAtNode: ReactMount.unmountComponentAtNode, + isValidClass: ReactLegacyElement.isValidClass, + isValidElement: ReactElement.isValidElement, + withContext: ReactContext.withContext, + + // Hook for JSX spread, don't use this for anything else. + __spread: assign, + + // Deprecations (remove for 0.13) + renderComponent: deprecated( 'React', 'renderComponent', - ReactMount.renderComponent + 'render', + this, + render ), - renderComponentToString: ReactServerRendering.renderComponentToString, - renderComponentToStaticMarkup: - ReactServerRendering.renderComponentToStaticMarkup, - unmountComponentAtNode: ReactMount.unmountComponentAtNode, - isValidClass: ReactDescriptor.isValidFactory, - isValidComponent: ReactDescriptor.isValidDescriptor, - withContext: ReactContext.withContext, - __internals: { + renderComponentToString: deprecated( + 'React', + 'renderComponentToString', + 'renderToString', + this, + ReactServerRendering.renderToString + ), + renderComponentToStaticMarkup: deprecated( + 'React', + 'renderComponentToStaticMarkup', + 'renderToStaticMarkup', + this, + ReactServerRendering.renderToStaticMarkup + ), + isValidComponent: deprecated( + 'React', + 'isValidComponent', + 'isValidElement', + this, + ReactElement.isValidElement + ) +}; + +// Inject the runtime into a devtools global hook regardless of browser. +// Allows for debugging when the hook is injected on the page. +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { + __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ Component: ReactComponent, CurrentOwner: ReactCurrentOwner, DOMComponent: ReactDOMComponent, @@ -20299,18 +20327,23 @@ var React = { Mount: ReactMount, MultiChild: ReactMultiChild, TextComponent: ReactTextComponent - } -}; + }); +} if ("production" !== "development") { var ExecutionEnvironment = _dereq_("./ExecutionEnvironment"); - if (ExecutionEnvironment.canUseDOM && - window.top === window.self && - navigator.userAgent.indexOf('Chrome') > -1) { - console.debug( - 'Download the React DevTools for a better development experience: ' + - 'http://fb.me/react-devtools' - ); + if (ExecutionEnvironment.canUseDOM && window.top === window.self) { + + // If we're in Chrome, look for the devtools marker and provide a download + // link if not installed. + if (navigator.userAgent.indexOf('Chrome') > -1) { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { + console.debug( + 'Download the React DevTools for a better development experience: ' + + 'http://fb.me/react-devtools' + ); + } + } var expectedFeatures = [ // shims @@ -20330,7 +20363,7 @@ if ("production" !== "development") { Object.freeze ]; - for (var i in expectedFeatures) { + 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: ' + @@ -20344,25 +20377,18 @@ if ("production" !== "development") { // Version exists only in the open-source version of React, not in Facebook's // internal version. -React.version = '0.11.1'; +React.version = '0.12.1'; module.exports = React; -},{"./DOMPropertyOperations":12,"./EventPluginUtils":20,"./ExecutionEnvironment":22,"./ReactChildren":34,"./ReactComponent":35,"./ReactCompositeComponent":38,"./ReactContext":39,"./ReactCurrentOwner":40,"./ReactDOM":41,"./ReactDOMComponent":43,"./ReactDefaultInjection":53,"./ReactDescriptor":56,"./ReactInstanceHandles":64,"./ReactMount":67,"./ReactMultiChild":68,"./ReactPerf":71,"./ReactPropTypes":75,"./ReactServerRendering":79,"./ReactTextComponent":83,"./onlyChild":149}],30:[function(_dereq_,module,exports){ +},{"./DOMPropertyOperations":13,"./EventPluginUtils":21,"./ExecutionEnvironment":23,"./Object.assign":29,"./ReactChildren":36,"./ReactComponent":37,"./ReactCompositeComponent":40,"./ReactContext":41,"./ReactCurrentOwner":42,"./ReactDOM":43,"./ReactDOMComponent":45,"./ReactDefaultInjection":55,"./ReactElement":58,"./ReactElementValidator":59,"./ReactInstanceHandles":66,"./ReactLegacyElement":67,"./ReactMount":70,"./ReactMultiChild":71,"./ReactPerf":75,"./ReactPropTypes":79,"./ReactServerRendering":83,"./ReactTextComponent":87,"./deprecated":120,"./onlyChild":151}],32:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactBrowserComponentMixin */ @@ -20396,21 +20422,14 @@ var ReactBrowserComponentMixin = { module.exports = ReactBrowserComponentMixin; -},{"./ReactEmptyComponent":58,"./ReactMount":67,"./invariant":134}],31:[function(_dereq_,module,exports){ +},{"./ReactEmptyComponent":60,"./ReactMount":70,"./invariant":140}],33:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactBrowserEventEmitter * @typechecks static-only @@ -20424,8 +20443,8 @@ var EventPluginRegistry = _dereq_("./EventPluginRegistry"); var ReactEventEmitterMixin = _dereq_("./ReactEventEmitterMixin"); var ViewportMetrics = _dereq_("./ViewportMetrics"); +var assign = _dereq_("./Object.assign"); var isEventSupported = _dereq_("./isEventSupported"); -var merge = _dereq_("./merge"); /** * Summary of `ReactBrowserEventEmitter` event handling: @@ -20554,7 +20573,7 @@ function getListeningForDocument(mountAt) { * * @internal */ -var ReactBrowserEventEmitter = merge(ReactEventEmitterMixin, { +var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, { /** * Injectable event backend @@ -20758,21 +20777,14 @@ var ReactBrowserEventEmitter = merge(ReactEventEmitterMixin, { module.exports = ReactBrowserEventEmitter; -},{"./EventConstants":16,"./EventPluginHub":18,"./EventPluginRegistry":19,"./ReactEventEmitterMixin":60,"./ViewportMetrics":105,"./isEventSupported":135,"./merge":144}],32:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPluginHub":19,"./EventPluginRegistry":20,"./Object.assign":29,"./ReactEventEmitterMixin":62,"./ViewportMetrics":108,"./isEventSupported":141}],34:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in 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 @@ -20782,8 +20794,14 @@ module.exports = ReactBrowserEventEmitter; var React = _dereq_("./React"); -var ReactTransitionGroup = _dereq_("./ReactTransitionGroup"); -var ReactCSSTransitionGroupChild = _dereq_("./ReactCSSTransitionGroupChild"); +var assign = _dereq_("./Object.assign"); + +var ReactTransitionGroup = React.createFactory( + _dereq_("./ReactTransitionGroup") +); +var ReactCSSTransitionGroupChild = React.createFactory( + _dereq_("./ReactCSSTransitionGroupChild") +); var ReactCSSTransitionGroup = React.createClass({ displayName: 'ReactCSSTransitionGroup', @@ -20816,10 +20834,9 @@ var ReactCSSTransitionGroup = React.createClass({ }, render: function() { - return this.transferPropsTo( + return ( ReactTransitionGroup( - {childFactory: this._wrapChild}, - this.props.children + assign({}, this.props, {childFactory: this._wrapChild}) ) ); } @@ -20827,21 +20844,14 @@ var ReactCSSTransitionGroup = React.createClass({ module.exports = ReactCSSTransitionGroup; -},{"./React":29,"./ReactCSSTransitionGroupChild":33,"./ReactTransitionGroup":86}],33:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./React":31,"./ReactCSSTransitionGroupChild":35,"./ReactTransitionGroup":90}],35:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in 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 @@ -20886,7 +20896,10 @@ var ReactCSSTransitionGroupChild = React.createClass({ var activeClassName = className + '-active'; var noEventTimeout = null; - var endListener = function() { + var endListener = function(e) { + if (e && e.target !== node) { + return; + } if ("production" !== "development") { clearTimeout(noEventTimeout); } @@ -20964,21 +20977,14 @@ var ReactCSSTransitionGroupChild = React.createClass({ module.exports = ReactCSSTransitionGroupChild; -},{"./CSSCore":3,"./React":29,"./ReactTransitionEvents":85,"./onlyChild":149}],34:[function(_dereq_,module,exports){ +},{"./CSSCore":4,"./React":31,"./ReactTransitionEvents":89,"./onlyChild":151}],36:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactChildren */ @@ -21119,34 +21125,27 @@ var ReactChildren = { module.exports = ReactChildren; -},{"./PooledClass":28,"./traverseAllChildren":156,"./warning":158}],35:[function(_dereq_,module,exports){ +},{"./PooledClass":30,"./traverseAllChildren":158,"./warning":160}],37:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactComponent */ "use strict"; -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); var ReactOwner = _dereq_("./ReactOwner"); var ReactUpdates = _dereq_("./ReactUpdates"); +var assign = _dereq_("./Object.assign"); var invariant = _dereq_("./invariant"); var keyMirror = _dereq_("./keyMirror"); -var merge = _dereq_("./merge"); /** * Every React component is in one of these life cycles. @@ -21269,11 +21268,11 @@ var ReactComponent = { * @public */ setProps: function(partialProps, callback) { - // Merge with the pending descriptor if it exists, otherwise with existing - // descriptor props. - var descriptor = this._pendingDescriptor || this._descriptor; + // Merge with the pending element if it exists, otherwise with existing + // element props. + var element = this._pendingElement || this._currentElement; this.replaceProps( - merge(descriptor.props, partialProps), + assign({}, element.props, partialProps), callback ); }, @@ -21299,10 +21298,10 @@ var ReactComponent = { '`render` method to pass the correct value as props to the component ' + 'where it is created.' ) : invariant(this._mountDepth === 0)); - // This is a deoptimized path. We optimize for always having a descriptor. - // This creates an extra internal descriptor. - this._pendingDescriptor = ReactDescriptor.cloneAndReplaceProps( - this._pendingDescriptor || this._descriptor, + // This is a deoptimized path. We optimize for always having a element. + // This creates an extra internal element. + this._pendingElement = ReactElement.cloneAndReplaceProps( + this._pendingElement || this._currentElement, props ); ReactUpdates.enqueueUpdate(this, callback); @@ -21317,12 +21316,12 @@ var ReactComponent = { * @internal */ _setPropsInternal: function(partialProps, callback) { - // This is a deoptimized path. We optimize for always having a descriptor. - // This creates an extra internal descriptor. - var descriptor = this._pendingDescriptor || this._descriptor; - this._pendingDescriptor = ReactDescriptor.cloneAndReplaceProps( - descriptor, - merge(descriptor.props, partialProps) + // This is a deoptimized path. We optimize for always having a element. + // This creates an extra internal element. + var element = this._pendingElement || this._currentElement; + this._pendingElement = ReactElement.cloneAndReplaceProps( + element, + assign({}, element.props, partialProps) ); ReactUpdates.enqueueUpdate(this, callback); }, @@ -21333,19 +21332,19 @@ var ReactComponent = { * Subclasses that override this method should make sure to invoke * `ReactComponent.Mixin.construct.call(this, ...)`. * - * @param {ReactDescriptor} descriptor + * @param {ReactElement} element * @internal */ - construct: function(descriptor) { + construct: function(element) { // This is the public exposed props object after it has been processed - // with default props. The descriptor's props represents the true internal + // with default props. The element's props represents the true internal // state of the props. - this.props = descriptor.props; + this.props = element.props; // Record the component responsible for creating this component. - // This is accessible through the descriptor but we maintain an extra + // This is accessible through the element but we maintain an extra // field for compatibility with devtools and as a way to make an // incremental update. TODO: Consider deprecating this field. - this._owner = descriptor._owner; + this._owner = element._owner; // All components start unmounted. this._lifeCycleState = ComponentLifeCycle.UNMOUNTED; @@ -21353,10 +21352,10 @@ var ReactComponent = { // See ReactUpdates. this._pendingCallbacks = null; - // We keep the old descriptor and a reference to the pending descriptor + // We keep the old element and a reference to the pending element // to track updates. - this._descriptor = descriptor; - this._pendingDescriptor = null; + this._currentElement = element; + this._pendingElement = null; }, /** @@ -21381,10 +21380,10 @@ var ReactComponent = { 'single component instance in multiple places.', rootID ) : invariant(!this.isMounted())); - var props = this._descriptor.props; - if (props.ref != null) { - var owner = this._descriptor._owner; - ReactOwner.addComponentAsRefTo(this, props.ref, owner); + var ref = this._currentElement.ref; + if (ref != null) { + var owner = this._currentElement._owner; + ReactOwner.addComponentAsRefTo(this, ref, owner); } this._rootNodeID = rootID; this._lifeCycleState = ComponentLifeCycle.MOUNTED; @@ -21407,9 +21406,9 @@ var ReactComponent = { this.isMounted(), 'unmountComponent(): Can only unmount a mounted component.' ) : invariant(this.isMounted())); - var props = this.props; - if (props.ref != null) { - ReactOwner.removeComponentAsRefFrom(this, props.ref, this._owner); + var ref = this._currentElement.ref; + if (ref != null) { + ReactOwner.removeComponentAsRefFrom(this, ref, this._owner); } unmountIDFromEnvironment(this._rootNodeID); this._rootNodeID = null; @@ -21427,49 +21426,49 @@ var ReactComponent = { * @param {ReactReconcileTransaction} transaction * @internal */ - receiveComponent: function(nextDescriptor, transaction) { + receiveComponent: function(nextElement, transaction) { ("production" !== "development" ? invariant( this.isMounted(), 'receiveComponent(...): Can only update a mounted component.' ) : invariant(this.isMounted())); - this._pendingDescriptor = nextDescriptor; + this._pendingElement = nextElement; this.performUpdateIfNecessary(transaction); }, /** - * If `_pendingDescriptor` is set, update the component. + * If `_pendingElement` is set, update the component. * * @param {ReactReconcileTransaction} transaction * @internal */ performUpdateIfNecessary: function(transaction) { - if (this._pendingDescriptor == null) { + if (this._pendingElement == null) { return; } - var prevDescriptor = this._descriptor; - var nextDescriptor = this._pendingDescriptor; - this._descriptor = nextDescriptor; - this.props = nextDescriptor.props; - this._owner = nextDescriptor._owner; - this._pendingDescriptor = null; - this.updateComponent(transaction, prevDescriptor); + var prevElement = this._currentElement; + var nextElement = this._pendingElement; + this._currentElement = nextElement; + this.props = nextElement.props; + this._owner = nextElement._owner; + this._pendingElement = null; + this.updateComponent(transaction, prevElement); }, /** * Updates the component's currently mounted representation. * * @param {ReactReconcileTransaction} transaction - * @param {object} prevDescriptor + * @param {object} prevElement * @internal */ - updateComponent: function(transaction, prevDescriptor) { - var nextDescriptor = this._descriptor; + updateComponent: function(transaction, prevElement) { + var nextElement = this._currentElement; // If either the owner or a `ref` has changed, make sure the newest owner // has stored a reference to `this`, and the previous owner (if different) - // has forgotten the reference to `this`. We use the descriptor instead + // has forgotten the reference to `this`. We use the element instead // of the public this.props because the post processing cannot determine - // a ref. The ref conceptually lives on the descriptor. + // a ref. The ref conceptually lives on the element. // TODO: Should this even be possible? The owner cannot change because // it's forbidden by shouldUpdateReactComponent. The ref can change @@ -21477,19 +21476,19 @@ var ReactComponent = { // is made. It probably belongs where the key checking and // instantiateReactComponent is done. - if (nextDescriptor._owner !== prevDescriptor._owner || - nextDescriptor.props.ref !== prevDescriptor.props.ref) { - if (prevDescriptor.props.ref != null) { + if (nextElement._owner !== prevElement._owner || + nextElement.ref !== prevElement.ref) { + if (prevElement.ref != null) { ReactOwner.removeComponentAsRefFrom( - this, prevDescriptor.props.ref, prevDescriptor._owner + this, prevElement.ref, prevElement._owner ); } // Correct, even if the owner is the same, and only the ref has changed. - if (nextDescriptor.props.ref != null) { + if (nextElement.ref != null) { ReactOwner.addComponentAsRefTo( this, - nextDescriptor.props.ref, - nextDescriptor._owner + nextElement.ref, + nextElement._owner ); } } @@ -21503,7 +21502,7 @@ var ReactComponent = { * @param {boolean} shouldReuseMarkup If true, do not insert markup * @final * @internal - * @see {ReactMount.renderComponent} + * @see {ReactMount.render} */ mountComponentIntoNode: function(rootID, container, shouldReuseMarkup) { var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(); @@ -21567,21 +21566,14 @@ var ReactComponent = { module.exports = ReactComponent; -},{"./ReactDescriptor":56,"./ReactOwner":70,"./ReactUpdates":87,"./invariant":134,"./keyMirror":140,"./merge":144}],36:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./ReactElement":58,"./ReactOwner":74,"./ReactUpdates":91,"./invariant":140,"./keyMirror":146}],38:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactComponentBrowserEnvironment */ @@ -21694,21 +21686,14 @@ var ReactComponentBrowserEnvironment = { module.exports = ReactComponentBrowserEnvironment; -},{"./ReactDOMIDOperations":45,"./ReactMarkupChecksum":66,"./ReactMount":67,"./ReactPerf":71,"./ReactReconcileTransaction":77,"./getReactRootElementInContainer":128,"./invariant":134,"./setInnerHTML":152}],37:[function(_dereq_,module,exports){ +},{"./ReactDOMIDOperations":47,"./ReactMarkupChecksum":69,"./ReactMount":70,"./ReactPerf":75,"./ReactReconcileTransaction":81,"./getReactRootElementInContainer":134,"./invariant":140,"./setInnerHTML":154}],39:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 */ @@ -21750,21 +21735,14 @@ var ReactComponentWithPureRenderMixin = { module.exports = ReactComponentWithPureRenderMixin; -},{"./shallowEqual":153}],38:[function(_dereq_,module,exports){ +},{"./shallowEqual":155}],40:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactCompositeComponent */ @@ -21774,10 +21752,11 @@ module.exports = ReactComponentWithPureRenderMixin; var ReactComponent = _dereq_("./ReactComponent"); var ReactContext = _dereq_("./ReactContext"); var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); -var ReactDescriptor = _dereq_("./ReactDescriptor"); -var ReactDescriptorValidator = _dereq_("./ReactDescriptorValidator"); +var ReactElement = _dereq_("./ReactElement"); +var ReactElementValidator = _dereq_("./ReactElementValidator"); var ReactEmptyComponent = _dereq_("./ReactEmptyComponent"); var ReactErrorUtils = _dereq_("./ReactErrorUtils"); +var ReactLegacyElement = _dereq_("./ReactLegacyElement"); var ReactOwner = _dereq_("./ReactOwner"); var ReactPerf = _dereq_("./ReactPerf"); var ReactPropTransferer = _dereq_("./ReactPropTransferer"); @@ -21785,16 +21764,18 @@ var ReactPropTypeLocations = _dereq_("./ReactPropTypeLocations"); var ReactPropTypeLocationNames = _dereq_("./ReactPropTypeLocationNames"); var ReactUpdates = _dereq_("./ReactUpdates"); +var assign = _dereq_("./Object.assign"); var instantiateReactComponent = _dereq_("./instantiateReactComponent"); var invariant = _dereq_("./invariant"); var keyMirror = _dereq_("./keyMirror"); -var merge = _dereq_("./merge"); -var mixInto = _dereq_("./mixInto"); +var keyOf = _dereq_("./keyOf"); var monitorCodeUse = _dereq_("./monitorCodeUse"); var mapObject = _dereq_("./mapObject"); var shouldUpdateReactComponent = _dereq_("./shouldUpdateReactComponent"); var warning = _dereq_("./warning"); +var MIXINS_KEY = keyOf({mixins: null}); + /** * Policies that describe methods in `ReactCompositeComponentInterface`. */ @@ -22098,7 +22079,8 @@ var RESERVED_SPEC_KEYS = { childContextTypes, ReactPropTypeLocations.childContext ); - Constructor.childContextTypes = merge( + Constructor.childContextTypes = assign( + {}, Constructor.childContextTypes, childContextTypes ); @@ -22109,7 +22091,11 @@ var RESERVED_SPEC_KEYS = { contextTypes, ReactPropTypeLocations.context ); - Constructor.contextTypes = merge(Constructor.contextTypes, contextTypes); + Constructor.contextTypes = assign( + {}, + Constructor.contextTypes, + contextTypes + ); }, /** * Special case getDefaultProps which should move into statics but requires @@ -22131,7 +22117,11 @@ var RESERVED_SPEC_KEYS = { propTypes, ReactPropTypeLocations.prop ); - Constructor.propTypes = merge(Constructor.propTypes, propTypes); + Constructor.propTypes = assign( + {}, + Constructor.propTypes, + propTypes + ); }, statics: function(Constructor, statics) { mixStaticSpecIntoComponent(Constructor, statics); @@ -22200,11 +22190,12 @@ function validateLifeCycleOnReplaceState(instance) { 'replaceState(...): Can only update a mounted or mounting component.' ) : invariant(instance.isMounted() || compositeLifeCycleState === CompositeLifeCycle.MOUNTING)); - ("production" !== "development" ? invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE, + ("production" !== "development" ? invariant( + ReactCurrentOwner.current == null, 'replaceState(...): Cannot update during an existing state transition ' + - '(such as within `render`). This could potentially cause an infinite ' + - 'loop so it is forbidden.' - ) : invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE)); + '(such as within `render`). Render methods should be a pure function ' + + 'of props and state.' + ) : invariant(ReactCurrentOwner.current == null)); ("production" !== "development" ? invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING, 'replaceState(...): Cannot update while unmounting component. This ' + 'usually means you called setState() on an unmounted component.' @@ -22212,28 +22203,45 @@ function validateLifeCycleOnReplaceState(instance) { } /** - * Custom version of `mixInto` which handles policy validation and reserved + * Mixin helper which handles policy validation and reserved * specification keys when building `ReactCompositeComponent` classses. */ function mixSpecIntoComponent(Constructor, spec) { + if (!spec) { + return; + } + ("production" !== "development" ? invariant( - !ReactDescriptor.isValidFactory(spec), + !ReactLegacyElement.isValidFactory(spec), 'ReactCompositeComponent: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.' - ) : invariant(!ReactDescriptor.isValidFactory(spec))); + ) : invariant(!ReactLegacyElement.isValidFactory(spec))); ("production" !== "development" ? invariant( - !ReactDescriptor.isValidDescriptor(spec), + !ReactElement.isValidElement(spec), 'ReactCompositeComponent: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.' - ) : invariant(!ReactDescriptor.isValidDescriptor(spec))); + ) : invariant(!ReactElement.isValidElement(spec))); var proto = Constructor.prototype; + + // By handling mixins before any other properties, we ensure the same + // chaining order is applied to methods with DEFINE_MANY policy, whether + // mixins are listed before or after these methods in the spec. + if (spec.hasOwnProperty(MIXINS_KEY)) { + RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); + } + for (var name in spec) { - var property = spec[name]; if (!spec.hasOwnProperty(name)) { continue; } + if (name === MIXINS_KEY) { + // We have already handled mixins in a special case above + continue; + } + + var property = spec[name]; validateMethodOverride(proto, name); if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { @@ -22311,23 +22319,25 @@ function mixStaticSpecIntoComponent(Constructor, statics) { continue; } + var isReserved = name in RESERVED_SPEC_KEYS; + ("production" !== "development" ? invariant( + !isReserved, + 'ReactCompositeComponent: You are attempting to define a reserved ' + + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + + 'as an instance property instead; it will still be accessible on the ' + + 'constructor.', + name + ) : invariant(!isReserved)); + var isInherited = name in Constructor; - var result = property; - if (isInherited) { - var existingProperty = Constructor[name]; - var existingType = typeof existingProperty; - var propertyType = typeof property; - ("production" !== "development" ? invariant( - existingType === 'function' && propertyType === 'function', - 'ReactCompositeComponent: You are attempting to define ' + - '`%s` on your component more than once, but that is only supported ' + - 'for functions, which are chained together. This conflict may be ' + - 'due to a mixin.', - name - ) : invariant(existingType === 'function' && propertyType === 'function')); - result = createChainedFunction(existingProperty, property); - } - Constructor[name] = result; + ("production" !== "development" ? invariant( + !isInherited, + 'ReactCompositeComponent: You are attempting to define ' + + '`%s` on your component more than once. This conflict may be ' + + 'due to a mixin.', + name + ) : invariant(!isInherited)); + Constructor[name] = property; } } @@ -22348,7 +22358,10 @@ function mergeObjectsWithNoDuplicateKeys(one, two) { ("production" !== "development" ? invariant( one[key] === undefined, 'mergeObjectsWithNoDuplicateKeys(): ' + - 'Tried to merge two objects with the same key: %s', + 'Tried to merge two objects with the same key: `%s`. This conflict ' + + 'may be due to a mixin; in particular, this may be caused by two ' + + 'getInitialState() or getDefaultProps() methods returning objects ' + + 'with clashing keys.', key ) : invariant(one[key] === undefined)); one[key] = value; @@ -22404,19 +22417,19 @@ function createChainedFunction(one, two) { * Top Row: ReactComponent.ComponentLifeCycle * Low Row: ReactComponent.CompositeLifeCycle * - * +-------+------------------------------------------------------+--------+ - * | UN | MOUNTED | UN | - * |MOUNTED| | MOUNTED| - * +-------+------------------------------------------------------+--------+ - * | ^--------+ +------+ +------+ +------+ +--------^ | - * | | | | | | | | | | | | - * | 0--|MOUNTING|-0-|RECEIV|-0-|RECEIV|-0-|RECEIV|-0-| UN |--->0 | - * | | | |PROPS | | PROPS| | STATE| |MOUNTING| | - * | | | | | | | | | | | | - * | | | | | | | | | | | | - * | +--------+ +------+ +------+ +------+ +--------+ | - * | | | | - * +-------+------------------------------------------------------+--------+ + * +-------+---------------------------------+--------+ + * | UN | MOUNTED | UN | + * |MOUNTED| | MOUNTED| + * +-------+---------------------------------+--------+ + * | ^--------+ +-------+ +--------^ | + * | | | | | | | | + * | 0--|MOUNTING|-0-|RECEIVE|-0-| UN |--->0 | + * | | | |PROPS | |MOUNTING| | + * | | | | | | | | + * | | | | | | | | + * | +--------+ +-------+ +--------+ | + * | | | | + * +-------+---------------------------------+--------+ */ var CompositeLifeCycle = keyMirror({ /** @@ -22433,12 +22446,7 @@ var CompositeLifeCycle = keyMirror({ * Components that are mounted and receiving new props respond to state * changes differently. */ - RECEIVING_PROPS: null, - /** - * Components that are mounted and receiving new state are guarded against - * additional state changes. - */ - RECEIVING_STATE: null + RECEIVING_PROPS: null }); /** @@ -22449,11 +22457,11 @@ var ReactCompositeComponentMixin = { /** * Base constructor for all composite component. * - * @param {ReactDescriptor} descriptor + * @param {ReactElement} element * @final * @internal */ - construct: function(descriptor) { + construct: function(element) { // Children can be either an array or more than one argument ReactComponent.Mixin.construct.apply(this, arguments); ReactOwner.Mixin.construct.apply(this, arguments); @@ -22462,7 +22470,7 @@ var ReactCompositeComponentMixin = { this._pendingState = null; // This is the public post-processed context. The real context and pending - // context lives on the descriptor. + // context lives on the element. this.context = null; this._compositeLifeCycleState = null; @@ -22505,7 +22513,7 @@ var ReactCompositeComponentMixin = { this._bindAutoBindMethods(); } - this.context = this._processContext(this._descriptor._context); + this.context = this._processContext(this._currentElement._context); this.props = this._processProps(this.props); this.state = this.getInitialState ? this.getInitialState() : null; @@ -22529,7 +22537,8 @@ var ReactCompositeComponentMixin = { } this._renderedComponent = instantiateReactComponent( - this._renderValidatedComponent() + this._renderValidatedComponent(), + this._currentElement.type // The wrapping type ); // Done with mounting, `setState` will now trigger UI changes. @@ -22601,7 +22610,7 @@ var ReactCompositeComponentMixin = { } // Merge with `_pendingState` if it exists, otherwise with existing state. this.replaceState( - merge(this._pendingState || this.state, partialState), + assign({}, this._pendingState || this.state, partialState), callback ); }, @@ -22689,7 +22698,7 @@ var ReactCompositeComponentMixin = { name ) : invariant(name in this.constructor.childContextTypes)); } - return merge(currentContext, childContext); + return assign({}, currentContext, childContext); } return currentContext; }, @@ -22704,25 +22713,13 @@ var ReactCompositeComponentMixin = { * @private */ _processProps: function(newProps) { - var defaultProps = this.constructor.defaultProps; - var props; - if (defaultProps) { - props = merge(newProps); - for (var propName in defaultProps) { - if (typeof props[propName] === 'undefined') { - props[propName] = defaultProps[propName]; - } - } - } else { - props = newProps; - } if ("production" !== "development") { var propTypes = this.constructor.propTypes; if (propTypes) { - this._checkPropTypes(propTypes, props, ReactPropTypeLocations.prop); + this._checkPropTypes(propTypes, newProps, ReactPropTypeLocations.prop); } } - return props; + return newProps; }, /** @@ -22734,7 +22731,7 @@ var ReactCompositeComponentMixin = { * @private */ _checkPropTypes: function(propTypes, props, location) { - // TODO: Stop validating prop types here and only use the descriptor + // TODO: Stop validating prop types here and only use the element // validation. var componentName = this.constructor.displayName; for (var propName in propTypes) { @@ -22753,7 +22750,7 @@ var ReactCompositeComponentMixin = { }, /** - * If any of `_pendingDescriptor`, `_pendingState`, or `_pendingForceUpdate` + * If any of `_pendingElement`, `_pendingState`, or `_pendingForceUpdate` * is set, update the component. * * @param {ReactReconcileTransaction} transaction @@ -22768,7 +22765,7 @@ var ReactCompositeComponentMixin = { return; } - if (this._pendingDescriptor == null && + if (this._pendingElement == null && this._pendingState == null && !this._pendingForceUpdate) { return; @@ -22776,12 +22773,12 @@ var ReactCompositeComponentMixin = { var nextContext = this.context; var nextProps = this.props; - var nextDescriptor = this._descriptor; - if (this._pendingDescriptor != null) { - nextDescriptor = this._pendingDescriptor; - nextContext = this._processContext(nextDescriptor._context); - nextProps = this._processProps(nextDescriptor.props); - this._pendingDescriptor = null; + var nextElement = this._currentElement; + if (this._pendingElement != null) { + nextElement = this._pendingElement; + nextContext = this._processContext(nextElement._context); + nextProps = this._processProps(nextElement.props); + this._pendingElement = null; this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_PROPS; if (this.componentWillReceiveProps) { @@ -22789,51 +22786,47 @@ var ReactCompositeComponentMixin = { } } - this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_STATE; + this._compositeLifeCycleState = null; var nextState = this._pendingState || this.state; this._pendingState = null; - try { - var shouldUpdate = - this._pendingForceUpdate || - !this.shouldComponentUpdate || - this.shouldComponentUpdate(nextProps, nextState, nextContext); + var shouldUpdate = + this._pendingForceUpdate || + !this.shouldComponentUpdate || + this.shouldComponentUpdate(nextProps, nextState, nextContext); - if ("production" !== "development") { - if (typeof shouldUpdate === "undefined") { - console.warn( - (this.constructor.displayName || 'ReactCompositeComponent') + - '.shouldComponentUpdate(): Returned undefined instead of a ' + - 'boolean value. Make sure to return true or false.' - ); - } + if ("production" !== "development") { + if (typeof shouldUpdate === "undefined") { + console.warn( + (this.constructor.displayName || 'ReactCompositeComponent') + + '.shouldComponentUpdate(): Returned undefined instead of a ' + + 'boolean value. Make sure to return true or false.' + ); } + } - if (shouldUpdate) { - this._pendingForceUpdate = false; - // Will set `this.props`, `this.state` and `this.context`. - this._performComponentUpdate( - nextDescriptor, - nextProps, - nextState, - nextContext, - transaction - ); - } else { - // If it's determined that a component should not update, we still want - // to set props and state. - this._descriptor = nextDescriptor; - this.props = nextProps; - this.state = nextState; - this.context = nextContext; + if (shouldUpdate) { + this._pendingForceUpdate = false; + // Will set `this.props`, `this.state` and `this.context`. + this._performComponentUpdate( + nextElement, + nextProps, + nextState, + nextContext, + transaction + ); + } else { + // If it's determined that a component should not update, we still want + // to set props and state. + this._currentElement = nextElement; + this.props = nextProps; + this.state = nextState; + this.context = nextContext; - // Owner cannot change because shouldUpdateReactComponent doesn't allow - // it. TODO: Remove this._owner completely. - this._owner = nextDescriptor._owner; - } - } finally { - this._compositeLifeCycleState = null; + // Owner cannot change because shouldUpdateReactComponent doesn't allow + // it. TODO: Remove this._owner completely. + this._owner = nextElement._owner; } }, @@ -22841,7 +22834,7 @@ var ReactCompositeComponentMixin = { * Merges new props and state, notifies delegate methods of update and * performs update. * - * @param {ReactDescriptor} nextDescriptor Next descriptor + * @param {ReactElement} nextElement Next element * @param {object} nextProps Next public object to set as properties. * @param {?object} nextState Next object to set as state. * @param {?object} nextContext Next public object to set as context. @@ -22849,13 +22842,13 @@ var ReactCompositeComponentMixin = { * @private */ _performComponentUpdate: function( - nextDescriptor, + nextElement, nextProps, nextState, nextContext, transaction ) { - var prevDescriptor = this._descriptor; + var prevElement = this._currentElement; var prevProps = this.props; var prevState = this.state; var prevContext = this.context; @@ -22864,18 +22857,18 @@ var ReactCompositeComponentMixin = { this.componentWillUpdate(nextProps, nextState, nextContext); } - this._descriptor = nextDescriptor; + this._currentElement = nextElement; this.props = nextProps; this.state = nextState; this.context = nextContext; // Owner cannot change because shouldUpdateReactComponent doesn't allow // it. TODO: Remove this._owner completely. - this._owner = nextDescriptor._owner; + this._owner = nextElement._owner; this.updateComponent( transaction, - prevDescriptor + prevElement ); if (this.componentDidUpdate) { @@ -22886,22 +22879,22 @@ var ReactCompositeComponentMixin = { } }, - receiveComponent: function(nextDescriptor, transaction) { - if (nextDescriptor === this._descriptor && - nextDescriptor._owner != null) { - // Since descriptors are immutable after the owner is rendered, + receiveComponent: function(nextElement, transaction) { + if (nextElement === this._currentElement && + nextElement._owner != null) { + // Since elements are immutable after the owner is rendered, // we can do a cheap identity compare here to determine if this is a // superfluous reconcile. It's possible for state to be mutable but such // change should trigger an update of the owner which would recreate - // the descriptor. We explicitly check for the existence of an owner since - // it's possible for a descriptor created outside a composite to be + // the element. We explicitly check for the existence of an owner since + // it's possible for a element created outside a composite to be // deeply mutated and reused. return; } ReactComponent.Mixin.receiveComponent.call( this, - nextDescriptor, + nextElement, transaction ); }, @@ -22913,31 +22906,34 @@ var ReactCompositeComponentMixin = { * Sophisticated clients may wish to override this. * * @param {ReactReconcileTransaction} transaction - * @param {ReactDescriptor} prevDescriptor + * @param {ReactElement} prevElement * @internal * @overridable */ updateComponent: ReactPerf.measure( 'ReactCompositeComponent', 'updateComponent', - function(transaction, prevParentDescriptor) { + function(transaction, prevParentElement) { ReactComponent.Mixin.updateComponent.call( this, transaction, - prevParentDescriptor + prevParentElement ); var prevComponentInstance = this._renderedComponent; - var prevDescriptor = prevComponentInstance._descriptor; - var nextDescriptor = this._renderValidatedComponent(); - if (shouldUpdateReactComponent(prevDescriptor, nextDescriptor)) { - prevComponentInstance.receiveComponent(nextDescriptor, transaction); + var prevElement = prevComponentInstance._currentElement; + var nextElement = this._renderValidatedComponent(); + if (shouldUpdateReactComponent(prevElement, nextElement)) { + prevComponentInstance.receiveComponent(nextElement, transaction); } else { // These two IDs are actually the same! But nothing should rely on that. var thisID = this._rootNodeID; var prevComponentID = prevComponentInstance._rootNodeID; prevComponentInstance.unmountComponent(); - this._renderedComponent = instantiateReactComponent(nextDescriptor); + this._renderedComponent = instantiateReactComponent( + nextElement, + this._currentElement.type + ); var nextMarkup = this._renderedComponent.mountComponent( thisID, transaction, @@ -22975,12 +22971,12 @@ var ReactCompositeComponentMixin = { ) : invariant(this.isMounted() || compositeLifeCycleState === CompositeLifeCycle.MOUNTING)); ("production" !== "development" ? invariant( - compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE && - compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING, + compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING && + ReactCurrentOwner.current == null, 'forceUpdate(...): Cannot force an update while unmounting component ' + - 'or during an existing state transition (such as within `render`).' - ) : invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE && - compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING)); + 'or within a `render` function.' + ) : invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING && + ReactCurrentOwner.current == null)); this._pendingForceUpdate = true; ReactUpdates.enqueueUpdate(this, callback); }, @@ -22995,7 +22991,7 @@ var ReactCompositeComponentMixin = { var renderedComponent; var previousContext = ReactContext.current; ReactContext.current = this._processChildContext( - this._descriptor._context + this._currentElement._context ); ReactCurrentOwner.current = this; try { @@ -23011,11 +23007,11 @@ var ReactCompositeComponentMixin = { ReactCurrentOwner.current = null; } ("production" !== "development" ? invariant( - ReactDescriptor.isValidDescriptor(renderedComponent), + ReactElement.isValidElement(renderedComponent), '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.constructor.displayName || 'ReactCompositeComponent' - ) : invariant(ReactDescriptor.isValidDescriptor(renderedComponent))); + ) : invariant(ReactElement.isValidElement(renderedComponent))); return renderedComponent; } ), @@ -23044,16 +23040,14 @@ var ReactCompositeComponentMixin = { */ _bindAutoBindMethod: function(method) { var component = this; - var boundMethod = function() { - return method.apply(component, arguments); - }; + var boundMethod = method.bind(component); if ("production" !== "development") { boundMethod.__reactBoundContext = component; boundMethod.__reactBoundMethod = method; boundMethod.__reactBoundArguments = null; var componentName = component.constructor.displayName; var _bind = boundMethod.bind; - boundMethod.bind = function(newThis ) {var args=Array.prototype.slice.call(arguments,1); + boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]); // User is trying to bind() an autobound method; we effectively will // ignore the value of "this" that the user is trying to use, so // let's warn. @@ -23084,10 +23078,13 @@ var ReactCompositeComponentMixin = { }; var ReactCompositeComponentBase = function() {}; -mixInto(ReactCompositeComponentBase, ReactComponent.Mixin); -mixInto(ReactCompositeComponentBase, ReactOwner.Mixin); -mixInto(ReactCompositeComponentBase, ReactPropTransferer.Mixin); -mixInto(ReactCompositeComponentBase, ReactCompositeComponentMixin); +assign( + ReactCompositeComponentBase.prototype, + ReactComponent.Mixin, + ReactOwner.Mixin, + ReactPropTransferer.Mixin, + ReactCompositeComponentMixin +); /** * Module for creating composite components. @@ -23111,8 +23108,10 @@ var ReactCompositeComponent = { * @public */ createClass: function(spec) { - var Constructor = function(props, owner) { - this.construct(props, owner); + var Constructor = function(props) { + // This constructor is overridden by mocks. The argument is used + // by mocks to assert on what gets mounted. This will later be used + // by the stand-alone class implementation. }; Constructor.prototype = new ReactCompositeComponentBase(); Constructor.prototype.constructor = Constructor; @@ -23155,17 +23154,14 @@ var ReactCompositeComponent = { } } - var descriptorFactory = ReactDescriptor.createFactory(Constructor); - if ("production" !== "development") { - return ReactDescriptorValidator.createFactory( - descriptorFactory, - Constructor.propTypes, - Constructor.contextTypes + return ReactLegacyElement.wrapFactory( + ReactElementValidator.createFactory(Constructor) ); } - - return descriptorFactory; + return ReactLegacyElement.wrapFactory( + ReactElement.createFactory(Constructor) + ); }, injection: { @@ -23177,28 +23173,21 @@ var ReactCompositeComponent = { module.exports = ReactCompositeComponent; -},{"./ReactComponent":35,"./ReactContext":39,"./ReactCurrentOwner":40,"./ReactDescriptor":56,"./ReactDescriptorValidator":57,"./ReactEmptyComponent":58,"./ReactErrorUtils":59,"./ReactOwner":70,"./ReactPerf":71,"./ReactPropTransferer":72,"./ReactPropTypeLocationNames":73,"./ReactPropTypeLocations":74,"./ReactUpdates":87,"./instantiateReactComponent":133,"./invariant":134,"./keyMirror":140,"./mapObject":142,"./merge":144,"./mixInto":147,"./monitorCodeUse":148,"./shouldUpdateReactComponent":154,"./warning":158}],39:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./ReactComponent":37,"./ReactContext":41,"./ReactCurrentOwner":42,"./ReactElement":58,"./ReactElementValidator":59,"./ReactEmptyComponent":60,"./ReactErrorUtils":61,"./ReactLegacyElement":67,"./ReactOwner":74,"./ReactPerf":75,"./ReactPropTransferer":76,"./ReactPropTypeLocationNames":77,"./ReactPropTypeLocations":78,"./ReactUpdates":91,"./instantiateReactComponent":139,"./invariant":140,"./keyMirror":146,"./keyOf":147,"./mapObject":148,"./monitorCodeUse":150,"./shouldUpdateReactComponent":156,"./warning":160}],41:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactContext */ "use strict"; -var merge = _dereq_("./merge"); +var assign = _dereq_("./Object.assign"); /** * Keeps track of the current context. @@ -23220,7 +23209,7 @@ var ReactContext = { * A typical use case might look like * * render: function() { - * var children = ReactContext.withContext({foo: 'foo'} () => ( + * var children = ReactContext.withContext({foo: 'foo'}, () => ( * * )); * return <div>{children}</div>; @@ -23233,7 +23222,7 @@ var ReactContext = { withContext: function(newContext, scopedCallback) { var result; var previousContext = ReactContext.current; - ReactContext.current = merge(previousContext, newContext); + ReactContext.current = assign({}, previousContext, newContext); try { result = scopedCallback(); } finally { @@ -23246,21 +23235,14 @@ var ReactContext = { module.exports = ReactContext; -},{"./merge":144}],40:[function(_dereq_,module,exports){ +},{"./Object.assign":29}],42:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactCurrentOwner */ @@ -23287,21 +23269,14 @@ var ReactCurrentOwner = { module.exports = ReactCurrentOwner; -},{}],41:[function(_dereq_,module,exports){ +},{}],43:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 * @typechecks static-only @@ -23309,45 +23284,27 @@ module.exports = ReactCurrentOwner; "use strict"; -var ReactDescriptor = _dereq_("./ReactDescriptor"); -var ReactDescriptorValidator = _dereq_("./ReactDescriptorValidator"); -var ReactDOMComponent = _dereq_("./ReactDOMComponent"); +var ReactElement = _dereq_("./ReactElement"); +var ReactElementValidator = _dereq_("./ReactElementValidator"); +var ReactLegacyElement = _dereq_("./ReactLegacyElement"); -var mergeInto = _dereq_("./mergeInto"); var mapObject = _dereq_("./mapObject"); /** - * Creates a new React class that is idempotent and capable of containing other - * React components. It accepts event listeners and DOM properties that are - * valid according to `DOMProperty`. - * - * - Event listeners: `onClick`, `onMouseDown`, etc. - * - DOM properties: `className`, `name`, `title`, etc. - * - * The `style` property functions differently from the DOM API. It accepts an - * object mapping of style properties to values. + * Create a factory that creates HTML tag elements. * - * @param {boolean} omitClose True if the close tag should be omitted. * @param {string} tag Tag name (e.g. `div`). * @private */ -function createDOMComponentClass(omitClose, tag) { - var Constructor = function(descriptor) { - this.construct(descriptor); - }; - Constructor.prototype = new ReactDOMComponent(tag, omitClose); - Constructor.prototype.constructor = Constructor; - Constructor.displayName = tag; - - var ConvenienceConstructor = ReactDescriptor.createFactory(Constructor); - +function createDOMFactory(tag) { if ("production" !== "development") { - return ReactDescriptorValidator.createFactory( - ConvenienceConstructor + return ReactLegacyElement.markNonLegacyFactory( + ReactElementValidator.createFactory(tag) ); } - - return ConvenienceConstructor; + return ReactLegacyElement.markNonLegacyFactory( + ReactElement.createFactory(tag) + ); } /** @@ -23357,162 +23314,150 @@ function createDOMComponentClass(omitClose, tag) { * @public */ var ReactDOM = mapObject({ - a: false, - abbr: false, - address: false, - area: true, - article: false, - aside: false, - audio: false, - b: false, - base: true, - bdi: false, - bdo: false, - big: false, - blockquote: false, - body: false, - br: true, - button: false, - canvas: false, - caption: false, - cite: false, - code: false, - col: true, - colgroup: false, - data: false, - datalist: false, - dd: false, - del: false, - details: false, - dfn: false, - div: false, - dl: false, - dt: false, - em: false, - embed: true, - fieldset: false, - figcaption: false, - figure: false, - footer: false, - form: false, // NOTE: Injected, see `ReactDOMForm`. - h1: false, - h2: false, - h3: false, - h4: false, - h5: false, - h6: false, - head: false, - header: false, - hr: true, - html: false, - i: false, - iframe: false, - img: true, - input: true, - ins: false, - kbd: false, - keygen: true, - label: false, - legend: false, - li: false, - link: true, - main: false, - map: false, - mark: false, - menu: false, - menuitem: false, // NOTE: Close tag should be omitted, but causes problems. - meta: true, - meter: false, - nav: false, - noscript: false, - object: false, - ol: false, - optgroup: false, - option: false, - output: false, - p: false, - param: true, - pre: false, - progress: false, - q: false, - rp: false, - rt: false, - ruby: false, - s: false, - samp: false, - script: false, - section: false, - select: false, - small: false, - source: true, - span: false, - strong: false, - style: false, - sub: false, - summary: false, - sup: false, - table: false, - tbody: false, - td: false, - textarea: false, // NOTE: Injected, see `ReactDOMTextarea`. - tfoot: false, - th: false, - thead: false, - time: false, - title: false, - tr: false, - track: true, - u: false, - ul: false, - 'var': false, - video: false, - wbr: true, + a: 'a', + abbr: 'abbr', + address: 'address', + area: 'area', + article: 'article', + aside: 'aside', + audio: 'audio', + b: 'b', + base: 'base', + bdi: 'bdi', + bdo: 'bdo', + big: 'big', + blockquote: 'blockquote', + body: 'body', + br: 'br', + button: 'button', + canvas: 'canvas', + caption: 'caption', + cite: 'cite', + code: 'code', + col: 'col', + colgroup: 'colgroup', + data: 'data', + datalist: 'datalist', + dd: 'dd', + del: 'del', + details: 'details', + dfn: 'dfn', + dialog: 'dialog', + div: 'div', + dl: 'dl', + dt: 'dt', + em: 'em', + embed: 'embed', + fieldset: 'fieldset', + figcaption: 'figcaption', + figure: 'figure', + footer: 'footer', + form: 'form', + h1: 'h1', + h2: 'h2', + h3: 'h3', + h4: 'h4', + h5: 'h5', + h6: 'h6', + head: 'head', + header: 'header', + hr: 'hr', + html: 'html', + i: 'i', + iframe: 'iframe', + img: 'img', + input: 'input', + ins: 'ins', + kbd: 'kbd', + keygen: 'keygen', + label: 'label', + legend: 'legend', + li: 'li', + link: 'link', + main: 'main', + map: 'map', + mark: 'mark', + menu: 'menu', + menuitem: 'menuitem', + meta: 'meta', + meter: 'meter', + nav: 'nav', + noscript: 'noscript', + object: 'object', + ol: 'ol', + optgroup: 'optgroup', + option: 'option', + output: 'output', + p: 'p', + param: 'param', + picture: 'picture', + pre: 'pre', + progress: 'progress', + q: 'q', + rp: 'rp', + rt: 'rt', + ruby: 'ruby', + s: 's', + samp: 'samp', + script: 'script', + section: 'section', + select: 'select', + small: 'small', + source: 'source', + span: 'span', + strong: 'strong', + style: 'style', + sub: 'sub', + summary: 'summary', + sup: 'sup', + table: 'table', + tbody: 'tbody', + td: 'td', + textarea: 'textarea', + tfoot: 'tfoot', + th: 'th', + thead: 'thead', + time: 'time', + title: 'title', + tr: 'tr', + track: 'track', + u: 'u', + ul: 'ul', + 'var': 'var', + video: 'video', + wbr: 'wbr', // SVG - circle: false, - defs: false, - ellipse: false, - g: false, - line: false, - linearGradient: false, - mask: false, - path: false, - pattern: false, - polygon: false, - polyline: false, - radialGradient: false, - rect: false, - stop: false, - svg: false, - text: false, - tspan: false -}, createDOMComponentClass); - -var injection = { - injectComponentClasses: function(componentClasses) { - mergeInto(ReactDOM, componentClasses); - } -}; - -ReactDOM.injection = injection; + circle: 'circle', + defs: 'defs', + ellipse: 'ellipse', + g: 'g', + line: 'line', + linearGradient: 'linearGradient', + mask: 'mask', + path: 'path', + pattern: 'pattern', + polygon: 'polygon', + polyline: 'polyline', + radialGradient: 'radialGradient', + rect: 'rect', + stop: 'stop', + svg: 'svg', + text: 'text', + tspan: 'tspan' + +}, createDOMFactory); module.exports = ReactDOM; -},{"./ReactDOMComponent":43,"./ReactDescriptor":56,"./ReactDescriptorValidator":57,"./mapObject":142,"./mergeInto":146}],42:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./ReactElementValidator":59,"./ReactLegacyElement":67,"./mapObject":148}],44:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMButton */ @@ -23522,12 +23467,13 @@ module.exports = ReactDOM; var AutoFocusMixin = _dereq_("./AutoFocusMixin"); var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); var keyMirror = _dereq_("./keyMirror"); -// Store a reference to the <button> `ReactDOMComponent`. -var button = ReactDOM.button; +// Store a reference to the <button> `ReactDOMComponent`. TODO: use string +var button = ReactElement.createFactory(ReactDOM.button.type); var mouseListenerNames = keyMirror({ onClick: true, @@ -23569,21 +23515,14 @@ var ReactDOMButton = ReactCompositeComponent.createClass({ module.exports = ReactDOMButton; -},{"./AutoFocusMixin":1,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./keyMirror":140}],43:[function(_dereq_,module,exports){ +},{"./AutoFocusMixin":2,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58,"./keyMirror":146}],45:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMComponent * @typechecks static-only @@ -23601,11 +23540,12 @@ var ReactMount = _dereq_("./ReactMount"); var ReactMultiChild = _dereq_("./ReactMultiChild"); var ReactPerf = _dereq_("./ReactPerf"); +var assign = _dereq_("./Object.assign"); var escapeTextForBrowser = _dereq_("./escapeTextForBrowser"); var invariant = _dereq_("./invariant"); +var isEventSupported = _dereq_("./isEventSupported"); var keyOf = _dereq_("./keyOf"); -var merge = _dereq_("./merge"); -var mixInto = _dereq_("./mixInto"); +var monitorCodeUse = _dereq_("./monitorCodeUse"); var deleteListener = ReactBrowserEventEmitter.deleteListener; var listenTo = ReactBrowserEventEmitter.listenTo; @@ -23630,6 +23570,16 @@ function assertValidProps(props) { props.children == null || props.dangerouslySetInnerHTML == null, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.' ) : invariant(props.children == null || props.dangerouslySetInnerHTML == null)); + if ("production" !== "development") { + if (props.contentEditable && props.children != null) { + console.warn( + 'A component is `contentEditable` and contains `children` managed by ' + + 'React. It is now your responsibility to guarantee that none of those '+ + 'nodes are unexpectedly modified or duplicated. This is probably not ' + + 'intentional.' + ); + } + } ("production" !== "development" ? invariant( props.style == null || typeof props.style === 'object', 'The `style` prop expects a mapping from style properties to values, ' + @@ -23638,6 +23588,15 @@ function assertValidProps(props) { } function putListener(id, registrationName, listener, transaction) { + if ("production" !== "development") { + // IE8 has no API for event capturing and the `onScroll` event doesn't + // bubble. + if (registrationName === 'onScroll' && + !isEventSupported('scroll', true)) { + monitorCodeUse('react_no_scroll_event'); + console.warn('This browser doesn\'t support the `onScroll` event'); + } + } var container = ReactMount.findReactContainerForID(id); if (container) { var doc = container.nodeType === ELEMENT_NODE_TYPE ? @@ -23652,18 +23611,66 @@ function putListener(id, registrationName, listener, transaction) { ); } +// For HTML, certain tags should omit their close tag. We keep a whitelist for +// those special cased tags. + +var omittedCloseTags = { + 'area': true, + 'base': true, + 'br': true, + 'col': true, + 'embed': true, + 'hr': true, + 'img': true, + 'input': true, + 'keygen': true, + 'link': true, + 'meta': true, + 'param': true, + 'source': true, + 'track': true, + 'wbr': true + // NOTE: menuitem's close tag should be omitted, but that causes problems. +}; + +// We accept any tag to be rendered but since this gets injected into abitrary +// HTML, we want to make sure that it's a safe tag. +// http://www.w3.org/TR/REC-xml/#NT-Name + +var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset +var validatedTagCache = {}; +var hasOwnProperty = {}.hasOwnProperty; + +function validateDangerousTag(tag) { + if (!hasOwnProperty.call(validatedTagCache, tag)) { + ("production" !== "development" ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag))); + validatedTagCache[tag] = true; + } +} /** + * Creates a new React class that is idempotent and capable of containing other + * React components. It accepts event listeners and DOM properties that are + * valid according to `DOMProperty`. + * + * - Event listeners: `onClick`, `onMouseDown`, etc. + * - DOM properties: `className`, `name`, `title`, etc. + * + * The `style` property functions differently from the DOM API. It accepts an + * object mapping of style properties to values. + * * @constructor ReactDOMComponent * @extends ReactComponent * @extends ReactMultiChild */ -function ReactDOMComponent(tag, omitClose) { - this._tagOpen = '<' + tag; - this._tagClose = omitClose ? '' : '</' + tag + '>'; +function ReactDOMComponent(tag) { + validateDangerousTag(tag); + this._tag = tag; this.tagName = tag.toUpperCase(); } +ReactDOMComponent.displayName = 'ReactDOMComponent'; + ReactDOMComponent.Mixin = { /** @@ -23687,10 +23694,11 @@ ReactDOMComponent.Mixin = { mountDepth ); assertValidProps(this.props); + var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>'; return ( this._createOpenTagMarkupAndPutListeners(transaction) + this._createContentMarkup(transaction) + - this._tagClose + closeTag ); } ), @@ -23709,7 +23717,7 @@ ReactDOMComponent.Mixin = { */ _createOpenTagMarkupAndPutListeners: function(transaction) { var props = this.props; - var ret = this._tagOpen; + var ret = '<' + this._tag; for (var propKey in props) { if (!props.hasOwnProperty(propKey)) { @@ -23724,7 +23732,7 @@ ReactDOMComponent.Mixin = { } else { if (propKey === STYLE) { if (propValue) { - propValue = props.style = merge(props.style); + propValue = props.style = assign({}, props.style); } propValue = CSSPropertyOperations.createMarkupForStyles(propValue); } @@ -23777,22 +23785,22 @@ ReactDOMComponent.Mixin = { return ''; }, - receiveComponent: function(nextDescriptor, transaction) { - if (nextDescriptor === this._descriptor && - nextDescriptor._owner != null) { - // Since descriptors are immutable after the owner is rendered, + receiveComponent: function(nextElement, transaction) { + if (nextElement === this._currentElement && + nextElement._owner != null) { + // Since elements are immutable after the owner is rendered, // we can do a cheap identity compare here to determine if this is a // superfluous reconcile. It's possible for state to be mutable but such // change should trigger an update of the owner which would recreate - // the descriptor. We explicitly check for the existence of an owner since - // it's possible for a descriptor created outside a composite to be + // the element. We explicitly check for the existence of an owner since + // it's possible for a element created outside a composite to be // deeply mutated and reused. return; } ReactComponent.Mixin.receiveComponent.call( this, - nextDescriptor, + nextElement, transaction ); }, @@ -23802,22 +23810,22 @@ ReactDOMComponent.Mixin = { * attached to the DOM. Reconciles the root DOM node, then recurses. * * @param {ReactReconcileTransaction} transaction - * @param {ReactDescriptor} prevDescriptor + * @param {ReactElement} prevElement * @internal * @overridable */ updateComponent: ReactPerf.measure( 'ReactDOMComponent', 'updateComponent', - function(transaction, prevDescriptor) { - assertValidProps(this._descriptor.props); + function(transaction, prevElement) { + assertValidProps(this._currentElement.props); ReactComponent.Mixin.updateComponent.call( this, transaction, - prevDescriptor + prevElement ); - this._updateDOMProperties(prevDescriptor.props, transaction); - this._updateDOMChildren(prevDescriptor.props, transaction); + this._updateDOMProperties(prevElement.props, transaction); + this._updateDOMChildren(prevElement.props, transaction); } ), @@ -23873,7 +23881,7 @@ ReactDOMComponent.Mixin = { } if (propKey === STYLE) { if (nextProp) { - nextProp = nextProps.style = merge(nextProp); + nextProp = nextProps.style = assign({}, nextProp); } if (lastProp) { // Unset styles on `lastProp` but not on `nextProp`. @@ -23982,28 +23990,24 @@ ReactDOMComponent.Mixin = { }; -mixInto(ReactDOMComponent, ReactComponent.Mixin); -mixInto(ReactDOMComponent, ReactDOMComponent.Mixin); -mixInto(ReactDOMComponent, ReactMultiChild.Mixin); -mixInto(ReactDOMComponent, ReactBrowserComponentMixin); +assign( + ReactDOMComponent.prototype, + ReactComponent.Mixin, + ReactDOMComponent.Mixin, + ReactMultiChild.Mixin, + ReactBrowserComponentMixin +); module.exports = ReactDOMComponent; -},{"./CSSPropertyOperations":5,"./DOMProperty":11,"./DOMPropertyOperations":12,"./ReactBrowserComponentMixin":30,"./ReactBrowserEventEmitter":31,"./ReactComponent":35,"./ReactMount":67,"./ReactMultiChild":68,"./ReactPerf":71,"./escapeTextForBrowser":118,"./invariant":134,"./keyOf":141,"./merge":144,"./mixInto":147}],44:[function(_dereq_,module,exports){ +},{"./CSSPropertyOperations":6,"./DOMProperty":12,"./DOMPropertyOperations":13,"./Object.assign":29,"./ReactBrowserComponentMixin":32,"./ReactBrowserEventEmitter":33,"./ReactComponent":37,"./ReactMount":70,"./ReactMultiChild":71,"./ReactPerf":75,"./escapeTextForBrowser":123,"./invariant":140,"./isEventSupported":141,"./keyOf":147,"./monitorCodeUse":150}],46:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMForm */ @@ -24014,10 +24018,11 @@ var EventConstants = _dereq_("./EventConstants"); var LocalEventTrapMixin = _dereq_("./LocalEventTrapMixin"); var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); -// Store a reference to the <form> `ReactDOMComponent`. -var form = ReactDOM.form; +// Store a reference to the <form> `ReactDOMComponent`. TODO: use string +var form = ReactElement.createFactory(ReactDOM.form.type); /** * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need @@ -24034,7 +24039,7 @@ var ReactDOMForm = ReactCompositeComponent.createClass({ // TODO: Instead of using `ReactDOM` directly, we should use JSX. However, // `jshint` fails to parse JSX so in order for linting to work in the open // source repo, we need to just use `ReactDOM.form`. - return this.transferPropsTo(form(null, this.props.children)); + return form(this.props); }, componentDidMount: function() { @@ -24045,21 +24050,14 @@ var ReactDOMForm = ReactCompositeComponent.createClass({ module.exports = ReactDOMForm; -},{"./EventConstants":16,"./LocalEventTrapMixin":26,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41}],45:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./LocalEventTrapMixin":27,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58}],47:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMIDOperations * @typechecks static-only @@ -24236,21 +24234,14 @@ var ReactDOMIDOperations = { module.exports = ReactDOMIDOperations; -},{"./CSSPropertyOperations":5,"./DOMChildrenOperations":10,"./DOMPropertyOperations":12,"./ReactMount":67,"./ReactPerf":71,"./invariant":134,"./setInnerHTML":152}],46:[function(_dereq_,module,exports){ +},{"./CSSPropertyOperations":6,"./DOMChildrenOperations":11,"./DOMPropertyOperations":13,"./ReactMount":70,"./ReactPerf":75,"./invariant":140,"./setInnerHTML":154}],48:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMImg */ @@ -24261,10 +24252,11 @@ var EventConstants = _dereq_("./EventConstants"); var LocalEventTrapMixin = _dereq_("./LocalEventTrapMixin"); var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); -// Store a reference to the <img> `ReactDOMComponent`. -var img = ReactDOM.img; +// Store a reference to the <img> `ReactDOMComponent`. TODO: use string +var img = ReactElement.createFactory(ReactDOM.img.type); /** * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to @@ -24290,21 +24282,14 @@ var ReactDOMImg = ReactCompositeComponent.createClass({ module.exports = ReactDOMImg; -},{"./EventConstants":16,"./LocalEventTrapMixin":26,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41}],47:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./LocalEventTrapMixin":27,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58}],49:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMInput */ @@ -24316,17 +24301,26 @@ var DOMPropertyOperations = _dereq_("./DOMPropertyOperations"); var LinkedValueUtils = _dereq_("./LinkedValueUtils"); var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); var ReactMount = _dereq_("./ReactMount"); +var ReactUpdates = _dereq_("./ReactUpdates"); +var assign = _dereq_("./Object.assign"); var invariant = _dereq_("./invariant"); -var merge = _dereq_("./merge"); -// Store a reference to the <input> `ReactDOMComponent`. -var input = ReactDOM.input; +// Store a reference to the <input> `ReactDOMComponent`. TODO: use string +var input = ReactElement.createFactory(ReactDOM.input.type); var instancesByReactID = {}; +function forceUpdateIfMounted() { + /*jshint validthis:true */ + if (this.isMounted()) { + this.forceUpdate(); + } +} + /** * Implements an <input> native component that allows setting these optional * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. @@ -24351,28 +24345,23 @@ var ReactDOMInput = ReactCompositeComponent.createClass({ getInitialState: function() { var defaultValue = this.props.defaultValue; return { - checked: this.props.defaultChecked || false, - value: defaultValue != null ? defaultValue : null + initialChecked: this.props.defaultChecked || false, + initialValue: defaultValue != null ? defaultValue : null }; }, - shouldComponentUpdate: function() { - // Defer any updates to this component during the `onChange` handler. - return !this._isChanging; - }, - render: function() { // Clone `this.props` so we don't mutate the input. - var props = merge(this.props); + var props = assign({}, this.props); props.defaultChecked = null; props.defaultValue = null; var value = LinkedValueUtils.getValue(this); - props.value = value != null ? value : this.state.value; + props.value = value != null ? value : this.state.initialValue; var checked = LinkedValueUtils.getChecked(this); - props.checked = checked != null ? checked : this.state.checked; + props.checked = checked != null ? checked : this.state.initialChecked; props.onChange = this._handleChange; @@ -24412,14 +24401,12 @@ var ReactDOMInput = ReactCompositeComponent.createClass({ var returnValue; var onChange = LinkedValueUtils.getOnChange(this); if (onChange) { - this._isChanging = true; returnValue = onChange.call(this, event); - this._isChanging = false; } - this.setState({ - checked: event.target.checked, - value: event.target.value - }); + // Here we use asap to wait until all updates have propagated, which + // is important when using controlled components within layers: + // https://github.com/facebook/react/issues/1698 + ReactUpdates.asap(forceUpdateIfMounted, this); var name = this.props.name; if (this.props.type === 'radio' && name != null) { @@ -24457,13 +24444,10 @@ var ReactDOMInput = ReactCompositeComponent.createClass({ 'ReactDOMInput: Unknown radio button ID %s.', otherID ) : invariant(otherInstance)); - // In some cases, this will actually change the `checked` state value. - // In other cases, there's no change but this forces a reconcile upon - // which componentDidUpdate will reset the DOM property to whatever it - // should be. - otherInstance.setState({ - checked: false - }); + // If this is a controlled radio button group, forcing the input that + // was previously checked to update will cause it to be come re-checked + // as appropriate. + ReactUpdates.asap(forceUpdateIfMounted, otherInstance); } } @@ -24474,21 +24458,14 @@ var ReactDOMInput = ReactCompositeComponent.createClass({ module.exports = ReactDOMInput; -},{"./AutoFocusMixin":1,"./DOMPropertyOperations":12,"./LinkedValueUtils":25,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./ReactMount":67,"./invariant":134,"./merge":144}],48:[function(_dereq_,module,exports){ +},{"./AutoFocusMixin":2,"./DOMPropertyOperations":13,"./LinkedValueUtils":26,"./Object.assign":29,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58,"./ReactMount":70,"./ReactUpdates":91,"./invariant":140}],50:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMOption */ @@ -24497,12 +24474,13 @@ module.exports = ReactDOMInput; var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); var warning = _dereq_("./warning"); -// Store a reference to the <option> `ReactDOMComponent`. -var option = ReactDOM.option; +// Store a reference to the <option> `ReactDOMComponent`. TODO: use string +var option = ReactElement.createFactory(ReactDOM.option.type); /** * Implements an <option> native component that warns when `selected` is set. @@ -24531,21 +24509,14 @@ var ReactDOMOption = ReactCompositeComponent.createClass({ module.exports = ReactDOMOption; -},{"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./warning":158}],49:[function(_dereq_,module,exports){ +},{"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58,"./warning":160}],51:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMSelect */ @@ -24556,12 +24527,22 @@ var AutoFocusMixin = _dereq_("./AutoFocusMixin"); var LinkedValueUtils = _dereq_("./LinkedValueUtils"); var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); +var ReactUpdates = _dereq_("./ReactUpdates"); + +var assign = _dereq_("./Object.assign"); -var merge = _dereq_("./merge"); +// Store a reference to the <select> `ReactDOMComponent`. TODO: use string +var select = ReactElement.createFactory(ReactDOM.select.type); -// Store a reference to the <select> `ReactDOMComponent`. -var select = ReactDOM.select; +function updateWithPendingValueIfMounted() { + /*jshint validthis:true */ + if (this.isMounted()) { + this.setState({value: this._pendingValue}); + this._pendingValue = 0; + } +} /** * Validation function for `value` and `defaultValue`. @@ -24648,6 +24629,10 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({ return {value: this.props.defaultValue || (this.props.multiple ? [] : '')}; }, + componentWillMount: function() { + this._pendingValue = null; + }, + componentWillReceiveProps: function(nextProps) { if (!this.props.multiple && nextProps.multiple) { this.setState({value: [this.state.value]}); @@ -24656,14 +24641,9 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({ } }, - shouldComponentUpdate: function() { - // Defer any updates to this component during the `onChange` handler. - return !this._isChanging; - }, - render: function() { // Clone `this.props` so we don't mutate the input. - var props = merge(this.props); + var props = assign({}, this.props); props.onChange = this._handleChange; props.value = null; @@ -24688,9 +24668,7 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({ var returnValue; var onChange = LinkedValueUtils.getOnChange(this); if (onChange) { - this._isChanging = true; returnValue = onChange.call(this, event); - this._isChanging = false; } var selectedValue; @@ -24706,7 +24684,8 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({ selectedValue = event.target.value; } - this.setState({value: selectedValue}); + this._pendingValue = selectedValue; + ReactUpdates.asap(updateWithPendingValueIfMounted, this); return returnValue; } @@ -24714,21 +24693,14 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({ module.exports = ReactDOMSelect; -},{"./AutoFocusMixin":1,"./LinkedValueUtils":25,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./merge":144}],50:[function(_dereq_,module,exports){ +},{"./AutoFocusMixin":2,"./LinkedValueUtils":26,"./Object.assign":29,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58,"./ReactUpdates":91}],52:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMSelection */ @@ -24787,9 +24759,9 @@ function getIEOffsets(node) { * @return {?object} */ function getModernOffsets(node) { - var selection = window.getSelection(); + var selection = window.getSelection && window.getSelection(); - if (selection.rangeCount === 0) { + if (!selection || selection.rangeCount === 0) { return null; } @@ -24831,7 +24803,6 @@ function getModernOffsets(node) { detectionRange.setStart(anchorNode, anchorOffset); detectionRange.setEnd(focusNode, focusOffset); var isBackward = detectionRange.collapsed; - detectionRange.detach(); return { start: isBackward ? end : start, @@ -24878,8 +24849,11 @@ function setIEOffsets(node, offsets) { * @param {object} offsets */ function setModernOffsets(node, offsets) { - var selection = window.getSelection(); + if (!window.getSelection) { + return; + } + var selection = window.getSelection(); var length = node[getTextContentAccessor()].length; var start = Math.min(offsets.start, length); var end = typeof offsets.end === 'undefined' ? @@ -24908,8 +24882,6 @@ function setModernOffsets(node, offsets) { range.setEnd(endMarker.node, endMarker.offset); selection.addRange(range); } - - range.detach(); } } @@ -24930,21 +24902,14 @@ var ReactDOMSelection = { module.exports = ReactDOMSelection; -},{"./ExecutionEnvironment":22,"./getNodeForCharacterOffset":127,"./getTextContentAccessor":129}],51:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23,"./getNodeForCharacterOffset":133,"./getTextContentAccessor":135}],53:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMTextarea */ @@ -24956,15 +24921,24 @@ var DOMPropertyOperations = _dereq_("./DOMPropertyOperations"); var LinkedValueUtils = _dereq_("./LinkedValueUtils"); var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); +var ReactUpdates = _dereq_("./ReactUpdates"); +var assign = _dereq_("./Object.assign"); var invariant = _dereq_("./invariant"); -var merge = _dereq_("./merge"); var warning = _dereq_("./warning"); -// Store a reference to the <textarea> `ReactDOMComponent`. -var textarea = ReactDOM.textarea; +// Store a reference to the <textarea> `ReactDOMComponent`. TODO: use string +var textarea = ReactElement.createFactory(ReactDOM.textarea.type); + +function forceUpdateIfMounted() { + /*jshint validthis:true */ + if (this.isMounted()) { + this.forceUpdate(); + } +} /** * Implements a <textarea> native component that allows setting `value`, and @@ -25025,14 +24999,9 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({ }; }, - shouldComponentUpdate: function() { - // Defer any updates to this component during the `onChange` handler. - return !this._isChanging; - }, - render: function() { // Clone `this.props` so we don't mutate the input. - var props = merge(this.props); + var props = assign({}, this.props); ("production" !== "development" ? invariant( props.dangerouslySetInnerHTML == null, @@ -25062,11 +25031,9 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({ var returnValue; var onChange = LinkedValueUtils.getOnChange(this); if (onChange) { - this._isChanging = true; returnValue = onChange.call(this, event); - this._isChanging = false; } - this.setState({value: event.target.value}); + ReactUpdates.asap(forceUpdateIfMounted, this); return returnValue; } @@ -25074,21 +25041,14 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({ module.exports = ReactDOMTextarea; -},{"./AutoFocusMixin":1,"./DOMPropertyOperations":12,"./LinkedValueUtils":25,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./invariant":134,"./merge":144,"./warning":158}],52:[function(_dereq_,module,exports){ +},{"./AutoFocusMixin":2,"./DOMPropertyOperations":13,"./LinkedValueUtils":26,"./Object.assign":29,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58,"./ReactUpdates":91,"./invariant":140,"./warning":160}],54:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDefaultBatchingStrategy */ @@ -25098,8 +25058,8 @@ module.exports = ReactDOMTextarea; var ReactUpdates = _dereq_("./ReactUpdates"); var Transaction = _dereq_("./Transaction"); +var assign = _dereq_("./Object.assign"); var emptyFunction = _dereq_("./emptyFunction"); -var mixInto = _dereq_("./mixInto"); var RESET_BATCHED_UPDATES = { initialize: emptyFunction, @@ -25119,12 +25079,15 @@ function ReactDefaultBatchingStrategyTransaction() { this.reinitializeTransaction(); } -mixInto(ReactDefaultBatchingStrategyTransaction, Transaction.Mixin); -mixInto(ReactDefaultBatchingStrategyTransaction, { - getTransactionWrappers: function() { - return TRANSACTION_WRAPPERS; +assign( + ReactDefaultBatchingStrategyTransaction.prototype, + Transaction.Mixin, + { + getTransactionWrappers: function() { + return TRANSACTION_WRAPPERS; + } } -}); +); var transaction = new ReactDefaultBatchingStrategyTransaction(); @@ -25151,21 +25114,14 @@ var ReactDefaultBatchingStrategy = { module.exports = ReactDefaultBatchingStrategy; -},{"./ReactUpdates":87,"./Transaction":104,"./emptyFunction":116,"./mixInto":147}],53:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./ReactUpdates":91,"./Transaction":107,"./emptyFunction":121}],55:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDefaultInjection */ @@ -25185,7 +25141,7 @@ var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactComponentBrowserEnvironment = _dereq_("./ReactComponentBrowserEnvironment"); var ReactDefaultBatchingStrategy = _dereq_("./ReactDefaultBatchingStrategy"); -var ReactDOM = _dereq_("./ReactDOM"); +var ReactDOMComponent = _dereq_("./ReactDOMComponent"); var ReactDOMButton = _dereq_("./ReactDOMButton"); var ReactDOMForm = _dereq_("./ReactDOMForm"); var ReactDOMImg = _dereq_("./ReactDOMImg"); @@ -25230,18 +25186,22 @@ function inject() { BeforeInputEventPlugin: BeforeInputEventPlugin }); - ReactInjection.DOM.injectComponentClasses({ - button: ReactDOMButton, - form: ReactDOMForm, - img: ReactDOMImg, - input: ReactDOMInput, - option: ReactDOMOption, - select: ReactDOMSelect, - textarea: ReactDOMTextarea, - - html: createFullPageComponent(ReactDOM.html), - head: createFullPageComponent(ReactDOM.head), - body: createFullPageComponent(ReactDOM.body) + ReactInjection.NativeComponent.injectGenericComponentClass( + ReactDOMComponent + ); + + ReactInjection.NativeComponent.injectComponentClasses({ + 'button': ReactDOMButton, + 'form': ReactDOMForm, + 'img': ReactDOMImg, + 'input': ReactDOMInput, + 'option': ReactDOMOption, + 'select': ReactDOMSelect, + 'textarea': ReactDOMTextarea, + + 'html': createFullPageComponent('html'), + 'head': createFullPageComponent('head'), + 'body': createFullPageComponent('body') }); // This needs to happen after createFullPageComponent() otherwise the mixin @@ -25251,7 +25211,7 @@ function inject() { ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig); ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig); - ReactInjection.EmptyComponent.injectEmptyComponent(ReactDOM.noscript); + ReactInjection.EmptyComponent.injectEmptyComponent('noscript'); ReactInjection.Updates.injectReconcileTransaction( ReactComponentBrowserEnvironment.ReactReconcileTransaction @@ -25281,21 +25241,14 @@ module.exports = { inject: inject }; -},{"./BeforeInputEventPlugin":2,"./ChangeEventPlugin":7,"./ClientReactRootIndex":8,"./CompositionEventPlugin":9,"./DefaultEventPluginOrder":14,"./EnterLeaveEventPlugin":15,"./ExecutionEnvironment":22,"./HTMLDOMPropertyConfig":23,"./MobileSafariClickEventPlugin":27,"./ReactBrowserComponentMixin":30,"./ReactComponentBrowserEnvironment":36,"./ReactDOM":41,"./ReactDOMButton":42,"./ReactDOMForm":44,"./ReactDOMImg":46,"./ReactDOMInput":47,"./ReactDOMOption":48,"./ReactDOMSelect":49,"./ReactDOMTextarea":51,"./ReactDefaultBatchingStrategy":52,"./ReactDefaultPerf":54,"./ReactEventListener":61,"./ReactInjection":62,"./ReactInstanceHandles":64,"./ReactMount":67,"./SVGDOMPropertyConfig":89,"./SelectEventPlugin":90,"./ServerReactRootIndex":91,"./SimpleEventPlugin":92,"./createFullPageComponent":112}],54:[function(_dereq_,module,exports){ +},{"./BeforeInputEventPlugin":3,"./ChangeEventPlugin":8,"./ClientReactRootIndex":9,"./CompositionEventPlugin":10,"./DefaultEventPluginOrder":15,"./EnterLeaveEventPlugin":16,"./ExecutionEnvironment":23,"./HTMLDOMPropertyConfig":24,"./MobileSafariClickEventPlugin":28,"./ReactBrowserComponentMixin":32,"./ReactComponentBrowserEnvironment":38,"./ReactDOMButton":44,"./ReactDOMComponent":45,"./ReactDOMForm":46,"./ReactDOMImg":48,"./ReactDOMInput":49,"./ReactDOMOption":50,"./ReactDOMSelect":51,"./ReactDOMTextarea":53,"./ReactDefaultBatchingStrategy":54,"./ReactDefaultPerf":56,"./ReactEventListener":63,"./ReactInjection":64,"./ReactInstanceHandles":66,"./ReactMount":70,"./SVGDOMPropertyConfig":92,"./SelectEventPlugin":93,"./ServerReactRootIndex":94,"./SimpleEventPlugin":95,"./createFullPageComponent":116}],56:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDefaultPerf * @typechecks static-only @@ -25374,19 +25327,23 @@ var ReactDefaultPerf = { ); }, - printWasted: function(measurements) { - measurements = measurements || ReactDefaultPerf._allMeasurements; + getMeasurementsSummaryMap: function(measurements) { var summary = ReactDefaultPerfAnalysis.getInclusiveSummary( measurements, true ); - console.table(summary.map(function(item) { + return summary.map(function(item) { return { 'Owner > component': item.componentName, 'Wasted time (ms)': item.time, 'Instances': item.count }; - })); + }); + }, + + printWasted: function(measurements) { + measurements = measurements || ReactDefaultPerf._allMeasurements; + console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements)); console.log( 'Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms' @@ -25424,7 +25381,7 @@ var ReactDefaultPerf = { }, measure: function(moduleName, fnName, func) { - return function() {var args=Array.prototype.slice.call(arguments,0); + return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]); var totalTime; var rv; var start; @@ -25544,26 +25501,19 @@ var ReactDefaultPerf = { module.exports = ReactDefaultPerf; -},{"./DOMProperty":11,"./ReactDefaultPerfAnalysis":55,"./ReactMount":67,"./ReactPerf":71,"./performanceNow":151}],55:[function(_dereq_,module,exports){ +},{"./DOMProperty":12,"./ReactDefaultPerfAnalysis":57,"./ReactMount":70,"./ReactPerf":75,"./performanceNow":153}],57:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDefaultPerfAnalysis */ -var merge = _dereq_("./merge"); +var assign = _dereq_("./Object.assign"); // Don't try to save users less than 1.2ms (a number I made up) var DONT_CARE_THRESHOLD = 1.2; @@ -25618,7 +25568,11 @@ function getExclusiveSummary(measurements) { for (var i = 0; i < measurements.length; i++) { var measurement = measurements[i]; - var allIDs = merge(measurement.exclusive, measurement.inclusive); + var allIDs = assign( + {}, + measurement.exclusive, + measurement.inclusive + ); for (var id in allIDs) { displayName = measurement.displayNames[id].current; @@ -25666,7 +25620,11 @@ function getInclusiveSummary(measurements, onlyClean) { for (var i = 0; i < measurements.length; i++) { var measurement = measurements[i]; - var allIDs = merge(measurement.exclusive, measurement.inclusive); + var allIDs = assign( + {}, + measurement.exclusive, + measurement.inclusive + ); var cleanComponents; if (onlyClean) { @@ -25721,11 +25679,11 @@ function getUnchangedComponents(measurement) { // the amount of time it took to render the entire subtree. var cleanComponents = {}; var dirtyLeafIDs = Object.keys(measurement.writes); - var allIDs = merge(measurement.exclusive, measurement.inclusive); + var allIDs = assign({}, measurement.exclusive, measurement.inclusive); for (var id in allIDs) { var isDirty = false; - // For each component that rendered, see if a component that triggerd + // For each component that rendered, see if a component that triggered // a DOM op is in its subtree. for (var i = 0; i < dirtyLeafIDs.length; i++) { if (dirtyLeafIDs[i].indexOf(id) === 0) { @@ -25749,23 +25707,16 @@ var ReactDefaultPerfAnalysis = { module.exports = ReactDefaultPerfAnalysis; -},{"./merge":144}],56:[function(_dereq_,module,exports){ +},{"./Object.assign":29}],58:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule ReactDescriptor + * @providesModule ReactElement */ "use strict"; @@ -25773,9 +25724,13 @@ module.exports = ReactDefaultPerfAnalysis; var ReactContext = _dereq_("./ReactContext"); var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); -var merge = _dereq_("./merge"); var warning = _dereq_("./warning"); +var RESERVED_PROPS = { + key: true, + ref: true +}; + /** * Warn for mutations. * @@ -25817,7 +25772,7 @@ var useMutationMembrane = false; * Warn for mutations. * * @internal - * @param {object} descriptor + * @param {object} element */ function defineMutationMembrane(prototype) { try { @@ -25834,161 +25789,145 @@ function defineMutationMembrane(prototype) { } /** - * Transfer static properties from the source to the target. Functions are - * rebound to have this reflect the original source. - */ -function proxyStaticMethods(target, source) { - if (typeof source !== 'function') { - return; - } - for (var key in source) { - if (source.hasOwnProperty(key)) { - var value = source[key]; - if (typeof value === 'function') { - var bound = value.bind(source); - // Copy any properties defined on the function, such as `isRequired` on - // a PropTypes validator. (mergeInto refuses to work on functions.) - for (var k in value) { - if (value.hasOwnProperty(k)) { - bound[k] = value[k]; - } - } - target[key] = bound; - } else { - target[key] = value; - } - } - } -} - -/** - * Base constructor for all React descriptors. This is only used to make this + * Base constructor for all React elements. This is only used to make this * work with a dynamic instanceof check. Nothing should live on this prototype. * * @param {*} type + * @param {string|object} ref + * @param {*} key + * @param {*} props * @internal */ -var ReactDescriptor = function() {}; +var ReactElement = function(type, key, ref, owner, context, props) { + // Built-in properties that belong on the element + this.type = type; + this.key = key; + this.ref = ref; -if ("production" !== "development") { - defineMutationMembrane(ReactDescriptor.prototype); -} + // Record the component responsible for creating this element. + this._owner = owner; -ReactDescriptor.createFactory = function(type) { + // TODO: Deprecate withContext, and then the context becomes accessible + // through the owner. + this._context = context; - var descriptorPrototype = Object.create(ReactDescriptor.prototype); - - var factory = function(props, children) { - // For consistency we currently allocate a new object for every descriptor. - // This protects the descriptor from being mutated by the original props - // object being mutated. It also protects the original props object from - // being mutated by children arguments and default props. This behavior - // comes with a performance cost and could be deprecated in the future. - // It could also be optimized with a smarter JSX transform. - if (props == null) { - props = {}; - } else if (typeof props === 'object') { - props = merge(props); + if ("production" !== "development") { + // The validation flag and props are currently mutative. We put them on + // an external backing store so that we can freeze the whole object. + // This can be replaced with a WeakMap once they are implemented in + // commonly used development environments. + this._store = { validated: false, props: props }; + + // We're not allowed to set props directly on the object so we early + // return and rely on the prototype membrane to forward to the backing + // store. + if (useMutationMembrane) { + Object.freeze(this); + return; } + } - // Children can be more than one argument, and those are transferred onto - // the newly allocated props object. - var childrenLength = arguments.length - 1; - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 1]; - } - props.children = childArray; - } + this.props = props; +}; - // Initialize the descriptor object - var descriptor = Object.create(descriptorPrototype); +// We intentionally don't expose the function on the constructor property. +// ReactElement should be indistinguishable from a plain object. +ReactElement.prototype = { + _isReactElement: true +}; - // Record the component responsible for creating this descriptor. - descriptor._owner = ReactCurrentOwner.current; +if ("production" !== "development") { + defineMutationMembrane(ReactElement.prototype); +} - // TODO: Deprecate withContext, and then the context becomes accessible - // through the owner. - descriptor._context = ReactContext.current; +ReactElement.createElement = function(type, config, children) { + var propName; - if ("production" !== "development") { - // The validation flag and props are currently mutative. We put them on - // an external backing store so that we can freeze the whole object. - // This can be replaced with a WeakMap once they are implemented in - // commonly used development environments. - descriptor._store = { validated: false, props: props }; + // Reserved names are extracted + var props = {}; - // We're not allowed to set props directly on the object so we early - // return and rely on the prototype membrane to forward to the backing - // store. - if (useMutationMembrane) { - Object.freeze(descriptor); - return descriptor; + var key = null; + var ref = null; + + if (config != null) { + ref = config.ref === undefined ? null : config.ref; + if ("production" !== "development") { + ("production" !== "development" ? warning( + config.key !== null, + 'createElement(...): Encountered component with a `key` of null. In ' + + 'a future version, this will be treated as equivalent to the string ' + + '\'null\'; instead, provide an explicit key or use undefined.' + ) : null); + } + // TODO: Change this back to `config.key === undefined` + key = config.key == null ? null : '' + config.key; + // Remaining properties are added to a new props object + for (propName in config) { + if (config.hasOwnProperty(propName) && + !RESERVED_PROPS.hasOwnProperty(propName)) { + props[propName] = config[propName]; } } + } - descriptor.props = props; - return descriptor; - }; + // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + var childrenLength = arguments.length - 2; + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + props.children = childArray; + } + + // Resolve default props + if (type.defaultProps) { + var defaultProps = type.defaultProps; + for (propName in defaultProps) { + if (typeof props[propName] === 'undefined') { + props[propName] = defaultProps[propName]; + } + } + } - // Currently we expose the prototype of the descriptor so that - // <Foo /> instanceof Foo works. This is controversial pattern. - factory.prototype = descriptorPrototype; + return new ReactElement( + type, + key, + ref, + ReactCurrentOwner.current, + ReactContext.current, + props + ); +}; +ReactElement.createFactory = function(type) { + var factory = ReactElement.createElement.bind(null, type); // Expose the type on the factory and the prototype so that it can be - // easily accessed on descriptors. E.g. <Foo />.type === Foo.type and for - // static methods like <Foo />.type.staticMethod(); - // This should not be named constructor since this may not be the function - // that created the descriptor, and it may not even be a constructor. + // easily accessed on elements. E.g. <Foo />.type === Foo.type. + // This should not be named `constructor` since this may not be the function + // that created the element, and it may not even be a constructor. factory.type = type; - descriptorPrototype.type = type; - - proxyStaticMethods(factory, type); - - // Expose a unique constructor on the prototype is that this works with type - // systems that compare constructor properties: <Foo />.constructor === Foo - // This may be controversial since it requires a known factory function. - descriptorPrototype.constructor = factory; - return factory; - }; -ReactDescriptor.cloneAndReplaceProps = function(oldDescriptor, newProps) { - var newDescriptor = Object.create(oldDescriptor.constructor.prototype); - // It's important that this property order matches the hidden class of the - // original descriptor to maintain perf. - newDescriptor._owner = oldDescriptor._owner; - newDescriptor._context = oldDescriptor._context; +ReactElement.cloneAndReplaceProps = function(oldElement, newProps) { + var newElement = new ReactElement( + oldElement.type, + oldElement.key, + oldElement.ref, + oldElement._owner, + oldElement._context, + newProps + ); if ("production" !== "development") { - newDescriptor._store = { - validated: oldDescriptor._store.validated, - props: newProps - }; - if (useMutationMembrane) { - Object.freeze(newDescriptor); - return newDescriptor; - } + // If the key on the original is valid, then the clone is valid + newElement._store.validated = oldElement._store.validated; } - - newDescriptor.props = newProps; - return newDescriptor; -}; - -/** - * Checks if a value is a valid descriptor constructor. - * - * @param {*} - * @return {boolean} - * @public - */ -ReactDescriptor.isValidFactory = function(factory) { - return typeof factory === 'function' && - factory.prototype instanceof ReactDescriptor; + return newElement; }; /** @@ -25996,41 +25935,44 @@ ReactDescriptor.isValidFactory = function(factory) { * @return {boolean} True if `object` is a valid component. * @final */ -ReactDescriptor.isValidDescriptor = function(object) { - return object instanceof ReactDescriptor; +ReactElement.isValidElement = function(object) { + // ReactTestUtils is often used outside of beforeEach where as React is + // within it. This leads to two different instances of React on the same + // page. To identify a element from a different React instance we use + // a flag instead of an instanceof check. + var isElement = !!(object && object._isReactElement); + // if (isElement && !(object instanceof ReactElement)) { + // This is an indicator that you're using multiple versions of React at the + // same time. This will screw with ownership and stuff. Fix it, please. + // TODO: We could possibly warn here. + // } + return isElement; }; -module.exports = ReactDescriptor; +module.exports = ReactElement; -},{"./ReactContext":39,"./ReactCurrentOwner":40,"./merge":144,"./warning":158}],57:[function(_dereq_,module,exports){ +},{"./ReactContext":41,"./ReactCurrentOwner":42,"./warning":160}],59:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule ReactDescriptorValidator + * @providesModule ReactElementValidator */ /** - * ReactDescriptorValidator provides a wrapper around a descriptor factory - * which validates the props passed to the descriptor. This is intended to be + * 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 ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); var ReactPropTypeLocations = _dereq_("./ReactPropTypeLocations"); var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); @@ -26073,7 +26015,7 @@ function getCurrentOwnerDisplayName() { * @param {*} parentType component's parent's type. */ function validateExplicitKey(component, parentType) { - if (component._store.validated || component.props.key != null) { + if (component._store.validated || component.key != null) { return; } component._store.validated = true; @@ -26179,11 +26121,11 @@ function validateChildKeys(component, parentType) { if (Array.isArray(component)) { for (var i = 0; i < component.length; i++) { var child = component[i]; - if (ReactDescriptor.isValidDescriptor(child)) { + if (ReactElement.isValidElement(child)) { validateExplicitKey(child, parentType); } } - } else if (ReactDescriptor.isValidDescriptor(component)) { + } else if (ReactElement.isValidElement(component)) { // This component was passed in a valid location. component._store.validated = true; } else if (component && typeof component === 'object') { @@ -26229,85 +26171,70 @@ function checkPropTypes(componentName, propTypes, props, location) { } } -var ReactDescriptorValidator = { +var ReactElementValidator = { - /** - * Wraps a descriptor factory function in another function which validates - * the props and context of the descriptor and warns about any failed type - * checks. - * - * @param {function} factory The original descriptor factory - * @param {object?} propTypes A prop type definition set - * @param {object?} contextTypes A context type definition set - * @return {object} The component descriptor, which may be invalid. - * @private - */ - createFactory: function(factory, propTypes, contextTypes) { - var validatedFactory = function(props, children) { - var descriptor = factory.apply(this, arguments); - - for (var i = 1; i < arguments.length; i++) { - validateChildKeys(arguments[i], descriptor.type); - } + createElement: function(type, props, children) { + var element = ReactElement.createElement.apply(this, arguments); - var name = descriptor.type.displayName; - if (propTypes) { - checkPropTypes( - name, - propTypes, - descriptor.props, - ReactPropTypeLocations.prop - ); - } - if (contextTypes) { - checkPropTypes( - name, - contextTypes, - descriptor._context, - ReactPropTypeLocations.context - ); - } - return descriptor; - }; + // 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; + } - validatedFactory.prototype = factory.prototype; - validatedFactory.type = factory.type; + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], type); + } - // Copy static properties - for (var key in factory) { - if (factory.hasOwnProperty(key)) { - validatedFactory[key] = factory[key]; - } + var name = type.displayName; + if (type.propTypes) { + checkPropTypes( + name, + type.propTypes, + element.props, + ReactPropTypeLocations.prop + ); } + if (type.contextTypes) { + checkPropTypes( + name, + type.contextTypes, + element._context, + ReactPropTypeLocations.context + ); + } + return element; + }, + createFactory: function(type) { + var validatedFactory = ReactElementValidator.createElement.bind( + null, + type + ); + validatedFactory.type = type; return validatedFactory; } }; -module.exports = ReactDescriptorValidator; +module.exports = ReactElementValidator; -},{"./ReactCurrentOwner":40,"./ReactDescriptor":56,"./ReactPropTypeLocations":74,"./monitorCodeUse":148}],58:[function(_dereq_,module,exports){ +},{"./ReactCurrentOwner":42,"./ReactElement":58,"./ReactPropTypeLocations":78,"./monitorCodeUse":150}],60:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactEmptyComponent */ "use strict"; +var ReactElement = _dereq_("./ReactElement"); + var invariant = _dereq_("./invariant"); var component; @@ -26317,7 +26244,7 @@ var nullComponentIdsRegistry = {}; var ReactEmptyComponentInjection = { injectEmptyComponent: function(emptyComponent) { - component = emptyComponent; + component = ReactElement.createFactory(emptyComponent); } }; @@ -26367,21 +26294,14 @@ var ReactEmptyComponent = { module.exports = ReactEmptyComponent; -},{"./invariant":134}],59:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./invariant":140}],61:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactErrorUtils * @typechecks @@ -26406,21 +26326,14 @@ var ReactErrorUtils = { module.exports = ReactErrorUtils; -},{}],60:[function(_dereq_,module,exports){ +},{}],62:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactEventEmitterMixin */ @@ -26463,21 +26376,14 @@ var ReactEventEmitterMixin = { module.exports = ReactEventEmitterMixin; -},{"./EventPluginHub":18}],61:[function(_dereq_,module,exports){ +},{"./EventPluginHub":19}],63:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactEventListener * @typechecks static-only @@ -26492,9 +26398,9 @@ var ReactInstanceHandles = _dereq_("./ReactInstanceHandles"); var ReactMount = _dereq_("./ReactMount"); var ReactUpdates = _dereq_("./ReactUpdates"); +var assign = _dereq_("./Object.assign"); var getEventTarget = _dereq_("./getEventTarget"); var getUnboundedScrollPosition = _dereq_("./getUnboundedScrollPosition"); -var mixInto = _dereq_("./mixInto"); /** * Finds the parent React component of `node`. @@ -26520,7 +26426,7 @@ function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) { this.nativeEvent = nativeEvent; this.ancestors = []; } -mixInto(TopLevelCallbackBookKeeping, { +assign(TopLevelCallbackBookKeeping.prototype, { destructor: function() { this.topLevelType = null; this.nativeEvent = null; @@ -26654,21 +26560,14 @@ var ReactEventListener = { module.exports = ReactEventListener; -},{"./EventListener":17,"./ExecutionEnvironment":22,"./PooledClass":28,"./ReactInstanceHandles":64,"./ReactMount":67,"./ReactUpdates":87,"./getEventTarget":125,"./getUnboundedScrollPosition":130,"./mixInto":147}],62:[function(_dereq_,module,exports){ +},{"./EventListener":18,"./ExecutionEnvironment":23,"./Object.assign":29,"./PooledClass":30,"./ReactInstanceHandles":66,"./ReactMount":70,"./ReactUpdates":91,"./getEventTarget":131,"./getUnboundedScrollPosition":136}],64:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactInjection */ @@ -26679,9 +26578,9 @@ var DOMProperty = _dereq_("./DOMProperty"); var EventPluginHub = _dereq_("./EventPluginHub"); var ReactComponent = _dereq_("./ReactComponent"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); -var ReactDOM = _dereq_("./ReactDOM"); var ReactEmptyComponent = _dereq_("./ReactEmptyComponent"); var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter"); +var ReactNativeComponent = _dereq_("./ReactNativeComponent"); var ReactPerf = _dereq_("./ReactPerf"); var ReactRootIndex = _dereq_("./ReactRootIndex"); var ReactUpdates = _dereq_("./ReactUpdates"); @@ -26692,8 +26591,8 @@ var ReactInjection = { DOMProperty: DOMProperty.injection, EmptyComponent: ReactEmptyComponent.injection, EventPluginHub: EventPluginHub.injection, - DOM: ReactDOM.injection, EventEmitter: ReactBrowserEventEmitter.injection, + NativeComponent: ReactNativeComponent.injection, Perf: ReactPerf.injection, RootIndex: ReactRootIndex.injection, Updates: ReactUpdates.injection @@ -26701,21 +26600,14 @@ var ReactInjection = { module.exports = ReactInjection; -},{"./DOMProperty":11,"./EventPluginHub":18,"./ReactBrowserEventEmitter":31,"./ReactComponent":35,"./ReactCompositeComponent":38,"./ReactDOM":41,"./ReactEmptyComponent":58,"./ReactPerf":71,"./ReactRootIndex":78,"./ReactUpdates":87}],63:[function(_dereq_,module,exports){ +},{"./DOMProperty":12,"./EventPluginHub":19,"./ReactBrowserEventEmitter":33,"./ReactComponent":37,"./ReactCompositeComponent":40,"./ReactEmptyComponent":60,"./ReactNativeComponent":73,"./ReactPerf":75,"./ReactRootIndex":82,"./ReactUpdates":91}],65:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactInputSelection */ @@ -26844,21 +26736,14 @@ var ReactInputSelection = { module.exports = ReactInputSelection; -},{"./ReactDOMSelection":50,"./containsNode":109,"./focusNode":120,"./getActiveElement":122}],64:[function(_dereq_,module,exports){ +},{"./ReactDOMSelection":52,"./containsNode":114,"./focusNode":125,"./getActiveElement":127}],66:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactInstanceHandles * @typechecks static-only @@ -27184,21 +27069,259 @@ var ReactInstanceHandles = { module.exports = ReactInstanceHandles; -},{"./ReactRootIndex":78,"./invariant":134}],65:[function(_dereq_,module,exports){ +},{"./ReactRootIndex":82,"./invariant":140}],67:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule ReactLegacyElement + */ + +"use strict"; + +var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); + +var invariant = _dereq_("./invariant"); +var monitorCodeUse = _dereq_("./monitorCodeUse"); +var warning = _dereq_("./warning"); + +var legacyFactoryLogs = {}; +function warnForLegacyFactoryCall() { + if (!ReactLegacyElementFactory._isLegacyCallWarningEnabled) { + return; + } + var owner = ReactCurrentOwner.current; + var name = owner && owner.constructor ? owner.constructor.displayName : ''; + if (!name) { + name = 'Something'; + } + if (legacyFactoryLogs.hasOwnProperty(name)) { + return; + } + legacyFactoryLogs[name] = true; + ("production" !== "development" ? warning( + false, + name + ' is calling a React component directly. ' + + 'Use a factory or JSX instead. See: http://fb.me/react-legacyfactory' + ) : null); + monitorCodeUse('react_legacy_factory_call', { version: 3, name: name }); +} + +function warnForPlainFunctionType(type) { + var isReactClass = + type.prototype && + typeof type.prototype.mountComponent === 'function' && + typeof type.prototype.receiveComponent === 'function'; + if (isReactClass) { + ("production" !== "development" ? warning( + false, + 'Did not expect to get a React class here. Use `Component` instead ' + + 'of `Component.type` or `this.constructor`.' + ) : null); + } else { + if (!type._reactWarnedForThisType) { + try { + type._reactWarnedForThisType = true; + } catch (x) { + // just incase this is a frozen object or some special object + } + monitorCodeUse( + 'react_non_component_in_jsx', + { version: 3, name: type.name } + ); + } + ("production" !== "development" ? warning( + false, + 'This JSX uses a plain function. Only React components are ' + + 'valid in React\'s JSX transform.' + ) : null); + } +} + +function warnForNonLegacyFactory(type) { + ("production" !== "development" ? warning( + false, + 'Do not pass React.DOM.' + type.type + ' to JSX or createFactory. ' + + 'Use the string "' + type.type + '" instead.' + ) : null); +} + +/** + * Transfer static properties from the source to the target. Functions are + * rebound to have this reflect the original source. + */ +function proxyStaticMethods(target, source) { + if (typeof source !== 'function') { + return; + } + for (var key in source) { + if (source.hasOwnProperty(key)) { + var value = source[key]; + if (typeof value === 'function') { + var bound = value.bind(source); + // Copy any properties defined on the function, such as `isRequired` on + // a PropTypes validator. + for (var k in value) { + if (value.hasOwnProperty(k)) { + bound[k] = value[k]; + } + } + target[key] = bound; + } else { + target[key] = value; + } + } + } +} + +// We use an object instead of a boolean because booleans are ignored by our +// mocking libraries when these factories gets mocked. +var LEGACY_MARKER = {}; +var NON_LEGACY_MARKER = {}; + +var ReactLegacyElementFactory = {}; + +ReactLegacyElementFactory.wrapCreateFactory = function(createFactory) { + var legacyCreateFactory = function(type) { + if (typeof type !== 'function') { + // Non-function types cannot be legacy factories + return createFactory(type); + } + + if (type.isReactNonLegacyFactory) { + // This is probably a factory created by ReactDOM we unwrap it to get to + // the underlying string type. It shouldn't have been passed here so we + // warn. + if ("production" !== "development") { + warnForNonLegacyFactory(type); + } + return createFactory(type.type); + } + + if (type.isReactLegacyFactory) { + // This is probably a legacy factory created by ReactCompositeComponent. + // We unwrap it to get to the underlying class. + return createFactory(type.type); + } + + if ("production" !== "development") { + warnForPlainFunctionType(type); + } + + // Unless it's a legacy factory, then this is probably a plain function, + // that is expecting to be invoked by JSX. We can just return it as is. + return type; + }; + return legacyCreateFactory; +}; + +ReactLegacyElementFactory.wrapCreateElement = function(createElement) { + var legacyCreateElement = function(type, props, children) { + if (typeof type !== 'function') { + // Non-function types cannot be legacy factories + return createElement.apply(this, arguments); + } + + var args; + + if (type.isReactNonLegacyFactory) { + // This is probably a factory created by ReactDOM we unwrap it to get to + // the underlying string type. It shouldn't have been passed here so we + // warn. + if ("production" !== "development") { + warnForNonLegacyFactory(type); + } + args = Array.prototype.slice.call(arguments, 0); + args[0] = type.type; + return createElement.apply(this, args); + } + + if (type.isReactLegacyFactory) { + // This is probably a legacy factory created by ReactCompositeComponent. + // We unwrap it to get to the underlying class. + if (type._isMockFunction) { + // If this is a mock function, people will expect it to be called. We + // will actually call the original mock factory function instead. This + // future proofs unit testing that assume that these are classes. + type.type._mockedReactClassConstructor = type; + } + args = Array.prototype.slice.call(arguments, 0); + args[0] = type.type; + return createElement.apply(this, args); + } + + if ("production" !== "development") { + warnForPlainFunctionType(type); + } + + // This is being called with a plain function we should invoke it + // immediately as if this was used with legacy JSX. + return type.apply(null, Array.prototype.slice.call(arguments, 1)); + }; + return legacyCreateElement; +}; + +ReactLegacyElementFactory.wrapFactory = function(factory) { + ("production" !== "development" ? invariant( + typeof factory === 'function', + 'This is suppose to accept a element factory' + ) : invariant(typeof factory === 'function')); + var legacyElementFactory = function(config, children) { + // This factory should not be called when JSX is used. Use JSX instead. + if ("production" !== "development") { + warnForLegacyFactoryCall(); + } + return factory.apply(this, arguments); + }; + proxyStaticMethods(legacyElementFactory, factory.type); + legacyElementFactory.isReactLegacyFactory = LEGACY_MARKER; + legacyElementFactory.type = factory.type; + return legacyElementFactory; +}; + +// This is used to mark a factory that will remain. E.g. we're allowed to call +// it as a function. However, you're not suppose to pass it to createElement +// or createFactory, so it will warn you if you do. +ReactLegacyElementFactory.markNonLegacyFactory = function(factory) { + factory.isReactNonLegacyFactory = NON_LEGACY_MARKER; + return factory; +}; + +// Checks if a factory function is actually a legacy factory pretending to +// be a class. +ReactLegacyElementFactory.isValidFactory = function(factory) { + // TODO: This will be removed and moved into a class validator or something. + return typeof factory === 'function' && + factory.isReactLegacyFactory === LEGACY_MARKER; +}; + +ReactLegacyElementFactory.isValidClass = function(factory) { + if ("production" !== "development") { + ("production" !== "development" ? warning( + false, + 'isValidClass is deprecated and will be removed in a future release. ' + + 'Use a more specific validator instead.' + ) : null); + } + return ReactLegacyElementFactory.isValidFactory(factory); +}; + +ReactLegacyElementFactory._isLegacyCallWarningEnabled = true; + +module.exports = ReactLegacyElementFactory; + +},{"./ReactCurrentOwner":42,"./invariant":140,"./monitorCodeUse":150,"./warning":160}],68:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 @@ -27264,21 +27387,14 @@ ReactLink.PropTypes = { module.exports = ReactLink; -},{"./React":29}],66:[function(_dereq_,module,exports){ +},{"./React":31}],69:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactMarkupChecksum */ @@ -27319,21 +27435,14 @@ var ReactMarkupChecksum = { module.exports = ReactMarkupChecksum; -},{"./adler32":107}],67:[function(_dereq_,module,exports){ +},{"./adler32":110}],70:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactMount */ @@ -27343,17 +27452,23 @@ module.exports = ReactMarkupChecksum; var DOMProperty = _dereq_("./DOMProperty"); var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter"); var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); +var ReactLegacyElement = _dereq_("./ReactLegacyElement"); var ReactInstanceHandles = _dereq_("./ReactInstanceHandles"); var ReactPerf = _dereq_("./ReactPerf"); var containsNode = _dereq_("./containsNode"); +var deprecated = _dereq_("./deprecated"); var getReactRootElementInContainer = _dereq_("./getReactRootElementInContainer"); var instantiateReactComponent = _dereq_("./instantiateReactComponent"); var invariant = _dereq_("./invariant"); var shouldUpdateReactComponent = _dereq_("./shouldUpdateReactComponent"); var warning = _dereq_("./warning"); +var createElement = ReactLegacyElement.wrapCreateElement( + ReactElement.createElement +); + var SEPARATOR = ReactInstanceHandles.SEPARATOR; var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; @@ -27521,7 +27636,7 @@ function findDeepestCachedAncestor(targetID) { * representative DOM elements and inserting them into a supplied `container`. * Any prior content inside `container` is destroyed in the process. * - * ReactMount.renderComponent( + * ReactMount.render( * component, * document.getElementById('container') * ); @@ -27627,7 +27742,7 @@ var ReactMount = { 'componentDidUpdate.' ) : null); - var componentInstance = instantiateReactComponent(nextComponent); + var componentInstance = instantiateReactComponent(nextComponent, null); var reactRootID = ReactMount._registerComponent( componentInstance, container @@ -27655,35 +27770,38 @@ var ReactMount = { * perform an update on it and only mutate the DOM as necessary to reflect the * latest React component. * - * @param {ReactDescriptor} nextDescriptor Component descriptor to render. + * @param {ReactElement} nextElement Component element to render. * @param {DOMElement} container DOM element to render into. * @param {?function} callback function triggered on completion * @return {ReactComponent} Component instance rendered in `container`. */ - renderComponent: function(nextDescriptor, container, callback) { + render: function(nextElement, container, callback) { ("production" !== "development" ? invariant( - ReactDescriptor.isValidDescriptor(nextDescriptor), - 'renderComponent(): Invalid component descriptor.%s', + ReactElement.isValidElement(nextElement), + 'renderComponent(): Invalid component element.%s', ( - ReactDescriptor.isValidFactory(nextDescriptor) ? + typeof nextElement === 'string' ? + ' Instead of passing an element string, make sure to instantiate ' + + 'it by passing it to React.createElement.' : + ReactLegacyElement.isValidFactory(nextElement) ? ' Instead of passing a component class, make sure to instantiate ' + - 'it first by calling it with props.' : - // Check if it quacks like a descriptor - typeof nextDescriptor.props !== "undefined" ? + 'it by passing it to React.createElement.' : + // Check if it quacks like a element + typeof nextElement.props !== "undefined" ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '' ) - ) : invariant(ReactDescriptor.isValidDescriptor(nextDescriptor))); + ) : invariant(ReactElement.isValidElement(nextElement))); var prevComponent = instancesByReactRootID[getReactRootID(container)]; if (prevComponent) { - var prevDescriptor = prevComponent._descriptor; - if (shouldUpdateReactComponent(prevDescriptor, nextDescriptor)) { + var prevElement = prevComponent._currentElement; + if (shouldUpdateReactComponent(prevElement, nextElement)) { return ReactMount._updateRootComponent( prevComponent, - nextDescriptor, + nextElement, container, callback ); @@ -27699,7 +27817,7 @@ var ReactMount = { var shouldReuseMarkup = containerHasReactMarkup && !prevComponent; var component = ReactMount._renderNewRootComponent( - nextDescriptor, + nextElement, container, shouldReuseMarkup ); @@ -27717,7 +27835,8 @@ var ReactMount = { * @return {ReactComponent} Component instance rendered in `container`. */ constructAndRenderComponent: function(constructor, props, container) { - return ReactMount.renderComponent(constructor(props), container); + var element = createElement(constructor, props); + return ReactMount.render(element, container); }, /** @@ -27976,9 +28095,10 @@ var ReactMount = { false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + - 'usually due to forgetting a <tbody> when using tables, nesting <p> ' + - 'or <a> tags, or using non-SVG elements in an <svg> parent. Try ' + - 'inspecting the child nodes of the element with React ID `%s`.', + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + + 'parent. ' + + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode) ) : invariant(false)); @@ -28000,23 +28120,25 @@ var ReactMount = { purgeID: purgeID }; +// Deprecations (remove for 0.13) +ReactMount.renderComponent = deprecated( + 'ReactMount', + 'renderComponent', + 'render', + this, + ReactMount.render +); + module.exports = ReactMount; -},{"./DOMProperty":11,"./ReactBrowserEventEmitter":31,"./ReactCurrentOwner":40,"./ReactDescriptor":56,"./ReactInstanceHandles":64,"./ReactPerf":71,"./containsNode":109,"./getReactRootElementInContainer":128,"./instantiateReactComponent":133,"./invariant":134,"./shouldUpdateReactComponent":154,"./warning":158}],68:[function(_dereq_,module,exports){ +},{"./DOMProperty":12,"./ReactBrowserEventEmitter":33,"./ReactCurrentOwner":42,"./ReactElement":58,"./ReactInstanceHandles":66,"./ReactLegacyElement":67,"./ReactPerf":75,"./containsNode":114,"./deprecated":120,"./getReactRootElementInContainer":134,"./instantiateReactComponent":139,"./invariant":140,"./shouldUpdateReactComponent":156,"./warning":160}],71:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactMultiChild * @typechecks static-only @@ -28200,7 +28322,7 @@ var ReactMultiChild = { if (children.hasOwnProperty(name)) { // The rendered children must be turned into instances as they're // mounted. - var childInstance = instantiateReactComponent(child); + var childInstance = instantiateReactComponent(child, null); children[name] = childInstance; // Inlined for performance, see `ReactInstanceHandles.createReactID`. var rootID = this._rootNodeID + name; @@ -28291,12 +28413,12 @@ var ReactMultiChild = { continue; } var prevChild = prevChildren && prevChildren[name]; - var prevDescriptor = prevChild && prevChild._descriptor; - var nextDescriptor = nextChildren[name]; - if (shouldUpdateReactComponent(prevDescriptor, nextDescriptor)) { + var prevElement = prevChild && prevChild._currentElement; + var nextElement = nextChildren[name]; + if (shouldUpdateReactComponent(prevElement, nextElement)) { this.moveChild(prevChild, nextIndex, lastIndex); lastIndex = Math.max(prevChild._mountIndex, lastIndex); - prevChild.receiveComponent(nextDescriptor, transaction); + prevChild.receiveComponent(nextElement, transaction); prevChild._mountIndex = nextIndex; } else { if (prevChild) { @@ -28305,7 +28427,10 @@ var ReactMultiChild = { this._unmountChildByName(prevChild, name); } // The child must be instantiated before it's mounted. - var nextChildInstance = instantiateReactComponent(nextDescriptor); + var nextChildInstance = instantiateReactComponent( + nextElement, + null + ); this._mountChildByNameAtIndex( nextChildInstance, name, nextIndex, transaction ); @@ -28434,21 +28559,14 @@ var ReactMultiChild = { module.exports = ReactMultiChild; -},{"./ReactComponent":35,"./ReactMultiChildUpdateTypes":69,"./flattenChildren":119,"./instantiateReactComponent":133,"./shouldUpdateReactComponent":154}],69:[function(_dereq_,module,exports){ +},{"./ReactComponent":37,"./ReactMultiChildUpdateTypes":72,"./flattenChildren":124,"./instantiateReactComponent":139,"./shouldUpdateReactComponent":156}],72:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactMultiChildUpdateTypes */ @@ -28474,21 +28592,85 @@ var ReactMultiChildUpdateTypes = keyMirror({ module.exports = ReactMultiChildUpdateTypes; -},{"./keyMirror":140}],70:[function(_dereq_,module,exports){ +},{"./keyMirror":146}],73:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule ReactNativeComponent + */ + +"use strict"; + +var assign = _dereq_("./Object.assign"); +var invariant = _dereq_("./invariant"); + +var genericComponentClass = null; +// This registry keeps track of wrapper classes around native tags +var tagToComponentClass = {}; + +var ReactNativeComponentInjection = { + // This accepts a class that receives the tag string. This is a catch all + // that can render any kind of tag. + injectGenericComponentClass: function(componentClass) { + genericComponentClass = componentClass; + }, + // This accepts a keyed object with classes as values. Each key represents a + // tag. That particular tag will use this class instead of the generic one. + injectComponentClasses: function(componentClasses) { + assign(tagToComponentClass, componentClasses); + } +}; + +/** + * Create an internal class for a specific tag. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * @param {string} tag The tag for which to create an internal instance. + * @param {any} props The props passed to the instance constructor. + * @return {ReactComponent} component The injected empty component. + */ +function createInstanceForTag(tag, props, parentType) { + var componentClass = tagToComponentClass[tag]; + if (componentClass == null) { + ("production" !== "development" ? invariant( + genericComponentClass, + 'There is no registered component for the tag %s', + tag + ) : invariant(genericComponentClass)); + return new genericComponentClass(tag, props); + } + if (parentType === tag) { + // Avoid recursion + ("production" !== "development" ? invariant( + genericComponentClass, + 'There is no registered component for the tag %s', + tag + ) : invariant(genericComponentClass)); + return new genericComponentClass(tag, props); + } + // Unwrap legacy factories + return new componentClass.type(props); +} + +var ReactNativeComponent = { + createInstanceForTag: createInstanceForTag, + injection: ReactNativeComponentInjection +}; + +module.exports = ReactNativeComponent; + +},{"./Object.assign":29,"./invariant":140}],74:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactOwner */ @@ -28635,21 +28817,14 @@ var ReactOwner = { module.exports = ReactOwner; -},{"./emptyObject":117,"./invariant":134}],71:[function(_dereq_,module,exports){ +},{"./emptyObject":122,"./invariant":140}],75:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactPerf * @typechecks static-only @@ -28685,7 +28860,7 @@ var ReactPerf = { measure: function(objName, fnName, func) { if ("production" !== "development") { var measuredFunc = null; - return function() { + var wrapper = function() { if (ReactPerf.enableMeasure) { if (!measuredFunc) { measuredFunc = ReactPerf.storedMeasure(objName, fnName, func); @@ -28694,6 +28869,8 @@ var ReactPerf = { } return func.apply(this, arguments); }; + wrapper.displayName = objName + '_' + fnName; + return wrapper; } return func; }, @@ -28722,31 +28899,27 @@ function _noMeasure(objName, fnName, func) { module.exports = ReactPerf; -},{}],72:[function(_dereq_,module,exports){ +},{}],76:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 = _dereq_("./Object.assign"); var emptyFunction = _dereq_("./emptyFunction"); var invariant = _dereq_("./invariant"); var joinClasses = _dereq_("./joinClasses"); -var merge = _dereq_("./merge"); +var warning = _dereq_("./warning"); + +var didWarn = false; /** * Creates a transfer strategy that will merge prop values using the supplied @@ -28769,7 +28942,7 @@ 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 merge(b, a); + return assign({}, b, a); }); /** @@ -28787,14 +28960,6 @@ var TransferStrategies = { */ className: createTransferStrategy(joinClasses), /** - * Never transfer the `key` prop. - */ - key: emptyFunction, - /** - * Never transfer the `ref` prop. - */ - ref: emptyFunction, - /** * Transfer the `style` prop (which is an object) by merging them. */ style: transferStrategyMerge @@ -28843,7 +29008,7 @@ var ReactPropTransferer = { * @return {object} a new object containing both sets of props merged. */ mergeProps: function(oldProps, newProps) { - return transferInto(merge(oldProps), newProps); + return transferInto(assign({}, oldProps), newProps); }, /** @@ -28859,26 +29024,39 @@ var ReactPropTransferer = { * * This is usually used to pass down props to a returned root component. * - * @param {ReactDescriptor} descriptor Component receiving the properties. - * @return {ReactDescriptor} The supplied `component`. + * @param {ReactElement} element Component receiving the properties. + * @return {ReactElement} The supplied `component`. * @final * @protected */ - transferPropsTo: function(descriptor) { + transferPropsTo: function(element) { ("production" !== "development" ? invariant( - descriptor._owner === this, + element._owner === this, '%s: You can\'t call transferPropsTo() on a component that you ' + 'don\'t own, %s. This usually means you are calling ' + 'transferPropsTo() on a component passed in as props or children.', this.constructor.displayName, - descriptor.type.displayName - ) : invariant(descriptor._owner === this)); + typeof element.type === 'string' ? + element.type : + element.type.displayName + ) : invariant(element._owner === this)); + + if ("production" !== "development") { + if (!didWarn) { + didWarn = true; + ("production" !== "development" ? warning( + false, + 'transferPropsTo is deprecated. ' + + 'See http://fb.me/react-transferpropsto for more information.' + ) : null); + } + } - // Because descriptors are immutable we have to merge into the existing + // Because elements are immutable we have to merge into the existing // props object rather than clone it. - transferInto(descriptor.props, this.props); + transferInto(element.props, this.props); - return descriptor; + return element; } } @@ -28886,21 +29064,14 @@ var ReactPropTransferer = { module.exports = ReactPropTransferer; -},{"./emptyFunction":116,"./invariant":134,"./joinClasses":139,"./merge":144}],73:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./emptyFunction":121,"./invariant":140,"./joinClasses":145,"./warning":160}],77:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactPropTypeLocationNames */ @@ -28919,21 +29090,14 @@ if ("production" !== "development") { module.exports = ReactPropTypeLocationNames; -},{}],74:[function(_dereq_,module,exports){ +},{}],78:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactPropTypeLocations */ @@ -28950,30 +29114,24 @@ var ReactPropTypeLocations = keyMirror({ module.exports = ReactPropTypeLocations; -},{"./keyMirror":140}],75:[function(_dereq_,module,exports){ +},{"./keyMirror":146}],79:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactPropTypes */ "use strict"; -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); var ReactPropTypeLocationNames = _dereq_("./ReactPropTypeLocationNames"); +var deprecated = _dereq_("./deprecated"); var emptyFunction = _dereq_("./emptyFunction"); /** @@ -29025,6 +29183,9 @@ var emptyFunction = _dereq_("./emptyFunction"); var ANONYMOUS = '<<anonymous>>'; +var elementTypeChecker = createElementTypeChecker(); +var nodeTypeChecker = createNodeChecker(); + var ReactPropTypes = { array: createPrimitiveTypeChecker('array'), bool: createPrimitiveTypeChecker('boolean'), @@ -29035,13 +29196,28 @@ var ReactPropTypes = { any: createAnyTypeChecker(), arrayOf: createArrayOfTypeChecker, - component: createComponentTypeChecker(), + element: elementTypeChecker, instanceOf: createInstanceTypeChecker, + node: nodeTypeChecker, objectOf: createObjectOfTypeChecker, oneOf: createEnumTypeChecker, oneOfType: createUnionTypeChecker, - renderable: createRenderableTypeChecker(), - shape: createShapeTypeChecker + shape: createShapeTypeChecker, + + component: deprecated( + 'React.PropTypes', + 'component', + 'element', + this, + elementTypeChecker + ), + renderable: deprecated( + 'React.PropTypes', + 'renderable', + 'node', + this, + nodeTypeChecker + ) }; function createChainableTypeChecker(validate) { @@ -29111,13 +29287,13 @@ function createArrayOfTypeChecker(typeChecker) { return createChainableTypeChecker(validate); } -function createComponentTypeChecker() { +function createElementTypeChecker() { function validate(props, propName, componentName, location) { - if (!ReactDescriptor.isValidDescriptor(props[propName])) { + if (!ReactElement.isValidElement(props[propName])) { var locationName = ReactPropTypeLocationNames[location]; return new Error( ("Invalid " + locationName + " `" + propName + "` supplied to ") + - ("`" + componentName + "`, expected a React component.") + ("`" + componentName + "`, expected a ReactElement.") ); } } @@ -29198,13 +29374,13 @@ function createUnionTypeChecker(arrayOfTypeCheckers) { return createChainableTypeChecker(validate); } -function createRenderableTypeChecker() { +function createNodeChecker() { function validate(props, propName, componentName, location) { - if (!isRenderable(props[propName])) { + if (!isNode(props[propName])) { var locationName = ReactPropTypeLocationNames[location]; return new Error( ("Invalid " + locationName + " `" + propName + "` supplied to ") + - ("`" + componentName + "`, expected a renderable prop.") + ("`" + componentName + "`, expected a ReactNode.") ); } } @@ -29236,11 +29412,8 @@ function createShapeTypeChecker(shapeTypes) { return createChainableTypeChecker(validate, 'expected `object`'); } -function isRenderable(propValue) { +function isNode(propValue) { switch(typeof propValue) { - // TODO: this was probably written with the assumption that we're not - // returning `this.props.component` directly from `render`. This is - // currently not supported but we should, to make it consistent. case 'number': case 'string': return true; @@ -29248,13 +29421,13 @@ function isRenderable(propValue) { return !propValue; case 'object': if (Array.isArray(propValue)) { - return propValue.every(isRenderable); + return propValue.every(isNode); } - if (ReactDescriptor.isValidDescriptor(propValue)) { + if (ReactElement.isValidElement(propValue)) { return true; } for (var k in propValue) { - if (!isRenderable(propValue[k])) { + if (!isNode(propValue[k])) { return false; } } @@ -29295,21 +29468,14 @@ function getPreciseType(propValue) { module.exports = ReactPropTypes; -},{"./ReactDescriptor":56,"./ReactPropTypeLocationNames":73,"./emptyFunction":116}],76:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./ReactPropTypeLocationNames":77,"./deprecated":120,"./emptyFunction":121}],80:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactPutListenerQueue */ @@ -29319,13 +29485,13 @@ module.exports = ReactPropTypes; var PooledClass = _dereq_("./PooledClass"); var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter"); -var mixInto = _dereq_("./mixInto"); +var assign = _dereq_("./Object.assign"); function ReactPutListenerQueue() { this.listenersToPut = []; } -mixInto(ReactPutListenerQueue, { +assign(ReactPutListenerQueue.prototype, { enqueuePutListener: function(rootNodeID, propKey, propValue) { this.listenersToPut.push({ rootNodeID: rootNodeID, @@ -29358,21 +29524,14 @@ PooledClass.addPoolingTo(ReactPutListenerQueue); module.exports = ReactPutListenerQueue; -},{"./PooledClass":28,"./ReactBrowserEventEmitter":31,"./mixInto":147}],77:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./PooledClass":30,"./ReactBrowserEventEmitter":33}],81:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactReconcileTransaction * @typechecks static-only @@ -29387,7 +29546,7 @@ var ReactInputSelection = _dereq_("./ReactInputSelection"); var ReactPutListenerQueue = _dereq_("./ReactPutListenerQueue"); var Transaction = _dereq_("./Transaction"); -var mixInto = _dereq_("./mixInto"); +var assign = _dereq_("./Object.assign"); /** * Ensures that, when possible, the selection range (currently selected text @@ -29535,28 +29694,20 @@ var Mixin = { }; -mixInto(ReactReconcileTransaction, Transaction.Mixin); -mixInto(ReactReconcileTransaction, Mixin); +assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin); PooledClass.addPoolingTo(ReactReconcileTransaction); module.exports = ReactReconcileTransaction; -},{"./CallbackQueue":6,"./PooledClass":28,"./ReactBrowserEventEmitter":31,"./ReactInputSelection":63,"./ReactPutListenerQueue":76,"./Transaction":104,"./mixInto":147}],78:[function(_dereq_,module,exports){ +},{"./CallbackQueue":7,"./Object.assign":29,"./PooledClass":30,"./ReactBrowserEventEmitter":33,"./ReactInputSelection":65,"./ReactPutListenerQueue":80,"./Transaction":107}],82:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactRootIndex * @typechecks @@ -29580,28 +29731,21 @@ var ReactRootIndex = { module.exports = ReactRootIndex; -},{}],79:[function(_dereq_,module,exports){ +},{}],83:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in 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 ReactServerRendering */ "use strict"; -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); var ReactInstanceHandles = _dereq_("./ReactInstanceHandles"); var ReactMarkupChecksum = _dereq_("./ReactMarkupChecksum"); var ReactServerRenderingTransaction = @@ -29611,20 +29755,14 @@ var instantiateReactComponent = _dereq_("./instantiateReactComponent"); var invariant = _dereq_("./invariant"); /** - * @param {ReactComponent} component + * @param {ReactElement} element * @return {string} the HTML markup */ -function renderComponentToString(component) { - ("production" !== "development" ? invariant( - ReactDescriptor.isValidDescriptor(component), - 'renderComponentToString(): You must pass a valid ReactComponent.' - ) : invariant(ReactDescriptor.isValidDescriptor(component))); - +function renderToString(element) { ("production" !== "development" ? invariant( - !(arguments.length === 2 && typeof arguments[1] === 'function'), - 'renderComponentToString(): This function became synchronous and now ' + - 'returns the generated markup. Please remove the second parameter.' - ) : invariant(!(arguments.length === 2 && typeof arguments[1] === 'function'))); + ReactElement.isValidElement(element), + 'renderToString(): You must pass a valid ReactElement.' + ) : invariant(ReactElement.isValidElement(element))); var transaction; try { @@ -29632,7 +29770,7 @@ function renderComponentToString(component) { transaction = ReactServerRenderingTransaction.getPooled(false); return transaction.perform(function() { - var componentInstance = instantiateReactComponent(component); + var componentInstance = instantiateReactComponent(element, null); var markup = componentInstance.mountComponent(id, transaction, 0); return ReactMarkupChecksum.addChecksumToMarkup(markup); }, null); @@ -29642,15 +29780,15 @@ function renderComponentToString(component) { } /** - * @param {ReactComponent} component + * @param {ReactElement} element * @return {string} the HTML markup, without the extra React ID and checksum -* (for generating static pages) + * (for generating static pages) */ -function renderComponentToStaticMarkup(component) { +function renderToStaticMarkup(element) { ("production" !== "development" ? invariant( - ReactDescriptor.isValidDescriptor(component), - 'renderComponentToStaticMarkup(): You must pass a valid ReactComponent.' - ) : invariant(ReactDescriptor.isValidDescriptor(component))); + ReactElement.isValidElement(element), + 'renderToStaticMarkup(): You must pass a valid ReactElement.' + ) : invariant(ReactElement.isValidElement(element))); var transaction; try { @@ -29658,7 +29796,7 @@ function renderComponentToStaticMarkup(component) { transaction = ReactServerRenderingTransaction.getPooled(true); return transaction.perform(function() { - var componentInstance = instantiateReactComponent(component); + var componentInstance = instantiateReactComponent(element, null); return componentInstance.mountComponent(id, transaction, 0); }, null); } finally { @@ -29667,25 +29805,18 @@ function renderComponentToStaticMarkup(component) { } module.exports = { - renderComponentToString: renderComponentToString, - renderComponentToStaticMarkup: renderComponentToStaticMarkup + renderToString: renderToString, + renderToStaticMarkup: renderToStaticMarkup }; -},{"./ReactDescriptor":56,"./ReactInstanceHandles":64,"./ReactMarkupChecksum":66,"./ReactServerRenderingTransaction":80,"./instantiateReactComponent":133,"./invariant":134}],80:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./ReactInstanceHandles":66,"./ReactMarkupChecksum":69,"./ReactServerRenderingTransaction":84,"./instantiateReactComponent":139,"./invariant":140}],84:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactServerRenderingTransaction * @typechecks @@ -29698,8 +29829,8 @@ var CallbackQueue = _dereq_("./CallbackQueue"); var ReactPutListenerQueue = _dereq_("./ReactPutListenerQueue"); var Transaction = _dereq_("./Transaction"); +var assign = _dereq_("./Object.assign"); var emptyFunction = _dereq_("./emptyFunction"); -var mixInto = _dereq_("./mixInto"); /** * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks @@ -29781,28 +29912,24 @@ var Mixin = { }; -mixInto(ReactServerRenderingTransaction, Transaction.Mixin); -mixInto(ReactServerRenderingTransaction, Mixin); +assign( + ReactServerRenderingTransaction.prototype, + Transaction.Mixin, + Mixin +); PooledClass.addPoolingTo(ReactServerRenderingTransaction); module.exports = ReactServerRenderingTransaction; -},{"./CallbackQueue":6,"./PooledClass":28,"./ReactPutListenerQueue":76,"./Transaction":104,"./emptyFunction":116,"./mixInto":147}],81:[function(_dereq_,module,exports){ +},{"./CallbackQueue":7,"./Object.assign":29,"./PooledClass":30,"./ReactPutListenerQueue":80,"./Transaction":107,"./emptyFunction":121}],85:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 */ @@ -29901,21 +30028,14 @@ ReactStateSetters.Mixin = { module.exports = ReactStateSetters; -},{}],82:[function(_dereq_,module,exports){ +},{}],86:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 */ @@ -29926,16 +30046,14 @@ var EventConstants = _dereq_("./EventConstants"); var EventPluginHub = _dereq_("./EventPluginHub"); var EventPropagators = _dereq_("./EventPropagators"); var React = _dereq_("./React"); -var ReactDescriptor = _dereq_("./ReactDescriptor"); -var ReactDOM = _dereq_("./ReactDOM"); +var ReactElement = _dereq_("./ReactElement"); var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter"); var ReactMount = _dereq_("./ReactMount"); var ReactTextComponent = _dereq_("./ReactTextComponent"); var ReactUpdates = _dereq_("./ReactUpdates"); var SyntheticEvent = _dereq_("./SyntheticEvent"); -var mergeInto = _dereq_("./mergeInto"); -var copyProperties = _dereq_("./copyProperties"); +var assign = _dereq_("./Object.assign"); var topLevelTypes = EventConstants.topLevelTypes; @@ -29958,16 +30076,16 @@ var ReactTestUtils = { // clean up, so we're going to stop honoring the name of this method // (and probably rename it eventually) if no problems arise. // document.documentElement.appendChild(div); - return React.renderComponent(instance, div); + return React.render(instance, div); }, - isDescriptor: function(descriptor) { - return ReactDescriptor.isValidDescriptor(descriptor); + isElement: function(element) { + return ReactElement.isValidElement(element); }, - isDescriptorOfType: function(inst, convenienceConstructor) { + isElementOfType: function(inst, convenienceConstructor) { return ( - ReactDescriptor.isValidDescriptor(inst) && + ReactElement.isValidElement(inst) && inst.type === convenienceConstructor.type ); }, @@ -29976,9 +30094,9 @@ var ReactTestUtils = { return !!(inst && inst.mountComponent && inst.tagName); }, - isDOMComponentDescriptor: function(inst) { + isDOMComponentElement: function(inst) { return !!(inst && - ReactDescriptor.isValidDescriptor(inst) && + ReactElement.isValidElement(inst) && !!inst.tagName); }, @@ -29992,8 +30110,8 @@ var ReactTestUtils = { (inst.constructor === type.type)); }, - isCompositeComponentDescriptor: function(inst) { - if (!ReactDescriptor.isValidDescriptor(inst)) { + isCompositeComponentElement: function(inst) { + if (!ReactElement.isValidElement(inst)) { return false; } // We check the prototype of the type that will get mounted, not the @@ -30005,8 +30123,8 @@ var ReactTestUtils = { ); }, - isCompositeComponentDescriptorWithType: function(inst, type) { - return !!(ReactTestUtils.isCompositeComponentDescriptor(inst) && + isCompositeComponentElementWithType: function(inst, type) { + return !!(ReactTestUtils.isCompositeComponentElement(inst) && (inst.constructor === type)); }, @@ -30142,16 +30260,23 @@ var ReactTestUtils = { * @return {object} the ReactTestUtils object (for chaining) */ mockComponent: function(module, mockTagName) { - var ConvenienceConstructor = React.createClass({ + mockTagName = mockTagName || module.mockTagName || "div"; + + var ConvenienceConstructor = React.createClass({displayName: 'ConvenienceConstructor', render: function() { - var mockTagName = mockTagName || module.mockTagName || "div"; - return ReactDOM[mockTagName](null, this.props.children); + return React.createElement( + mockTagName, + null, + this.props.children + ); } }); - copyProperties(module, ConvenienceConstructor); module.mockImplementation(ConvenienceConstructor); + module.type = ConvenienceConstructor.type; + module.isReactLegacyFactory = true; + return this; }, @@ -30226,7 +30351,7 @@ function makeSimulator(eventType) { ReactMount.getID(node), fakeNativeEvent ); - mergeInto(event, eventData); + assign(event, eventData); EventPropagators.accumulateTwoPhaseDispatches(event); ReactUpdates.batchedUpdates(function() { @@ -30282,7 +30407,7 @@ buildSimulators(); function makeNativeSimulator(eventType) { return function(domComponentOrNode, nativeEventData) { var fakeNativeEvent = new Event(eventType); - mergeInto(fakeNativeEvent, nativeEventData); + assign(fakeNativeEvent, nativeEventData); if (ReactTestUtils.isDOMComponent(domComponentOrNode)) { ReactTestUtils.simulateNativeEventOnDOMComponent( eventType, @@ -30315,21 +30440,14 @@ for (eventType in topLevelTypes) { module.exports = ReactTestUtils; -},{"./EventConstants":16,"./EventPluginHub":18,"./EventPropagators":21,"./React":29,"./ReactBrowserEventEmitter":31,"./ReactDOM":41,"./ReactDescriptor":56,"./ReactMount":67,"./ReactTextComponent":83,"./ReactUpdates":87,"./SyntheticEvent":96,"./copyProperties":110,"./mergeInto":146}],83:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPluginHub":19,"./EventPropagators":22,"./Object.assign":29,"./React":31,"./ReactBrowserEventEmitter":33,"./ReactElement":58,"./ReactMount":70,"./ReactTextComponent":87,"./ReactUpdates":91,"./SyntheticEvent":99}],87:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactTextComponent * @typechecks static-only @@ -30338,12 +30456,11 @@ module.exports = ReactTestUtils; "use strict"; var DOMPropertyOperations = _dereq_("./DOMPropertyOperations"); -var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactComponent = _dereq_("./ReactComponent"); -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); +var assign = _dereq_("./Object.assign"); var escapeTextForBrowser = _dereq_("./escapeTextForBrowser"); -var mixInto = _dereq_("./mixInto"); /** * Text nodes violate a couple assumptions that React makes about components: @@ -30360,13 +30477,11 @@ var mixInto = _dereq_("./mixInto"); * @extends ReactComponent * @internal */ -var ReactTextComponent = function(descriptor) { - this.construct(descriptor); +var ReactTextComponent = function(props) { + // This constructor and it's argument is currently used by mocks. }; -mixInto(ReactTextComponent, ReactComponent.Mixin); -mixInto(ReactTextComponent, ReactBrowserComponentMixin); -mixInto(ReactTextComponent, { +assign(ReactTextComponent.prototype, ReactComponent.Mixin, { /** * Creates the markup for this text node. This node is not intended to have @@ -30422,23 +30537,23 @@ mixInto(ReactTextComponent, { }); -module.exports = ReactDescriptor.createFactory(ReactTextComponent); +var ReactTextComponentFactory = function(text) { + // Bypass validation and configuration + return new ReactElement(ReactTextComponent, null, null, null, null, text); +}; + +ReactTextComponentFactory.type = ReactTextComponent; + +module.exports = ReactTextComponentFactory; -},{"./DOMPropertyOperations":12,"./ReactBrowserComponentMixin":30,"./ReactComponent":35,"./ReactDescriptor":56,"./escapeTextForBrowser":118,"./mixInto":147}],84:[function(_dereq_,module,exports){ +},{"./DOMPropertyOperations":13,"./Object.assign":29,"./ReactComponent":37,"./ReactElement":58,"./escapeTextForBrowser":123}],88:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in 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 @@ -30464,7 +30579,7 @@ var ReactTransitionChildMapping = { /** * When you're adding or removing children some may be added or removed in the - * same render pass. We want ot show *both* since we want to simultaneously + * 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 @@ -30532,21 +30647,14 @@ var ReactTransitionChildMapping = { module.exports = ReactTransitionChildMapping; -},{"./ReactChildren":34}],85:[function(_dereq_,module,exports){ +},{"./ReactChildren":36}],89:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 */ @@ -30650,21 +30758,14 @@ var ReactTransitionEvents = { module.exports = ReactTransitionEvents; -},{"./ExecutionEnvironment":22}],86:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23}],90:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 */ @@ -30674,21 +30775,21 @@ module.exports = ReactTransitionEvents; var React = _dereq_("./React"); var ReactTransitionChildMapping = _dereq_("./ReactTransitionChildMapping"); +var assign = _dereq_("./Object.assign"); var cloneWithProps = _dereq_("./cloneWithProps"); var emptyFunction = _dereq_("./emptyFunction"); -var merge = _dereq_("./merge"); var ReactTransitionGroup = React.createClass({ displayName: 'ReactTransitionGroup', propTypes: { - component: React.PropTypes.func, + component: React.PropTypes.any, childFactory: React.PropTypes.func }, getDefaultProps: function() { return { - component: React.DOM.span, + component: 'span', childFactory: emptyFunction.thatReturnsArgument }; }, @@ -30812,7 +30913,7 @@ var ReactTransitionGroup = React.createClass({ // This entered again before it fully left. Add it again. this.performEnter(key); } else { - var newChildren = merge(this.state.children); + var newChildren = assign({}, this.state.children); delete newChildren[key]; this.setState({children: newChildren}); } @@ -30836,27 +30937,24 @@ var ReactTransitionGroup = React.createClass({ ); } } - return this.transferPropsTo(this.props.component(null, childrenToRender)); + return React.createElement( + this.props.component, + this.props, + childrenToRender + ); } }); module.exports = ReactTransitionGroup; -},{"./React":29,"./ReactTransitionChildMapping":84,"./cloneWithProps":108,"./emptyFunction":116,"./merge":144}],87:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./React":31,"./ReactTransitionChildMapping":88,"./cloneWithProps":113,"./emptyFunction":121}],91:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactUpdates */ @@ -30869,11 +30967,13 @@ var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); var ReactPerf = _dereq_("./ReactPerf"); var Transaction = _dereq_("./Transaction"); +var assign = _dereq_("./Object.assign"); var invariant = _dereq_("./invariant"); -var mixInto = _dereq_("./mixInto"); var warning = _dereq_("./warning"); var dirtyComponents = []; +var asapCallbackQueue = CallbackQueue.getPooled(); +var asapEnqueued = false; var batchingStrategy = null; @@ -30918,13 +31018,14 @@ var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; function ReactUpdatesFlushTransaction() { this.reinitializeTransaction(); this.dirtyComponentsLength = null; - this.callbackQueue = CallbackQueue.getPooled(null); + this.callbackQueue = CallbackQueue.getPooled(); this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(); } -mixInto(ReactUpdatesFlushTransaction, Transaction.Mixin); -mixInto(ReactUpdatesFlushTransaction, { +assign( + ReactUpdatesFlushTransaction.prototype, + Transaction.Mixin, { getTransactionWrappers: function() { return TRANSACTION_WRAPPERS; }, @@ -31015,11 +31116,21 @@ var flushBatchedUpdates = ReactPerf.measure( // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents // array and perform any updates enqueued by mount-ready handlers (i.e., // componentDidUpdate) but we need to check here too in order to catch - // updates enqueued by setState callbacks. - while (dirtyComponents.length) { - var transaction = ReactUpdatesFlushTransaction.getPooled(); - transaction.perform(runBatchedUpdates, null, transaction); - ReactUpdatesFlushTransaction.release(transaction); + // updates enqueued by setState callbacks and asap calls. + while (dirtyComponents.length || asapEnqueued) { + if (dirtyComponents.length) { + var transaction = ReactUpdatesFlushTransaction.getPooled(); + transaction.perform(runBatchedUpdates, null, transaction); + ReactUpdatesFlushTransaction.release(transaction); + } + + if (asapEnqueued) { + asapEnqueued = false; + var queue = asapCallbackQueue; + asapCallbackQueue = CallbackQueue.getPooled(); + queue.notifyAll(); + CallbackQueue.release(queue); + } } } ); @@ -31066,6 +31177,20 @@ function enqueueUpdate(component, callback) { } } +/** + * Enqueue a callback to be run at the end of the current batching cycle. Throws + * if no updates are currently being performed. + */ +function asap(callback, context) { + ("production" !== "development" ? invariant( + batchingStrategy.isBatchingUpdates, + 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + + 'updates are not being batched.' + ) : invariant(batchingStrategy.isBatchingUpdates)); + asapCallbackQueue.enqueue(callback, context); + asapEnqueued = true; +} + var ReactUpdatesInjection = { injectReconcileTransaction: function(ReconcileTransaction) { ("production" !== "development" ? invariant( @@ -31104,84 +31229,20 @@ var ReactUpdates = { batchedUpdates: batchedUpdates, enqueueUpdate: enqueueUpdate, flushBatchedUpdates: flushBatchedUpdates, - injection: ReactUpdatesInjection + injection: ReactUpdatesInjection, + asap: asap }; module.exports = ReactUpdates; -},{"./CallbackQueue":6,"./PooledClass":28,"./ReactCurrentOwner":40,"./ReactPerf":71,"./Transaction":104,"./invariant":134,"./mixInto":147,"./warning":158}],88:[function(_dereq_,module,exports){ +},{"./CallbackQueue":7,"./Object.assign":29,"./PooledClass":30,"./ReactCurrentOwner":42,"./ReactPerf":75,"./Transaction":107,"./invariant":140,"./warning":160}],92:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule ReactWithAddons - */ - -/** - * This module exists purely in the open source project, and is meant as a way - * to create a separate standalone build of React. This build has "addons", or - * functionality we've built and think might be useful but doesn't have a good - * place to live inside React core. - */ - -"use strict"; - -var LinkedStateMixin = _dereq_("./LinkedStateMixin"); -var React = _dereq_("./React"); -var ReactComponentWithPureRenderMixin = - _dereq_("./ReactComponentWithPureRenderMixin"); -var ReactCSSTransitionGroup = _dereq_("./ReactCSSTransitionGroup"); -var ReactTransitionGroup = _dereq_("./ReactTransitionGroup"); - -var cx = _dereq_("./cx"); -var cloneWithProps = _dereq_("./cloneWithProps"); -var update = _dereq_("./update"); - -React.addons = { - CSSTransitionGroup: ReactCSSTransitionGroup, - LinkedStateMixin: LinkedStateMixin, - PureRenderMixin: ReactComponentWithPureRenderMixin, - TransitionGroup: ReactTransitionGroup, - - classSet: cx, - cloneWithProps: cloneWithProps, - update: update -}; - -if ("production" !== "development") { - React.addons.Perf = _dereq_("./ReactDefaultPerf"); - React.addons.TestUtils = _dereq_("./ReactTestUtils"); -} - -module.exports = React; - - -},{"./LinkedStateMixin":24,"./React":29,"./ReactCSSTransitionGroup":32,"./ReactComponentWithPureRenderMixin":37,"./ReactDefaultPerf":54,"./ReactTestUtils":82,"./ReactTransitionGroup":86,"./cloneWithProps":108,"./cx":114,"./update":157}],89:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SVGDOMPropertyConfig */ @@ -31266,21 +31327,14 @@ var SVGDOMPropertyConfig = { module.exports = SVGDOMPropertyConfig; -},{"./DOMProperty":11}],90:[function(_dereq_,module,exports){ +},{"./DOMProperty":12}],93:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SelectEventPlugin */ @@ -31338,6 +31392,14 @@ function getSelection(node) { start: node.selectionStart, end: node.selectionEnd }; + } else if (window.getSelection) { + var selection = window.getSelection(); + return { + anchorNode: selection.anchorNode, + anchorOffset: selection.anchorOffset, + focusNode: selection.focusNode, + focusOffset: selection.focusOffset + }; } else if (document.selection) { var range = document.selection.createRange(); return { @@ -31346,14 +31408,6 @@ function getSelection(node) { top: range.boundingTop, left: range.boundingLeft }; - } else { - var selection = window.getSelection(); - return { - anchorNode: selection.anchorNode, - anchorOffset: selection.anchorOffset, - focusNode: selection.focusNode, - focusOffset: selection.focusOffset - }; } } @@ -31468,21 +31522,14 @@ var SelectEventPlugin = { module.exports = SelectEventPlugin; -},{"./EventConstants":16,"./EventPropagators":21,"./ReactInputSelection":63,"./SyntheticEvent":96,"./getActiveElement":122,"./isTextInputElement":137,"./keyOf":141,"./shallowEqual":153}],91:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPropagators":22,"./ReactInputSelection":65,"./SyntheticEvent":99,"./getActiveElement":127,"./isTextInputElement":143,"./keyOf":147,"./shallowEqual":155}],94:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ServerReactRootIndex * @typechecks @@ -31506,21 +31553,14 @@ var ServerReactRootIndex = { module.exports = ServerReactRootIndex; -},{}],92:[function(_dereq_,module,exports){ +},{}],95:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SimpleEventPlugin */ @@ -31540,8 +31580,11 @@ var SyntheticTouchEvent = _dereq_("./SyntheticTouchEvent"); var SyntheticUIEvent = _dereq_("./SyntheticUIEvent"); var SyntheticWheelEvent = _dereq_("./SyntheticWheelEvent"); +var getEventCharCode = _dereq_("./getEventCharCode"); + var invariant = _dereq_("./invariant"); var keyOf = _dereq_("./keyOf"); +var warning = _dereq_("./warning"); var topLevelTypes = EventConstants.topLevelTypes; @@ -31808,7 +31851,7 @@ var SimpleEventPlugin = { /** * Same as the default implementation, except cancels the event when return - * value is false. + * value is false. This behavior will be disabled in a future release. * * @param {object} Event to be dispatched. * @param {function} Application-level callback. @@ -31816,6 +31859,14 @@ var SimpleEventPlugin = { */ executeDispatch: function(event, listener, domID) { var returnValue = EventPluginUtils.executeDispatch(event, listener, domID); + + ("production" !== "development" ? warning( + typeof returnValue !== 'boolean', + 'Returning `false` from an event handler is deprecated and will be ' + + 'ignored in a future release. Instead, manually call ' + + 'e.stopPropagation() or e.preventDefault(), as appropriate.' + ) : null); + if (returnValue === false) { event.stopPropagation(); event.preventDefault(); @@ -31852,8 +31903,9 @@ var SimpleEventPlugin = { break; case topLevelTypes.topKeyPress: // FireFox creates a keypress event for function keys too. This removes - // the unwanted keypress events. - if (nativeEvent.charCode === 0) { + // the unwanted keypress events. Enter is however both printable and + // non-printable. One would expect Tab to be as well (but it isn't). + if (getEventCharCode(nativeEvent) === 0) { return null; } /* falls through */ @@ -31927,21 +31979,14 @@ var SimpleEventPlugin = { module.exports = SimpleEventPlugin; -},{"./EventConstants":16,"./EventPluginUtils":20,"./EventPropagators":21,"./SyntheticClipboardEvent":93,"./SyntheticDragEvent":95,"./SyntheticEvent":96,"./SyntheticFocusEvent":97,"./SyntheticKeyboardEvent":99,"./SyntheticMouseEvent":100,"./SyntheticTouchEvent":101,"./SyntheticUIEvent":102,"./SyntheticWheelEvent":103,"./invariant":134,"./keyOf":141}],93:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPluginUtils":21,"./EventPropagators":22,"./SyntheticClipboardEvent":96,"./SyntheticDragEvent":98,"./SyntheticEvent":99,"./SyntheticFocusEvent":100,"./SyntheticKeyboardEvent":102,"./SyntheticMouseEvent":103,"./SyntheticTouchEvent":104,"./SyntheticUIEvent":105,"./SyntheticWheelEvent":106,"./getEventCharCode":128,"./invariant":140,"./keyOf":147,"./warning":160}],96:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticClipboardEvent * @typechecks static-only @@ -31980,21 +32025,14 @@ SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); module.exports = SyntheticClipboardEvent; -},{"./SyntheticEvent":96}],94:[function(_dereq_,module,exports){ +},{"./SyntheticEvent":99}],97:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticCompositionEvent * @typechecks static-only @@ -32033,21 +32071,14 @@ SyntheticEvent.augmentClass( module.exports = SyntheticCompositionEvent; -},{"./SyntheticEvent":96}],95:[function(_dereq_,module,exports){ +},{"./SyntheticEvent":99}],98:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticDragEvent * @typechecks static-only @@ -32079,21 +32110,14 @@ SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); module.exports = SyntheticDragEvent; -},{"./SyntheticMouseEvent":100}],96:[function(_dereq_,module,exports){ +},{"./SyntheticMouseEvent":103}],99:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticEvent * @typechecks static-only @@ -32103,10 +32127,9 @@ module.exports = SyntheticDragEvent; var PooledClass = _dereq_("./PooledClass"); +var assign = _dereq_("./Object.assign"); var emptyFunction = _dereq_("./emptyFunction"); var getEventTarget = _dereq_("./getEventTarget"); -var merge = _dereq_("./merge"); -var mergeInto = _dereq_("./mergeInto"); /** * @interface Event @@ -32173,7 +32196,7 @@ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) { this.isPropagationStopped = emptyFunction.thatReturnsFalse; } -mergeInto(SyntheticEvent.prototype, { +assign(SyntheticEvent.prototype, { preventDefault: function() { this.defaultPrevented = true; @@ -32231,11 +32254,11 @@ SyntheticEvent.augmentClass = function(Class, Interface) { var Super = this; var prototype = Object.create(Super.prototype); - mergeInto(prototype, Class.prototype); + assign(prototype, Class.prototype); Class.prototype = prototype; Class.prototype.constructor = Class; - Class.Interface = merge(Super.Interface, Interface); + Class.Interface = assign({}, Super.Interface, Interface); Class.augmentClass = Super.augmentClass; PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler); @@ -32245,21 +32268,14 @@ PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler); module.exports = SyntheticEvent; -},{"./PooledClass":28,"./emptyFunction":116,"./getEventTarget":125,"./merge":144,"./mergeInto":146}],97:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./PooledClass":30,"./emptyFunction":121,"./getEventTarget":131}],100:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticFocusEvent * @typechecks static-only @@ -32291,21 +32307,14 @@ SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); module.exports = SyntheticFocusEvent; -},{"./SyntheticUIEvent":102}],98:[function(_dereq_,module,exports){ +},{"./SyntheticUIEvent":105}],101:[function(_dereq_,module,exports){ /** * Copyright 2013 Facebook, Inc. + * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticInputEvent * @typechecks static-only @@ -32345,21 +32354,14 @@ SyntheticEvent.augmentClass( module.exports = SyntheticInputEvent; -},{"./SyntheticEvent":96}],99:[function(_dereq_,module,exports){ +},{"./SyntheticEvent":99}],102:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticKeyboardEvent * @typechecks static-only @@ -32369,6 +32371,7 @@ module.exports = SyntheticInputEvent; var SyntheticUIEvent = _dereq_("./SyntheticUIEvent"); +var getEventCharCode = _dereq_("./getEventCharCode"); var getEventKey = _dereq_("./getEventKey"); var getEventModifierState = _dereq_("./getEventModifierState"); @@ -32391,11 +32394,10 @@ var KeyboardEventInterface = { // `charCode` is the result of a KeyPress event and represents the value of // the actual printable character. - // KeyPress is deprecated but its replacement is not yet final and not - // implemented in any major browser. + // KeyPress is deprecated, but its replacement is not yet final and not + // implemented in any major browser. Only KeyPress has charCode. if (event.type === 'keypress') { - // IE8 does not implement "charCode", but "keyCode" has the correct value. - return 'charCode' in event ? event.charCode : event.keyCode; + return getEventCharCode(event); } return 0; }, @@ -32414,9 +32416,14 @@ var KeyboardEventInterface = { }, which: function(event) { // `which` is an alias for either `keyCode` or `charCode` depending on the - // type of the event. There is no need to determine the type of the event - // as `keyCode` and `charCode` are either aliased or default to zero. - return event.keyCode || event.charCode; + // type of the event. + if (event.type === 'keypress') { + return getEventCharCode(event); + } + if (event.type === 'keydown' || event.type === 'keyup') { + return event.keyCode; + } + return 0; } }; @@ -32434,21 +32441,14 @@ SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); module.exports = SyntheticKeyboardEvent; -},{"./SyntheticUIEvent":102,"./getEventKey":123,"./getEventModifierState":124}],100:[function(_dereq_,module,exports){ +},{"./SyntheticUIEvent":105,"./getEventCharCode":128,"./getEventKey":129,"./getEventModifierState":130}],103:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticMouseEvent * @typechecks static-only @@ -32524,21 +32524,14 @@ SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); module.exports = SyntheticMouseEvent; -},{"./SyntheticUIEvent":102,"./ViewportMetrics":105,"./getEventModifierState":124}],101:[function(_dereq_,module,exports){ +},{"./SyntheticUIEvent":105,"./ViewportMetrics":108,"./getEventModifierState":130}],104:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticTouchEvent * @typechecks static-only @@ -32579,21 +32572,14 @@ SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); module.exports = SyntheticTouchEvent; -},{"./SyntheticUIEvent":102,"./getEventModifierState":124}],102:[function(_dereq_,module,exports){ +},{"./SyntheticUIEvent":105,"./getEventModifierState":130}],105:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticUIEvent * @typechecks static-only @@ -32648,21 +32634,14 @@ SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); module.exports = SyntheticUIEvent; -},{"./SyntheticEvent":96,"./getEventTarget":125}],103:[function(_dereq_,module,exports){ +},{"./SyntheticEvent":99,"./getEventTarget":131}],106:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticWheelEvent * @typechecks static-only @@ -32716,21 +32695,14 @@ SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); module.exports = SyntheticWheelEvent; -},{"./SyntheticMouseEvent":100}],104:[function(_dereq_,module,exports){ +},{"./SyntheticMouseEvent":103}],107:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule Transaction */ @@ -32962,21 +32934,14 @@ var Transaction = { module.exports = Transaction; -},{"./invariant":134}],105:[function(_dereq_,module,exports){ +},{"./invariant":140}],108:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ViewportMetrics */ @@ -33001,23 +32966,16 @@ var ViewportMetrics = { module.exports = ViewportMetrics; -},{"./getUnboundedScrollPosition":130}],106:[function(_dereq_,module,exports){ +},{"./getUnboundedScrollPosition":136}],109:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule accumulate + * @providesModule accumulateInto */ "use strict"; @@ -33025,53 +32983,61 @@ module.exports = ViewportMetrics; var invariant = _dereq_("./invariant"); /** - * Accumulates items that must not be null or undefined. * - * This is used to conserve memory by avoiding array allocations. + * Accumulates items that must not be null or undefined into the first one. This + * is used to conserve memory by avoiding array allocations, and thus sacrifices + * API cleanness. Since `current` can be null before being passed in and not + * null after this function, make sure to assign it back to `current`: + * + * `a = accumulateInto(a, b);` + * + * This API should be sparingly used. Try `accumulate` for something cleaner. * * @return {*|array<*>} An accumulation of items. */ -function accumulate(current, next) { + +function accumulateInto(current, next) { ("production" !== "development" ? invariant( next != null, - 'accumulate(...): Accumulated items must be not be null or undefined.' + 'accumulateInto(...): Accumulated items must not be null or undefined.' ) : invariant(next != null)); if (current == null) { return next; - } else { - // Both are not empty. Warning: Never call x.concat(y) when you are not - // certain that x is an Array (x could be a string with concat method). - var currentIsArray = Array.isArray(current); - var nextIsArray = Array.isArray(next); - if (currentIsArray) { - return current.concat(next); - } else { - if (nextIsArray) { - return [current].concat(next); - } else { - return [current, next]; - } - } } + + // Both are not empty. Warning: Never call x.concat(y) when you are not + // certain that x is an Array (x could be a string with concat method). + var currentIsArray = Array.isArray(current); + var nextIsArray = Array.isArray(next); + + if (currentIsArray && nextIsArray) { + current.push.apply(current, next); + return current; + } + + if (currentIsArray) { + current.push(next); + return current; + } + + if (nextIsArray) { + // A bit too dangerous to mutate `next`. + return [current].concat(next); + } + + return [current, next]; } -module.exports = accumulate; +module.exports = accumulateInto; -},{"./invariant":134}],107:[function(_dereq_,module,exports){ +},{"./invariant":140}],110:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule adler32 */ @@ -33084,7 +33050,7 @@ var MOD = 65521; // This is a clean-room implementation of adler32 designed for detecting // if markup is not what we expect it to be. It does not need to be -// cryptographically strong, only reasonable good at detecting if markup +// cryptographically strong, only reasonably good at detecting if markup // generated on the server is different than that on the client. function adler32(data) { var a = 1; @@ -33098,21 +33064,88 @@ function adler32(data) { module.exports = adler32; -},{}],108:[function(_dereq_,module,exports){ +},{}],111:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule camelize + * @typechecks + */ + +var _hyphenPattern = /-(.)/g; + +/** + * Camelcases a hyphenated string, for example: * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * > camelize('background-color') + * < "backgroundColor" + * + * @param {string} string + * @return {string} + */ +function camelize(string) { + return string.replace(_hyphenPattern, function(_, character) { + return character.toUpperCase(); + }); +} + +module.exports = camelize; + +},{}],112:[function(_dereq_,module,exports){ +/** + * Copyright 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule camelizeStyleName + * @typechecks + */ + +"use strict"; + +var camelize = _dereq_("./camelize"); + +var msPattern = /^-ms-/; + +/** + * Camelcases a hyphenated CSS property name, for example: + * + * > camelizeStyleName('background-color') + * < "backgroundColor" + * > camelizeStyleName('-moz-transition') + * < "MozTransition" + * > camelizeStyleName('-ms-transition') + * < "msTransition" + * + * As Andi Smith suggests + * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix + * is converted to lowercase `ms`. + * + * @param {string} string + * @return {string} + */ +function camelizeStyleName(string) { + return camelize(string.replace(msPattern, 'ms-')); +} + +module.exports = camelizeStyleName; + +},{"./camelize":111}],113:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in 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 cloneWithProps @@ -33120,6 +33153,7 @@ module.exports = adler32; "use strict"; +var ReactElement = _dereq_("./ReactElement"); var ReactPropTransferer = _dereq_("./ReactPropTransferer"); var keyOf = _dereq_("./keyOf"); @@ -33139,7 +33173,7 @@ var CHILDREN_PROP = keyOf({children: null}); function cloneWithProps(child, props) { if ("production" !== "development") { ("production" !== "development" ? warning( - !child.props.ref, + !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.' @@ -33155,27 +33189,20 @@ function cloneWithProps(child, props) { } // The current API doesn't retain _owner and _context, which is why this - // doesn't use ReactDescriptor.cloneAndReplaceProps. - return child.constructor(newProps); + // doesn't use ReactElement.cloneAndReplaceProps. + return ReactElement.createElement(child.type, newProps); } module.exports = cloneWithProps; -},{"./ReactPropTransferer":72,"./keyOf":141,"./warning":158}],109:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./ReactPropTransferer":76,"./keyOf":147,"./warning":160}],114:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule containsNode * @typechecks @@ -33212,77 +33239,14 @@ function containsNode(outerNode, innerNode) { module.exports = containsNode; -},{"./isTextNode":138}],110:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule copyProperties - */ - -/** - * Copy properties from one or more objects (up to 5) into the first object. - * This is a shallow copy. It mutates the first object and also returns it. - * - * NOTE: `arguments` has a very significant performance penalty, which is why - * we don't support unlimited arguments. - */ -function copyProperties(obj, a, b, c, d, e, f) { - obj = obj || {}; - - if ("production" !== "development") { - if (f) { - throw new Error('Too many arguments passed to copyProperties'); - } - } - - var args = [a, b, c, d, e]; - var ii = 0, v; - while (args[ii]) { - v = args[ii++]; - for (var k in v) { - obj[k] = v[k]; - } - - // IE ignores toString in object iteration.. See: - // webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html - if (v.hasOwnProperty && v.hasOwnProperty('toString') && - (typeof v.toString != 'undefined') && (obj.toString !== v.toString)) { - obj.toString = v.toString; - } - } - - return obj; -} - -module.exports = copyProperties; - -},{}],111:[function(_dereq_,module,exports){ +},{"./isTextNode":144}],115:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule createArrayFrom * @typechecks @@ -33361,21 +33325,14 @@ function createArrayFrom(obj) { module.exports = createArrayFrom; -},{"./toArray":155}],112:[function(_dereq_,module,exports){ +},{"./toArray":157}],116:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule createFullPageComponent * @typechecks @@ -33385,6 +33342,7 @@ module.exports = createArrayFrom; // Defeat circular references by requiring this directly. var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var invariant = _dereq_("./invariant"); @@ -33396,14 +33354,14 @@ var invariant = _dereq_("./invariant"); * take advantage of React's reconciliation for styling and <title> * management. So we just document it and throw in dangerous cases. * - * @param {function} componentClass convenience constructor to wrap + * @param {string} tag The tag to wrap * @return {function} convenience constructor of new component */ -function createFullPageComponent(componentClass) { +function createFullPageComponent(tag) { + var elementFactory = ReactElement.createFactory(tag); + var FullPageComponent = ReactCompositeComponent.createClass({ - displayName: 'ReactFullPageComponent' + ( - componentClass.type.displayName || '' - ), + displayName: 'ReactFullPageComponent' + tag, componentWillUnmount: function() { ("production" !== "development" ? invariant( @@ -33417,7 +33375,7 @@ function createFullPageComponent(componentClass) { }, render: function() { - return this.transferPropsTo(componentClass(null, this.props.children)); + return elementFactory(this.props); } }); @@ -33426,21 +33384,14 @@ function createFullPageComponent(componentClass) { module.exports = createFullPageComponent; -},{"./ReactCompositeComponent":38,"./invariant":134}],113:[function(_dereq_,module,exports){ +},{"./ReactCompositeComponent":40,"./ReactElement":58,"./invariant":140}],117:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule createNodesFromMarkup * @typechecks @@ -33521,21 +33472,14 @@ function createNodesFromMarkup(markup, handleScript) { module.exports = createNodesFromMarkup; -},{"./ExecutionEnvironment":22,"./createArrayFrom":111,"./getMarkupWrap":126,"./invariant":134}],114:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23,"./createArrayFrom":115,"./getMarkupWrap":132,"./invariant":140}],118:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule cx */ @@ -33567,21 +33511,14 @@ function cx(classNames) { module.exports = cx; -},{}],115:[function(_dereq_,module,exports){ +},{}],119:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule dangerousStyleValue * @typechecks static-only @@ -33632,27 +33569,67 @@ function dangerousStyleValue(name, value) { module.exports = dangerousStyleValue; -},{"./CSSProperty":4}],116:[function(_dereq_,module,exports){ +},{"./CSSProperty":5}],120:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule deprecated + */ + +var assign = _dereq_("./Object.assign"); +var warning = _dereq_("./warning"); + +/** + * This will log a single deprecation notice per function and forward the call + * on to the new API. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * @param {string} namespace The namespace of the call, eg 'React' + * @param {string} oldName The old function name, eg 'renderComponent' + * @param {string} newName The new function name, eg 'render' + * @param {*} ctx The context this forwarded call should run in + * @param {function} fn The function to forward on to + * @return {*} Will be the value as returned from `fn` + */ +function deprecated(namespace, oldName, newName, ctx, fn) { + var warned = false; + if ("production" !== "development") { + var newFn = function() { + ("production" !== "development" ? warning( + warned, + (namespace + "." + oldName + " will be deprecated in a future version. ") + + ("Use " + namespace + "." + newName + " instead.") + ) : null); + warned = true; + return fn.apply(ctx, arguments); + }; + newFn.displayName = (namespace + "_" + oldName); + // 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; + +},{"./Object.assign":29,"./warning":160}],121:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule emptyFunction */ -var copyProperties = _dereq_("./copyProperties"); - function makeEmptyFunction(arg) { return function() { return arg; @@ -33666,32 +33643,23 @@ function makeEmptyFunction(arg) { */ function emptyFunction() {} -copyProperties(emptyFunction, { - thatReturns: makeEmptyFunction, - thatReturnsFalse: makeEmptyFunction(false), - thatReturnsTrue: makeEmptyFunction(true), - thatReturnsNull: makeEmptyFunction(null), - thatReturnsThis: function() { return this; }, - thatReturnsArgument: function(arg) { return arg; } -}); +emptyFunction.thatReturns = makeEmptyFunction; +emptyFunction.thatReturnsFalse = makeEmptyFunction(false); +emptyFunction.thatReturnsTrue = makeEmptyFunction(true); +emptyFunction.thatReturnsNull = makeEmptyFunction(null); +emptyFunction.thatReturnsThis = function() { return this; }; +emptyFunction.thatReturnsArgument = function(arg) { return arg; }; module.exports = emptyFunction; -},{"./copyProperties":110}],117:[function(_dereq_,module,exports){ +},{}],122:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule emptyObject */ @@ -33706,21 +33674,14 @@ if ("production" !== "development") { module.exports = emptyObject; -},{}],118:[function(_dereq_,module,exports){ +},{}],123:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule escapeTextForBrowser * @typechecks static-only @@ -33754,27 +33715,22 @@ function escapeTextForBrowser(text) { module.exports = escapeTextForBrowser; -},{}],119:[function(_dereq_,module,exports){ +},{}],124:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule flattenChildren */ "use strict"; +var ReactTextComponent = _dereq_("./ReactTextComponent"); + var traverseAllChildren = _dereq_("./traverseAllChildren"); var warning = _dereq_("./warning"); @@ -33795,7 +33751,18 @@ function flattenSingleChildIntoContext(traverseContext, child, name) { name ) : null); if (keyUnique && child != null) { - result[name] = child; + var type = typeof child; + var normalizedValue; + + if (type === 'string') { + normalizedValue = ReactTextComponent(child); + } else if (type === 'number') { + normalizedValue = ReactTextComponent('' + child); + } else { + normalizedValue = child; + } + + result[name] = normalizedValue; } } @@ -33815,21 +33782,14 @@ function flattenChildren(children) { module.exports = flattenChildren; -},{"./traverseAllChildren":156,"./warning":158}],120:[function(_dereq_,module,exports){ +},{"./ReactTextComponent":87,"./traverseAllChildren":158,"./warning":160}],125:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule focusNode */ @@ -33837,34 +33797,28 @@ module.exports = flattenChildren; "use strict"; /** - * IE8 throws if an input/textarea is disabled and we try to focus it. - * Focus only when necessary. - * * @param {DOMElement} node input/textarea to focus */ function focusNode(node) { - if (!node.disabled) { + // IE8 can throw "Can't move focus to the control because it is invisible, + // not enabled, or of a type that does not accept the focus." for all kinds of + // reasons that are too expensive and fragile to test. + try { node.focus(); + } catch(e) { } } module.exports = focusNode; -},{}],121:[function(_dereq_,module,exports){ +},{}],126:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule forEachAccumulated */ @@ -33888,21 +33842,14 @@ var forEachAccumulated = function(arr, cb, scope) { module.exports = forEachAccumulated; -},{}],122:[function(_dereq_,module,exports){ +},{}],127:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getActiveElement * @typechecks @@ -33924,21 +33871,66 @@ function getActiveElement() /*?DOMElement*/ { module.exports = getActiveElement; -},{}],123:[function(_dereq_,module,exports){ +},{}],128:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule getEventCharCode + * @typechecks static-only + */ + +"use strict"; + +/** + * `charCode` represents the actual "character code" and is safe to use with + * `String.fromCharCode`. As such, only keys that correspond to printable + * characters produce a valid `charCode`, the only exception to this is Enter. + * The Tab-key is considered non-printable and does not have a `charCode`, + * presumably because it does not produce a tab-character in browsers. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * @param {object} nativeEvent Native browser event. + * @return {string} Normalized `charCode` property. + */ +function getEventCharCode(nativeEvent) { + var charCode; + var keyCode = nativeEvent.keyCode; + + if ('charCode' in nativeEvent) { + charCode = nativeEvent.charCode; + + // FF does not set `charCode` for the Enter-key, check against `keyCode`. + if (charCode === 0 && keyCode === 13) { + charCode = 13; + } + } else { + // IE8 does not implement `charCode`, but `keyCode` has the correct value. + charCode = keyCode; + } + + // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. + // Must not discard the (non-)printable Enter-key. + if (charCode >= 32 || charCode === 13) { + return charCode; + } + + return 0; +} + +module.exports = getEventCharCode; + +},{}],129:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getEventKey * @typechecks static-only @@ -33946,7 +33938,7 @@ module.exports = getActiveElement; "use strict"; -var invariant = _dereq_("./invariant"); +var getEventCharCode = _dereq_("./getEventCharCode"); /** * Normalization of deprecated HTML5 `key` values @@ -33968,7 +33960,7 @@ var normalizeKey = { }; /** - * Translation from legacy `which`/`keyCode` to HTML5 `key` + * Translation from legacy `keyCode` to HTML5 `key` * Only special keys supported, all others depend on keyboard layout or browser * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names */ @@ -34020,11 +34012,7 @@ function getEventKey(nativeEvent) { // Browser does not implement `key`, polyfill as much of it as we can. if (nativeEvent.type === 'keypress') { - // Create the character from the `charCode` ourselves and use as an almost - // perfect replacement. - var charCode = 'charCode' in nativeEvent ? - nativeEvent.charCode : - nativeEvent.keyCode; + var charCode = getEventCharCode(nativeEvent); // The enter-key is technically both printable and non-printable and can // thus be captured by `keypress`, no other non-printable key should. @@ -34035,27 +34023,19 @@ function getEventKey(nativeEvent) { // `keyCode` value, almost all function keys have a universal value. return translateToKey[nativeEvent.keyCode] || 'Unidentified'; } - - ("production" !== "development" ? invariant(false, "Unexpected keyboard event type: %s", nativeEvent.type) : invariant(false)); + return ''; } module.exports = getEventKey; -},{"./invariant":134}],124:[function(_dereq_,module,exports){ +},{"./getEventCharCode":128}],130:[function(_dereq_,module,exports){ /** * Copyright 2013 Facebook, Inc. + * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getEventModifierState * @typechecks static-only @@ -34095,21 +34075,14 @@ function getEventModifierState(nativeEvent) { module.exports = getEventModifierState; -},{}],125:[function(_dereq_,module,exports){ +},{}],131:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getEventTarget * @typechecks static-only @@ -34133,21 +34106,14 @@ function getEventTarget(nativeEvent) { module.exports = getEventTarget; -},{}],126:[function(_dereq_,module,exports){ +},{}],132:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getMarkupWrap */ @@ -34255,21 +34221,14 @@ function getMarkupWrap(nodeName) { module.exports = getMarkupWrap; -},{"./ExecutionEnvironment":22,"./invariant":134}],127:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23,"./invariant":140}],133:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getNodeForCharacterOffset */ @@ -34337,21 +34296,14 @@ function getNodeForCharacterOffset(root, offset) { module.exports = getNodeForCharacterOffset; -},{}],128:[function(_dereq_,module,exports){ +},{}],134:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getReactRootElementInContainer */ @@ -34379,21 +34331,14 @@ function getReactRootElementInContainer(container) { module.exports = getReactRootElementInContainer; -},{}],129:[function(_dereq_,module,exports){ +},{}],135:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getTextContentAccessor */ @@ -34423,21 +34368,14 @@ function getTextContentAccessor() { module.exports = getTextContentAccessor; -},{"./ExecutionEnvironment":22}],130:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23}],136:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getUnboundedScrollPosition * @typechecks @@ -34470,21 +34408,14 @@ function getUnboundedScrollPosition(scrollable) { module.exports = getUnboundedScrollPosition; -},{}],131:[function(_dereq_,module,exports){ +},{}],137:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule hyphenate * @typechecks @@ -34510,21 +34441,14 @@ function hyphenate(string) { module.exports = hyphenate; -},{}],132:[function(_dereq_,module,exports){ +},{}],138:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule hyphenateStyleName * @typechecks @@ -34539,11 +34463,11 @@ var msPattern = /^ms-/; /** * Hyphenates a camelcased CSS property name, for example: * - * > hyphenate('backgroundColor') + * > hyphenateStyleName('backgroundColor') * < "background-color" - * > hyphenate('MozTransition') + * > hyphenateStyleName('MozTransition') * < "-moz-transition" - * > hyphenate('msTransition') + * > hyphenateStyleName('msTransition') * < "-ms-transition" * * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix @@ -34558,21 +34482,14 @@ function hyphenateStyleName(string) { module.exports = hyphenateStyleName; -},{"./hyphenate":131}],133:[function(_dereq_,module,exports){ +},{"./hyphenate":137}],139:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule instantiateReactComponent * @typechecks static-only @@ -34580,63 +34497,111 @@ module.exports = hyphenateStyleName; "use strict"; -var invariant = _dereq_("./invariant"); +var warning = _dereq_("./warning"); -/** - * Validate a `componentDescriptor`. This should be exposed publicly in a follow - * up diff. - * - * @param {object} descriptor - * @return {boolean} Returns true if this is a valid descriptor of a Component. - */ -function isValidComponentDescriptor(descriptor) { - return ( - descriptor && - typeof descriptor.type === 'function' && - typeof descriptor.type.prototype.mountComponent === 'function' && - typeof descriptor.type.prototype.receiveComponent === 'function' - ); -} +var ReactElement = _dereq_("./ReactElement"); +var ReactLegacyElement = _dereq_("./ReactLegacyElement"); +var ReactNativeComponent = _dereq_("./ReactNativeComponent"); +var ReactEmptyComponent = _dereq_("./ReactEmptyComponent"); /** - * Given a `componentDescriptor` create an instance that will actually be - * mounted. Currently it just extracts an existing clone from composite - * components but this is an implementation detail which will change. + * Given an `element` create an instance that will actually be mounted. * - * @param {object} descriptor - * @return {object} A new instance of componentDescriptor's constructor. + * @param {object} element + * @param {*} parentCompositeType The composite type that resolved this. + * @return {object} A new instance of the element's constructor. * @protected */ -function instantiateReactComponent(descriptor) { +function instantiateReactComponent(element, parentCompositeType) { + var instance; - // TODO: Make warning - // if (__DEV__) { - ("production" !== "development" ? invariant( - isValidComponentDescriptor(descriptor), - 'Only React Components are valid for mounting.' - ) : invariant(isValidComponentDescriptor(descriptor))); - // } + if ("production" !== "development") { + ("production" !== "development" ? warning( + element && (typeof element.type === 'function' || + typeof element.type === 'string'), + 'Only functions or strings can be mounted as React components.' + ) : null); - return new descriptor.type(descriptor); + // Resolve mock instances + if (element.type._mockedReactClassConstructor) { + // If this is a mocked class, we treat the legacy factory as if it was the + // class constructor for future proofing unit tests. Because this might + // be mocked as a legacy factory, we ignore any warnings triggerd by + // this temporary hack. + ReactLegacyElement._isLegacyCallWarningEnabled = false; + try { + instance = new element.type._mockedReactClassConstructor( + element.props + ); + } finally { + ReactLegacyElement._isLegacyCallWarningEnabled = true; + } + + // If the mock implementation was a legacy factory, then it returns a + // element. We need to turn this into a real component instance. + if (ReactElement.isValidElement(instance)) { + instance = new instance.type(instance.props); + } + + var render = instance.render; + if (!render) { + // For auto-mocked factories, the prototype isn't shimmed and therefore + // there is no render function on the instance. We replace the whole + // component with an empty component instance instead. + element = ReactEmptyComponent.getEmptyComponent(); + } else { + if (render._isMockFunction && !render._getMockImplementation()) { + // Auto-mocked components may have a prototype with a mocked render + // function. For those, we'll need to mock the result of the render + // since we consider undefined to be invalid results from render. + render.mockImplementation( + ReactEmptyComponent.getEmptyComponent + ); + } + instance.construct(element); + return instance; + } + } + } + + // Special case string values + if (typeof element.type === 'string') { + instance = ReactNativeComponent.createInstanceForTag( + element.type, + element.props, + parentCompositeType + ); + } else { + // Normal case for non-mocks and non-strings + instance = new element.type(element.props); + } + + if ("production" !== "development") { + ("production" !== "development" ? warning( + typeof instance.construct === 'function' && + typeof instance.mountComponent === 'function' && + typeof instance.receiveComponent === 'function', + 'Only React Components can be mounted.' + ) : null); + } + + // This actually sets up the internal instance. This will become decoupled + // from the public instance in a future diff. + instance.construct(element); + + return instance; } module.exports = instantiateReactComponent; -},{"./invariant":134}],134:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./ReactEmptyComponent":60,"./ReactLegacyElement":67,"./ReactNativeComponent":73,"./warning":160}],140:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule invariant */ @@ -34684,21 +34649,14 @@ var invariant = function(condition, format, a, b, c, d, e, f) { module.exports = invariant; -},{}],135:[function(_dereq_,module,exports){ +},{}],141:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isEventSupported */ @@ -34756,21 +34714,14 @@ function isEventSupported(eventNameSuffix, capture) { module.exports = isEventSupported; -},{"./ExecutionEnvironment":22}],136:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23}],142:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isNode * @typechecks @@ -34791,21 +34742,14 @@ function isNode(object) { module.exports = isNode; -},{}],137:[function(_dereq_,module,exports){ +},{}],143:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isTextInputElement */ @@ -34842,21 +34786,14 @@ function isTextInputElement(elem) { module.exports = isTextInputElement; -},{}],138:[function(_dereq_,module,exports){ +},{}],144:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isTextNode * @typechecks @@ -34874,21 +34811,14 @@ function isTextNode(object) { module.exports = isTextNode; -},{"./isNode":136}],139:[function(_dereq_,module,exports){ +},{"./isNode":142}],145:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 @@ -34912,7 +34842,9 @@ function joinClasses(className/*, ... */) { if (argLength > 1) { for (var ii = 1; ii < argLength; ii++) { nextClass = arguments[ii]; - nextClass && (className += ' ' + nextClass); + if (nextClass) { + className = (className ? className + ' ' : '') + nextClass; + } } } return className; @@ -34920,21 +34852,14 @@ function joinClasses(className/*, ... */) { module.exports = joinClasses; -},{}],140:[function(_dereq_,module,exports){ +},{}],146:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyMirror * @typechecks static-only @@ -34980,21 +34905,14 @@ var keyMirror = function(obj) { module.exports = keyMirror; -},{"./invariant":134}],141:[function(_dereq_,module,exports){ +},{"./invariant":140}],147:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyOf */ @@ -35023,75 +34941,67 @@ var keyOf = function(oneKeyObj) { module.exports = keyOf; -},{}],142:[function(_dereq_,module,exports){ +},{}],148:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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"; +'use strict'; + +var hasOwnProperty = Object.prototype.hasOwnProperty; /** - * For each key/value pair, invokes callback func and constructs a resulting - * object which contains, for every key in obj, values that are the result of - * of invoking the function: + * 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: * - * func(value, key, iteration) + * - the property value + * - the property name + * - the object being traversed * - * Grepable names: + * 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. * - * function objectMap() - * function objMap() + * @grep function objectMap() + * @grep function objMap() * - * @param {?object} obj Object to map keys over - * @param {function} func Invoked for each key/val pair. - * @param {?*} context - * @return {?object} Result of mapping or null if obj is falsey + * @param {?object} object + * @param {function} callback + * @param {*} context + * @return {?object} */ -function mapObject(obj, func, context) { - if (!obj) { +function mapObject(object, callback, context) { + if (!object) { return null; } - var i = 0; - var ret = {}; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - ret[key] = func.call(context, obj[key], key, i++); + var result = {}; + for (var name in object) { + if (hasOwnProperty.call(object, name)) { + result[name] = callback.call(context, object[name], name, object); } } - return ret; + return result; } module.exports = mapObject; -},{}],143:[function(_dereq_,module,exports){ +},{}],149:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule memoizeStringOnly * @typechecks static-only @@ -35118,293 +35028,14 @@ function memoizeStringOnly(callback) { module.exports = memoizeStringOnly; -},{}],144:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule merge - */ - -"use strict"; - -var mergeInto = _dereq_("./mergeInto"); - +},{}],150:[function(_dereq_,module,exports){ /** - * Shallow merges two structures into a return value, without mutating either. - * - * @param {?object} one Optional object with properties to merge from. - * @param {?object} two Optional object with properties to merge from. - * @return {object} The shallow extension of one by two. - */ -var merge = function(one, two) { - var result = {}; - mergeInto(result, one); - mergeInto(result, two); - return result; -}; - -module.exports = merge; - -},{"./mergeInto":146}],145:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule mergeHelpers - * - * requiresPolyfills: Array.isArray - */ - -"use strict"; - -var invariant = _dereq_("./invariant"); -var keyMirror = _dereq_("./keyMirror"); - -/** - * Maximum number of levels to traverse. Will catch circular structures. - * @const - */ -var MAX_MERGE_DEPTH = 36; - -/** - * We won't worry about edge cases like new String('x') or new Boolean(true). - * Functions are considered terminals, and arrays are not. - * @param {*} o The item/object/value to test. - * @return {boolean} true iff the argument is a terminal. - */ -var isTerminal = function(o) { - return typeof o !== 'object' || o === null; -}; - -var mergeHelpers = { - - MAX_MERGE_DEPTH: MAX_MERGE_DEPTH, - - isTerminal: isTerminal, - - /** - * Converts null/undefined values into empty object. - * - * @param {?Object=} arg Argument to be normalized (nullable optional) - * @return {!Object} - */ - normalizeMergeArg: function(arg) { - return arg === undefined || arg === null ? {} : arg; - }, - - /** - * If merging Arrays, a merge strategy *must* be supplied. If not, it is - * likely the caller's fault. If this function is ever called with anything - * but `one` and `two` being `Array`s, it is the fault of the merge utilities. - * - * @param {*} one Array to merge into. - * @param {*} two Array to merge from. - */ - checkMergeArrayArgs: function(one, two) { - ("production" !== "development" ? invariant( - Array.isArray(one) && Array.isArray(two), - 'Tried to merge arrays, instead got %s and %s.', - one, - two - ) : invariant(Array.isArray(one) && Array.isArray(two))); - }, - - /** - * @param {*} one Object to merge into. - * @param {*} two Object to merge from. - */ - checkMergeObjectArgs: function(one, two) { - mergeHelpers.checkMergeObjectArg(one); - mergeHelpers.checkMergeObjectArg(two); - }, - - /** - * @param {*} arg - */ - checkMergeObjectArg: function(arg) { - ("production" !== "development" ? invariant( - !isTerminal(arg) && !Array.isArray(arg), - 'Tried to merge an object, instead got %s.', - arg - ) : invariant(!isTerminal(arg) && !Array.isArray(arg))); - }, - - /** - * @param {*} arg - */ - checkMergeIntoObjectArg: function(arg) { - ("production" !== "development" ? invariant( - (!isTerminal(arg) || typeof arg === 'function') && !Array.isArray(arg), - 'Tried to merge into an object, instead got %s.', - arg - ) : invariant((!isTerminal(arg) || typeof arg === 'function') && !Array.isArray(arg))); - }, - - /** - * Checks that a merge was not given a circular object or an object that had - * too great of depth. - * - * @param {number} Level of recursion to validate against maximum. - */ - checkMergeLevel: function(level) { - ("production" !== "development" ? invariant( - level < MAX_MERGE_DEPTH, - 'Maximum deep merge depth exceeded. You may be attempting to merge ' + - 'circular structures in an unsupported way.' - ) : invariant(level < MAX_MERGE_DEPTH)); - }, - - /** - * Checks that the supplied merge strategy is valid. - * - * @param {string} Array merge strategy. - */ - checkArrayStrategy: function(strategy) { - ("production" !== "development" ? invariant( - strategy === undefined || strategy in mergeHelpers.ArrayStrategies, - 'You must provide an array strategy to deep merge functions to ' + - 'instruct the deep merge how to resolve merging two arrays.' - ) : invariant(strategy === undefined || strategy in mergeHelpers.ArrayStrategies)); - }, - - /** - * Set of possible behaviors of merge algorithms when encountering two Arrays - * that must be merged together. - * - `clobber`: The left `Array` is ignored. - * - `indexByIndex`: The result is achieved by recursively deep merging at - * each index. (not yet supported.) - */ - ArrayStrategies: keyMirror({ - Clobber: true, - IndexByIndex: true - }) - -}; - -module.exports = mergeHelpers; - -},{"./invariant":134,"./keyMirror":140}],146:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule mergeInto - * @typechecks static-only - */ - -"use strict"; - -var mergeHelpers = _dereq_("./mergeHelpers"); - -var checkMergeObjectArg = mergeHelpers.checkMergeObjectArg; -var checkMergeIntoObjectArg = mergeHelpers.checkMergeIntoObjectArg; - -/** - * Shallow merges two structures by mutating the first parameter. - * - * @param {object|function} one Object to be merged into. - * @param {?object} two Optional object with properties to merge from. - */ -function mergeInto(one, two) { - checkMergeIntoObjectArg(one); - if (two != null) { - checkMergeObjectArg(two); - for (var key in two) { - if (!two.hasOwnProperty(key)) { - continue; - } - one[key] = two[key]; - } - } -} - -module.exports = mergeInto; - -},{"./mergeHelpers":145}],147:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule mixInto - */ - -"use strict"; - -/** - * Simply copies properties to the prototype. - */ -var mixInto = function(constructor, methodBag) { - var methodName; - for (methodName in methodBag) { - if (!methodBag.hasOwnProperty(methodName)) { - continue; - } - constructor.prototype[methodName] = methodBag[methodName]; - } -}; - -module.exports = mixInto; - -},{}],148:[function(_dereq_,module,exports){ -/** - * Copyright 2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule monitorCodeUse */ @@ -35429,27 +35060,20 @@ function monitorCodeUse(eventName, data) { module.exports = monitorCodeUse; -},{"./invariant":134}],149:[function(_dereq_,module,exports){ +},{"./invariant":140}],151:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); var invariant = _dereq_("./invariant"); @@ -35466,29 +35090,22 @@ var invariant = _dereq_("./invariant"); */ function onlyChild(children) { ("production" !== "development" ? invariant( - ReactDescriptor.isValidDescriptor(children), + ReactElement.isValidElement(children), 'onlyChild must be passed a children with exactly one child.' - ) : invariant(ReactDescriptor.isValidDescriptor(children))); + ) : invariant(ReactElement.isValidElement(children))); return children; } module.exports = onlyChild; -},{"./ReactDescriptor":56,"./invariant":134}],150:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./invariant":140}],152:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule performance * @typechecks @@ -35509,21 +35126,14 @@ if (ExecutionEnvironment.canUseDOM) { module.exports = performance || {}; -},{"./ExecutionEnvironment":22}],151:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23}],153:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule performanceNow * @typechecks @@ -35544,21 +35154,14 @@ var performanceNow = performance.now.bind(performance); module.exports = performanceNow; -},{"./performance":150}],152:[function(_dereq_,module,exports){ +},{"./performance":152}],154:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule setInnerHTML */ @@ -35567,6 +35170,9 @@ module.exports = performanceNow; var ExecutionEnvironment = _dereq_("./ExecutionEnvironment"); +var WHITESPACE_TEST = /^[ \r\n\t\f]/; +var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; + /** * Set the innerHTML property of a node, ensuring that whitespace is preserved * even in IE8. @@ -35603,13 +35209,8 @@ if (ExecutionEnvironment.canUseDOM) { // thin air on IE8, this only happens if there is no visible text // in-front of the non-visible tags. Piggyback on the whitespace fix // and simply check if any non-visible tags appear in the source. - if (html.match(/^[ \r\n\t\f]/) || - html[0] === '<' && ( - html.indexOf('<noscript') !== -1 || - html.indexOf('<script') !== -1 || - html.indexOf('<style') !== -1 || - html.indexOf('<meta') !== -1 || - html.indexOf('<link') !== -1)) { + if (WHITESPACE_TEST.test(html) || + html[0] === '<' && NONVISIBLE_TEST.test(html)) { // Recover leading whitespace by temporarily prepending any character. // \uFEFF has the potential advantage of being zero-width/invisible. node.innerHTML = '\uFEFF' + html; @@ -35631,21 +35232,14 @@ if (ExecutionEnvironment.canUseDOM) { module.exports = setInnerHTML; -},{"./ExecutionEnvironment":22}],153:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23}],155:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule shallowEqual */ @@ -35671,7 +35265,7 @@ function shallowEqual(objA, objB) { return false; } } - // Test for B'a keys missing from A. + // Test for B's keys missing from A. for (key in objB) { if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) { return false; @@ -35682,21 +35276,14 @@ function shallowEqual(objA, objB) { module.exports = shallowEqual; -},{}],154:[function(_dereq_,module,exports){ +},{}],156:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule shouldUpdateReactComponent * @typechecks static-only @@ -35705,22 +35292,21 @@ module.exports = shallowEqual; "use strict"; /** - * Given a `prevDescriptor` and `nextDescriptor`, determines if the existing + * Given a `prevElement` and `nextElement`, determines if the existing * instance should be updated as opposed to being destroyed or replaced by a new - * instance. Both arguments are descriptors. This ensures that this logic can + * instance. Both arguments are elements. This ensures that this logic can * operate on stateless trees without any backing instance. * - * @param {?object} prevDescriptor - * @param {?object} nextDescriptor + * @param {?object} prevElement + * @param {?object} nextElement * @return {boolean} True if the existing instance should be updated. * @protected */ -function shouldUpdateReactComponent(prevDescriptor, nextDescriptor) { - if (prevDescriptor && nextDescriptor && - prevDescriptor.type === nextDescriptor.type && ( - (prevDescriptor.props && prevDescriptor.props.key) === - (nextDescriptor.props && nextDescriptor.props.key) - ) && prevDescriptor._owner === nextDescriptor._owner) { +function shouldUpdateReactComponent(prevElement, nextElement) { + if (prevElement && nextElement && + prevElement.type === nextElement.type && + prevElement.key === nextElement.key && + prevElement._owner === nextElement._owner) { return true; } return false; @@ -35728,21 +35314,14 @@ function shouldUpdateReactComponent(prevDescriptor, nextDescriptor) { module.exports = shouldUpdateReactComponent; -},{}],155:[function(_dereq_,module,exports){ +},{}],157:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule toArray * @typechecks @@ -35805,29 +35384,22 @@ function toArray(obj) { module.exports = toArray; -},{"./invariant":134}],156:[function(_dereq_,module,exports){ +},{"./invariant":140}],158:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule traverseAllChildren */ "use strict"; +var ReactElement = _dereq_("./ReactElement"); var ReactInstanceHandles = _dereq_("./ReactInstanceHandles"); -var ReactTextComponent = _dereq_("./ReactTextComponent"); var invariant = _dereq_("./invariant"); @@ -35862,9 +35434,9 @@ function userProvidedKeyEscaper(match) { * @return {string} */ function getComponentKey(component, index) { - if (component && component.props && component.props.key != null) { + if (component && component.key != null) { // Explicit key - return wrapUserProvidedKey(component.props.key); + return wrapUserProvidedKey(component.key); } // Implicit key determined by the index in the set return index.toString(36); @@ -35905,16 +35477,17 @@ function wrapUserProvidedKey(key) { */ var traverseAllChildrenImpl = function(children, nameSoFar, indexSoFar, callback, traverseContext) { + var nextName, nextIndex; var subtreeCount = 0; // Count of children found in the current subtree. if (Array.isArray(children)) { for (var i = 0; i < children.length; i++) { var child = children[i]; - var nextName = ( + nextName = ( nameSoFar + (nameSoFar ? SUBSEPARATOR : SEPARATOR) + getComponentKey(child, i) ); - var nextIndex = indexSoFar + subtreeCount; + nextIndex = indexSoFar + subtreeCount; subtreeCount += traverseAllChildrenImpl( child, nextName, @@ -35934,40 +35507,32 @@ var traverseAllChildrenImpl = // All of the above are perceived as null. callback(traverseContext, null, storageName, indexSoFar); subtreeCount = 1; - } else if (children.type && children.type.prototype && - children.type.prototype.mountComponentIntoNode) { + } else if (type === 'string' || type === 'number' || + ReactElement.isValidElement(children)) { callback(traverseContext, children, storageName, indexSoFar); subtreeCount = 1; - } else { - if (type === 'object') { - ("production" !== "development" ? invariant( - !children || children.nodeType !== 1, - 'traverseAllChildren(...): Encountered an invalid child; DOM ' + - 'elements are not valid children of React components.' - ) : invariant(!children || children.nodeType !== 1)); - for (var key in children) { - if (children.hasOwnProperty(key)) { - subtreeCount += traverseAllChildrenImpl( - children[key], - ( - nameSoFar + (nameSoFar ? SUBSEPARATOR : SEPARATOR) + - wrapUserProvidedKey(key) + SUBSEPARATOR + - getComponentKey(children[key], 0) - ), - indexSoFar + subtreeCount, - callback, - traverseContext - ); - } + } else if (type === 'object') { + ("production" !== "development" ? invariant( + !children || children.nodeType !== 1, + 'traverseAllChildren(...): Encountered an invalid child; DOM ' + + 'elements are not valid children of React components.' + ) : invariant(!children || children.nodeType !== 1)); + for (var key in children) { + if (children.hasOwnProperty(key)) { + nextName = ( + nameSoFar + (nameSoFar ? SUBSEPARATOR : SEPARATOR) + + wrapUserProvidedKey(key) + SUBSEPARATOR + + getComponentKey(children[key], 0) + ); + nextIndex = indexSoFar + subtreeCount; + subtreeCount += traverseAllChildrenImpl( + children[key], + nextName, + nextIndex, + callback, + traverseContext + ); } - } else if (type === 'string') { - var normalizedText = ReactTextComponent(children); - callback(traverseContext, normalizedText, storageName, indexSoFar); - subtreeCount += 1; - } else if (type === 'number') { - var normalizedNumber = ReactTextComponent('' + children); - callback(traverseContext, normalizedNumber, storageName, indexSoFar); - subtreeCount += 1; } } } @@ -36000,28 +35565,21 @@ function traverseAllChildren(children, callback, traverseContext) { module.exports = traverseAllChildren; -},{"./ReactInstanceHandles":64,"./ReactTextComponent":83,"./invariant":134}],157:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./ReactInstanceHandles":66,"./invariant":140}],159:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the 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 */ "use strict"; -var copyProperties = _dereq_("./copyProperties"); +var assign = _dereq_("./Object.assign"); var keyOf = _dereq_("./keyOf"); var invariant = _dereq_("./invariant"); @@ -36029,7 +35587,7 @@ function shallowCopy(x) { if (Array.isArray(x)) { return x.concat(); } else if (x && typeof x === 'object') { - return copyProperties(new x.constructor(), x); + return assign(new x.constructor(), x); } else { return x; } @@ -36109,7 +35667,7 @@ function update(value, spec) { COMMAND_MERGE, nextValue ) : invariant(nextValue && typeof nextValue === 'object')); - copyProperties(nextValue, spec[COMMAND_MERGE]); + assign(nextValue, spec[COMMAND_MERGE]); } if (spec.hasOwnProperty(COMMAND_PUSH)) { @@ -36173,21 +35731,14 @@ function update(value, spec) { module.exports = update; -},{"./copyProperties":110,"./invariant":134,"./keyOf":141}],158:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./invariant":140,"./keyOf":147}],160:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule warning */ @@ -36206,7 +35757,7 @@ var emptyFunction = _dereq_("./emptyFunction"); var warning = emptyFunction; if ("production" !== "development") { - warning = function(condition, format ) {var args=Array.prototype.slice.call(arguments,2); + warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]); if (format === undefined) { throw new Error( '`warning(condition, format, ...args)` requires a warning ' + @@ -36223,71 +35774,66 @@ if ("production" !== "development") { module.exports = warning; -},{"./emptyFunction":116}]},{},[88]) -(88) +},{"./emptyFunction":121}]},{},[1])(1) }); !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.ReactRouter=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ -var LocationDispatcher = _dereq_('../dispatchers/LocationDispatcher'); -var makePath = _dereq_('../utils/makePath'); - /** * Actions that modify the URL. */ var LocationActions = { - PUSH: 'push', - REPLACE: 'replace', - POP: 'pop', - UPDATE_SCROLL: 'update-scroll', - /** - * Transitions to the URL specified in the arguments by pushing - * a new URL onto the history stack. + * Indicates a new location is being pushed to the history stack. */ - transitionTo: function (to, params, query) { - LocationDispatcher.handleViewAction({ - type: LocationActions.PUSH, - path: makePath(to, params, query) - }); - }, + PUSH: 'push', /** - * Transitions to the URL specified in the arguments by replacing - * the current URL in the history stack. + * Indicates the current location should be replaced. */ - replaceWith: function (to, params, query) { - LocationDispatcher.handleViewAction({ - type: LocationActions.REPLACE, - path: makePath(to, params, query) - }); - }, + REPLACE: 'replace', /** - * Transitions to the previous URL. + * Indicates the most recent entry should be removed from the history stack. */ - goBack: function () { - LocationDispatcher.handleViewAction({ - type: LocationActions.POP - }); - }, + POP: 'pop' - /** - * Updates the window's scroll position to the last known position - * for the current URL path. - */ - updateScroll: function () { - LocationDispatcher.handleViewAction({ - type: LocationActions.UPDATE_SCROLL - }); +}; + +module.exports = LocationActions; + +},{}],2:[function(_dereq_,module,exports){ +var LocationActions = _dereq_('../actions/LocationActions'); + +/** + * A scroll behavior that attempts to imitate the default behavior + * of modern browsers. + */ +var ImitateBrowserBehavior = { + + updateScrollPosition: function (position, actionType) { + switch (actionType) { + case LocationActions.PUSH: + case LocationActions.REPLACE: + window.scrollTo(0, 0); + break; + case LocationActions.POP: + if (position) { + window.scrollTo(position.x, position.y); + } else { + window.scrollTo(0, 0); + } + break; + } } }; -module.exports = LocationActions; +module.exports = ImitateBrowserBehavior; -},{"../dispatchers/LocationDispatcher":8,"../utils/makePath":26}],2:[function(_dereq_,module,exports){ -var merge = _dereq_('react/lib/merge'); -var Route = _dereq_('./Route'); +},{"../actions/LocationActions":1}],3:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); +var FakeNode = _dereq_('../mixins/FakeNode'); +var PropTypes = _dereq_('../utils/PropTypes'); /** * A <DefaultRoute> component is a special kind of <Route> that @@ -36295,25 +35841,28 @@ var Route = _dereq_('./Route'); * Only one such route may be used at any given level in the * route hierarchy. */ -function DefaultRoute(props) { - return Route( - merge(props, { - path: null, - isDefault: true - }) - ); -} +var DefaultRoute = React.createClass({ + + displayName: 'DefaultRoute', + + mixins: [ FakeNode ], + + propTypes: { + name: React.PropTypes.string, + path: PropTypes.falsy, + handler: React.PropTypes.func.isRequired + } + +}); module.exports = DefaultRoute; -},{"./Route":6,"react/lib/merge":44}],3:[function(_dereq_,module,exports){ +},{"../mixins/FakeNode":13,"../utils/PropTypes":21}],4:[function(_dereq_,module,exports){ var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var ActiveState = _dereq_('../mixins/ActiveState'); -var transitionTo = _dereq_('../actions/LocationActions').transitionTo; -var withoutProperties = _dereq_('../utils/withoutProperties'); -var hasOwnProperty = _dereq_('../utils/hasOwnProperty'); -var makeHref = _dereq_('../utils/makeHref'); -var warning = _dereq_('react/lib/warning'); +var classSet = _dereq_('react/lib/cx'); +var assign = _dereq_('react/lib/Object.assign'); +var Navigation = _dereq_('../mixins/Navigation'); +var State = _dereq_('../mixins/State'); function isLeftClickEvent(event) { return event.button === 0; @@ -36324,69 +35873,32 @@ function isModifiedEvent(event) { } /** - * DEPRECATED: A map of <Link> component props that are reserved for use by the - * router and/or React. All other props are used as params that are - * interpolated into the link's path. - */ -var RESERVED_PROPS = { - to: true, - key: true, - className: true, - activeClassName: true, - query: true, - onClick:true, - children: true // ReactChildren -}; - -/** * <Link> components are used to create an <a> element that links to a route. * When that route is active, the link gets an "active" class name (or the * value of its `activeClassName` prop). * * For example, assuming you have the following route: * - * <Route name="showPost" path="/posts/:postId" handler={Post}/> + * <Route name="showPost" path="/posts/:postID" handler={Post}/> * * You could use the following component to link to that route: * - * <Link to="showPost" params={{postId: "123"}} /> + * <Link to="showPost" params={{ postID: "123" }} /> * * In addition to params, links may pass along query string parameters * using the `query` prop. * - * <Link to="showPost" params={{postId: "123"}} query={{show:true}}/> + * <Link to="showPost" params={{ postID: "123" }} query={{ show:true }}/> */ var Link = React.createClass({ displayName: 'Link', - mixins: [ ActiveState ], - - statics: { - - // TODO: Deprecate passing props as params in v1.0 - getUnreservedProps: function (props) { - var props = withoutProperties(props, RESERVED_PROPS); - warning( - Object.keys(props).length === 0, - 'Passing props for params on <Link>s is deprecated, '+ - 'please use the `params` property.' - ); - return props; - }, - - /** - * Returns a hash of URL parameters to use in this <Link>'s path. - */ - getParams: function (props) { - return props.params || Link.getUnreservedProps(props); - } - - }, + mixins: [ Navigation, State ], propTypes: { - to: React.PropTypes.string.isRequired, activeClassName: React.PropTypes.string.isRequired, + to: React.PropTypes.string.isRequired, params: React.PropTypes.object, query: React.PropTypes.object, onClick: React.PropTypes.func @@ -36398,17 +35910,30 @@ var Link = React.createClass({ }; }, - getInitialState: function () { - return { - isActive: false - }; + handleClick: function (event) { + var allowTransition = true; + var clickResult; + + if (this.props.onClick) + clickResult = this.props.onClick(event); + + if (isModifiedEvent(event) || !isLeftClickEvent(event)) + return; + + if (clickResult === false || event.defaultPrevented === true) + allowTransition = false; + + event.preventDefault(); + + if (allowTransition) + this.transitionTo(this.props.to, this.props.params, this.props.query); }, /** * Returns the value of the "href" attribute to use on the DOM element. */ getHref: function () { - return makeHref(this.props.to, Link.getParams(this.props), this.props.query); + return this.makeHref(this.props.to, this.props.params, this.props.query); }, /** @@ -36416,59 +35941,23 @@ var Link = React.createClass({ * the value of the activeClassName property when this <Link> is active. */ getClassName: function () { - var className = this.props.className || ''; - - if (this.state.isActive) - return className + ' ' + this.props.activeClassName; - - return className; - }, - - componentWillReceiveProps: function (nextProps) { - var params = Link.getParams(nextProps); - - this.setState({ - isActive: Link.isActive(nextProps.to, params, nextProps.query) - }); - }, - - updateActiveState: function () { - this.setState({ - isActive: Link.isActive(this.props.to, Link.getParams(this.props), this.props.query) - }); - }, - - handleClick: function (event) { - var allowTransition = true; - var ret; - - if (this.props.onClick) - ret = this.props.onClick(event); + var classNames = {}; - if (isModifiedEvent(event) || !isLeftClickEvent(event)) - return; + if (this.props.className) + classNames[this.props.className] = true; - if (ret === false || event.defaultPrevented === true) - allowTransition = false; - - event.preventDefault(); + if (this.isActive(this.props.to, this.props.params, this.props.query)) + classNames[this.props.activeClassName] = true; - if (allowTransition) - transitionTo(this.props.to, Link.getParams(this.props), this.props.query); + return classSet(classNames); }, render: function () { - var props = { + var props = assign({}, this.props, { href: this.getHref(), className: this.getClassName(), onClick: this.handleClick - }; - - // pull in props without overriding - for (var propName in this.props) { - if (hasOwnProperty(this.props, propName) && hasOwnProperty(props, propName) === false) - props[propName] = this.props[propName]; - } + }); return React.DOM.a(props, this.props.children); } @@ -36477,9 +35966,10 @@ var Link = React.createClass({ module.exports = Link; -},{"../actions/LocationActions":1,"../mixins/ActiveState":15,"../utils/hasOwnProperty":24,"../utils/makeHref":25,"../utils/withoutProperties":29,"react/lib/warning":48}],4:[function(_dereq_,module,exports){ -var merge = _dereq_('react/lib/merge'); -var Route = _dereq_('./Route'); +},{"../mixins/Navigation":14,"../mixins/State":17,"react/lib/Object.assign":36,"react/lib/cx":37}],5:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); +var FakeNode = _dereq_('../mixins/FakeNode'); +var PropTypes = _dereq_('../utils/PropTypes'); /** * A <NotFoundRoute> is a special kind of <Route> that @@ -36488,65 +35978,51 @@ var Route = _dereq_('./Route'); * Only one such route may be used at any given level in the * route hierarchy. */ -function NotFoundRoute(props) { - return Route( - merge(props, { - path: null, - catchAll: true - }) - ); -} +var NotFoundRoute = React.createClass({ -module.exports = NotFoundRoute; + displayName: 'NotFoundRoute', -},{"./Route":6,"react/lib/merge":44}],5:[function(_dereq_,module,exports){ -var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var Route = _dereq_('./Route'); + mixins: [ FakeNode ], -function createRedirectHandler(to) { - return React.createClass({ - statics: { - willTransitionTo: function (transition, params, query) { - transition.redirect(to, params, query); - } - }, + propTypes: { + name: React.PropTypes.string, + path: PropTypes.falsy, + handler: React.PropTypes.func.isRequired + } - render: function () { - return null; - } - }); -} +}); + +module.exports = NotFoundRoute; + +},{"../mixins/FakeNode":13,"../utils/PropTypes":21}],6:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); +var FakeNode = _dereq_('../mixins/FakeNode'); +var PropTypes = _dereq_('../utils/PropTypes'); /** * A <Redirect> component is a special kind of <Route> that always * redirects to another route when it matches. */ -function Redirect(props) { - return Route({ - name: props.name, - path: props.from || props.path || '*', - handler: createRedirectHandler(props.to) - }); -} +var Redirect = React.createClass({ + + displayName: 'Redirect', + + mixins: [ FakeNode ], + + propTypes: { + path: React.PropTypes.string, + from: React.PropTypes.string, // Alias for path. + to: React.PropTypes.string, + handler: PropTypes.falsy + } + +}); module.exports = Redirect; -},{"./Route":6}],6:[function(_dereq_,module,exports){ +},{"../mixins/FakeNode":13,"../utils/PropTypes":21}],7:[function(_dereq_,module,exports){ var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var withoutProperties = _dereq_('../utils/withoutProperties'); - -/** - * A map of <Route> component props that are reserved for use by the - * router and/or React. All other props are considered "static" and - * are passed through to the route handler. - */ -var RESERVED_PROPS = { - handler: true, - path: true, - defaultRoute: true, - paramNames: true, - children: true // ReactChildren -}; +var FakeNode = _dereq_('../mixins/FakeNode'); /** * <Route> components specify components that are rendered to the page when the @@ -36558,40 +36034,29 @@ var RESERVED_PROPS = { * "active" and their components are rendered into the DOM, nested in the same * order as they are in the tree. * - * Unlike Ember, a nested route's path does not build upon that of its parents. - * This may seem like it creates more work up front in specifying URLs, but it - * has the nice benefit of decoupling nested UI from "nested" URLs. - * * The preferred way to configure a router is using JSX. The XML-like syntax is * a great way to visualize how routes are laid out in an application. * - * React.renderComponent(( - * <Routes handler={App}> + * var routes = [ + * <Route handler={App}> * <Route name="login" handler={Login}/> * <Route name="logout" handler={Logout}/> * <Route name="about" handler={About}/> - * </Routes> - * ), document.body); - * - * If you don't use JSX, you can also assemble a Router programmatically using - * the standard React component JavaScript API. - * - * React.renderComponent(( - * Routes({ handler: App }, - * Route({ name: 'login', handler: Login }), - * Route({ name: 'logout', handler: Logout }), - * Route({ name: 'about', handler: About }) - * ) - * ), document.body); + * </Route> + * ]; + * + * Router.run(routes, function (Handler) { + * React.render(<Handler/>, document.body); + * }); * * Handlers for Route components that contain children can render their active - * child route using the activeRouteHandler prop. + * child route using a <RouteHandler> element. * * var App = React.createClass({ * render: function () { * return ( * <div class="application"> - * {this.props.activeRouteHandler()} + * <RouteHandler/> * </div> * ); * } @@ -36601,542 +36066,119 @@ var Route = React.createClass({ displayName: 'Route', - statics: { - - getUnreservedProps: function (props) { - return withoutProperties(props, RESERVED_PROPS); - }, - - }, + mixins: [ FakeNode ], propTypes: { - preserveScrollPosition: React.PropTypes.bool.isRequired, - handler: React.PropTypes.any.isRequired, + name: React.PropTypes.string, path: React.PropTypes.string, - name: React.PropTypes.string - }, - - getDefaultProps: function () { - return { - preserveScrollPosition: false - }; - }, - - render: function () { - throw new Error( - 'The <Route> component should not be rendered directly. You may be ' + - 'missing a <Routes> wrapper around your list of routes.' - ); + handler: React.PropTypes.func.isRequired, + ignoreScrollBehavior: React.PropTypes.bool } }); module.exports = Route; -},{"../utils/withoutProperties":29}],7:[function(_dereq_,module,exports){ +},{"../mixins/FakeNode":13}],8:[function(_dereq_,module,exports){ var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var warning = _dereq_('react/lib/warning'); -var copyProperties = _dereq_('react/lib/copyProperties'); -var Promise = _dereq_('when/lib/Promise'); -var LocationActions = _dereq_('../actions/LocationActions'); -var Route = _dereq_('../components/Route'); -var Path = _dereq_('../utils/Path'); -var Redirect = _dereq_('../utils/Redirect'); -var Transition = _dereq_('../utils/Transition'); -var DefaultLocation = _dereq_('../locations/DefaultLocation'); -var HashLocation = _dereq_('../locations/HashLocation'); -var HistoryLocation = _dereq_('../locations/HistoryLocation'); -var RefreshLocation = _dereq_('../locations/RefreshLocation'); -var ActiveStore = _dereq_('../stores/ActiveStore'); -var PathStore = _dereq_('../stores/PathStore'); -var RouteStore = _dereq_('../stores/RouteStore'); - -/** - * The ref name that can be used to reference the active route component. - */ -var REF_NAME = '__activeRoute__'; - -/** - * A hash of { name, location } pairs of all locations. - */ -var NAMED_LOCATIONS = { - hash: HashLocation, - history: HistoryLocation, - refresh: RefreshLocation -}; - -/** - * The default handler for aborted transitions. Redirects replace - * the current URL and all others roll it back. - */ -function defaultAbortedTransitionHandler(transition) { - var reason = transition.abortReason; - - if (reason instanceof Redirect) { - LocationActions.replaceWith(reason.to, reason.params, reason.query); - } else { - LocationActions.goBack(); - } -} - -/** - * The default handler for active state updates. - */ -function defaultActiveStateChangeHandler(state) { - ActiveStore.updateState(state); -} - -/** - * The default handler for errors that were thrown asynchronously - * while transitioning. The default behavior is to re-throw the - * error so that it isn't silently swallowed. - */ -function defaultTransitionErrorHandler(error) { - throw error; // This error probably originated in a transition hook. -} - -function maybeUpdateScroll(routes, rootRoute) { - if (!routes.props.preserveScrollPosition && !rootRoute.props.preserveScrollPosition) - LocationActions.updateScroll(); -} /** - * The <Routes> component configures the route hierarchy and renders the - * route matching the current location when rendered into a document. - * - * See the <Route> component for more details. + * A <RouteHandler> component renders the active child route handler + * when routes are nested. */ -var Routes = React.createClass({ - - displayName: 'Routes', +var RouteHandler = React.createClass({ - propTypes: { - onAbortedTransition: React.PropTypes.func.isRequired, - onActiveStateChange: React.PropTypes.func.isRequired, - onTransitionError: React.PropTypes.func.isRequired, - preserveScrollPosition: React.PropTypes.bool, - location: function (props, propName, componentName) { - var location = props[propName]; - - if (typeof location === 'string' && !(location in NAMED_LOCATIONS)) - return new Error('Unknown location "' + location + '", see ' + componentName); - } - }, + displayName: 'RouteHandler', getDefaultProps: function () { return { - onAbortedTransition: defaultAbortedTransitionHandler, - onActiveStateChange: defaultActiveStateChangeHandler, - onTransitionError: defaultTransitionErrorHandler, - preserveScrollPosition: false, - location: DefaultLocation - }; - }, - - getInitialState: function () { - return { - routes: RouteStore.registerChildren(this.props.children, this) + ref: '__routeHandler__' }; }, - getLocation: function () { - var location = this.props.location; - - if (typeof location === 'string') - return NAMED_LOCATIONS[location]; - - return location; + contextTypes: { + getRouteAtDepth: React.PropTypes.func.isRequired, + getRouteComponents: React.PropTypes.func.isRequired, + routeHandlers: React.PropTypes.array.isRequired }, - componentWillMount: function () { - PathStore.setup(this.getLocation()); - PathStore.addChangeListener(this.handlePathChange); + childContextTypes: { + routeHandlers: React.PropTypes.array.isRequired }, - componentDidMount: function () { - this.handlePathChange(); + getChildContext: function () { + return { + routeHandlers: this.context.routeHandlers.concat([ this ]) + }; }, - componentWillUnmount: function () { - PathStore.removeChangeListener(this.handlePathChange); + getRouteDepth: function () { + return this.context.routeHandlers.length - 1; }, - handlePathChange: function () { - this.dispatch(PathStore.getCurrentPath()); + componentDidMount: function () { + this._updateRouteComponent(); }, - /** - * Performs a depth-first search for the first route in the tree that matches - * on the given path. Returns an array of all routes in the tree leading to - * the one that matched in the format { route, params } where params is an - * object that contains the URL parameters relevant to that route. Returns - * null if no route in the tree matches the path. - * - * React.renderComponent( - * <Routes> - * <Route handler={App}> - * <Route name="posts" handler={Posts}/> - * <Route name="post" path="/posts/:id" handler={Post}/> - * </Route> - * </Routes> - * ).match('/posts/123'); => [ { route: <AppRoute>, params: {} }, - * { route: <PostRoute>, params: { id: '123' } } ] - */ - match: function (path) { - return findMatches(Path.withoutQuery(path), this.state.routes, this.props.defaultRoute, this.props.notFoundRoute); + componentDidUpdate: function () { + this._updateRouteComponent(); }, - /** - * Performs a transition to the given path and returns a promise for the - * Transition object that was used. - * - * In order to do this, the router first determines which routes are involved - * in the transition beginning with the current route, up the route tree to - * the first parent route that is shared with the destination route, and back - * down the tree to the destination route. The willTransitionFrom static - * method is invoked on all route handlers we're transitioning away from, in - * reverse nesting order. Likewise, the willTransitionTo static method - * is invoked on all route handlers we're transitioning to. - * - * Both willTransitionFrom and willTransitionTo hooks may either abort or - * redirect the transition. If they need to resolve asynchronously, they may - * return a promise. - * - * Any error that occurs asynchronously during the transition is re-thrown in - * the top-level scope unless returnRejectedPromise is true, in which case a - * rejected promise is returned so the caller may handle the error. - * - * Note: This function does not update the URL in a browser's location bar. - * If you want to keep the URL in sync with transitions, use Router.transitionTo, - * Router.replaceWith, or Router.goBack instead. - */ - dispatch: function (path, returnRejectedPromise) { - var transition = new Transition(path); - var routes = this; - - var promise = runTransitionHooks(routes, transition).then(function (nextState) { - if (transition.isAborted) { - routes.props.onAbortedTransition(transition); - } else if (nextState) { - routes.setState(nextState); - routes.props.onActiveStateChange(nextState); - - // TODO: add functional test - var rootMatch = getRootMatch(nextState.matches); - - if (rootMatch) - maybeUpdateScroll(routes, rootMatch.route); - } - - return transition; - }); - - if (!returnRejectedPromise) { - promise = promise.then(undefined, function (error) { - // Use setTimeout to break the promise chain. - setTimeout(function () { - routes.props.onTransitionError(error); - }); - }); - } - - return promise; + _updateRouteComponent: function () { + var depth = this.getRouteDepth(); + var components = this.context.getRouteComponents(); + components[depth] = this.refs[this.props.ref]; }, render: function () { - if (!this.state.path) - return null; - - var matches = this.state.matches; - if (matches.length) { - // matches[0] corresponds to the top-most match - return matches[0].route.props.handler(computeHandlerProps(matches, this.state.activeQuery)); - } else { - return null; - } - } - -}); - -function findMatches(path, routes, defaultRoute, notFoundRoute) { - var matches = null, route, params; - - for (var i = 0, len = routes.length; i < len; ++i) { - route = routes[i]; - - // Check the subtree first to find the most deeply-nested match. - matches = findMatches(path, route.props.children, route.props.defaultRoute, route.props.notFoundRoute); - - if (matches != null) { - var rootParams = getRootMatch(matches).params; - - params = route.props.paramNames.reduce(function (params, paramName) { - params[paramName] = rootParams[paramName]; - return params; - }, {}); - - matches.unshift(makeMatch(route, params)); - - return matches; - } - - // No routes in the subtree matched, so check this route. - params = Path.extractParams(route.props.path, path); - - if (params) - return [ makeMatch(route, params) ]; - } - - // No routes matched, so try the default route if there is one. - if (defaultRoute && (params = Path.extractParams(defaultRoute.props.path, path))) - return [ makeMatch(defaultRoute, params) ]; - - // Last attempt: does the "not found" route match? - if (notFoundRoute && (params = Path.extractParams(notFoundRoute.props.path, path))) - return [ makeMatch(notFoundRoute, params) ]; - - return matches; -} - -function makeMatch(route, params) { - return { route: route, params: params }; -} - -function hasMatch(matches, match) { - return matches.some(function (m) { - if (m.route !== match.route) - return false; - - for (var property in m.params) { - if (m.params[property] !== match.params[property]) - return false; - } - - return true; - }); -} - -function getRootMatch(matches) { - return matches[matches.length - 1]; -} - -function updateMatchComponents(matches, refs) { - var i = 0, component; - while (component = refs[REF_NAME]) { - matches[i++].component = component; - refs = component.refs; - } -} - -/** - * Runs all transition hooks that are required to get from the current state - * to the state specified by the given transition and updates the current state - * if they all pass successfully. Returns a promise that resolves to the new - * state if it needs to be updated, or undefined if not. - */ -function runTransitionHooks(routes, transition) { - if (routes.state.path === transition.path) - return Promise.resolve(); // Nothing to do! - - var currentMatches = routes.state.matches; - var nextMatches = routes.match(transition.path); - - warning( - nextMatches, - 'No route matches path "' + transition.path + '". Make sure you have ' + - '<Route path="' + transition.path + '"> somewhere in your routes' - ); - - if (!nextMatches) - nextMatches = []; - - var fromMatches, toMatches; - if (currentMatches) { - updateMatchComponents(currentMatches, routes.refs); - - fromMatches = currentMatches.filter(function (match) { - return !hasMatch(nextMatches, match); - }); - - toMatches = nextMatches.filter(function (match) { - return !hasMatch(currentMatches, match); - }); - } else { - fromMatches = []; - toMatches = nextMatches; - } - - var query = Path.extractQuery(transition.path) || {}; - - return runTransitionFromHooks(fromMatches, transition).then(function () { - if (transition.isAborted) - return; // No need to continue. - - return runTransitionToHooks(toMatches, transition, query).then(function () { - if (transition.isAborted) - return; // No need to continue. - - var rootMatch = getRootMatch(nextMatches); - var params = (rootMatch && rootMatch.params) || {}; - - return { - path: transition.path, - matches: nextMatches, - activeParams: params, - activeQuery: query, - activeRoutes: nextMatches.map(function (match) { - return match.route; - }) - }; - }); - }); -} - -/** - * Calls the willTransitionFrom hook of all handlers in the given matches - * serially in reverse with the transition object and the current instance of - * the route's handler, so that the deepest nested handlers are called first. - * Returns a promise that resolves after the last handler. - */ -function runTransitionFromHooks(matches, transition) { - var promise = Promise.resolve(); - - reversedArray(matches).forEach(function (match) { - promise = promise.then(function () { - var handler = match.route.props.handler; - - if (!transition.isAborted && handler.willTransitionFrom) - return handler.willTransitionFrom(transition, match.component); - }); - }); - - return promise; -} - -/** - * Calls the willTransitionTo hook of all handlers in the given matches serially - * with the transition object and any params that apply to that handler. Returns - * a promise that resolves after the last handler. - */ -function runTransitionToHooks(matches, transition, query) { - var promise = Promise.resolve(); - - matches.forEach(function (match) { - promise = promise.then(function () { - var handler = match.route.props.handler; - - if (!transition.isAborted && handler.willTransitionTo) - return handler.willTransitionTo(transition, match.params, query); - }); - }); - - return promise; -} - -/** - * Given an array of matches as returned by findMatches, return a descriptor for - * the handler hierarchy specified by the route. - */ -function computeHandlerProps(matches, query) { - var props = { - ref: null, - key: null, - params: null, - query: null, - activeRouteHandler: returnNull - }; - - var childHandler; - reversedArray(matches).forEach(function (match) { - var route = match.route; - - props = Route.getUnreservedProps(route.props); - - props.ref = REF_NAME; - props.params = match.params; - props.query = query; - - if (route.props.addHandlerKey) - props.key = Path.injectParams(route.props.path, match.params); - - if (childHandler) { - props.activeRouteHandler = childHandler; - } else { - props.activeRouteHandler = returnNull; - } - - childHandler = function (props, addedProps) { - if (arguments.length > 2 && typeof arguments[2] !== 'undefined') - throw new Error('Passing children to a route handler is not supported'); - - return route.props.handler(copyProperties(props, addedProps)); - }.bind(this, props); - }); - - return props; -} - -function returnNull() { - return null; -} - -function reversedArray(array) { - return array.slice(0).reverse(); -} - -module.exports = Routes; - -},{"../actions/LocationActions":1,"../components/Route":6,"../locations/DefaultLocation":10,"../locations/HashLocation":11,"../locations/HistoryLocation":12,"../locations/RefreshLocation":14,"../stores/ActiveStore":17,"../stores/PathStore":18,"../stores/RouteStore":19,"../utils/Path":20,"../utils/Redirect":21,"../utils/Transition":22,"react/lib/copyProperties":40,"react/lib/warning":48,"when/lib/Promise":49}],8:[function(_dereq_,module,exports){ -var copyProperties = _dereq_('react/lib/copyProperties'); -var Dispatcher = _dereq_('flux').Dispatcher; - -/** - * Dispatches actions that modify the URL. - */ -var LocationDispatcher = copyProperties(new Dispatcher, { - - handleViewAction: function (action) { - this.dispatch({ - source: 'VIEW_ACTION', - action: action - }); + var route = this.context.getRouteAtDepth(this.getRouteDepth()); + return route ? React.createElement(route.handler, this.props) : null; } }); -module.exports = LocationDispatcher; - -},{"flux":31,"react/lib/copyProperties":40}],9:[function(_dereq_,module,exports){ -exports.goBack = _dereq_('./actions/LocationActions').goBack; -exports.replaceWith = _dereq_('./actions/LocationActions').replaceWith; -exports.transitionTo = _dereq_('./actions/LocationActions').transitionTo; +module.exports = RouteHandler; +},{}],9:[function(_dereq_,module,exports){ exports.DefaultRoute = _dereq_('./components/DefaultRoute'); exports.Link = _dereq_('./components/Link'); exports.NotFoundRoute = _dereq_('./components/NotFoundRoute'); exports.Redirect = _dereq_('./components/Redirect'); exports.Route = _dereq_('./components/Route'); -exports.Routes = _dereq_('./components/Routes'); +exports.RouteHandler = _dereq_('./components/RouteHandler'); -exports.ActiveState = _dereq_('./mixins/ActiveState'); -exports.AsyncState = _dereq_('./mixins/AsyncState'); +exports.HashLocation = _dereq_('./locations/HashLocation'); +exports.HistoryLocation = _dereq_('./locations/HistoryLocation'); +exports.RefreshLocation = _dereq_('./locations/RefreshLocation'); -exports.makeHref = _dereq_('./utils/makeHref'); +exports.Navigation = _dereq_('./mixins/Navigation'); +exports.State = _dereq_('./mixins/State'); -},{"./actions/LocationActions":1,"./components/DefaultRoute":2,"./components/Link":3,"./components/NotFoundRoute":4,"./components/Redirect":5,"./components/Route":6,"./components/Routes":7,"./mixins/ActiveState":15,"./mixins/AsyncState":16,"./utils/makeHref":25}],10:[function(_dereq_,module,exports){ -module.exports = "production" === 'test' - ? _dereq_('./MemoryLocation') - : _dereq_('./HashLocation'); +exports.create = _dereq_('./utils/createRouter'); +exports.run = _dereq_('./utils/runRouter'); -},{"./HashLocation":11,"./MemoryLocation":13}],11:[function(_dereq_,module,exports){ +},{"./components/DefaultRoute":3,"./components/Link":4,"./components/NotFoundRoute":5,"./components/Redirect":6,"./components/Route":7,"./components/RouteHandler":8,"./locations/HashLocation":10,"./locations/HistoryLocation":11,"./locations/RefreshLocation":12,"./mixins/Navigation":14,"./mixins/State":17,"./utils/createRouter":24,"./utils/runRouter":28}],10:[function(_dereq_,module,exports){ var invariant = _dereq_('react/lib/invariant'); -var ExecutionEnvironment = _dereq_('react/lib/ExecutionEnvironment'); -var getWindowPath = _dereq_('../utils/getWindowPath'); +var canUseDOM = _dereq_('react/lib/ExecutionEnvironment').canUseDOM; +var LocationActions = _dereq_('../actions/LocationActions'); +var Path = _dereq_('../utils/Path'); +/** + * Returns the current URL path from `window.location.hash`, including query string + */ function getHashPath() { - return window.location.hash.substr(1); + invariant( + canUseDOM, + 'getHashPath needs a DOM' + ); + + return Path.decode( + window.location.hash.substr(1) + ); } +var _actionType; + function ensureSlash() { var path = getHashPath(); @@ -37148,11 +36190,30 @@ function ensureSlash() { return false; } -var _onChange; +var _changeListeners = []; + +function notifyChange(type) { + var change = { + path: getHashPath(), + type: type + }; + + _changeListeners.forEach(function (listener) { + listener(change); + }); +} + +var _isListening = false; -function handleHashChange() { - if (ensureSlash()) - _onChange(); +function onHashChange() { + if (ensureSlash()) { + // If we don't have an _actionType then all we know is the hash + // changed. It was probably caused by the user clicking the Back + // button, but may have also been the Forward button or manual + // manipulation. So just guess 'pop'. + notifyChange(_actionType || LocationActions.POP); + _actionType = null; + } } /** @@ -37160,40 +36221,36 @@ function handleHashChange() { */ var HashLocation = { - setup: function (onChange) { - invariant( - ExecutionEnvironment.canUseDOM, - 'You cannot use HashLocation in an environment with no DOM' - ); - - _onChange = onChange; + addChangeListener: function (listener) { + _changeListeners.push(listener); + // Do this BEFORE listening for hashchange. ensureSlash(); + if (_isListening) + return; + if (window.addEventListener) { - window.addEventListener('hashchange', handleHashChange, false); + window.addEventListener('hashchange', onHashChange, false); } else { - window.attachEvent('onhashchange', handleHashChange); + window.attachEvent('onhashchange', onHashChange); } - }, - teardown: function () { - if (window.removeEventListener) { - window.removeEventListener('hashchange', handleHashChange, false); - } else { - window.detachEvent('onhashchange', handleHashChange); - } + _isListening = true; }, push: function (path) { - window.location.hash = path; + _actionType = LocationActions.PUSH; + window.location.hash = Path.encode(path); }, replace: function (path) { - window.location.replace(getWindowPath() + '#' + path); + _actionType = LocationActions.REPLACE; + window.location.replace(window.location.pathname + '#' + Path.encode(path)); }, pop: function () { + _actionType = LocationActions.POP; window.history.back(); }, @@ -37207,49 +36264,73 @@ var HashLocation = { module.exports = HashLocation; -},{"../utils/getWindowPath":23,"react/lib/ExecutionEnvironment":39,"react/lib/invariant":42}],12:[function(_dereq_,module,exports){ +},{"../actions/LocationActions":1,"../utils/Path":19,"react/lib/ExecutionEnvironment":35,"react/lib/invariant":39}],11:[function(_dereq_,module,exports){ var invariant = _dereq_('react/lib/invariant'); -var ExecutionEnvironment = _dereq_('react/lib/ExecutionEnvironment'); -var getWindowPath = _dereq_('../utils/getWindowPath'); +var canUseDOM = _dereq_('react/lib/ExecutionEnvironment').canUseDOM; +var LocationActions = _dereq_('../actions/LocationActions'); +var Path = _dereq_('../utils/Path'); -var _onChange; +/** + * Returns the current URL path from `window.location`, including query string + */ +function getWindowPath() { + invariant( + canUseDOM, + 'getWindowPath needs a DOM' + ); + + return Path.decode( + window.location.pathname + window.location.search + ); +} + +var _changeListeners = []; + +function notifyChange(type) { + var change = { + path: getWindowPath(), + type: type + }; + + _changeListeners.forEach(function (listener) { + listener(change); + }); +} + +var _isListening = false; + +function onPopState() { + notifyChange(LocationActions.POP); +} /** * A Location that uses HTML5 history. */ var HistoryLocation = { - setup: function (onChange) { - invariant( - ExecutionEnvironment.canUseDOM, - 'You cannot use HistoryLocation in an environment with no DOM' - ); + addChangeListener: function (listener) { + _changeListeners.push(listener); - _onChange = onChange; + if (_isListening) + return; if (window.addEventListener) { - window.addEventListener('popstate', _onChange, false); + window.addEventListener('popstate', onPopState, false); } else { - window.attachEvent('popstate', _onChange); + window.attachEvent('popstate', onPopState); } - }, - teardown: function () { - if (window.removeEventListener) { - window.removeEventListener('popstate', _onChange, false); - } else { - window.detachEvent('popstate', _onChange); - } + _isListening = true; }, push: function (path) { - window.history.pushState({ path: path }, '', path); - _onChange(); + window.history.pushState({ path: path }, '', Path.encode(path)); + notifyChange(LocationActions.PUSH); }, replace: function (path) { - window.history.replaceState({ path: path }, '', path); - _onChange(); + window.history.replaceState({ path: path }, '', Path.encode(path)); + notifyChange(LocationActions.REPLACE); }, pop: function () { @@ -37266,60 +36347,9 @@ var HistoryLocation = { module.exports = HistoryLocation; -},{"../utils/getWindowPath":23,"react/lib/ExecutionEnvironment":39,"react/lib/invariant":42}],13:[function(_dereq_,module,exports){ -var warning = _dereq_('react/lib/warning'); - -var _lastPath = null; -var _currentPath = null; -var _onChange; - -/** - * A Location that does not require a DOM. - */ -var MemoryLocation = { - - setup: function (onChange) { - _onChange = onChange; - }, - - push: function (path) { - _lastPath = _currentPath; - _currentPath = path; - _onChange(); - }, - - replace: function (path) { - _currentPath = path; - _onChange(); - }, - - pop: function () { - warning( - _lastPath != null, - 'You cannot use MemoryLocation to go back more than once' - ); - - _currentPath = _lastPath; - _lastPath = null; - _onChange(); - }, - - getCurrentPath: function () { - return _currentPath || '/'; - }, - - toString: function () { - return '<MemoryLocation>'; - } - -}; - -module.exports = MemoryLocation; - -},{"react/lib/warning":48}],14:[function(_dereq_,module,exports){ -var invariant = _dereq_('react/lib/invariant'); -var ExecutionEnvironment = _dereq_('react/lib/ExecutionEnvironment'); -var getWindowPath = _dereq_('../utils/getWindowPath'); +},{"../actions/LocationActions":1,"../utils/Path":19,"react/lib/ExecutionEnvironment":35,"react/lib/invariant":39}],12:[function(_dereq_,module,exports){ +var HistoryLocation = _dereq_('./HistoryLocation'); +var Path = _dereq_('../utils/Path'); /** * A Location that uses full page refreshes. This is used as @@ -37328,26 +36358,19 @@ var getWindowPath = _dereq_('../utils/getWindowPath'); */ var RefreshLocation = { - setup: function () { - invariant( - ExecutionEnvironment.canUseDOM, - 'You cannot use RefreshLocation in an environment with no DOM' - ); - }, - push: function (path) { - window.location = path; + window.location = Path.encode(path); }, replace: function (path) { - window.location.replace(path); + window.location.replace(Path.encode(path)); }, pop: function () { window.history.back(); }, - getCurrentPath: getWindowPath, + getCurrentPath: HistoryLocation.getCurrentPath, toString: function () { return '<RefreshLocation>'; @@ -37357,579 +36380,357 @@ var RefreshLocation = { module.exports = RefreshLocation; -},{"../utils/getWindowPath":23,"react/lib/ExecutionEnvironment":39,"react/lib/invariant":42}],15:[function(_dereq_,module,exports){ -var ActiveStore = _dereq_('../stores/ActiveStore'); - -/** - * A mixin for components that need to know about the routes, params, - * and query that are currently active. Components that use it get two - * things: - * - * 1. An `isActive` static method they can use to check if a route, - * params, and query are active. - * 2. An `updateActiveState` instance method that is called when the - * active state changes. - * - * Example: - * - * var Tab = React.createClass({ - * - * mixins: [ Router.ActiveState ], - * - * getInitialState: function () { - * return { - * isActive: false - * }; - * }, - * - * updateActiveState: function () { - * this.setState({ - * isActive: Tab.isActive(routeName, params, query) - * }) - * } - * - * }); - */ -var ActiveState = { - - statics: { - - /** - * Returns true if the route with the given name, URL parameters, and query - * are all currently active. - */ - isActive: ActiveStore.isActive - - }, - - componentWillMount: function () { - ActiveStore.addChangeListener(this.handleActiveStateChange); - }, - - componentDidMount: function () { - if (this.updateActiveState) - this.updateActiveState(); - }, +},{"../utils/Path":19,"./HistoryLocation":11}],13:[function(_dereq_,module,exports){ +var invariant = _dereq_('react/lib/invariant'); - componentWillUnmount: function () { - ActiveStore.removeChangeListener(this.handleActiveStateChange); - }, +var FakeNode = { - handleActiveStateChange: function () { - if (this.isMounted() && typeof this.updateActiveState === 'function') - this.updateActiveState(); + render: function () { + invariant( + false, + '%s elements should not be rendered', + this.constructor.displayName + ); } }; -module.exports = ActiveState; +module.exports = FakeNode; -},{"../stores/ActiveStore":17}],16:[function(_dereq_,module,exports){ +},{"react/lib/invariant":39}],14:[function(_dereq_,module,exports){ var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var resolveAsyncState = _dereq_('../utils/resolveAsyncState'); /** - * A mixin for route handler component classes that fetch at least - * part of their state asynchronously. Classes that use it should - * declare a static `getInitialAsyncState` method that fetches state - * for a component after it mounts. This function is given three - * arguments: 1) the current route params, 2) the current query and - * 3) a function that can be used to set state as it is received. - * - * Much like the familiar `getInitialState` method, `getInitialAsyncState` - * should return a hash of key/value pairs to use in the component's - * state. The difference is that the values may be promises. As these - * values resolve, the component's state is updated. You should only - * ever need to use the setState function for doing things like - * streaming data and/or updating progress. + * A mixin for components that modify the URL. * * Example: * - * var User = React.createClass({ - * - * statics: { - * - * getInitialAsyncState: function (params, query, setState) { - * // Return a hash with keys named after the state variables - * // you want to set, as you normally do in getInitialState, - * // except the values may be immediate values or promises. - * // The state is automatically updated as promises resolve. - * return { - * user: getUserByID(params.userID) // may be a promise - * }; - * - * // Or, use the setState function to stream data! - * var buffer = ''; - * - * return { - * - * // Same as above, the stream state variable is set to the - * // value returned by this promise when it resolves. - * stream: getStreamingData(params.userID, function (chunk) { - * buffer += chunk; - * - * // Notify of progress. - * setState({ - * streamBuffer: buffer - * }); - * }) - * - * }; - * } - * - * }, - * - * getInitialState: function () { - * return { - * user: null, // Receives a value when getUserByID resolves. - * stream: null, // Receives a value when getStreamingData resolves. - * streamBuffer: '' // Used to track data as it loads. - * }; + * var MyLink = React.createClass({ + * mixins: [ Router.Navigation ], + * handleClick: function (event) { + * event.preventDefault(); + * this.transitionTo('aRoute', { the: 'params' }, { the: 'query' }); * }, - * * render: function () { - * if (!this.state.user) - * return <LoadingUser/>; - * * return ( - * <div> - * <p>Welcome {this.state.user.name}!</p> - * <p>So far, you've received {this.state.streamBuffer.length} data!</p> - * </div> + * <a onClick={this.handleClick}>Click me!</a> * ); * } - * * }); - * - * When testing, use the `initialAsyncState` prop to simulate asynchronous - * data fetching. When this prop is present, no attempt is made to retrieve - * additional state via `getInitialAsyncState`. */ -var AsyncState = { +var Navigation = { - propTypes: { - initialAsyncState: React.PropTypes.object + contextTypes: { + makePath: React.PropTypes.func.isRequired, + makeHref: React.PropTypes.func.isRequired, + transitionTo: React.PropTypes.func.isRequired, + replaceWith: React.PropTypes.func.isRequired, + goBack: React.PropTypes.func.isRequired }, - getInitialState: function () { - return this.props.initialAsyncState || null; + /** + * Returns an absolute URL path created from the given route + * name, URL parameters, and query values. + */ + makePath: function (to, params, query) { + return this.context.makePath(to, params, query); }, - updateAsyncState: function (state) { - if (this.isMounted()) - this.setState(state); + /** + * Returns a string that may safely be used as the href of a + * link to the route with the given name. + */ + makeHref: function (to, params, query) { + return this.context.makeHref(to, params, query); }, - componentDidMount: function () { - if (this.props.initialAsyncState || typeof this.constructor.getInitialAsyncState !== 'function') - return; + /** + * Transitions to the URL specified in the arguments by pushing + * a new URL onto the history stack. + */ + transitionTo: function (to, params, query) { + this.context.transitionTo(to, params, query); + }, - resolveAsyncState( - this.constructor.getInitialAsyncState(this.props.params, this.props.query, this.updateAsyncState), - this.updateAsyncState - ); + /** + * Transitions to the URL specified in the arguments by replacing + * the current URL in the history stack. + */ + replaceWith: function (to, params, query) { + this.context.replaceWith(to, params, query); + }, + + /** + * Transitions to the previous URL. + */ + goBack: function () { + this.context.goBack(); } }; -module.exports = AsyncState; - -},{"../utils/resolveAsyncState":27}],17:[function(_dereq_,module,exports){ -var EventEmitter = _dereq_('events').EventEmitter; - -var CHANGE_EVENT = 'change'; -var _events = new EventEmitter; +module.exports = Navigation; -_events.setMaxListeners(0); - -function notifyChange() { - _events.emit(CHANGE_EVENT); -} +},{}],15:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var _activeRoutes = []; -var _activeParams = {}; -var _activeQuery = {}; +/** + * Provides the router with context for Router.Navigation. + */ +var NavigationContext = { -function routeIsActive(routeName) { - return _activeRoutes.some(function (route) { - return route.props.name === routeName; - }); -} + childContextTypes: { + makePath: React.PropTypes.func.isRequired, + makeHref: React.PropTypes.func.isRequired, + transitionTo: React.PropTypes.func.isRequired, + replaceWith: React.PropTypes.func.isRequired, + goBack: React.PropTypes.func.isRequired + }, -function paramsAreActive(params) { - for (var property in params) { - if (_activeParams[property] !== String(params[property])) - return false; + getChildContext: function () { + return { + makePath: this.constructor.makePath, + makeHref: this.constructor.makeHref, + transitionTo: this.constructor.transitionTo, + replaceWith: this.constructor.replaceWith, + goBack: this.constructor.goBack + }; } - return true; -} +}; -function queryIsActive(query) { - for (var property in query) { - if (_activeQuery[property] !== String(query[property])) - return false; - } +module.exports = NavigationContext; - return true; -} +},{}],16:[function(_dereq_,module,exports){ +var invariant = _dereq_('react/lib/invariant'); +var canUseDOM = _dereq_('react/lib/ExecutionEnvironment').canUseDOM; +var getWindowScrollPosition = _dereq_('../utils/getWindowScrollPosition'); /** - * The ActiveStore keeps track of which routes, URL and query parameters are - * currently active on a page. <Link>s subscribe to the ActiveStore to know - * whether or not they are active. + * Provides the router with the ability to manage window scroll position + * according to its scroll behavior. */ -var ActiveStore = { +var Scrolling = { - addChangeListener: function (listener) { - _events.on(CHANGE_EVENT, listener); + componentWillMount: function () { + invariant( + this.getScrollBehavior() == null || canUseDOM, + 'Cannot use scroll behavior without a DOM' + ); + + this._scrollHistory = {}; }, - removeChangeListener: function (listener) { - _events.removeListener(CHANGE_EVENT, listener); + componentDidMount: function () { + this._updateScroll(); }, - /** - * Updates the currently active state and notifies all listeners. - * This is automatically called by routes as they become active. - */ - updateState: function (state) { - state = state || {}; + componentWillUpdate: function () { + this._scrollHistory[this.state.path] = getWindowScrollPosition(); + }, - _activeRoutes = state.activeRoutes || []; - _activeParams = state.activeParams || {}; - _activeQuery = state.activeQuery || {}; + componentDidUpdate: function () { + this._updateScroll(); + }, - notifyChange(); + componentWillUnmount: function () { + delete this._scrollHistory; }, /** - * Returns true if the route with the given name, URL parameters, and query - * are all currently active. + * Returns the last known scroll position for the given URL path. */ - isActive: function (routeName, params, query) { - var isActive = routeIsActive(routeName) && paramsAreActive(params); + getScrollPosition: function (path) { + return this._scrollHistory[path] || null; + }, - if (query) - return isActive && queryIsActive(query); + _updateScroll: function () { + var scrollBehavior = this.getScrollBehavior(); - return isActive; + if (scrollBehavior) + scrollBehavior.updateScrollPosition( + this.getScrollPosition(this.state.path), + this.state.action + ); } }; -module.exports = ActiveStore; - -},{"events":30}],18:[function(_dereq_,module,exports){ -var warning = _dereq_('react/lib/warning'); -var EventEmitter = _dereq_('events').EventEmitter; -var LocationActions = _dereq_('../actions/LocationActions'); -var LocationDispatcher = _dereq_('../dispatchers/LocationDispatcher'); -var supportsHistory = _dereq_('../utils/supportsHistory'); -var HistoryLocation = _dereq_('../locations/HistoryLocation'); -var RefreshLocation = _dereq_('../locations/RefreshLocation'); - -var CHANGE_EVENT = 'change'; -var _events = new EventEmitter; - -function notifyChange() { - _events.emit(CHANGE_EVENT); -} - -var _scrollPositions = {}; - -function recordScrollPosition(path) { - _scrollPositions[path] = { - x: window.scrollX, - y: window.scrollY - }; -} - -function updateScrollPosition(path) { - var p = PathStore.getScrollPosition(path); - window.scrollTo(p.x, p.y); -} +module.exports = Scrolling; -var _location; +},{"../utils/getWindowScrollPosition":26,"react/lib/ExecutionEnvironment":35,"react/lib/invariant":39}],17:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); /** - * The PathStore keeps track of the current URL path and manages - * the location strategy that is used to update the URL. + * A mixin for components that need to know the path, routes, URL + * params and query that are currently active. + * + * Example: + * + * var AboutLink = React.createClass({ + * mixins: [ Router.State ], + * render: function () { + * var className = this.props.className; + * + * if (this.isActive('about')) + * className += ' is-active'; + * + * return React.DOM.a({ className: className }, this.props.children); + * } + * }); */ -var PathStore = { - - addChangeListener: function (listener) { - _events.on(CHANGE_EVENT, listener); - }, - - removeChangeListener: function (listener) { - _events.removeListener(CHANGE_EVENT, listener); - - // Automatically teardown when the last listener is removed. - if (EventEmitter.listenerCount(_events, CHANGE_EVENT) === 0) - PathStore.teardown(); - }, +var State = { - setup: function (location) { - // When using HistoryLocation, automatically fallback - // to RefreshLocation in browsers that do not support - // the HTML5 history API. - if (location === HistoryLocation && !supportsHistory()) - location = RefreshLocation; - - if (_location == null) { - _location = location; - - if (_location && typeof _location.setup === 'function') - _location.setup(notifyChange); - } else { - warning( - _location === location, - 'Cannot use location %s, already using %s', location, _location - ); - } + contextTypes: { + getCurrentPath: React.PropTypes.func.isRequired, + getCurrentRoutes: React.PropTypes.func.isRequired, + getCurrentParams: React.PropTypes.func.isRequired, + getCurrentQuery: React.PropTypes.func.isRequired, + isActive: React.PropTypes.func.isRequired }, - teardown: function () { - _events.removeAllListeners(CHANGE_EVENT); - - if (_location && typeof _location.teardown === 'function') - _location.teardown(); - - _location = null; + /** + * Returns the current URL path. + */ + getPath: function () { + return this.context.getCurrentPath(); }, /** - * Returns the location object currently in use. + * Returns an array of the routes that are currently active. */ - getLocation: function () { - return _location; + getRoutes: function () { + return this.context.getCurrentRoutes(); }, /** - * Returns the current URL path. + * Returns an object of the URL params that are currently active. */ - getCurrentPath: function () { - return _location.getCurrentPath(); + getParams: function () { + return this.context.getCurrentParams(); }, /** - * Returns the last known scroll position for the given path. + * Returns an object of the query params that are currently active. */ - getScrollPosition: function (path) { - return _scrollPositions[path] || { x: 0, y: 0 }; + getQuery: function () { + return this.context.getCurrentQuery(); }, - dispatchToken: LocationDispatcher.register(function (payload) { - var action = payload.action; - var currentPath = _location.getCurrentPath(); + /** + * A helper method to determine if a given route, params, and query + * are active. + */ + isActive: function (to, params, query) { + return this.context.isActive(to, params, query); + } - switch (action.type) { - case LocationActions.PUSH: - if (currentPath !== action.path) { - recordScrollPosition(currentPath); - _location.push(action.path); - } - break; +}; - case LocationActions.REPLACE: - if (currentPath !== action.path) { - recordScrollPosition(currentPath); - _location.replace(action.path); - } - break; +module.exports = State; - case LocationActions.POP: - recordScrollPosition(currentPath); - _location.pop(); - break; +},{}],18:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); +var assign = _dereq_('react/lib/Object.assign'); +var Path = _dereq_('../utils/Path'); - case LocationActions.UPDATE_SCROLL: - updateScrollPosition(currentPath); - break; - } - }) +function routeIsActive(activeRoutes, routeName) { + return activeRoutes.some(function (route) { + return route.name === routeName; + }); +} -}; +function paramsAreActive(activeParams, params) { + for (var property in params) + if (String(activeParams[property]) !== String(params[property])) + return false; -module.exports = PathStore; + return true; +} -},{"../actions/LocationActions":1,"../dispatchers/LocationDispatcher":8,"../locations/HistoryLocation":12,"../locations/RefreshLocation":14,"../utils/supportsHistory":28,"events":30,"react/lib/warning":48}],19:[function(_dereq_,module,exports){ -var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var invariant = _dereq_('react/lib/invariant'); -var warning = _dereq_('react/lib/warning'); -var Path = _dereq_('../utils/Path'); +function queryIsActive(activeQuery, query) { + for (var property in query) + if (String(activeQuery[property]) !== String(query[property])) + return false; -var _namedRoutes = {}; + return true; +} /** - * The RouteStore contains a directory of all <Route>s in the system. It is - * used primarily for looking up routes by name so that <Link>s can use a - * route name in the "to" prop and users can use route names in `Router.transitionTo` - * and other high-level utility methods. + * Provides the router with context for Router.State. */ -var RouteStore = { +var StateContext = { /** - * Removes all references to <Route>s from the store. Should only ever - * really be used in tests to clear the store between test runs. + * Returns the current URL path + query string. */ - unregisterAllRoutes: function () { - _namedRoutes = {}; + getCurrentPath: function () { + return this.state.path; }, /** - * Removes the reference to the given <Route> and all of its children - * from the store. + * Returns a read-only array of the currently active routes. */ - unregisterRoute: function (route) { - var props = route.props; - - if (props.name) - delete _namedRoutes[props.name]; - - React.Children.forEach(props.children, RouteStore.unregisterRoute); + getCurrentRoutes: function () { + return this.state.routes.slice(0); }, /** - * Registers a <Route> and all of its children with the store. Also, - * does some normalization and validation on route props. + * Returns a read-only object of the currently active URL parameters. */ - registerRoute: function (route, parentRoute) { - // Note: parentRoute may be a <Route> _or_ a <Routes>. - var props = route.props; - - invariant( - React.isValidClass(props.handler), - 'The handler for the "%s" route must be a valid React class', - props.name || props.path - ); - - var parentPath = (parentRoute && parentRoute.props.path) || '/'; - - if ((props.path || props.name) && !props.isDefault && !props.catchAll) { - var path = props.path || props.name; - - // Relative paths extend their parent. - if (!Path.isAbsolute(path)) - path = Path.join(parentPath, path); - - props.path = Path.normalize(path); - } else { - props.path = parentPath; - - if (props.catchAll) - props.path += '*'; - } - - props.paramNames = Path.extractParamNames(props.path); - - // Make sure the route's path has all params its parent needs. - if (parentRoute && Array.isArray(parentRoute.props.paramNames)) { - parentRoute.props.paramNames.forEach(function (paramName) { - invariant( - props.paramNames.indexOf(paramName) !== -1, - 'The nested route path "%s" is missing the "%s" parameter of its parent path "%s"', - props.path, paramName, parentRoute.props.path - ); - }); - } - - // Make sure the route can be looked up by <Link>s. - if (props.name) { - var existingRoute = _namedRoutes[props.name]; - - invariant( - !existingRoute || route === existingRoute, - 'You cannot use the name "%s" for more than one route', - props.name - ); - - _namedRoutes[props.name] = route; - } - - if (props.catchAll) { - invariant( - parentRoute, - '<NotFoundRoute> must have a parent <Route>' - ); - - invariant( - parentRoute.props.notFoundRoute == null, - 'You may not have more than one <NotFoundRoute> per <Route>' - ); - - parentRoute.props.notFoundRoute = route; - - return null; - } - - if (props.isDefault) { - invariant( - parentRoute, - '<DefaultRoute> must have a parent <Route>' - ); - - invariant( - parentRoute.props.defaultRoute == null, - 'You may not have more than one <DefaultRoute> per <Route>' - ); - - parentRoute.props.defaultRoute = route; - - return null; - } - - // Make sure children is an array. - props.children = RouteStore.registerChildren(props.children, route); + getCurrentParams: function () { + return assign({}, this.state.params); + }, - return route; + /** + * Returns a read-only object of the currently active query parameters. + */ + getCurrentQuery: function () { + return assign({}, this.state.query); }, /** - * Registers many children routes at once, always returning an array. + * Returns true if the given route, params, and query are active. */ - registerChildren: function (children, parentRoute) { - var routes = []; + isActive: function (to, params, query) { + if (Path.isAbsolute(to)) + return to === this.state.path; - React.Children.forEach(children, function (child) { - // Exclude <DefaultRoute>s. - if (child = RouteStore.registerRoute(child, parentRoute)) - routes.push(child); - }); + return routeIsActive(this.state.routes, to) && + paramsAreActive(this.state.params, params) && + (query == null || queryIsActive(this.state.query, query)); + }, - return routes; + childContextTypes: { + getCurrentPath: React.PropTypes.func.isRequired, + getCurrentRoutes: React.PropTypes.func.isRequired, + getCurrentParams: React.PropTypes.func.isRequired, + getCurrentQuery: React.PropTypes.func.isRequired, + isActive: React.PropTypes.func.isRequired }, - /** - * Returns the Route object with the given name, if one exists. - */ - getRouteByName: function (routeName) { - return _namedRoutes[routeName] || null; + getChildContext: function () { + return { + getCurrentPath: this.getCurrentPath, + getCurrentRoutes: this.getCurrentRoutes, + getCurrentParams: this.getCurrentParams, + getCurrentQuery: this.getCurrentQuery, + isActive: this.isActive + }; } }; -module.exports = RouteStore; +module.exports = StateContext; -},{"../utils/Path":20,"react/lib/invariant":42,"react/lib/warning":48}],20:[function(_dereq_,module,exports){ +},{"../utils/Path":19,"react/lib/Object.assign":36}],19:[function(_dereq_,module,exports){ var invariant = _dereq_('react/lib/invariant'); var merge = _dereq_('qs/lib/utils').merge; var qs = _dereq_('qs'); -function encodeURL(url) { - return encodeURIComponent(url).replace(/%20/g, '+'); -} - -function decodeURL(url) { - return decodeURIComponent(url.replace(/\+/g, ' ')); -} - -function encodeURLPath(path) { - return String(path).split('/').map(encodeURL).join('/'); -} - -var paramMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g; +var paramCompileMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g; +var paramInjectMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*]/g; +var paramInjectTrailingSlashMatcher = /\/\/\?|\/\?/g; var queryMatcher = /\?(.+)/; var _compiledPatterns = {}; @@ -37937,10 +36738,10 @@ var _compiledPatterns = {}; function compilePattern(pattern) { if (!(pattern in _compiledPatterns)) { var paramNames = []; - var source = pattern.replace(paramMatcher, function (match, paramName) { + var source = pattern.replace(paramCompileMatcher, function (match, paramName) { if (paramName) { paramNames.push(paramName); - return '([^./?#]+)'; + return '([^/?#]+)'; } else if (match === '*') { paramNames.push('splat'); return '(.*?)'; @@ -37961,6 +36762,20 @@ function compilePattern(pattern) { var Path = { /** + * Safely decodes special characters in the given URL path. + */ + decode: function (path) { + return decodeURI(path.replace(/\+/g, ' ')); + }, + + /** + * Safely encodes special characters in the given URL path. + */ + encode: function (path) { + return encodeURI(path).replace(/%20/g, '+'); + }, + + /** * Returns an array of the names of all parameters in the given pattern. */ extractParamNames: function (pattern) { @@ -37974,7 +36789,7 @@ var Path = { */ extractParams: function (pattern, path) { var object = compilePattern(pattern); - var match = decodeURL(path).match(object.matcher); + var match = path.match(object.matcher); if (!match) return null; @@ -37997,13 +36812,21 @@ var Path = { var splatIndex = 0; - return pattern.replace(paramMatcher, function (match, paramName) { + return pattern.replace(paramInjectMatcher, function (match, paramName) { paramName = paramName || 'splat'; - invariant( - params[paramName] != null, - 'Missing "' + paramName + '" parameter for path "' + pattern + '"' - ); + // If param is optional don't check for existence + if (paramName.slice(-1) !== '?') { + invariant( + params[paramName] != null, + 'Missing "' + paramName + '" parameter for path "' + pattern + '"' + ); + } else { + paramName = paramName.slice(0, -1); + + if (params[paramName] == null) + return ''; + } var segment; if (paramName === 'splat' && Array.isArray(params[paramName])) { @@ -38017,8 +36840,8 @@ var Path = { segment = params[paramName]; } - return encodeURLPath(segment); - }); + return segment; + }).replace(paramInjectTrailingSlashMatcher, '/'); }, /** @@ -38026,7 +36849,7 @@ var Path = { * in the given path, null if the path contains no query string. */ extractQuery: function (path) { - var match = decodeURL(path).match(queryMatcher); + var match = path.match(queryMatcher); return match && qs.parse(match[1]); }, @@ -38080,7 +36903,30 @@ var Path = { module.exports = Path; -},{"qs":34,"qs/lib/utils":38,"react/lib/invariant":42}],21:[function(_dereq_,module,exports){ +},{"qs":30,"qs/lib/utils":34,"react/lib/invariant":39}],20:[function(_dereq_,module,exports){ +var Promise = _dereq_('when/lib/Promise'); + +// TODO: Use process.env.NODE_ENV check + envify to enable +// when's promise monitor here when in dev. + +module.exports = Promise; + +},{"when/lib/Promise":41}],21:[function(_dereq_,module,exports){ +var PropTypes = { + + /** + * Requires that the value of a prop be falsy. + */ + falsy: function (props, propName, elementName) { + if (props[propName]) + return new Error('<' + elementName + '> may not have a "' + propName + '" prop'); + } + +}; + +module.exports = PropTypes; + +},{}],22:[function(_dereq_,module,exports){ /** * Encapsulates a redirect to the given route. */ @@ -38092,10 +36938,89 @@ function Redirect(to, params, query) { module.exports = Redirect; -},{}],22:[function(_dereq_,module,exports){ -var mixInto = _dereq_('react/lib/mixInto'); -var transitionTo = _dereq_('../actions/LocationActions').transitionTo; +},{}],23:[function(_dereq_,module,exports){ +var assign = _dereq_('react/lib/Object.assign'); +var reversedArray = _dereq_('./reversedArray'); var Redirect = _dereq_('./Redirect'); +var Promise = _dereq_('./Promise'); + +/** + * Runs all hook functions serially and calls callback(error) when finished. + * A hook may return a promise if it needs to execute asynchronously. + */ +function runHooks(hooks, callback) { + try { + var promise = hooks.reduce(function (promise, hook) { + // The first hook to use transition.wait makes the rest + // of the transition async from that point forward. + return promise ? promise.then(hook) : hook(); + }, null); + } catch (error) { + return callback(error); // Sync error. + } + + if (promise) { + // Use setTimeout to break the promise chain. + promise.then(function () { + setTimeout(callback); + }, function (error) { + setTimeout(function () { + callback(error); + }); + }); + } else { + callback(); + } +} + +/** + * Calls the willTransitionFrom hook of all handlers in the given matches + * serially in reverse with the transition object and the current instance of + * the route's handler, so that the deepest nested handlers are called first. + * Calls callback(error) when finished. + */ +function runTransitionFromHooks(transition, routes, components, callback) { + components = reversedArray(components); + + var hooks = reversedArray(routes).map(function (route, index) { + return function () { + var handler = route.handler; + + if (!transition.isAborted && handler.willTransitionFrom) + return handler.willTransitionFrom(transition, components[index]); + + var promise = transition._promise; + transition._promise = null; + + return promise; + }; + }); + + runHooks(hooks, callback); +} + +/** + * Calls the willTransitionTo hook of all handlers in the given matches + * serially with the transition object and any params that apply to that + * handler. Calls callback(error) when finished. + */ +function runTransitionToHooks(transition, routes, params, query, callback) { + var hooks = routes.map(function (route) { + return function () { + var handler = route.handler; + + if (!transition.isAborted && handler.willTransitionTo) + handler.willTransitionTo(transition, params, query); + + var promise = transition._promise; + transition._promise = null; + + return promise; + }; + }); + + runHooks(hooks, callback); +} /** * Encapsulates a transition to a given path. @@ -38103,13 +37028,15 @@ var Redirect = _dereq_('./Redirect'); * The willTransitionTo and willTransitionFrom handlers receive * an instance of this class as their first argument. */ -function Transition(path) { +function Transition(path, retry) { this.path = path; this.abortReason = null; this.isAborted = false; + this.retry = retry.bind(this); + this._promise = null; } -mixInto(Transition, { +assign(Transition.prototype, { abort: function (reason) { this.abortReason = reason; @@ -38120,763 +37047,715 @@ mixInto(Transition, { this.abort(new Redirect(to, params, query)); }, - retry: function () { - transitionTo(this.path); + wait: function (value) { + this._promise = Promise.resolve(value); + }, + + from: function (routes, components, callback) { + return runTransitionFromHooks(this, routes, components, callback); + }, + + to: function (routes, params, query, callback) { + return runTransitionToHooks(this, routes, params, query, callback); } }); module.exports = Transition; -},{"../actions/LocationActions":1,"./Redirect":21,"react/lib/mixInto":47}],23:[function(_dereq_,module,exports){ +},{"./Promise":20,"./Redirect":22,"./reversedArray":27,"react/lib/Object.assign":36}],24:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); +var warning = _dereq_('react/lib/warning'); +var invariant = _dereq_('react/lib/invariant'); +var canUseDOM = _dereq_('react/lib/ExecutionEnvironment').canUseDOM; +var ImitateBrowserBehavior = _dereq_('../behaviors/ImitateBrowserBehavior'); +var RouteHandler = _dereq_('../components/RouteHandler'); +var HashLocation = _dereq_('../locations/HashLocation'); +var HistoryLocation = _dereq_('../locations/HistoryLocation'); +var RefreshLocation = _dereq_('../locations/RefreshLocation'); +var NavigationContext = _dereq_('../mixins/NavigationContext'); +var StateContext = _dereq_('../mixins/StateContext'); +var Scrolling = _dereq_('../mixins/Scrolling'); +var createRoutesFromChildren = _dereq_('./createRoutesFromChildren'); +var supportsHistory = _dereq_('./supportsHistory'); +var Transition = _dereq_('./Transition'); +var PropTypes = _dereq_('./PropTypes'); +var Redirect = _dereq_('./Redirect'); +var Path = _dereq_('./Path'); + /** - * Returns the current URL path from `window.location`, including query string + * The default location for new routers. */ -function getWindowPath() { - return window.location.pathname + window.location.search; -} - -module.exports = getWindowPath; - - -},{}],24:[function(_dereq_,module,exports){ -module.exports = Function.prototype.call.bind(Object.prototype.hasOwnProperty); +var DEFAULT_LOCATION = canUseDOM ? HashLocation : '/'; -},{}],25:[function(_dereq_,module,exports){ -var HashLocation = _dereq_('../locations/HashLocation'); -var PathStore = _dereq_('../stores/PathStore'); -var makePath = _dereq_('./makePath'); +/** + * The default scroll behavior for new routers. + */ +var DEFAULT_SCROLL_BEHAVIOR = canUseDOM ? ImitateBrowserBehavior : null; /** - * Returns a string that may safely be used as the href of a - * link to the route with the given name. + * The default error handler for new routers. */ -function makeHref(to, params, query) { - var path = makePath(to, params, query); +function defaultErrorHandler(error) { + // Throw so we don't silently swallow async errors. + throw error; // This error probably originated in a transition hook. +} - if (PathStore.getLocation() === HashLocation) - return '#' + path; +/** + * The default aborted transition handler for new routers. + */ +function defaultAbortHandler(abortReason, location) { + if (typeof location === 'string') + throw new Error('Unhandled aborted transition! Reason: ' + abortReason); - return path; + if (abortReason instanceof Redirect) { + location.replace(this.makePath(abortReason.to, abortReason.params, abortReason.query)); + } else { + location.pop(); + } } -module.exports = makeHref; +function findMatch(pathname, routes, defaultRoute, notFoundRoute) { + var match, route, params; -},{"../locations/HashLocation":11,"../stores/PathStore":18,"./makePath":26}],26:[function(_dereq_,module,exports){ -var invariant = _dereq_('react/lib/invariant'); -var RouteStore = _dereq_('../stores/RouteStore'); -var Path = _dereq_('./Path'); + for (var i = 0, len = routes.length; i < len; ++i) { + route = routes[i]; -/** - * Returns an absolute URL path created from the given route name, URL - * parameters, and query values. - */ -function makePath(to, params, query) { - var path; - if (Path.isAbsolute(to)) { - path = Path.normalize(to); - } else { - var route = RouteStore.getRouteByName(to); + // Check the subtree first to find the most deeply-nested match. + match = findMatch(pathname, route.childRoutes, route.defaultRoute, route.notFoundRoute); - invariant( - route, - 'Unable to find a route named "' + to + '". Make sure you have ' + - 'a <Route name="' + to + '"> defined somewhere in your routes' - ); + if (match != null) { + match.routes.unshift(route); + return match; + } + + // No routes in the subtree matched, so check this route. + params = Path.extractParams(route.path, pathname); - path = route.props.path; + if (params) + return createMatch(route, params); } - return Path.withQuery(Path.injectParams(path, params), query); + // No routes matched, so try the default route if there is one. + if (defaultRoute && (params = Path.extractParams(defaultRoute.path, pathname))) + return createMatch(defaultRoute, params); + + // Last attempt: does the "not found" route match? + if (notFoundRoute && (params = Path.extractParams(notFoundRoute.path, pathname))) + return createMatch(notFoundRoute, params); + + return match; } -module.exports = makePath; +function createMatch(route, params) { + return { routes: [ route ], params: params }; +} -},{"../stores/RouteStore":19,"./Path":20,"react/lib/invariant":42}],27:[function(_dereq_,module,exports){ -var Promise = _dereq_('when/lib/Promise'); +function hasMatch(routes, route, prevParams, nextParams) { + return routes.some(function (r) { + if (r !== route) + return false; + + var paramNames = route.paramNames; + var paramName; + + for (var i = 0, len = paramNames.length; i < len; ++i) { + paramName = paramNames[i]; + + if (nextParams[paramName] !== prevParams[paramName]) + return false; + } + + return true; + }); +} /** - * Resolves all values in asyncState and calls the setState - * function with new state as they resolve. Returns a promise - * that resolves after all values are resolved. + * Creates and returns a new router using the given options. A router + * is a ReactComponent class that knows how to react to changes in the + * URL and keep the contents of the page in sync. + * + * Options may be any of the following: + * + * - routes (required) The route config + * - location The location to use. Defaults to HashLocation when + * the DOM is available, "/" otherwise + * - scrollBehavior The scroll behavior to use. Defaults to ImitateBrowserBehavior + * when the DOM is available, null otherwise + * - onError A function that is used to handle errors + * - onAbort A function that is used to handle aborted transitions + * + * When rendering in a server-side environment, the location should simply + * be the URL path that was used in the request, including the query string. */ -function resolveAsyncState(asyncState, setState) { - if (asyncState == null) - return Promise.resolve(); +function createRouter(options) { + options = options || {}; - var keys = Object.keys(asyncState); - - return Promise.all( - keys.map(function (key) { - return Promise.resolve(asyncState[key]).then(function (value) { - var newState = {}; - newState[key] = value; - setState(newState); - }); - }) - ); -} + if (typeof options === 'function') { + options = { routes: options }; // Router.create(<Route>) + } else if (Array.isArray(options)) { + options = { routes: options }; // Router.create([ <Route>, <Route> ]) + } -module.exports = resolveAsyncState; + var routes = []; + var namedRoutes = {}; + var components = []; + var location = options.location || DEFAULT_LOCATION; + var scrollBehavior = options.scrollBehavior || DEFAULT_SCROLL_BEHAVIOR; + var onError = options.onError || defaultErrorHandler; + var onAbort = options.onAbort || defaultAbortHandler; + var state = {}; + var nextState = {}; -},{"when/lib/Promise":49}],28:[function(_dereq_,module,exports){ -function supportsHistory() { - /*! taken from modernizr - * https://github.com/Modernizr/Modernizr/blob/master/LICENSE - * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js - */ - var ua = navigator.userAgent; - if ((ua.indexOf('Android 2.') !== -1 || - (ua.indexOf('Android 4.0') !== -1)) && - ua.indexOf('Mobile Safari') !== -1 && - ua.indexOf('Chrome') === -1) { - return false; + function updateState() { + state = nextState; + nextState = {}; } - return (window.history && 'pushState' in window.history); -} -module.exports = supportsHistory; + // Automatically fall back to full page refreshes in + // browsers that don't support the HTML history API. + if (location === HistoryLocation && !supportsHistory()) + location = RefreshLocation; -},{}],29:[function(_dereq_,module,exports){ -function withoutProperties(object, properties) { - var result = {}; + var router = React.createClass({ - for (var property in object) { - if (object.hasOwnProperty(property) && !properties[property]) - result[property] = object[property]; - } + displayName: 'Router', - return result; -} + mixins: [ NavigationContext, StateContext, Scrolling ], -module.exports = withoutProperties; + statics: { -},{}],30:[function(_dereq_,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -EventEmitter.defaultMaxListeners = 10; - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError('n must be a positive number'); - this._maxListeners = n; - return this; -}; - -EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; - - if (!this._events) - this._events = {}; - - // If there is no 'error' event listener then throw. - if (type === 'error') { - if (!this._events.error || - (isObject(this._events.error) && !this._events.error.length)) { - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } else { - throw TypeError('Uncaught, unspecified "error" event.'); - } - return false; - } - } + defaultRoute: null, + notFoundRoute: null, - handler = this._events[type]; + /** + * Adds routes to this router from the given children object (see ReactChildren). + */ + addRoutes: function (children) { + routes.push.apply(routes, createRoutesFromChildren(children, this, namedRoutes)); + }, - if (isUndefined(handler)) - return false; + /** + * Returns an absolute URL path created from the given route + * name, URL parameters, and query. + */ + makePath: function (to, params, query) { + var path; + if (Path.isAbsolute(to)) { + path = Path.normalize(to); + } else { + var route = namedRoutes[to]; - if (isFunction(handler)) { - switch (arguments.length) { - // fast cases - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - handler.apply(this, args); - } - } else if (isObject(handler)) { - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; + invariant( + route, + 'Unable to find <Route name="%s">', + to + ); - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } + path = route.path; + } - return true; -}; + return Path.withQuery(Path.injectParams(path, params), query); + }, -EventEmitter.prototype.addListener = function(type, listener) { - var m; - - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - if (!this._events) - this._events = {}; - - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (this._events.newListener) - this.emit('newListener', type, - isFunction(listener.listener) ? - listener.listener : listener); - - if (!this._events[type]) - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - else if (isObject(this._events[type])) - // If we've already got an array, just append. - this._events[type].push(listener); - else - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; - - // Check for listener leak - if (isObject(this._events[type]) && !this._events[type].warned) { - var m; - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; - } + /** + * Returns a string that may safely be used as the href of a link + * to the route with the given name, URL parameters, and query. + */ + makeHref: function (to, params, query) { + var path = this.makePath(to, params, query); + return (location === HashLocation) ? '#' + path : path; + }, - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - if (typeof console.trace === 'function') { - // not supported in IE 10 - console.trace(); - } - } - } + /** + * Transitions to the URL specified in the arguments by pushing + * a new URL onto the history stack. + */ + transitionTo: function (to, params, query) { + invariant( + typeof location !== 'string', + 'You cannot use transitionTo with a static location' + ); - return this; -}; + location.push(this.makePath(to, params, query)); + }, -EventEmitter.prototype.on = EventEmitter.prototype.addListener; + /** + * Transitions to the URL specified in the arguments by replacing + * the current URL in the history stack. + */ + replaceWith: function (to, params, query) { + invariant( + typeof location !== 'string', + 'You cannot use replaceWith with a static location' + ); -EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError('listener must be a function'); + location.replace(this.makePath(to, params, query)); + }, - var fired = false; + /** + * Transitions to the previous URL. + */ + goBack: function () { + invariant( + typeof location !== 'string', + 'You cannot use goBack with a static location' + ); - function g() { - this.removeListener(type, g); + location.pop(); + }, - if (!fired) { - fired = true; - listener.apply(this, arguments); - } - } + /** + * Performs a match of the given path against this router and returns an object with + * the { path, routes, params, query } that match. Returns null if no match can be made. + */ + match: function (path) { + return findMatch(Path.withoutQuery(path), routes, this.defaultRoute, this.notFoundRoute) || null; + }, - g.listener = listener; - this.on(type, g); + /** + * Performs a transition to the given path and calls callback(error, abortReason) + * when the transition is finished. If both arguments are null the router's state + * was updated. Otherwise the transition did not complete. + * + * In a transition, a router first determines which routes are involved by beginning + * with the current route, up the route tree to the first parent route that is shared + * with the destination route, and back down the tree to the destination route. The + * willTransitionFrom hook is invoked on all route handlers we're transitioning away + * from, in reverse nesting order. Likewise, the willTransitionTo hook is invoked on + * all route handlers we're transitioning to. + * + * Both willTransitionFrom and willTransitionTo hooks may either abort or redirect the + * transition. To resolve asynchronously, they may use transition.wait(promise). If no + * hooks wait, the transition is fully synchronous. + */ + dispatch: function (path, action, callback) { + if (state.path === path) + return; // Nothing to do! - return this; -}; + var match = this.match(path); -// emits a 'removeListener' event iff the listener was removed -EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; + warning( + match != null, + 'No route matches path "%s". Make sure you have <Route path="%s"> somewhere in your routes', + path, path + ); - if (!isFunction(listener)) - throw TypeError('listener must be a function'); + if (match == null) + match = {}; - if (!this._events || !this._events[type]) - return this; + var prevRoutes = state.routes || []; + var prevParams = state.params || {}; - list = this._events[type]; - length = list.length; - position = -1; - - if (list === listener || - (isFunction(list.listener) && list.listener === listener)) { - delete this._events[type]; - if (this._events.removeListener) - this.emit('removeListener', type, listener); - - } else if (isObject(list)) { - for (i = length; i-- > 0;) { - if (list[i] === listener || - (list[i].listener && list[i].listener === listener)) { - position = i; - break; + var nextRoutes = match.routes || []; + var nextParams = match.params || {}; + var nextQuery = Path.extractQuery(path) || {}; + + var fromRoutes, toRoutes; + if (prevRoutes.length) { + fromRoutes = prevRoutes.filter(function (route) { + return !hasMatch(nextRoutes, route, prevParams, nextParams); + }); + + toRoutes = nextRoutes.filter(function (route) { + return !hasMatch(prevRoutes, route, prevParams, nextParams); + }); + } else { + fromRoutes = []; + toRoutes = nextRoutes; + } + + var transition = new Transition(path, this.replaceWith.bind(this, path)); + + transition.from(fromRoutes, components, function (error) { + if (error || transition.isAborted) + return callback.call(router, error, transition); + + transition.to(toRoutes, nextParams, nextQuery, function (error) { + if (error || transition.isAborted) + return callback.call(router, error, transition); + + nextState.path = path; + nextState.action = action; + nextState.routes = nextRoutes; + nextState.params = nextParams; + nextState.query = nextQuery; + + callback.call(router, null, transition); + }); + }); + }, + + /** + * Starts this router and calls callback(router, state) when the route changes. + * + * If the router's location is static (i.e. a URL path in a server environment) + * the callback is called only once. Otherwise, the location should be one of the + * Router.*Location objects (e.g. Router.HashLocation or Router.HistoryLocation). + */ + run: function (callback) { + function dispatchHandler(error, transition) { + if (error) { + onError.call(router, error); + } else if (transition.isAborted) { + onAbort.call(router, transition.abortReason, location); + } else { + callback.call(router, router, nextState); + } + } + + if (typeof location === 'string') { + warning( + !canUseDOM || "production" === 'test', + 'You should not use a static location in a DOM environment because ' + + 'the router will not be kept in sync with the current URL' + ); + + // Dispatch the location. + router.dispatch(location, null, dispatchHandler); + } else { + invariant( + canUseDOM, + 'You cannot use %s in a non-DOM environment', + location + ); + + // Listen for changes to the location. + function changeListener(change) { + router.dispatch(change.path, change.type, dispatchHandler); + } + + if (location.addChangeListener) + location.addChangeListener(changeListener); + + // Bootstrap using the current path. + router.dispatch(location.getCurrentPath(), null, dispatchHandler); + } } - } - if (position < 0) - return this; + }, - if (list.length === 1) { - list.length = 0; - delete this._events[type]; - } else { - list.splice(position, 1); - } + propTypes: { + children: PropTypes.falsy + }, - if (this._events.removeListener) - this.emit('removeListener', type, listener); - } + getLocation: function () { + return location; + }, - return this; -}; + getScrollBehavior: function () { + return scrollBehavior; + }, -EventEmitter.prototype.removeAllListeners = function(type) { - var key, listeners; + getRouteAtDepth: function (depth) { + var routes = this.state.routes; + return routes && routes[depth]; + }, - if (!this._events) - return this; + getRouteComponents: function () { + return components; + }, - // not listening for removeListener, no need to emit - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; - } + getInitialState: function () { + updateState(); + return state; + }, - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - for (key in this._events) { - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = {}; - return this; - } + componentWillReceiveProps: function () { + updateState(); + this.setState(state); + }, - listeners = this._events[type]; + render: function () { + return this.getRouteAtDepth(0) ? React.createElement(RouteHandler, this.props) : null; + }, - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else { - // LIFO order - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); - } - delete this._events[type]; + childContextTypes: { + getRouteAtDepth: React.PropTypes.func.isRequired, + getRouteComponents: React.PropTypes.func.isRequired, + routeHandlers: React.PropTypes.array.isRequired + }, - return this; -}; + getChildContext: function () { + return { + getRouteComponents: this.getRouteComponents, + getRouteAtDepth: this.getRouteAtDepth, + routeHandlers: [ this ] + }; + } -EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; -}; + }); -EventEmitter.listenerCount = function(emitter, type) { - var ret; - if (!emitter._events || !emitter._events[type]) - ret = 0; - else if (isFunction(emitter._events[type])) - ret = 1; - else - ret = emitter._events[type].length; - return ret; -}; + if (options.routes) + router.addRoutes(options.routes); -function isFunction(arg) { - return typeof arg === 'function'; + return router; } -function isNumber(arg) { - return typeof arg === 'number'; -} +module.exports = createRouter; + +},{"../behaviors/ImitateBrowserBehavior":2,"../components/RouteHandler":8,"../locations/HashLocation":10,"../locations/HistoryLocation":11,"../locations/RefreshLocation":12,"../mixins/NavigationContext":15,"../mixins/Scrolling":16,"../mixins/StateContext":18,"./Path":19,"./PropTypes":21,"./Redirect":22,"./Transition":23,"./createRoutesFromChildren":25,"./supportsHistory":29,"react/lib/ExecutionEnvironment":35,"react/lib/invariant":39,"react/lib/warning":40}],25:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); +var warning = _dereq_('react/lib/warning'); +var invariant = _dereq_('react/lib/invariant'); +var DefaultRoute = _dereq_('../components/DefaultRoute'); +var NotFoundRoute = _dereq_('../components/NotFoundRoute'); +var Redirect = _dereq_('../components/Redirect'); +var Route = _dereq_('../components/Route'); +var Path = _dereq_('./Path'); + +var CONFIG_ELEMENT_TYPES = [ + DefaultRoute.type, + NotFoundRoute.type, + Redirect.type, + Route.type +]; -function isObject(arg) { - return typeof arg === 'object' && arg !== null; +function createRedirectHandler(to, _params, _query) { + return React.createClass({ + statics: { + willTransitionTo: function (transition, params, query) { + transition.redirect(to, _params || params, _query || query); + } + }, + + render: function () { + return null; + } + }); } -function isUndefined(arg) { - return arg === void 0; +function checkPropTypes(componentName, propTypes, props) { + for (var propName in propTypes) { + if (propTypes.hasOwnProperty(propName)) { + var error = propTypes[propName](props, propName, componentName); + + if (error instanceof Error) + warning(false, error.message); + } + } } -},{}],31:[function(_dereq_,module,exports){ -/** - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ +function createRoute(element, parentRoute, namedRoutes) { + var type = element.type; + var props = element.props; + var componentName = (type && type.displayName) || 'UnknownComponent'; -module.exports.Dispatcher = _dereq_('./lib/Dispatcher') + invariant( + CONFIG_ELEMENT_TYPES.indexOf(type) !== -1, + 'Unrecognized route configuration element "<%s>"', + componentName + ); -},{"./lib/Dispatcher":32}],32:[function(_dereq_,module,exports){ -/* - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule Dispatcher - * @typechecks - */ + if (type.propTypes) + checkPropTypes(componentName, type.propTypes, props); -var invariant = _dereq_('./invariant'); + var route = { name: props.name }; -var _lastID = 1; -var _prefix = 'ID_'; + if (type === Redirect.type) { + route.handler = createRedirectHandler(props.to, props.params, props.query); + props.path = props.path || props.from || '*'; + } else { + route.handler = props.handler; + } -/** - * Dispatcher is used to broadcast payloads to registered callbacks. This is - * different from generic pub-sub systems in two ways: - * - * 1) Callbacks are not subscribed to particular events. Every payload is - * dispatched to every registered callback. - * 2) Callbacks can be deferred in whole or part until other callbacks have - * been executed. - * - * For example, consider this hypothetical flight destination form, which - * selects a default city when a country is selected: - * - * var flightDispatcher = new Dispatcher(); - * - * // Keeps track of which country is selected - * var CountryStore = {country: null}; - * - * // Keeps track of which city is selected - * var CityStore = {city: null}; - * - * // Keeps track of the base flight price of the selected city - * var FlightPriceStore = {price: null} - * - * When a user changes the selected city, we dispatch the payload: - * - * flightDispatcher.dispatch({ - * actionType: 'city-update', - * selectedCity: 'paris' - * }); - * - * This payload is digested by `CityStore`: - * - * flightDispatcher.register(function(payload) { - * if (payload.actionType === 'city-update') { - * CityStore.city = payload.selectedCity; - * } - * }); - * - * When the user selects a country, we dispatch the payload: - * - * flightDispatcher.dispatch({ - * actionType: 'country-update', - * selectedCountry: 'australia' - * }); - * - * This payload is digested by both stores: - * - * CountryStore.dispatchToken = flightDispatcher.register(function(payload) { - * if (payload.actionType === 'country-update') { - * CountryStore.country = payload.selectedCountry; - * } - * }); - * - * When the callback to update `CountryStore` is registered, we save a reference - * to the returned token. Using this token with `waitFor()`, we can guarantee - * that `CountryStore` is updated before the callback that updates `CityStore` - * needs to query its data. - * - * CityStore.dispatchToken = flightDispatcher.register(function(payload) { - * if (payload.actionType === 'country-update') { - * // `CountryStore.country` may not be updated. - * flightDispatcher.waitFor([CountryStore.dispatchToken]); - * // `CountryStore.country` is now guaranteed to be updated. - * - * // Select the default city for the new country - * CityStore.city = getDefaultCityForCountry(CountryStore.country); - * } - * }); - * - * The usage of `waitFor()` can be chained, for example: - * - * FlightPriceStore.dispatchToken = - * flightDispatcher.register(function(payload) { - * switch (payload.actionType) { - * case 'country-update': - * flightDispatcher.waitFor([CityStore.dispatchToken]); - * FlightPriceStore.price = - * getFlightPriceStore(CountryStore.country, CityStore.city); - * break; - * - * case 'city-update': - * FlightPriceStore.price = - * FlightPriceStore(CountryStore.country, CityStore.city); - * break; - * } - * }); - * - * The `country-update` payload will be guaranteed to invoke the stores' - * registered callbacks in order: `CountryStore`, `CityStore`, then - * `FlightPriceStore`. - */ + var parentPath = (parentRoute && parentRoute.path) || '/'; + + if ((props.path || props.name) && type !== DefaultRoute.type && type !== NotFoundRoute.type) { + var path = props.path || props.name; + + // Relative paths extend their parent. + if (!Path.isAbsolute(path)) + path = Path.join(parentPath, path); + + route.path = Path.normalize(path); + } else { + route.path = parentPath; - function Dispatcher() {"use strict"; - this.$Dispatcher_callbacks = {}; - this.$Dispatcher_isPending = {}; - this.$Dispatcher_isHandled = {}; - this.$Dispatcher_isDispatching = false; - this.$Dispatcher_pendingPayload = null; + if (type === NotFoundRoute.type) + route.path += '*'; } - /** - * Registers a callback to be invoked with every dispatched payload. Returns - * a token that can be used with `waitFor()`. - * - * @param {function} callback - * @return {string} - */ - Dispatcher.prototype.register=function(callback) {"use strict"; - var id = _prefix + _lastID++; - this.$Dispatcher_callbacks[id] = callback; - return id; - }; + route.paramNames = Path.extractParamNames(route.path); - /** - * Removes a callback based on its token. - * - * @param {string} id - */ - Dispatcher.prototype.unregister=function(id) {"use strict"; + // Make sure the route's path has all params its parent needs. + if (parentRoute && Array.isArray(parentRoute.paramNames)) { + parentRoute.paramNames.forEach(function (paramName) { + invariant( + route.paramNames.indexOf(paramName) !== -1, + 'The nested route path "%s" is missing the "%s" parameter of its parent path "%s"', + route.path, paramName, parentRoute.path + ); + }); + } + + // Make sure the route can be looked up by <Link>s. + if (props.name) { invariant( - this.$Dispatcher_callbacks[id], - 'Dispatcher.unregister(...): `%s` does not map to a registered callback.', - id + namedRoutes[props.name] == null, + 'You cannot use the name "%s" for more than one route', + props.name ); - delete this.$Dispatcher_callbacks[id]; - }; - /** - * Waits for the callbacks specified to be invoked before continuing execution - * of the current callback. This method should only be used by a callback in - * response to a dispatched payload. - * - * @param {array<string>} ids - */ - Dispatcher.prototype.waitFor=function(ids) {"use strict"; + namedRoutes[props.name] = route; + } + + // Handle <NotFoundRoute>. + if (type === NotFoundRoute.type) { invariant( - this.$Dispatcher_isDispatching, - 'Dispatcher.waitFor(...): Must be invoked while dispatching.' + parentRoute, + '<NotFoundRoute> must have a parent <Route>' ); - for (var ii = 0; ii < ids.length; ii++) { - var id = ids[ii]; - if (this.$Dispatcher_isPending[id]) { - invariant( - this.$Dispatcher_isHandled[id], - 'Dispatcher.waitFor(...): Circular dependency detected while ' + - 'waiting for `%s`.', - id - ); - continue; - } - invariant( - this.$Dispatcher_callbacks[id], - 'Dispatcher.waitFor(...): `%s` does not map to a registered callback.', - id - ); - this.$Dispatcher_invokeCallback(id); - } - }; - /** - * Dispatches a payload to all registered callbacks. - * - * @param {object} payload - */ - Dispatcher.prototype.dispatch=function(payload) {"use strict"; invariant( - !this.$Dispatcher_isDispatching, - 'Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.' + parentRoute.notFoundRoute == null, + 'You may not have more than one <NotFoundRoute> per <Route>' ); - this.$Dispatcher_startDispatching(payload); - try { - for (var id in this.$Dispatcher_callbacks) { - if (this.$Dispatcher_isPending[id]) { - continue; - } - this.$Dispatcher_invokeCallback(id); - } - } finally { - this.$Dispatcher_stopDispatching(); - } - }; - /** - * Is this Dispatcher currently dispatching. - * - * @return {boolean} - */ - Dispatcher.prototype.isDispatching=function() {"use strict"; - return this.$Dispatcher_isDispatching; - }; + parentRoute.notFoundRoute = route; - /** - * Call the callback stored with the given id. Also do some internal - * bookkeeping. - * - * @param {string} id - * @internal - */ - Dispatcher.prototype.$Dispatcher_invokeCallback=function(id) {"use strict"; - this.$Dispatcher_isPending[id] = true; - this.$Dispatcher_callbacks[id](this.$Dispatcher_pendingPayload); - this.$Dispatcher_isHandled[id] = true; - }; + return null; + } - /** - * Set up bookkeeping needed when dispatching. - * - * @param {object} payload - * @internal - */ - Dispatcher.prototype.$Dispatcher_startDispatching=function(payload) {"use strict"; - for (var id in this.$Dispatcher_callbacks) { - this.$Dispatcher_isPending[id] = false; - this.$Dispatcher_isHandled[id] = false; - } - this.$Dispatcher_pendingPayload = payload; - this.$Dispatcher_isDispatching = true; - }; + // Handle <DefaultRoute>. + if (type === DefaultRoute.type) { + invariant( + parentRoute, + '<DefaultRoute> must have a parent <Route>' + ); - /** - * Clear bookkeeping used for dispatching. - * - * @internal - */ - Dispatcher.prototype.$Dispatcher_stopDispatching=function() {"use strict"; - this.$Dispatcher_pendingPayload = null; - this.$Dispatcher_isDispatching = false; - }; + invariant( + parentRoute.defaultRoute == null, + 'You may not have more than one <DefaultRoute> per <Route>' + ); + + parentRoute.defaultRoute = route; + + return null; + } + route.childRoutes = createRoutesFromChildren(props.children, route, namedRoutes); -module.exports = Dispatcher; + return route; +} -},{"./invariant":33}],33:[function(_dereq_,module,exports){ /** - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule invariant + * Creates and returns an array of route objects from the given ReactChildren. */ +function createRoutesFromChildren(children, parentRoute, namedRoutes) { + var routes = []; -"use strict"; + React.Children.forEach(children, function (child) { + // Exclude <DefaultRoute>s and <NotFoundRoute>s. + if (child = createRoute(child, parentRoute, namedRoutes)) + routes.push(child); + }); + + return routes; +} + +module.exports = createRoutesFromChildren; + +},{"../components/DefaultRoute":3,"../components/NotFoundRoute":5,"../components/Redirect":6,"../components/Route":7,"./Path":19,"react/lib/invariant":39,"react/lib/warning":40}],26:[function(_dereq_,module,exports){ +var invariant = _dereq_('react/lib/invariant'); +var canUseDOM = _dereq_('react/lib/ExecutionEnvironment').canUseDOM; /** - * Use invariant() to assert state which your program assumes to be true. + * Returns the current scroll position of the window as { x, y }. + */ +function getWindowScrollPosition() { + invariant( + canUseDOM, + 'Cannot get current scroll position without a DOM' + ); + + return { + x: window.scrollX, + y: window.scrollY + }; +} + +module.exports = getWindowScrollPosition; + +},{"react/lib/ExecutionEnvironment":35,"react/lib/invariant":39}],27:[function(_dereq_,module,exports){ +function reversedArray(array) { + return array.slice(0).reverse(); +} + +module.exports = reversedArray; + +},{}],28:[function(_dereq_,module,exports){ +var createRouter = _dereq_('./createRouter'); + +/** + * A high-level convenience method that creates, configures, and + * runs a router in one shot. The method signature is: * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. + * Router.run(routes[, location ], callback); * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. + * Using `window.location.hash` to manage the URL, you could do: + * + * Router.run(routes, function (Handler) { + * React.render(<Handler/>, document.body); + * }); + * + * Using HTML5 history and a custom "cursor" prop: + * + * Router.run(routes, Router.HistoryLocation, function (Handler) { + * React.render(<Handler cursor={cursor}/>, document.body); + * }); + * + * Returns the newly created router. + * + * Note: If you need to specify further options for your router such + * as error/abort handling or custom scroll behavior, use Router.create + * instead. + * + * var router = Router.create(options); + * router.run(function (Handler) { + * // ... + * }); */ - -var invariant = function(condition, format, a, b, c, d, e, f) { - if (false) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } +function runRouter(routes, location, callback) { + if (typeof location === 'function') { + callback = location; + location = null; } - if (!condition) { - var error; - if (format === undefined) { - error = new Error( - 'Minified exception occurred; use the non-minified dev environment ' + - 'for the full error message and additional helpful warnings.' - ); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error( - 'Invariant Violation: ' + - format.replace(/%s/g, function() { return args[argIndex++]; }) - ); - } + var router = createRouter({ + routes: routes, + location: location + }); - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; + router.run(callback); + + return router; +} + +module.exports = runRouter; + +},{"./createRouter":24}],29:[function(_dereq_,module,exports){ +function supportsHistory() { + /*! taken from modernizr + * https://github.com/Modernizr/Modernizr/blob/master/LICENSE + * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js + */ + var ua = navigator.userAgent; + if ((ua.indexOf('Android 2.') !== -1 || + (ua.indexOf('Android 4.0') !== -1)) && + ua.indexOf('Mobile Safari') !== -1 && + ua.indexOf('Chrome') === -1) { + return false; } -}; + return (window.history && 'pushState' in window.history); +} -module.exports = invariant; +module.exports = supportsHistory; -},{}],34:[function(_dereq_,module,exports){ +},{}],30:[function(_dereq_,module,exports){ module.exports = _dereq_('./lib'); -},{"./lib":35}],35:[function(_dereq_,module,exports){ +},{"./lib":31}],31:[function(_dereq_,module,exports){ // Load modules var Stringify = _dereq_('./stringify'); @@ -38893,7 +37772,7 @@ module.exports = { parse: Parse }; -},{"./parse":36,"./stringify":37}],36:[function(_dereq_,module,exports){ +},{"./parse":32,"./stringify":33}],32:[function(_dereq_,module,exports){ // Load modules var Utils = _dereq_('./utils'); @@ -39049,7 +37928,7 @@ module.exports = function (str, options) { return Utils.compact(obj); }; -},{"./utils":38}],37:[function(_dereq_,module,exports){ +},{"./utils":34}],33:[function(_dereq_,module,exports){ // Load modules var Utils = _dereq_('./utils'); @@ -39109,7 +37988,7 @@ module.exports = function (obj, options) { return keys.join(delimiter); }; -},{"./utils":38}],38:[function(_dereq_,module,exports){ +},{"./utils":34}],34:[function(_dereq_,module,exports){ // Load modules @@ -39250,21 +38129,14 @@ exports.isBuffer = function (obj) { } }; -},{}],39:[function(_dereq_,module,exports){ +},{}],35:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ExecutionEnvironment */ @@ -39302,82 +38174,103 @@ var ExecutionEnvironment = { module.exports = ExecutionEnvironment; -},{}],40:[function(_dereq_,module,exports){ +},{}],36:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule copyProperties + * @providesModule Object.assign */ -/** - * Copy properties from one or more objects (up to 5) into the first object. - * This is a shallow copy. It mutates the first object and also returns it. - * - * NOTE: `arguments` has a very significant performance penalty, which is why - * we don't support unlimited arguments. - */ -function copyProperties(obj, a, b, c, d, e, f) { - obj = obj || {}; +// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign - if ("production" !== "production") { - if (f) { - throw new Error('Too many arguments passed to copyProperties'); - } +function assign(target, sources) { + if (target == null) { + throw new TypeError('Object.assign target cannot be null or undefined'); } - var args = [a, b, c, d, e]; - var ii = 0, v; - while (args[ii]) { - v = args[ii++]; - for (var k in v) { - obj[k] = v[k]; + var to = Object(target); + var hasOwnProperty = Object.prototype.hasOwnProperty; + + for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) { + var nextSource = arguments[nextIndex]; + if (nextSource == null) { + continue; } - // IE ignores toString in object iteration.. See: - // webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html - if (v.hasOwnProperty && v.hasOwnProperty('toString') && - (typeof v.toString != 'undefined') && (obj.toString !== v.toString)) { - obj.toString = v.toString; + var from = Object(nextSource); + + // We don't currently support accessors nor proxies. Therefore this + // copy cannot throw. If we ever supported this then we must handle + // exceptions and side-effects. We don't support symbols so they won't + // be transferred. + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } } } - return obj; -} + return to; +}; -module.exports = copyProperties; +module.exports = assign; -},{}],41:[function(_dereq_,module,exports){ +},{}],37:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule cx + */ + +/** + * This function is used to mark string literals representing CSS class names + * so that they can be transformed statically. This allows for modularization + * and minification of CSS class names. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * In static_upstream, this function is actually implemented, but it should + * eventually be replaced with something more descriptive, and the transform + * that is used in the main stack should be ported for use elsewhere. * - * @providesModule emptyFunction + * @param string|object className to modularize, or an object of key/values. + * In the object case, the values are conditions that + * determine if the className keys should be included. + * @param [string ...] Variable list of classNames in the string case. + * @return string Renderable space-separated CSS className. */ +function cx(classNames) { + if (typeof classNames == 'object') { + return Object.keys(classNames).filter(function(className) { + return classNames[className]; + }).join(' '); + } else { + return Array.prototype.join.call(arguments, ' '); + } +} -var copyProperties = _dereq_("./copyProperties"); +module.exports = cx; + +},{}],38:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule emptyFunction + */ function makeEmptyFunction(arg) { return function() { @@ -39392,32 +38285,23 @@ function makeEmptyFunction(arg) { */ function emptyFunction() {} -copyProperties(emptyFunction, { - thatReturns: makeEmptyFunction, - thatReturnsFalse: makeEmptyFunction(false), - thatReturnsTrue: makeEmptyFunction(true), - thatReturnsNull: makeEmptyFunction(null), - thatReturnsThis: function() { return this; }, - thatReturnsArgument: function(arg) { return arg; } -}); +emptyFunction.thatReturns = makeEmptyFunction; +emptyFunction.thatReturnsFalse = makeEmptyFunction(false); +emptyFunction.thatReturnsTrue = makeEmptyFunction(true); +emptyFunction.thatReturnsNull = makeEmptyFunction(null); +emptyFunction.thatReturnsThis = function() { return this; }; +emptyFunction.thatReturnsArgument = function(arg) { return arg; }; module.exports = emptyFunction; -},{"./copyProperties":40}],42:[function(_dereq_,module,exports){ +},{}],39:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule invariant */ @@ -39465,353 +38349,14 @@ var invariant = function(condition, format, a, b, c, d, e, f) { module.exports = invariant; -},{}],43:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule keyMirror - * @typechecks static-only - */ - -"use strict"; - -var invariant = _dereq_("./invariant"); - -/** - * Constructs an enumeration with keys equal to their value. - * - * For example: - * - * var COLORS = keyMirror({blue: null, red: null}); - * var myColor = COLORS.blue; - * var isColorValid = !!COLORS[myColor]; - * - * The last line could not be performed if the values of the generated enum were - * not equal to their keys. - * - * Input: {key1: val1, key2: val2} - * Output: {key1: key1, key2: key2} - * - * @param {object} obj - * @return {object} - */ -var keyMirror = function(obj) { - var ret = {}; - var key; - ("production" !== "production" ? invariant( - obj instanceof Object && !Array.isArray(obj), - 'keyMirror(...): Argument must be an object.' - ) : invariant(obj instanceof Object && !Array.isArray(obj))); - for (key in obj) { - if (!obj.hasOwnProperty(key)) { - continue; - } - ret[key] = key; - } - return ret; -}; - -module.exports = keyMirror; - -},{"./invariant":42}],44:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule merge - */ - -"use strict"; - -var mergeInto = _dereq_("./mergeInto"); - -/** - * Shallow merges two structures into a return value, without mutating either. - * - * @param {?object} one Optional object with properties to merge from. - * @param {?object} two Optional object with properties to merge from. - * @return {object} The shallow extension of one by two. - */ -var merge = function(one, two) { - var result = {}; - mergeInto(result, one); - mergeInto(result, two); - return result; -}; - -module.exports = merge; - -},{"./mergeInto":46}],45:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule mergeHelpers - * - * requiresPolyfills: Array.isArray - */ - -"use strict"; - -var invariant = _dereq_("./invariant"); -var keyMirror = _dereq_("./keyMirror"); - -/** - * Maximum number of levels to traverse. Will catch circular structures. - * @const - */ -var MAX_MERGE_DEPTH = 36; - -/** - * We won't worry about edge cases like new String('x') or new Boolean(true). - * Functions are considered terminals, and arrays are not. - * @param {*} o The item/object/value to test. - * @return {boolean} true iff the argument is a terminal. - */ -var isTerminal = function(o) { - return typeof o !== 'object' || o === null; -}; - -var mergeHelpers = { - - MAX_MERGE_DEPTH: MAX_MERGE_DEPTH, - - isTerminal: isTerminal, - - /** - * Converts null/undefined values into empty object. - * - * @param {?Object=} arg Argument to be normalized (nullable optional) - * @return {!Object} - */ - normalizeMergeArg: function(arg) { - return arg === undefined || arg === null ? {} : arg; - }, - - /** - * If merging Arrays, a merge strategy *must* be supplied. If not, it is - * likely the caller's fault. If this function is ever called with anything - * but `one` and `two` being `Array`s, it is the fault of the merge utilities. - * - * @param {*} one Array to merge into. - * @param {*} two Array to merge from. - */ - checkMergeArrayArgs: function(one, two) { - ("production" !== "production" ? invariant( - Array.isArray(one) && Array.isArray(two), - 'Tried to merge arrays, instead got %s and %s.', - one, - two - ) : invariant(Array.isArray(one) && Array.isArray(two))); - }, - - /** - * @param {*} one Object to merge into. - * @param {*} two Object to merge from. - */ - checkMergeObjectArgs: function(one, two) { - mergeHelpers.checkMergeObjectArg(one); - mergeHelpers.checkMergeObjectArg(two); - }, - - /** - * @param {*} arg - */ - checkMergeObjectArg: function(arg) { - ("production" !== "production" ? invariant( - !isTerminal(arg) && !Array.isArray(arg), - 'Tried to merge an object, instead got %s.', - arg - ) : invariant(!isTerminal(arg) && !Array.isArray(arg))); - }, - - /** - * @param {*} arg - */ - checkMergeIntoObjectArg: function(arg) { - ("production" !== "production" ? invariant( - (!isTerminal(arg) || typeof arg === 'function') && !Array.isArray(arg), - 'Tried to merge into an object, instead got %s.', - arg - ) : invariant((!isTerminal(arg) || typeof arg === 'function') && !Array.isArray(arg))); - }, - - /** - * Checks that a merge was not given a circular object or an object that had - * too great of depth. - * - * @param {number} Level of recursion to validate against maximum. - */ - checkMergeLevel: function(level) { - ("production" !== "production" ? invariant( - level < MAX_MERGE_DEPTH, - 'Maximum deep merge depth exceeded. You may be attempting to merge ' + - 'circular structures in an unsupported way.' - ) : invariant(level < MAX_MERGE_DEPTH)); - }, - - /** - * Checks that the supplied merge strategy is valid. - * - * @param {string} Array merge strategy. - */ - checkArrayStrategy: function(strategy) { - ("production" !== "production" ? invariant( - strategy === undefined || strategy in mergeHelpers.ArrayStrategies, - 'You must provide an array strategy to deep merge functions to ' + - 'instruct the deep merge how to resolve merging two arrays.' - ) : invariant(strategy === undefined || strategy in mergeHelpers.ArrayStrategies)); - }, - - /** - * Set of possible behaviors of merge algorithms when encountering two Arrays - * that must be merged together. - * - `clobber`: The left `Array` is ignored. - * - `indexByIndex`: The result is achieved by recursively deep merging at - * each index. (not yet supported.) - */ - ArrayStrategies: keyMirror({ - Clobber: true, - IndexByIndex: true - }) - -}; - -module.exports = mergeHelpers; - -},{"./invariant":42,"./keyMirror":43}],46:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule mergeInto - * @typechecks static-only - */ - -"use strict"; - -var mergeHelpers = _dereq_("./mergeHelpers"); - -var checkMergeObjectArg = mergeHelpers.checkMergeObjectArg; -var checkMergeIntoObjectArg = mergeHelpers.checkMergeIntoObjectArg; - -/** - * Shallow merges two structures by mutating the first parameter. - * - * @param {object|function} one Object to be merged into. - * @param {?object} two Optional object with properties to merge from. - */ -function mergeInto(one, two) { - checkMergeIntoObjectArg(one); - if (two != null) { - checkMergeObjectArg(two); - for (var key in two) { - if (!two.hasOwnProperty(key)) { - continue; - } - one[key] = two[key]; - } - } -} - -module.exports = mergeInto; - -},{"./mergeHelpers":45}],47:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule mixInto - */ - -"use strict"; - -/** - * Simply copies properties to the prototype. - */ -var mixInto = function(constructor, methodBag) { - var methodName; - for (methodName in methodBag) { - if (!methodBag.hasOwnProperty(methodName)) { - continue; - } - constructor.prototype[methodName] = methodBag[methodName]; - } -}; - -module.exports = mixInto; - -},{}],48:[function(_dereq_,module,exports){ +},{}],40:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule warning */ @@ -39847,7 +38392,7 @@ if ("production" !== "production") { module.exports = warning; -},{"./emptyFunction":41}],49:[function(_dereq_,module,exports){ +},{"./emptyFunction":38}],41:[function(_dereq_,module,exports){ /** @license MIT License (c) copyright 2010-2014 original author or authors */ /** @author Brian Cavalier */ /** @author John Hann */ @@ -39866,7 +38411,7 @@ define(function (_dereq_) { }); })(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(_dereq_); }); -},{"./Scheduler":51,"./async":52,"./makePromise":53}],50:[function(_dereq_,module,exports){ +},{"./Scheduler":43,"./async":44,"./makePromise":45}],42:[function(_dereq_,module,exports){ /** @license MIT License (c) copyright 2010-2014 original author or authors */ /** @author Brian Cavalier */ /** @author John Hann */ @@ -39938,7 +38483,7 @@ define(function() { }); }(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); })); -},{}],51:[function(_dereq_,module,exports){ +},{}],43:[function(_dereq_,module,exports){ /** @license MIT License (c) copyright 2010-2014 original author or authors */ /** @author Brian Cavalier */ /** @author John Hann */ @@ -40022,7 +38567,7 @@ define(function(_dereq_) { }); }(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(_dereq_); })); -},{"./Queue":50}],52:[function(_dereq_,module,exports){ +},{"./Queue":42}],44:[function(_dereq_,module,exports){ /** @license MIT License (c) copyright 2010-2014 original author or authors */ /** @author Brian Cavalier */ /** @author John Hann */ @@ -40067,11 +38612,21 @@ define(function(_dereq_) { } else { nextTick = (function(cjsRequire) { + var vertx; try { // vert.x 1.x || 2.x - return cjsRequire('vertx').runOnLoop || cjsRequire('vertx').runOnContext; + vertx = cjsRequire('vertx'); } catch (ignore) {} + if (vertx) { + if (typeof vertx.runOnLoop === 'function') { + return vertx.runOnLoop; + } + if (typeof vertx.runOnContext === 'function') { + return vertx.runOnContext; + } + } + // capture setTimeout to avoid being caught by fake timers // used in time based tests var capturedSetTimeout = setTimeout; @@ -40085,7 +38640,7 @@ define(function(_dereq_) { }); }(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(_dereq_); })); -},{}],53:[function(_dereq_,module,exports){ +},{}],45:[function(_dereq_,module,exports){ /** @license MIT License (c) copyright 2010-2014 original author or authors */ /** @author Brian Cavalier */ /** @author John Hann */ @@ -40216,10 +38771,12 @@ define(function() { */ Promise.prototype.then = function(onFulfilled, onRejected) { var parent = this._handler; + var state = parent.join().state(); - if (typeof onFulfilled !== 'function' && parent.join().state() > 0) { + if ((typeof onFulfilled !== 'function' && state > 0) || + (typeof onRejected !== 'function' && state < 0)) { // Short circuit: value will not change, simply share handler - return new Promise(Handler, parent); + return new this.constructor(Handler, parent); } var p = this._beget(); @@ -40280,9 +38837,7 @@ define(function() { } if (maybeThenable(x)) { - h = isPromise(x) - ? x._handler.join() - : getHandlerUntrusted(x); + h = getHandlerMaybeThenable(x); s = h.state(); if (s === 0) { @@ -40291,6 +38846,7 @@ define(function() { results[i] = h.value; --pending; } else { + unreportRemaining(promises, i+1, h); resolver.become(h); break; } @@ -40316,6 +38872,20 @@ define(function() { } } + function unreportRemaining(promises, start, rejectedHandler) { + var i, h, x; + for(i=start; i<promises.length; ++i) { + x = promises[i]; + if(maybeThenable(x)) { + h = getHandlerMaybeThenable(x); + + if(h !== rejectedHandler) { + h.visit(h, void 0, h._unreport); + } + } + } + } + /** * Fulfill-reject competitive race. Return a promise that will settle * to the same state as the earliest input promise to settle. @@ -40364,6 +38934,16 @@ define(function() { } /** + * Get a handler for thenable x. + * NOTE: You must only call this if maybeThenable(x) == true + * @param {object|function|Promise} x + * @returns {object} handler + */ + function getHandlerMaybeThenable(x) { + return isPromise(x) ? x._handler.join() : getHandlerUntrusted(x); + } + + /** * Get a handler for potentially untrusted thenable x * @param {*} x * @returns {object} handler |