aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/web/static/app.js2
-rw-r--r--mitmproxy/web/static/vendor.js15909
-rw-r--r--web/conf.js1
-rw-r--r--web/package.json24
4 files changed, 8022 insertions, 7914 deletions
diff --git a/mitmproxy/web/static/app.js b/mitmproxy/web/static/app.js
index 527fe225..2dadc696 100644
--- a/mitmproxy/web/static/app.js
+++ b/mitmproxy/web/static/app.js
@@ -2984,7 +2984,7 @@ var FilterDocs = _react2.default.createClass({
{ colSpan: "2" },
_react2.default.createElement(
"a",
- { href: "https://mitmproxy.org/doc/features/filters.html",
+ { href: "http://docs.mitmproxy.org/en/stable/features/filters.html",
target: "_blank" },
_react2.default.createElement("i", { className: "fa fa-external-link" }),
"  mitmproxy docs"
diff --git a/mitmproxy/web/static/vendor.js b/mitmproxy/web/static/vendor.js
index 0f6ec987..548fc355 100644
--- a/mitmproxy/web/static/vendor.js
+++ b/mitmproxy/web/static/vendor.js
@@ -180,7 +180,7 @@ var invariant = function (condition, format, a, b, c, d, e, f) {
module.exports = invariant;
}).call(this,require('_process'))
-},{"_process":27}],5:[function(require,module,exports){
+},{"_process":29}],5:[function(require,module,exports){
(function (process){
/**
* Copyright (c) 2014-2015, Facebook, Inc.
@@ -415,7 +415,7 @@ var Dispatcher = (function () {
module.exports = Dispatcher;
}).call(this,require('_process'))
-},{"_process":27,"fbjs/lib/invariant":4}],6:[function(require,module,exports){
+},{"_process":29,"fbjs/lib/invariant":4}],6:[function(require,module,exports){
/**
* Indicates that navigation was caused by a call to history.push.
*/
@@ -451,24 +451,56 @@ exports['default'] = {
"use strict";
exports.__esModule = true;
+var _slice = Array.prototype.slice;
exports.loopAsync = loopAsync;
function loopAsync(turns, work, callback) {
- var currentTurn = 0;
- var isDone = false;
+ var currentTurn = 0,
+ isDone = false;
+ var sync = false,
+ hasNext = false,
+ doneArgs = undefined;
function done() {
isDone = true;
+ if (sync) {
+ // Iterate instead of recursing if possible.
+ doneArgs = [].concat(_slice.call(arguments));
+ return;
+ }
+
callback.apply(this, arguments);
}
function next() {
- if (isDone) return;
+ if (isDone) {
+ return;
+ }
+
+ hasNext = true;
+ if (sync) {
+ // Iterate instead of recursing if possible.
+ return;
+ }
- if (currentTurn < turns) {
+ sync = true;
+
+ while (!isDone && currentTurn < turns && hasNext) {
+ hasNext = false;
work.call(this, currentTurn++, next, done);
- } else {
- done.apply(this, arguments);
+ }
+
+ sync = false;
+
+ if (isDone) {
+ // This means the loop finished synchronously.
+ callback.apply(this, doneArgs);
+ return;
+ }
+
+ if (currentTurn >= turns && hasNext) {
+ isDone = true;
+ callback();
}
}
@@ -551,7 +583,7 @@ function readState(key) {
}
}).call(this,require('_process'))
-},{"_process":27,"warning":236}],9:[function(require,module,exports){
+},{"_process":29,"warning":231}],9:[function(require,module,exports){
'use strict';
exports.__esModule = true;
@@ -684,7 +716,7 @@ function parsePath(path) {
}
}).call(this,require('_process'))
-},{"_process":27,"warning":236}],12:[function(require,module,exports){
+},{"_process":29,"warning":231}],12:[function(require,module,exports){
(function (process){
'use strict';
@@ -745,7 +777,7 @@ function createBrowserHistory() {
state = null;
key = history.createKey();
- if (isSupported) window.history.replaceState(_extends({}, historyState, { key: key }), null, path);
+ if (isSupported) window.history.replaceState(_extends({}, historyState, { key: key }), null);
}
var location = _PathUtils.parsePath(path);
@@ -864,7 +896,7 @@ exports['default'] = createBrowserHistory;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./Actions":6,"./DOMStateStorage":8,"./DOMUtils":9,"./ExecutionEnvironment":10,"./PathUtils":11,"./createDOMHistory":13,"_process":27,"invariant":22}],13:[function(require,module,exports){
+},{"./Actions":6,"./DOMStateStorage":8,"./DOMUtils":9,"./ExecutionEnvironment":10,"./PathUtils":11,"./createDOMHistory":13,"_process":29,"invariant":23}],13:[function(require,module,exports){
(function (process){
'use strict';
@@ -908,7 +940,7 @@ exports['default'] = createDOMHistory;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./DOMUtils":9,"./ExecutionEnvironment":10,"./createHistory":15,"_process":27,"invariant":22}],14:[function(require,module,exports){
+},{"./DOMUtils":9,"./ExecutionEnvironment":10,"./createHistory":15,"_process":29,"invariant":23}],14:[function(require,module,exports){
(function (process){
'use strict';
@@ -1158,7 +1190,7 @@ exports['default'] = createHashHistory;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./Actions":6,"./DOMStateStorage":8,"./DOMUtils":9,"./ExecutionEnvironment":10,"./PathUtils":11,"./createDOMHistory":13,"_process":27,"invariant":22,"warning":236}],15:[function(require,module,exports){
+},{"./Actions":6,"./DOMStateStorage":8,"./DOMUtils":9,"./ExecutionEnvironment":10,"./PathUtils":11,"./createDOMHistory":13,"_process":29,"invariant":23,"warning":231}],15:[function(require,module,exports){
(function (process){
'use strict';
@@ -1212,8 +1244,8 @@ function createHistory() {
var finishTransition = options.finishTransition;
var saveState = options.saveState;
var go = options.go;
- var keyLength = options.keyLength;
var getUserConfirmation = options.getUserConfirmation;
+ var keyLength = options.keyLength;
if (typeof keyLength !== 'number') keyLength = DefaultKeyLength;
@@ -1450,7 +1482,7 @@ exports['default'] = createHistory;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./Actions":6,"./AsyncUtils":7,"./PathUtils":11,"./createLocation":16,"./deprecate":18,"./runTransitionHook":19,"_process":27,"deep-equal":1,"warning":236}],16:[function(require,module,exports){
+},{"./Actions":6,"./AsyncUtils":7,"./PathUtils":11,"./createLocation":16,"./deprecate":18,"./runTransitionHook":19,"_process":29,"deep-equal":1,"warning":231}],16:[function(require,module,exports){
(function (process){
'use strict';
@@ -1505,7 +1537,7 @@ exports['default'] = createLocation;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./Actions":6,"./PathUtils":11,"_process":27,"warning":236}],17:[function(require,module,exports){
+},{"./Actions":6,"./PathUtils":11,"_process":29,"warning":231}],17:[function(require,module,exports){
(function (process){
'use strict';
@@ -1594,19 +1626,20 @@ function createMemoryHistory() {
function getCurrentLocation() {
var entry = entries[current];
- var key = entry.key;
var basename = entry.basename;
var pathname = entry.pathname;
var search = entry.search;
var path = (basename || '') + pathname + (search || '');
- var state = undefined;
- if (key) {
+ var key = undefined,
+ state = undefined;
+ if (entry.key) {
+ key = entry.key;
state = readState(key);
} else {
- state = null;
key = history.createKey();
+ state = null;
entry.key = key;
}
@@ -1662,7 +1695,7 @@ exports['default'] = createMemoryHistory;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./Actions":6,"./PathUtils":11,"./createHistory":15,"_process":27,"invariant":22,"warning":236}],18:[function(require,module,exports){
+},{"./Actions":6,"./PathUtils":11,"./createHistory":15,"_process":29,"invariant":23,"warning":231}],18:[function(require,module,exports){
(function (process){
'use strict';
@@ -1685,7 +1718,7 @@ exports['default'] = deprecate;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"_process":27,"warning":236}],19:[function(require,module,exports){
+},{"_process":29,"warning":231}],19:[function(require,module,exports){
(function (process){
'use strict';
@@ -1713,7 +1746,8 @@ exports['default'] = runTransitionHook;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"_process":27,"warning":236}],20:[function(require,module,exports){
+},{"_process":29,"warning":231}],20:[function(require,module,exports){
+(function (process){
'use strict';
exports.__esModule = true;
@@ -1722,7 +1756,9 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
+var _warning = require('warning');
+
+var _warning2 = _interopRequireDefault(_warning);
var _ExecutionEnvironment = require('./ExecutionEnvironment');
@@ -1739,21 +1775,37 @@ var _deprecate2 = _interopRequireDefault(_deprecate);
function useBasename(createHistory) {
return function () {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
+
+ var history = createHistory(options);
+
var basename = options.basename;
- var historyOptions = _objectWithoutProperties(options, ['basename']);
+ var checkedBaseHref = false;
+
+ function checkBaseHref() {
+ if (checkedBaseHref) {
+ return;
+ }
- var history = createHistory(historyOptions);
+ // Automatically use the value of <base href> in HTML
+ // documents as basename if it's not explicitly given.
+ if (basename == null && _ExecutionEnvironment.canUseDOM) {
+ var base = document.getElementsByTagName('base')[0];
+ var baseHref = base && base.getAttribute('href');
- // Automatically use the value of <base href> in HTML
- // documents as basename if it's not explicitly given.
- if (basename == null && _ExecutionEnvironment.canUseDOM) {
- var base = document.getElementsByTagName('base')[0];
+ if (baseHref != null) {
+ basename = baseHref;
- if (base) basename = _PathUtils.extractPath(base.href);
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'Automatically setting basename using <base href> is deprecated and will ' + 'be removed in the next major release. The semantics of <base href> are ' + 'subtly different from basename. Please pass the basename explicitly in ' + 'the options to createHistory') : undefined;
+ }
+ }
+
+ checkedBaseHref = true;
}
function addBasename(location) {
+ checkBaseHref();
+
if (basename && location.basename == null) {
if (location.pathname.indexOf(basename) === 0) {
location.pathname = location.pathname.substring(basename.length);
@@ -1769,6 +1821,8 @@ function useBasename(createHistory) {
}
function prependBasename(location) {
+ checkBaseHref();
+
if (!basename) return location;
if (typeof location === 'string') location = _PathUtils.parsePath(location);
@@ -1852,7 +1906,9 @@ function useBasename(createHistory) {
exports['default'] = useBasename;
module.exports = exports['default'];
-},{"./ExecutionEnvironment":10,"./PathUtils":11,"./deprecate":18,"./runTransitionHook":19}],21:[function(require,module,exports){
+}).call(this,require('_process'))
+
+},{"./ExecutionEnvironment":10,"./PathUtils":11,"./deprecate":18,"./runTransitionHook":19,"_process":29,"warning":231}],21:[function(require,module,exports){
(function (process){
'use strict';
@@ -1862,8 +1918,6 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
-
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
@@ -1890,7 +1944,7 @@ var defaultParseQueryString = _queryString.parse;
function isNestedObject(object) {
for (var p in object) {
- if (object.hasOwnProperty(p) && typeof object[p] === 'object' && !Array.isArray(object[p]) && object[p] !== null) return true;
+ if (Object.prototype.hasOwnProperty.call(object, p) && typeof object[p] === 'object' && !Array.isArray(object[p]) && object[p] !== null) return true;
}return false;
}
@@ -1901,12 +1955,11 @@ function isNestedObject(object) {
function useQueries(createHistory) {
return function () {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
- var stringifyQuery = options.stringifyQuery;
- var parseQueryString = options.parseQueryString;
- var historyOptions = _objectWithoutProperties(options, ['stringifyQuery', 'parseQueryString']);
+ var history = createHistory(options);
- var history = createHistory(historyOptions);
+ var stringifyQuery = options.stringifyQuery;
+ var parseQueryString = options.parseQueryString;
if (typeof stringifyQuery !== 'function') stringifyQuery = defaultStringifyQuery;
@@ -2035,7 +2088,49 @@ exports['default'] = useQueries;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./PathUtils":11,"./deprecate":18,"./runTransitionHook":19,"_process":27,"query-string":28,"warning":236}],22:[function(require,module,exports){
+},{"./PathUtils":11,"./deprecate":18,"./runTransitionHook":19,"_process":29,"query-string":30,"warning":231}],22:[function(require,module,exports){
+/**
+ * Copyright 2015, Yahoo! Inc.
+ * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
+ */
+'use strict';
+
+var REACT_STATICS = {
+ childContextTypes: true,
+ contextTypes: true,
+ defaultProps: true,
+ displayName: true,
+ getDefaultProps: true,
+ mixins: true,
+ propTypes: true,
+ type: true
+};
+
+var KNOWN_STATICS = {
+ name: true,
+ length: true,
+ prototype: true,
+ caller: true,
+ arguments: true,
+ arity: true
+};
+
+module.exports = function hoistNonReactStatics(targetComponent, sourceComponent) {
+ var keys = Object.getOwnPropertyNames(sourceComponent);
+ for (var i=0; i<keys.length; ++i) {
+ if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]]) {
+ try {
+ targetComponent[keys[i]] = sourceComponent[keys[i]];
+ } catch (error) {
+
+ }
+ }
+ }
+
+ return targetComponent;
+};
+
+},{}],23:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
@@ -2091,7 +2186,7 @@ module.exports = invariant;
}).call(this,require('_process'))
-},{"_process":27}],23:[function(require,module,exports){
+},{"_process":29}],24:[function(require,module,exports){
/**
* lodash 3.9.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
@@ -2230,7 +2325,7 @@ function isNative(value) {
module.exports = getNative;
-},{}],24:[function(require,module,exports){
+},{}],25:[function(require,module,exports){
/**
* lodash 3.0.8 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
@@ -2475,7 +2570,7 @@ function isObjectLike(value) {
module.exports = isArguments;
-},{}],25:[function(require,module,exports){
+},{}],26:[function(require,module,exports){
/**
* lodash 3.0.4 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
@@ -2657,7 +2752,7 @@ function isNative(value) {
module.exports = isArray;
-},{}],26:[function(require,module,exports){
+},{}],27:[function(require,module,exports){
/**
* lodash 3.1.2 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
@@ -2895,7 +2990,48 @@ function keysIn(object) {
module.exports = keys;
-},{"lodash._getnative":23,"lodash.isarguments":24,"lodash.isarray":25}],27:[function(require,module,exports){
+},{"lodash._getnative":24,"lodash.isarguments":25,"lodash.isarray":26}],28:[function(require,module,exports){
+/* eslint-disable no-unused-vars */
+'use strict';
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+var propIsEnumerable = Object.prototype.propertyIsEnumerable;
+
+function toObject(val) {
+ if (val === null || val === undefined) {
+ throw new TypeError('Object.assign cannot be called with null or undefined');
+ }
+
+ return Object(val);
+}
+
+module.exports = Object.assign || function (target, source) {
+ var from;
+ var to = toObject(target);
+ var symbols;
+
+ for (var s = 1; s < arguments.length; s++) {
+ from = Object(arguments[s]);
+
+ for (var key in from) {
+ if (hasOwnProperty.call(from, key)) {
+ to[key] = from[key];
+ }
+ }
+
+ if (Object.getOwnPropertySymbols) {
+ symbols = Object.getOwnPropertySymbols(from);
+ for (var i = 0; i < symbols.length; i++) {
+ if (propIsEnumerable.call(from, symbols[i])) {
+ to[symbols[i]] = from[symbols[i]];
+ }
+ }
+ }
+ }
+
+ return to;
+};
+
+},{}],29:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
@@ -2988,7 +3124,7 @@ process.chdir = function (dir) {
};
process.umask = function() { return 0; };
-},{}],28:[function(require,module,exports){
+},{}],30:[function(require,module,exports){
'use strict';
var strictUriEncode = require('strict-uri-encode');
@@ -3056,26 +3192,24 @@ exports.stringify = function (obj) {
}).join('&') : '';
};
-},{"strict-uri-encode":235}],29:[function(require,module,exports){
+},{"strict-uri-encode":230}],31:[function(require,module,exports){
"use strict";
exports.__esModule = true;
-var _slice = Array.prototype.slice;
exports.loopAsync = loopAsync;
exports.mapAsync = mapAsync;
-
function loopAsync(turns, work, callback) {
var currentTurn = 0,
isDone = false;
var sync = false,
hasNext = false,
- doneArgs = undefined;
+ doneArgs = void 0;
function done() {
isDone = true;
if (sync) {
// Iterate instead of recursing if possible.
- doneArgs = [].concat(_slice.call(arguments));
+ doneArgs = [].concat(Array.prototype.slice.call(arguments));
return;
}
@@ -3147,19 +3281,19 @@ function mapAsync(array, work, callback) {
});
});
}
-},{}],30:[function(require,module,exports){
+},{}],32:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _routerWarning = require('./routerWarning');
var _routerWarning2 = _interopRequireDefault(_routerWarning);
-var _PropTypes = require('./PropTypes');
+var _InternalPropTypes = require('./InternalPropTypes');
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A mixin that adds the "history" instance variable to components.
@@ -3167,29 +3301,26 @@ var _PropTypes = require('./PropTypes');
var History = {
contextTypes: {
- history: _PropTypes.history
+ history: _InternalPropTypes.history
},
componentWillMount: function componentWillMount() {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'the `History` mixin is deprecated, please access `context.router` with your own `contextTypes`. http://tiny.cc/router-historymixin') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'the `History` mixin is deprecated, please access `context.router` with your own `contextTypes`. http://tiny.cc/router-historymixin') : void 0;
this.history = this.context.history;
}
-
};
-exports['default'] = History;
+exports.default = History;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./PropTypes":37,"./routerWarning":59,"_process":27}],31:[function(require,module,exports){
+},{"./InternalPropTypes":36,"./routerWarning":63,"_process":29}],33:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@@ -3198,28 +3329,26 @@ var _Link = require('./Link');
var _Link2 = _interopRequireDefault(_Link);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
/**
* An <IndexLink> is used to link to an <IndexRoute>.
*/
-var IndexLink = _react2['default'].createClass({
+var IndexLink = _react2.default.createClass({
displayName: 'IndexLink',
-
render: function render() {
- return _react2['default'].createElement(_Link2['default'], _extends({}, this.props, { onlyActiveOnIndex: true }));
+ return _react2.default.createElement(_Link2.default, _extends({}, this.props, { onlyActiveOnIndex: true }));
}
-
});
-exports['default'] = IndexLink;
+exports.default = IndexLink;
module.exports = exports['default'];
-},{"./Link":35,"react":"react"}],32:[function(require,module,exports){
+},{"./Link":38,"react":"react"}],34:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@@ -3236,58 +3365,57 @@ var _Redirect = require('./Redirect');
var _Redirect2 = _interopRequireDefault(_Redirect);
-var _PropTypes = require('./PropTypes');
+var _InternalPropTypes = require('./InternalPropTypes');
-var _React$PropTypes = _react2['default'].PropTypes;
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var _React$PropTypes = _react2.default.PropTypes;
var string = _React$PropTypes.string;
var object = _React$PropTypes.object;
/**
* An <IndexRedirect> is used to redirect from an indexRoute.
*/
-var IndexRedirect = _react2['default'].createClass({
+
+var IndexRedirect = _react2.default.createClass({
displayName: 'IndexRedirect',
- statics: {
+ statics: {
createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
/* istanbul ignore else: sanity check */
if (parentRoute) {
- parentRoute.indexRoute = _Redirect2['default'].createRouteFromReactElement(element);
+ parentRoute.indexRoute = _Redirect2.default.createRouteFromReactElement(element);
} else {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'An <IndexRedirect> does not make sense at the root of your route config') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'An <IndexRedirect> does not make sense at the root of your route config') : void 0;
}
}
-
},
propTypes: {
to: string.isRequired,
query: object,
state: object,
- onEnter: _PropTypes.falsy,
- children: _PropTypes.falsy
+ onEnter: _InternalPropTypes.falsy,
+ children: _InternalPropTypes.falsy
},
/* istanbul ignore next: sanity check */
render: function render() {
- !false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, '<IndexRedirect> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined;
+ !false ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<IndexRedirect> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
}
-
});
-exports['default'] = IndexRedirect;
+exports.default = IndexRedirect;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./PropTypes":37,"./Redirect":38,"./routerWarning":59,"_process":27,"invariant":22,"react":"react"}],33:[function(require,module,exports){
+},{"./InternalPropTypes":36,"./Redirect":41,"./routerWarning":63,"_process":29,"invariant":23,"react":"react"}],35:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@@ -3302,56 +3430,88 @@ var _invariant2 = _interopRequireDefault(_invariant);
var _RouteUtils = require('./RouteUtils');
-var _PropTypes = require('./PropTypes');
+var _InternalPropTypes = require('./InternalPropTypes');
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-var func = _react2['default'].PropTypes.func;
+var func = _react2.default.PropTypes.func;
/**
* An <IndexRoute> is used to specify its parent's <Route indexRoute> in
* a JSX route config.
*/
-var IndexRoute = _react2['default'].createClass({
+
+var IndexRoute = _react2.default.createClass({
displayName: 'IndexRoute',
- statics: {
+ statics: {
createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
/* istanbul ignore else: sanity check */
if (parentRoute) {
- parentRoute.indexRoute = _RouteUtils.createRouteFromReactElement(element);
+ parentRoute.indexRoute = (0, _RouteUtils.createRouteFromReactElement)(element);
} else {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'An <IndexRoute> does not make sense at the root of your route config') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'An <IndexRoute> does not make sense at the root of your route config') : void 0;
}
}
-
},
propTypes: {
- path: _PropTypes.falsy,
- component: _PropTypes.component,
- components: _PropTypes.components,
+ path: _InternalPropTypes.falsy,
+ component: _InternalPropTypes.component,
+ components: _InternalPropTypes.components,
getComponent: func,
getComponents: func
},
/* istanbul ignore next: sanity check */
render: function render() {
- !false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, '<IndexRoute> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined;
+ !false ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<IndexRoute> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
}
-
});
-exports['default'] = IndexRoute;
+exports.default = IndexRoute;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./PropTypes":37,"./RouteUtils":41,"./routerWarning":59,"_process":27,"invariant":22,"react":"react"}],34:[function(require,module,exports){
-(function (process){
+},{"./InternalPropTypes":36,"./RouteUtils":44,"./routerWarning":63,"_process":29,"invariant":23,"react":"react"}],36:[function(require,module,exports){
'use strict';
exports.__esModule = true;
+exports.routes = exports.route = exports.components = exports.component = exports.history = undefined;
+exports.falsy = falsy;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+var _react = require('react');
+
+var func = _react.PropTypes.func;
+var object = _react.PropTypes.object;
+var arrayOf = _react.PropTypes.arrayOf;
+var oneOfType = _react.PropTypes.oneOfType;
+var element = _react.PropTypes.element;
+var shape = _react.PropTypes.shape;
+var string = _react.PropTypes.string;
+function falsy(props, propName, componentName) {
+ if (props[propName]) return new Error('<' + componentName + '> should not have a "' + propName + '" prop');
+}
+
+var history = exports.history = shape({
+ listen: func.isRequired,
+ push: func.isRequired,
+ replace: func.isRequired,
+ go: func.isRequired,
+ goBack: func.isRequired,
+ goForward: func.isRequired
+});
+
+var component = exports.component = oneOfType([func, string]);
+var components = exports.components = oneOfType([component, object]);
+var route = exports.route = oneOfType([object, element]);
+var routes = exports.routes = oneOfType([route, arrayOf(route)]);
+},{"react":"react"}],37:[function(require,module,exports){
+(function (process){
+'use strict';
+
+exports.__esModule = true;
var _routerWarning = require('./routerWarning');
@@ -3365,7 +3525,9 @@ var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
-var object = _react2['default'].PropTypes.object;
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var object = _react2.default.PropTypes.object;
/**
* The Lifecycle mixin adds the routerWillLeave lifecycle method to a
@@ -3382,6 +3544,7 @@ var object = _react2['default'].PropTypes.object;
* to. In this case routerWillLeave must return a prompt message to prevent
* the user from closing the window/tab.
*/
+
var Lifecycle = {
contextTypes: {
@@ -3398,27 +3561,25 @@ var Lifecycle = {
},
componentDidMount: function componentDidMount() {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'the `Lifecycle` mixin is deprecated, please use `context.router.setRouteLeaveHook(route, hook)`. http://tiny.cc/router-lifecyclemixin') : undefined;
- !this.routerWillLeave ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'The Lifecycle mixin requires you to define a routerWillLeave method') : _invariant2['default'](false) : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'the `Lifecycle` mixin is deprecated, please use `context.router.setRouteLeaveHook(route, hook)`. http://tiny.cc/router-lifecyclemixin') : void 0;
+ !this.routerWillLeave ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'The Lifecycle mixin requires you to define a routerWillLeave method') : (0, _invariant2.default)(false) : void 0;
var route = this.props.route || this.context.route;
- !route ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'The Lifecycle mixin must be used on either a) a <Route component> or ' + 'b) a descendant of a <Route component> that uses the RouteContext mixin') : _invariant2['default'](false) : undefined;
+ !route ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'The Lifecycle mixin must be used on either a) a <Route component> or ' + 'b) a descendant of a <Route component> that uses the RouteContext mixin') : (0, _invariant2.default)(false) : void 0;
this._unlistenBeforeLeavingRoute = this.context.history.listenBeforeLeavingRoute(route, this.routerWillLeave);
},
-
componentWillUnmount: function componentWillUnmount() {
if (this._unlistenBeforeLeavingRoute) this._unlistenBeforeLeavingRoute();
}
-
};
-exports['default'] = Lifecycle;
+exports.default = Lifecycle;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./routerWarning":59,"_process":27,"invariant":22,"react":"react"}],35:[function(require,module,exports){
+},{"./routerWarning":63,"_process":29,"invariant":23,"react":"react"}],38:[function(require,module,exports){
(function (process){
'use strict';
@@ -3426,10 +3587,6 @@ exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
-
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@@ -3438,13 +3595,20 @@ var _routerWarning = require('./routerWarning');
var _routerWarning2 = _interopRequireDefault(_routerWarning);
-var _React$PropTypes = _react2['default'].PropTypes;
+var _PropTypes = require('./PropTypes');
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
+
+var _React$PropTypes = _react2.default.PropTypes;
var bool = _React$PropTypes.bool;
var object = _React$PropTypes.object;
var string = _React$PropTypes.string;
var func = _React$PropTypes.func;
var oneOfType = _React$PropTypes.oneOfType;
+
function isLeftClickEvent(event) {
return event.button === 0;
}
@@ -3453,9 +3617,10 @@ function isModifiedEvent(event) {
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
+// TODO: De-duplicate against hasAnyProperties in createTransitionManager.
function isEmptyObject(object) {
for (var p in object) {
- if (object.hasOwnProperty(p)) return false;
+ if (Object.prototype.hasOwnProperty.call(object, p)) return false;
}return true;
}
@@ -3489,11 +3654,12 @@ function createLocationDescriptor(to, _ref) {
*
* <Link ... query={{ show: true }} state={{ the: 'state' }} />
*/
-var Link = _react2['default'].createClass({
+var Link = _react2.default.createClass({
displayName: 'Link',
+
contextTypes: {
- router: object
+ router: _PropTypes.routerShape
},
propTypes: {
@@ -3504,17 +3670,16 @@ var Link = _react2['default'].createClass({
activeStyle: object,
activeClassName: string,
onlyActiveOnIndex: bool.isRequired,
- onClick: func
+ onClick: func,
+ target: string
},
getDefaultProps: function getDefaultProps() {
return {
onlyActiveOnIndex: false,
- className: '',
style: {}
};
},
-
handleClick: function handleClick(event) {
var allowTransition = true;
@@ -3541,12 +3706,11 @@ var Link = _react2['default'].createClass({
var hash = _props.hash;
var state = _props.state;
- var _location = createLocationDescriptor(to, { query: query, hash: hash, state: state });
+ var location = createLocationDescriptor(to, { query: query, hash: hash, state: state });
- this.context.router.push(_location);
+ this.context.router.push(location);
}
},
-
render: function render() {
var _props2 = this.props;
var to = _props2.to;
@@ -3559,34 +3723,40 @@ var Link = _react2['default'].createClass({
var props = _objectWithoutProperties(_props2, ['to', 'query', 'hash', 'state', 'activeClassName', 'activeStyle', 'onlyActiveOnIndex']);
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](!(query || hash || state), 'the `query`, `hash`, and `state` props on `<Link>` are deprecated, use `<Link to={{ pathname, query, hash, state }}/>. http://tiny.cc/router-isActivedeprecated') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(!(query || hash || state), 'the `query`, `hash`, and `state` props on `<Link>` are deprecated, use `<Link to={{ pathname, query, hash, state }}/>. http://tiny.cc/router-isActivedeprecated') : void 0;
// Ignore if rendered outside the context of router, simplifies unit testing.
var router = this.context.router;
+
if (router) {
- var _location2 = createLocationDescriptor(to, { query: query, hash: hash, state: state });
- props.href = router.createHref(_location2);
+ var location = createLocationDescriptor(to, { query: query, hash: hash, state: state });
+ props.href = router.createHref(location);
if (activeClassName || activeStyle != null && !isEmptyObject(activeStyle)) {
- if (router.isActive(_location2, onlyActiveOnIndex)) {
- if (activeClassName) props.className += props.className === '' ? activeClassName : ' ' + activeClassName;
+ if (router.isActive(location, onlyActiveOnIndex)) {
+ if (activeClassName) {
+ if (props.className) {
+ props.className += ' ' + activeClassName;
+ } else {
+ props.className = activeClassName;
+ }
+ }
if (activeStyle) props.style = _extends({}, props.style, activeStyle);
}
}
}
- return _react2['default'].createElement('a', _extends({}, props, { onClick: this.handleClick }));
+ return _react2.default.createElement('a', _extends({}, props, { onClick: this.handleClick }));
}
-
});
-exports['default'] = Link;
+exports.default = Link;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./routerWarning":59,"_process":27,"react":"react"}],36:[function(require,module,exports){
+},{"./PropTypes":40,"./routerWarning":63,"_process":29,"react":"react"}],39:[function(require,module,exports){
(function (process){
'use strict';
@@ -3597,42 +3767,38 @@ exports.getParamNames = getParamNames;
exports.getParams = getParams;
exports.formatPattern = formatPattern;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
-function escapeSource(string) {
- return escapeRegExp(string).replace(/\/+/g, '/+');
-}
-
function _compilePattern(pattern) {
var regexpSource = '';
var paramNames = [];
var tokens = [];
- var match = undefined,
+ var match = void 0,
lastIndex = 0,
matcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|\*\*|\*|\(|\)/g;
while (match = matcher.exec(pattern)) {
if (match.index !== lastIndex) {
tokens.push(pattern.slice(lastIndex, match.index));
- regexpSource += escapeSource(pattern.slice(lastIndex, match.index));
+ regexpSource += escapeRegExp(pattern.slice(lastIndex, match.index));
}
if (match[1]) {
- regexpSource += '([^/?#]+)';
+ regexpSource += '([^/]+)';
paramNames.push(match[1]);
} else if (match[0] === '**') {
- regexpSource += '([\\s\\S]*)';
+ regexpSource += '(.*)';
paramNames.push('splat');
} else if (match[0] === '*') {
- regexpSource += '([\\s\\S]*?)';
+ regexpSource += '(.*?)';
paramNames.push('splat');
} else if (match[0] === '(') {
regexpSource += '(?:';
@@ -3647,7 +3813,7 @@ function _compilePattern(pattern) {
if (lastIndex !== pattern.length) {
tokens.push(pattern.slice(lastIndex, pattern.length));
- regexpSource += escapeSource(pattern.slice(lastIndex, pattern.length));
+ regexpSource += escapeRegExp(pattern.slice(lastIndex, pattern.length));
}
return {
@@ -3685,15 +3851,11 @@ function compilePattern(pattern) {
* - paramNames
* - paramValues
*/
-
function matchPattern(pattern, pathname) {
- // Make leading slashes consistent between pattern and pathname.
+ // Ensure pattern starts with leading slash for consistency with pathname.
if (pattern.charAt(0) !== '/') {
pattern = '/' + pattern;
}
- if (pathname.charAt(0) !== '/') {
- pathname = '/' + pathname;
- }
var _compilePattern2 = compilePattern(pattern);
@@ -3701,51 +3863,42 @@ function matchPattern(pattern, pathname) {
var paramNames = _compilePattern2.paramNames;
var tokens = _compilePattern2.tokens;
- regexpSource += '/*'; // Capture path separators
- // Special-case patterns like '*' for catch-all routes.
- var captureRemaining = tokens[tokens.length - 1] !== '*';
+ if (pattern.charAt(pattern.length - 1) !== '/') {
+ regexpSource += '/?'; // Allow optional path separator at end.
+ }
- if (captureRemaining) {
- // This will match newlines in the remaining path.
- regexpSource += '([\\s\\S]*?)';
+ // Special-case patterns like '*' for catch-all routes.
+ if (tokens[tokens.length - 1] === '*') {
+ regexpSource += '$';
}
- var match = pathname.match(new RegExp('^' + regexpSource + '$', 'i'));
+ var match = pathname.match(new RegExp('^' + regexpSource, 'i'));
+ if (match == null) {
+ return null;
+ }
- var remainingPathname = undefined,
- paramValues = undefined;
- if (match != null) {
- if (captureRemaining) {
- remainingPathname = match.pop();
- var matchedPath = match[0].substr(0, match[0].length - remainingPathname.length);
+ var matchedPath = match[0];
+ var remainingPathname = pathname.substr(matchedPath.length);
- // If we didn't match the entire pathname, then make sure that the match
- // we did get ends at a path separator (potentially the one we added
- // above at the beginning of the path, if the actual match was empty).
- if (remainingPathname && matchedPath.charAt(matchedPath.length - 1) !== '/') {
- return {
- remainingPathname: null,
- paramNames: paramNames,
- paramValues: null
- };
- }
- } else {
- // If this matched at all, then the match was the entire pathname.
- remainingPathname = '';
+ if (remainingPathname) {
+ // Require that the match ends at a path separator, if we didn't match
+ // the full path, so any remaining pathname is a new path segment.
+ if (matchedPath.charAt(matchedPath.length - 1) !== '/') {
+ return null;
}
- paramValues = match.slice(1).map(function (v) {
- return v != null ? decodeURIComponent(v) : v;
- });
- } else {
- remainingPathname = paramValues = null;
+ // If there is a remaining pathname, treat the path separator as part of
+ // the remaining pathname for properly continuing the match.
+ remainingPathname = '/' + remainingPathname;
}
return {
remainingPathname: remainingPathname,
paramNames: paramNames,
- paramValues: paramValues
+ paramValues: match.slice(1).map(function (v) {
+ return v && decodeURIComponent(v);
+ })
};
}
@@ -3754,26 +3907,27 @@ function getParamNames(pattern) {
}
function getParams(pattern, pathname) {
- var _matchPattern = matchPattern(pattern, pathname);
+ var match = matchPattern(pattern, pathname);
+ if (!match) {
+ return null;
+ }
- var paramNames = _matchPattern.paramNames;
- var paramValues = _matchPattern.paramValues;
+ var paramNames = match.paramNames;
+ var paramValues = match.paramValues;
- if (paramValues != null) {
- return paramNames.reduce(function (memo, paramName, index) {
- memo[paramName] = paramValues[index];
- return memo;
- }, {});
- }
+ var params = {};
- return null;
+ paramNames.forEach(function (paramName, index) {
+ params[paramName] = paramValues[index];
+ });
+
+ return params;
}
/**
* Returns a version of the given pattern with params interpolated. Throws
* if there is a dynamic segment of the pattern for which there is no param.
*/
-
function formatPattern(pattern, params) {
params = params || {};
@@ -3785,16 +3939,16 @@ function formatPattern(pattern, params) {
pathname = '',
splatIndex = 0;
- var token = undefined,
- paramName = undefined,
- paramValue = undefined;
+ var token = void 0,
+ paramName = void 0,
+ paramValue = void 0;
for (var i = 0, len = tokens.length; i < len; ++i) {
token = tokens[i];
if (token === '*' || token === '**') {
paramValue = Array.isArray(params.splat) ? params.splat[splatIndex++] : params.splat;
- !(paramValue != null || parenCount > 0) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Missing splat #%s for path "%s"', splatIndex, pattern) : _invariant2['default'](false) : undefined;
+ !(paramValue != null || parenCount > 0) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Missing splat #%s for path "%s"', splatIndex, pattern) : (0, _invariant2.default)(false) : void 0;
if (paramValue != null) pathname += encodeURI(paramValue);
} else if (token === '(') {
@@ -3805,7 +3959,7 @@ function formatPattern(pattern, params) {
paramName = token.substring(1);
paramValue = params[paramName];
- !(paramValue != null || parenCount > 0) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Missing "%s" parameter for path "%s"', paramName, pattern) : _invariant2['default'](false) : undefined;
+ !(paramValue != null || parenCount > 0) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Missing "%s" parameter for path "%s"', paramName, pattern) : (0, _invariant2.default)(false) : void 0;
if (paramValue != null) pathname += encodeURIComponent(paramValue);
} else {
@@ -3817,35 +3971,46 @@ function formatPattern(pattern, params) {
}
}).call(this,require('_process'))
-},{"_process":27,"invariant":22}],37:[function(require,module,exports){
+},{"_process":29,"invariant":23}],40:[function(require,module,exports){
+(function (process){
'use strict';
exports.__esModule = true;
-exports.falsy = falsy;
+exports.router = exports.routes = exports.route = exports.components = exports.component = exports.location = exports.history = exports.falsy = exports.locationShape = exports.routerShape = undefined;
var _react = require('react');
+var _deprecateObjectProperties = require('./deprecateObjectProperties');
+
+var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties);
+
+var _InternalPropTypes = require('./InternalPropTypes');
+
+var InternalPropTypes = _interopRequireWildcard(_InternalPropTypes);
+
+var _routerWarning = require('./routerWarning');
+
+var _routerWarning2 = _interopRequireDefault(_routerWarning);
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
var func = _react.PropTypes.func;
var object = _react.PropTypes.object;
-var arrayOf = _react.PropTypes.arrayOf;
-var oneOfType = _react.PropTypes.oneOfType;
-var element = _react.PropTypes.element;
var shape = _react.PropTypes.shape;
var string = _react.PropTypes.string;
-
-function falsy(props, propName, componentName) {
- if (props[propName]) return new Error('<' + componentName + '> should not have a "' + propName + '" prop');
-}
-
-var history = shape({
- listen: func.isRequired,
- pushState: func.isRequired,
- replaceState: func.isRequired,
- go: func.isRequired
+var routerShape = exports.routerShape = shape({
+ push: func.isRequired,
+ replace: func.isRequired,
+ go: func.isRequired,
+ goBack: func.isRequired,
+ goForward: func.isRequired,
+ setRouteLeaveHook: func.isRequired,
+ isActive: func.isRequired
});
-exports.history = history;
-var location = shape({
+var locationShape = exports.locationShape = shape({
pathname: string.isRequired,
search: string.isRequired,
state: object,
@@ -3853,32 +4018,70 @@ var location = shape({
key: string
});
-exports.location = location;
-var component = oneOfType([func, string]);
-exports.component = component;
-var components = oneOfType([component, object]);
-exports.components = components;
-var route = oneOfType([object, element]);
-exports.route = route;
-var routes = oneOfType([route, arrayOf(route)]);
+// Deprecated stuff below:
-exports.routes = routes;
-exports['default'] = {
+var falsy = exports.falsy = InternalPropTypes.falsy;
+var history = exports.history = InternalPropTypes.history;
+var location = exports.location = locationShape;
+var component = exports.component = InternalPropTypes.component;
+var components = exports.components = InternalPropTypes.components;
+var route = exports.route = InternalPropTypes.route;
+var routes = exports.routes = InternalPropTypes.routes;
+var router = exports.router = routerShape;
+
+if (process.env.NODE_ENV !== 'production') {
+ (function () {
+ var deprecatePropType = function deprecatePropType(propType, message) {
+ return function () {
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, message) : void 0;
+ return propType.apply(undefined, arguments);
+ };
+ };
+
+ var deprecateInternalPropType = function deprecateInternalPropType(propType) {
+ return deprecatePropType(propType, 'This prop type is not intended for external use, and was previously exported by mistake. These internal prop types are deprecated for external use, and will be removed in a later version.');
+ };
+
+ var deprecateRenamedPropType = function deprecateRenamedPropType(propType, name) {
+ return deprecatePropType(propType, 'The `' + name + '` prop type is now exported as `' + name + 'Shape` to avoid name conflicts. This export is deprecated and will be removed in a later version.');
+ };
+
+ exports.falsy = falsy = deprecateInternalPropType(falsy);
+ exports.history = history = deprecateInternalPropType(history);
+ exports.component = component = deprecateInternalPropType(component);
+ exports.components = components = deprecateInternalPropType(components);
+ exports.route = route = deprecateInternalPropType(route);
+ exports.routes = routes = deprecateInternalPropType(routes);
+
+ exports.location = location = deprecateRenamedPropType(location, 'location');
+ exports.router = router = deprecateRenamedPropType(router, 'router');
+ })();
+}
+
+var defaultExport = {
falsy: falsy,
history: history,
location: location,
component: component,
components: components,
- route: route
+ route: route,
+ // For some reason, routes was never here.
+ router: router
};
-},{"react":"react"}],38:[function(require,module,exports){
+
+if (process.env.NODE_ENV !== 'production') {
+ defaultExport = (0, _deprecateObjectProperties2.default)(defaultExport, 'The default export from `react-router/lib/PropTypes` is deprecated. Please use the named exports instead.');
+}
+
+exports.default = defaultExport;
+}).call(this,require('_process'))
+
+},{"./InternalPropTypes":36,"./deprecateObjectProperties":56,"./routerWarning":63,"_process":29,"react":"react"}],41:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@@ -3891,9 +4094,11 @@ var _RouteUtils = require('./RouteUtils');
var _PatternUtils = require('./PatternUtils');
-var _PropTypes = require('./PropTypes');
+var _InternalPropTypes = require('./InternalPropTypes');
-var _React$PropTypes = _react2['default'].PropTypes;
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var _React$PropTypes = _react2.default.PropTypes;
var string = _React$PropTypes.string;
var object = _React$PropTypes.object;
@@ -3904,13 +4109,14 @@ var object = _React$PropTypes.object;
* Redirects are placed alongside routes in the route configuration
* and are traversed in the same manner.
*/
-var Redirect = _react2['default'].createClass({
+
+var Redirect = _react2.default.createClass({
displayName: 'Redirect',
- statics: {
+ statics: {
createRouteFromReactElement: function createRouteFromReactElement(element) {
- var route = _RouteUtils.createRouteFromReactElement(element);
+ var route = (0, _RouteUtils.createRouteFromReactElement)(element);
if (route.from) route.path = route.from;
@@ -3918,16 +4124,17 @@ var Redirect = _react2['default'].createClass({
var location = nextState.location;
var params = nextState.params;
- var pathname = undefined;
+
+ var pathname = void 0;
if (route.to.charAt(0) === '/') {
- pathname = _PatternUtils.formatPattern(route.to, params);
+ pathname = (0, _PatternUtils.formatPattern)(route.to, params);
} else if (!route.to) {
pathname = location.pathname;
} else {
var routeIndex = nextState.routes.indexOf(route);
var parentPattern = Redirect.getRoutePattern(nextState.routes, routeIndex - 1);
var pattern = parentPattern.replace(/\/*$/, '/') + route.to;
- pathname = _PatternUtils.formatPattern(pattern, params);
+ pathname = (0, _PatternUtils.formatPattern)(pattern, params);
}
replace({
@@ -3939,7 +4146,6 @@ var Redirect = _react2['default'].createClass({
return route;
},
-
getRoutePattern: function getRoutePattern(routes, routeIndex) {
var parentPattern = '';
@@ -3954,7 +4160,6 @@ var Redirect = _react2['default'].createClass({
return '/' + parentPattern;
}
-
},
propTypes: {
@@ -3963,29 +4168,26 @@ var Redirect = _react2['default'].createClass({
to: string.isRequired,
query: object,
state: object,
- onEnter: _PropTypes.falsy,
- children: _PropTypes.falsy
+ onEnter: _InternalPropTypes.falsy,
+ children: _InternalPropTypes.falsy
},
/* istanbul ignore next: sanity check */
render: function render() {
- !false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, '<Redirect> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined;
+ !false ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<Redirect> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
}
-
});
-exports['default'] = Redirect;
+exports.default = Redirect;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./PatternUtils":36,"./PropTypes":37,"./RouteUtils":41,"_process":27,"invariant":22,"react":"react"}],39:[function(require,module,exports){
+},{"./InternalPropTypes":36,"./PatternUtils":39,"./RouteUtils":44,"_process":29,"invariant":23,"react":"react"}],42:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@@ -3996,9 +4198,11 @@ var _invariant2 = _interopRequireDefault(_invariant);
var _RouteUtils = require('./RouteUtils');
-var _PropTypes = require('./PropTypes');
+var _InternalPropTypes = require('./InternalPropTypes');
-var _React$PropTypes = _react2['default'].PropTypes;
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var _React$PropTypes = _react2.default.PropTypes;
var string = _React$PropTypes.string;
var func = _React$PropTypes.func;
@@ -4012,40 +4216,39 @@ var func = _React$PropTypes.func;
* that lead to it are considered "active" and their components are
* rendered into the DOM, nested in the same order as in the tree.
*/
-var Route = _react2['default'].createClass({
+
+var Route = _react2.default.createClass({
displayName: 'Route',
+
statics: {
createRouteFromReactElement: _RouteUtils.createRouteFromReactElement
},
propTypes: {
path: string,
- component: _PropTypes.component,
- components: _PropTypes.components,
+ component: _InternalPropTypes.component,
+ components: _InternalPropTypes.components,
getComponent: func,
getComponents: func
},
/* istanbul ignore next: sanity check */
render: function render() {
- !false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, '<Route> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined;
+ !false ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<Route> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
}
-
});
-exports['default'] = Route;
+exports.default = Route;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./PropTypes":37,"./RouteUtils":41,"_process":27,"invariant":22,"react":"react"}],40:[function(require,module,exports){
+},{"./InternalPropTypes":36,"./RouteUtils":44,"_process":29,"invariant":23,"react":"react"}],43:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _routerWarning = require('./routerWarning');
var _routerWarning2 = _interopRequireDefault(_routerWarning);
@@ -4054,7 +4257,9 @@ var _react = require('react');
var _react2 = _interopRequireDefault(_react);
-var object = _react2['default'].PropTypes.object;
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var object = _react2.default.PropTypes.object;
/**
* The RouteContext mixin provides a convenient way for route
@@ -4062,6 +4267,7 @@ var object = _react2['default'].PropTypes.object;
* routes that render elements that want to use the Lifecycle
* mixin to prevent transitions.
*/
+
var RouteContext = {
propTypes: {
@@ -4077,18 +4283,16 @@ var RouteContext = {
route: this.props.route
};
},
-
componentWillMount: function componentWillMount() {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'The `RouteContext` mixin is deprecated. You can provide `this.props.route` on context with your own `contextTypes`. http://tiny.cc/router-routecontextmixin') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'The `RouteContext` mixin is deprecated. You can provide `this.props.route` on context with your own `contextTypes`. http://tiny.cc/router-routecontextmixin') : void 0;
}
-
};
-exports['default'] = RouteContext;
+exports.default = RouteContext;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./routerWarning":59,"_process":27,"react":"react"}],41:[function(require,module,exports){
+},{"./routerWarning":63,"_process":29,"react":"react"}],44:[function(require,module,exports){
(function (process){
'use strict';
@@ -4101,8 +4305,6 @@ exports.createRouteFromReactElement = createRouteFromReactElement;
exports.createRoutesFromReactChildren = createRoutesFromReactChildren;
exports.createRoutes = createRoutes;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@@ -4111,8 +4313,10 @@ var _routerWarning = require('./routerWarning');
var _routerWarning2 = _interopRequireDefault(_routerWarning);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
function isValidChild(object) {
- return object == null || _react2['default'].isValidElement(object);
+ return object == null || _react2.default.isValidElement(object);
}
function isReactChildren(object) {
@@ -4123,11 +4327,11 @@ function checkPropTypes(componentName, propTypes, props) {
componentName = componentName || 'UnknownComponent';
for (var propName in propTypes) {
- if (propTypes.hasOwnProperty(propName)) {
+ if (Object.prototype.hasOwnProperty.call(propTypes, propName)) {
var error = propTypes[propName](props, propName, componentName);
/* istanbul ignore if: error logging */
- if (error instanceof Error) process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, error.message) : undefined;
+ if (error instanceof Error) process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, error.message) : void 0;
}
}
}
@@ -4170,12 +4374,11 @@ function createRouteFromReactElement(element) {
* Note: This method is automatically used when you provide <Route> children
* to a <Router> component.
*/
-
function createRoutesFromReactChildren(children, parentRoute) {
var routes = [];
- _react2['default'].Children.forEach(children, function (element) {
- if (_react2['default'].isValidElement(element)) {
+ _react2.default.Children.forEach(children, function (element) {
+ if (_react2.default.isValidElement(element)) {
// Component classes may have a static create* method.
if (element.type.createRouteFromReactElement) {
var route = element.type.createRouteFromReactElement(element, parentRoute);
@@ -4194,7 +4397,6 @@ function createRoutesFromReactChildren(children, parentRoute) {
* Creates and returns an array of routes from the given object which
* may be a JSX route, a plain object route, or an array of either.
*/
-
function createRoutes(routes) {
if (isReactChildren(routes)) {
routes = createRoutesFromReactChildren(routes);
@@ -4206,7 +4408,7 @@ function createRoutes(routes) {
}
}).call(this,require('_process'))
-},{"./routerWarning":59,"_process":27,"react":"react"}],42:[function(require,module,exports){
+},{"./routerWarning":63,"_process":29,"react":"react"}],45:[function(require,module,exports){
(function (process){
'use strict';
@@ -4214,17 +4416,13 @@ exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+var _createHashHistory = require('history/lib/createHashHistory');
-function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
-
-var _historyLibCreateHashHistory = require('history/lib/createHashHistory');
-
-var _historyLibCreateHashHistory2 = _interopRequireDefault(_historyLibCreateHashHistory);
+var _createHashHistory2 = _interopRequireDefault(_createHashHistory);
-var _historyLibUseQueries = require('history/lib/useQueries');
+var _useQueries = require('history/lib/useQueries');
-var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries);
+var _useQueries2 = _interopRequireDefault(_useQueries);
var _react = require('react');
@@ -4234,7 +4432,7 @@ var _createTransitionManager = require('./createTransitionManager');
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
-var _PropTypes = require('./PropTypes');
+var _InternalPropTypes = require('./InternalPropTypes');
var _RouterContext = require('./RouterContext');
@@ -4248,11 +4446,15 @@ var _routerWarning = require('./routerWarning');
var _routerWarning2 = _interopRequireDefault(_routerWarning);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
+
function isDeprecatedHistory(history) {
return !history || !history.__v2_compatible__;
}
-var _React$PropTypes = _react2['default'].PropTypes;
+var _React$PropTypes = _react2.default.PropTypes;
var func = _React$PropTypes.func;
var object = _React$PropTypes.object;
@@ -4261,13 +4463,15 @@ var object = _React$PropTypes.object;
* a router that renders a <RouterContext> with all the props
* it needs each time the URL changes.
*/
-var Router = _react2['default'].createClass({
+
+var Router = _react2.default.createClass({
displayName: 'Router',
+
propTypes: {
history: object,
- children: _PropTypes.routes,
- routes: _PropTypes.routes, // alias for children
+ children: _InternalPropTypes.routes,
+ routes: _InternalPropTypes.routes, // alias for children
render: func,
createElement: func,
onError: func,
@@ -4280,11 +4484,10 @@ var Router = _react2['default'].createClass({
getDefaultProps: function getDefaultProps() {
return {
render: function render(props) {
- return _react2['default'].createElement(_RouterContext2['default'], props);
+ return _react2.default.createElement(_RouterContext2.default, props);
}
};
},
-
getInitialState: function getInitialState() {
return {
location: null,
@@ -4293,7 +4496,6 @@ var Router = _react2['default'].createClass({
components: null
};
},
-
handleError: function handleError(error) {
if (this.props.onError) {
this.props.onError.call(this, error);
@@ -4302,7 +4504,6 @@ var Router = _react2['default'].createClass({
throw error; // This error probably occurred in getChildRoutes or getComponents.
}
},
-
componentWillMount: function componentWillMount() {
var _this = this;
@@ -4310,7 +4511,7 @@ var Router = _react2['default'].createClass({
var parseQueryString = _props.parseQueryString;
var stringifyQuery = _props.stringifyQuery;
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](!(parseQueryString || stringifyQuery), '`parseQueryString` and `stringifyQuery` are deprecated. Please create a custom history. http://tiny.cc/router-customquerystring') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(!(parseQueryString || stringifyQuery), '`parseQueryString` and `stringifyQuery` are deprecated. Please create a custom history. http://tiny.cc/router-customquerystring') : void 0;
var _createRouterObjects = this.createRouterObjects();
@@ -4318,6 +4519,7 @@ var Router = _react2['default'].createClass({
var transitionManager = _createRouterObjects.transitionManager;
var router = _createRouterObjects.router;
+
this._unlisten = transitionManager.listen(function (error, state) {
if (error) {
_this.handleError(error);
@@ -4329,7 +4531,6 @@ var Router = _react2['default'].createClass({
this.history = history;
this.router = router;
},
-
createRouterObjects: function createRouterObjects() {
var matchContext = this.props.matchContext;
@@ -4342,47 +4543,47 @@ var Router = _react2['default'].createClass({
var routes = _props2.routes;
var children = _props2.children;
+
if (isDeprecatedHistory(history)) {
history = this.wrapDeprecatedHistory(history);
}
- var transitionManager = _createTransitionManager2['default'](history, _RouteUtils.createRoutes(routes || children));
- var router = _RouterUtils.createRouterObject(history, transitionManager);
- var routingHistory = _RouterUtils.createRoutingHistory(history, transitionManager);
+ var transitionManager = (0, _createTransitionManager2.default)(history, (0, _RouteUtils.createRoutes)(routes || children));
+ var router = (0, _RouterUtils.createRouterObject)(history, transitionManager);
+ var routingHistory = (0, _RouterUtils.createRoutingHistory)(history, transitionManager);
return { history: routingHistory, transitionManager: transitionManager, router: router };
},
-
wrapDeprecatedHistory: function wrapDeprecatedHistory(history) {
var _props3 = this.props;
var parseQueryString = _props3.parseQueryString;
var stringifyQuery = _props3.stringifyQuery;
- var createHistory = undefined;
+
+ var createHistory = void 0;
if (history) {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'It appears you have provided a deprecated history object to `<Router/>`, please use a history provided by ' + 'React Router with `import { browserHistory } from \'react-router\'` or `import { hashHistory } from \'react-router\'`. ' + 'If you are using a custom history please create it with `useRouterHistory`, see http://tiny.cc/router-usinghistory for details.') : undefined;
- createHistory = function () {
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'It appears you have provided a deprecated history object to `<Router/>`, please use a history provided by ' + 'React Router with `import { browserHistory } from \'react-router\'` or `import { hashHistory } from \'react-router\'`. ' + 'If you are using a custom history please create it with `useRouterHistory`, see http://tiny.cc/router-usinghistory for details.') : void 0;
+ createHistory = function createHistory() {
return history;
};
} else {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, '`Router` no longer defaults the history prop to hash history. Please use the `hashHistory` singleton instead. http://tiny.cc/router-defaulthistory') : undefined;
- createHistory = _historyLibCreateHashHistory2['default'];
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, '`Router` no longer defaults the history prop to hash history. Please use the `hashHistory` singleton instead. http://tiny.cc/router-defaulthistory') : void 0;
+ createHistory = _createHashHistory2.default;
}
- return _historyLibUseQueries2['default'](createHistory)({ parseQueryString: parseQueryString, stringifyQuery: stringifyQuery });
+ return (0, _useQueries2.default)(createHistory)({ parseQueryString: parseQueryString, stringifyQuery: stringifyQuery });
},
+
/* istanbul ignore next: sanity check */
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](nextProps.history === this.props.history, 'You cannot change <Router history>; it will be ignored') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(nextProps.history === this.props.history, 'You cannot change <Router history>; it will be ignored') : void 0;
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default']((nextProps.routes || nextProps.children) === (this.props.routes || this.props.children), 'You cannot change <Router routes>; it will be ignored') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)((nextProps.routes || nextProps.children) === (this.props.routes || this.props.children), 'You cannot change <Router routes>; it will be ignored') : void 0;
},
-
componentWillUnmount: function componentWillUnmount() {
if (this._unlisten) this._unlisten();
},
-
render: function render() {
var _state = this.state;
var location = _state.location;
@@ -4413,22 +4614,21 @@ var Router = _react2['default'].createClass({
createElement: createElement
}));
}
-
});
-exports['default'] = Router;
+exports.default = Router;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./PropTypes":37,"./RouteUtils":41,"./RouterContext":43,"./RouterUtils":44,"./createTransitionManager":51,"./routerWarning":59,"_process":27,"history/lib/createHashHistory":14,"history/lib/useQueries":21,"react":"react"}],43:[function(require,module,exports){
+},{"./InternalPropTypes":36,"./RouteUtils":44,"./RouterContext":46,"./RouterUtils":47,"./createTransitionManager":55,"./routerWarning":63,"_process":29,"history/lib/createHashHistory":14,"history/lib/useQueries":21,"react":"react"}],46:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
-var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _invariant = require('invariant');
@@ -4452,7 +4652,9 @@ var _routerWarning = require('./routerWarning');
var _routerWarning2 = _interopRequireDefault(_routerWarning);
-var _React$PropTypes = _react2['default'].PropTypes;
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var _React$PropTypes = _react2.default.PropTypes;
var array = _React$PropTypes.array;
var func = _React$PropTypes.func;
var object = _React$PropTypes.object;
@@ -4461,9 +4663,11 @@ var object = _React$PropTypes.object;
* A <RouterContext> renders the component tree for a given router state
* and sets the history object and the current location in context.
*/
-var RouterContext = _react2['default'].createClass({
+
+var RouterContext = _react2.default.createClass({
displayName: 'RouterContext',
+
propTypes: {
history: object,
router: object.isRequired,
@@ -4476,10 +4680,11 @@ var RouterContext = _react2['default'].createClass({
getDefaultProps: function getDefaultProps() {
return {
- createElement: _react2['default'].createElement
+ createElement: _react2.default.createElement
};
},
+
childContextTypes: {
history: object,
location: object.isRequired,
@@ -4493,7 +4698,7 @@ var RouterContext = _react2['default'].createClass({
var location = _props.location;
if (!router) {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, '`<RouterContext>` expects a `router` rather than a `history`') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, '`<RouterContext>` expects a `router` rather than a `history`') : void 0;
router = _extends({}, history, {
setRouteLeaveHook: history.listenBeforeLeavingRoute
@@ -4502,16 +4707,14 @@ var RouterContext = _react2['default'].createClass({
}
if (process.env.NODE_ENV !== 'production') {
- location = _deprecateObjectProperties2['default'](location, '`context.location` is deprecated, please use a route component\'s `props.location` instead. http://tiny.cc/router-accessinglocation');
+ location = (0, _deprecateObjectProperties2.default)(location, '`context.location` is deprecated, please use a route component\'s `props.location` instead. http://tiny.cc/router-accessinglocation');
}
return { history: history, location: location, router: router };
},
-
createElement: function createElement(component, props) {
return component == null ? null : this.props.createElement(component, props);
},
-
render: function render() {
var _this = this;
@@ -4529,7 +4732,7 @@ var RouterContext = _react2['default'].createClass({
if (components == null) return element; // Don't create new children; use the grandchildren.
var route = routes[index];
- var routeParams = _getRouteParams2['default'](route, params);
+ var routeParams = (0, _getRouteParams2.default)(route, params);
var props = {
history: history,
location: location,
@@ -4539,19 +4742,19 @@ var RouterContext = _react2['default'].createClass({
routes: routes
};
- if (_RouteUtils.isReactChildren(element)) {
+ if ((0, _RouteUtils.isReactChildren)(element)) {
props.children = element;
} else if (element) {
for (var prop in element) {
- if (element.hasOwnProperty(prop)) props[prop] = element[prop];
+ if (Object.prototype.hasOwnProperty.call(element, prop)) props[prop] = element[prop];
}
}
- if (typeof components === 'object') {
+ if ((typeof components === 'undefined' ? 'undefined' : _typeof(components)) === 'object') {
var elements = {};
for (var key in components) {
- if (components.hasOwnProperty(key)) {
+ if (Object.prototype.hasOwnProperty.call(components, key)) {
// Pass through the key as a prop to createElement to allow
// custom createElement functions to know which named component
// they're rendering, for e.g. matching up to fetched data.
@@ -4567,18 +4770,17 @@ var RouterContext = _react2['default'].createClass({
}, element);
}
- !(element === null || element === false || _react2['default'].isValidElement(element)) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'The root route must render a single element') : _invariant2['default'](false) : undefined;
+ !(element === null || element === false || _react2.default.isValidElement(element)) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'The root route must render a single element') : (0, _invariant2.default)(false) : void 0;
return element;
}
-
});
-exports['default'] = RouterContext;
+exports.default = RouterContext;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./RouteUtils":41,"./deprecateObjectProperties":52,"./getRouteParams":54,"./routerWarning":59,"_process":27,"invariant":22,"react":"react"}],44:[function(require,module,exports){
+},{"./RouteUtils":44,"./deprecateObjectProperties":56,"./getRouteParams":58,"./routerWarning":63,"_process":29,"invariant":23,"react":"react"}],47:[function(require,module,exports){
(function (process){
'use strict';
@@ -4589,12 +4791,12 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
exports.createRouterObject = createRouterObject;
exports.createRoutingHistory = createRoutingHistory;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _deprecateObjectProperties = require('./deprecateObjectProperties');
var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
function createRouterObject(history, transitionManager) {
return _extends({}, history, {
setRouteLeaveHook: transitionManager.listenBeforeLeavingRoute,
@@ -4603,26 +4805,23 @@ function createRouterObject(history, transitionManager) {
}
// deprecated
-
function createRoutingHistory(history, transitionManager) {
history = _extends({}, history, transitionManager);
if (process.env.NODE_ENV !== 'production') {
- history = _deprecateObjectProperties2['default'](history, '`props.history` and `context.history` are deprecated. Please use `context.router`. http://tiny.cc/router-contextchanges');
+ history = (0, _deprecateObjectProperties2.default)(history, '`props.history` and `context.history` are deprecated. Please use `context.router`. http://tiny.cc/router-contextchanges');
}
return history;
}
}).call(this,require('_process'))
-},{"./deprecateObjectProperties":52,"_process":27}],45:[function(require,module,exports){
+},{"./deprecateObjectProperties":56,"_process":29}],48:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@@ -4635,43 +4834,49 @@ var _routerWarning = require('./routerWarning');
var _routerWarning2 = _interopRequireDefault(_routerWarning);
-var RoutingContext = _react2['default'].createClass({
- displayName: 'RoutingContext',
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+var RoutingContext = _react2.default.createClass({
+ displayName: 'RoutingContext',
componentWillMount: function componentWillMount() {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, '`RoutingContext` has been renamed to `RouterContext`. Please use `import { RouterContext } from \'react-router\'`. http://tiny.cc/router-routercontext') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, '`RoutingContext` has been renamed to `RouterContext`. Please use `import { RouterContext } from \'react-router\'`. http://tiny.cc/router-routercontext') : void 0;
},
-
render: function render() {
- return _react2['default'].createElement(_RouterContext2['default'], this.props);
+ return _react2.default.createElement(_RouterContext2.default, this.props);
}
});
-exports['default'] = RoutingContext;
+exports.default = RoutingContext;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./RouterContext":43,"./routerWarning":59,"_process":27,"react":"react"}],46:[function(require,module,exports){
+},{"./RouterContext":46,"./routerWarning":63,"_process":29,"react":"react"}],49:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
exports.runEnterHooks = runEnterHooks;
+exports.runChangeHooks = runChangeHooks;
exports.runLeaveHooks = runLeaveHooks;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _AsyncUtils = require('./AsyncUtils');
var _routerWarning = require('./routerWarning');
var _routerWarning2 = _interopRequireDefault(_routerWarning);
-function createEnterHook(hook, route) {
- return function (a, b, callback) {
- hook.apply(route, arguments);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- if (hook.length < 3) {
+function createTransitionHook(hook, route, asyncArity) {
+ return function () {
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ hook.apply(route, args);
+
+ if (hook.length < asyncArity) {
+ var callback = args[args.length - 1];
// Assume hook executes synchronously and
// automatically call the callback.
callback();
@@ -4681,35 +4886,29 @@ function createEnterHook(hook, route) {
function getEnterHooks(routes) {
return routes.reduce(function (hooks, route) {
- if (route.onEnter) hooks.push(createEnterHook(route.onEnter, route));
+ if (route.onEnter) hooks.push(createTransitionHook(route.onEnter, route, 3));
return hooks;
}, []);
}
-/**
- * Runs all onEnter hooks in the given array of routes in order
- * with onEnter(nextState, replace, callback) and calls
- * callback(error, redirectInfo) when finished. The first hook
- * to use replace short-circuits the loop.
- *
- * If a hook needs to run asynchronously, it may use the callback
- * function. However, doing so will cause the transition to pause,
- * which could lead to a non-responsive UI if the hook is slow.
- */
-
-function runEnterHooks(routes, nextState, callback) {
- var hooks = getEnterHooks(routes);
+function getChangeHooks(routes) {
+ return routes.reduce(function (hooks, route) {
+ if (route.onChange) hooks.push(createTransitionHook(route.onChange, route, 4));
+ return hooks;
+ }, []);
+}
- if (!hooks.length) {
+function runTransitionHooks(length, iter, callback) {
+ if (!length) {
callback();
return;
}
- var redirectInfo = undefined;
+ var redirectInfo = void 0;
function replace(location, deprecatedPathname, deprecatedQuery) {
if (deprecatedPathname) {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, '`replaceState(state, pathname, query) is deprecated; use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, '`replaceState(state, pathname, query) is deprecated; use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : void 0;
redirectInfo = {
pathname: deprecatedPathname,
query: deprecatedQuery,
@@ -4722,8 +4921,8 @@ function runEnterHooks(routes, nextState, callback) {
redirectInfo = location;
}
- _AsyncUtils.loopAsync(hooks.length, function (index, next, done) {
- hooks[index](nextState, replace, function (error) {
+ (0, _AsyncUtils.loopAsync)(length, function (index, next, done) {
+ iter(index, replace, function (error) {
if (error || redirectInfo) {
done(error, redirectInfo); // No need to continue.
} else {
@@ -4734,9 +4933,42 @@ function runEnterHooks(routes, nextState, callback) {
}
/**
- * Runs all onLeave hooks in the given array of routes in order.
+ * Runs all onEnter hooks in the given array of routes in order
+ * with onEnter(nextState, replace, callback) and calls
+ * callback(error, redirectInfo) when finished. The first hook
+ * to use replace short-circuits the loop.
+ *
+ * If a hook needs to run asynchronously, it may use the callback
+ * function. However, doing so will cause the transition to pause,
+ * which could lead to a non-responsive UI if the hook is slow.
*/
+function runEnterHooks(routes, nextState, callback) {
+ var hooks = getEnterHooks(routes);
+ return runTransitionHooks(hooks.length, function (index, replace, next) {
+ hooks[index](nextState, replace, next);
+ }, callback);
+}
+/**
+ * Runs all onChange hooks in the given array of routes in order
+ * with onChange(prevState, nextState, replace, callback) and calls
+ * callback(error, redirectInfo) when finished. The first hook
+ * to use replace short-circuits the loop.
+ *
+ * If a hook needs to run asynchronously, it may use the callback
+ * function. However, doing so will cause the transition to pause,
+ * which could lead to a non-responsive UI if the hook is slow.
+ */
+function runChangeHooks(routes, state, nextState, callback) {
+ var hooks = getChangeHooks(routes);
+ return runTransitionHooks(hooks.length, function (index, replace, next) {
+ hooks[index](state, nextState, replace, next);
+ }, callback);
+}
+
+/**
+ * Runs all onLeave hooks in the given array of routes in order.
+ */
function runLeaveHooks(routes) {
for (var i = 0, len = routes.length; i < len; ++i) {
if (routes[i].onLeave) routes[i].onLeave.call(routes[i]);
@@ -4744,24 +4976,75 @@ function runLeaveHooks(routes) {
}
}).call(this,require('_process'))
-},{"./AsyncUtils":29,"./routerWarning":59,"_process":27}],47:[function(require,module,exports){
+},{"./AsyncUtils":31,"./routerWarning":63,"_process":29}],50:[function(require,module,exports){
'use strict';
exports.__esModule = true;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
+
+var _react = require('react');
+
+var _react2 = _interopRequireDefault(_react);
+
+var _RouterContext = require('./RouterContext');
+
+var _RouterContext2 = _interopRequireDefault(_RouterContext);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-var _historyLibCreateBrowserHistory = require('history/lib/createBrowserHistory');
+exports.default = function () {
+ for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
+ middlewares[_key] = arguments[_key];
+ }
+
+ var withContext = middlewares.map(function (m) {
+ return m.renderRouterContext;
+ }).filter(function (f) {
+ return f;
+ });
+ var withComponent = middlewares.map(function (m) {
+ return m.renderRouteComponent;
+ }).filter(function (f) {
+ return f;
+ });
+ var makeCreateElement = function makeCreateElement() {
+ var baseCreateElement = arguments.length <= 0 || arguments[0] === undefined ? _react.createElement : arguments[0];
+ return function (Component, props) {
+ return withComponent.reduceRight(function (previous, renderRouteComponent) {
+ return renderRouteComponent(previous, props);
+ }, baseCreateElement(Component, props));
+ };
+ };
+
+ return function (renderProps) {
+ return withContext.reduceRight(function (previous, renderRouterContext) {
+ return renderRouterContext(previous, renderProps);
+ }, _react2.default.createElement(_RouterContext2.default, _extends({}, renderProps, {
+ createElement: makeCreateElement(renderProps.createElement)
+ })));
+ };
+};
+
+module.exports = exports['default'];
+},{"./RouterContext":46,"react":"react"}],51:[function(require,module,exports){
+'use strict';
+
+exports.__esModule = true;
-var _historyLibCreateBrowserHistory2 = _interopRequireDefault(_historyLibCreateBrowserHistory);
+var _createBrowserHistory = require('history/lib/createBrowserHistory');
+
+var _createBrowserHistory2 = _interopRequireDefault(_createBrowserHistory);
var _createRouterHistory = require('./createRouterHistory');
var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory);
-exports['default'] = _createRouterHistory2['default'](_historyLibCreateBrowserHistory2['default']);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+exports.default = (0, _createRouterHistory2.default)(_createBrowserHistory2.default);
module.exports = exports['default'];
-},{"./createRouterHistory":50,"history/lib/createBrowserHistory":12}],48:[function(require,module,exports){
+},{"./createRouterHistory":54,"history/lib/createBrowserHistory":12}],52:[function(require,module,exports){
'use strict';
exports.__esModule = true;
@@ -4771,7 +5054,7 @@ var _PatternUtils = require('./PatternUtils');
function routeParamsChanged(route, prevState, nextState) {
if (!route.path) return false;
- var paramNames = _PatternUtils.getParamNames(route.path);
+ var paramNames = (0, _PatternUtils.getParamNames)(route.path);
return paramNames.some(function (paramName) {
return prevState.params[paramName] !== nextState.params[paramName];
@@ -4779,7 +5062,7 @@ function routeParamsChanged(route, prevState, nextState) {
}
/**
- * Returns an object of { leaveRoutes, enterRoutes } determined by
+ * Returns an object of { leaveRoutes, changeRoutes, enterRoutes } determined by
* the change from prevState to nextState. We leave routes if either
* 1) they are not in the next state or 2) they are in the next state
* but their params have changed (i.e. /users/123 => /users/456).
@@ -4787,92 +5070,112 @@ function routeParamsChanged(route, prevState, nextState) {
* leaveRoutes are ordered starting at the leaf route of the tree
* we're leaving up to the common parent route. enterRoutes are ordered
* from the top of the tree we're entering down to the leaf route.
+ *
+ * changeRoutes are any routes that didn't leave or enter during
+ * the transition.
*/
function computeChangedRoutes(prevState, nextState) {
var prevRoutes = prevState && prevState.routes;
var nextRoutes = nextState.routes;
- var leaveRoutes = undefined,
- enterRoutes = undefined;
+ var leaveRoutes = void 0,
+ changeRoutes = void 0,
+ enterRoutes = void 0;
if (prevRoutes) {
- leaveRoutes = prevRoutes.filter(function (route) {
- return nextRoutes.indexOf(route) === -1 || routeParamsChanged(route, prevState, nextState);
- });
+ (function () {
+ var parentIsLeaving = false;
+ leaveRoutes = prevRoutes.filter(function (route) {
+ if (parentIsLeaving) {
+ return true;
+ } else {
+ var isLeaving = nextRoutes.indexOf(route) === -1 || routeParamsChanged(route, prevState, nextState);
+ if (isLeaving) parentIsLeaving = true;
+ return isLeaving;
+ }
+ });
- // onLeave hooks start at the leaf route.
- leaveRoutes.reverse();
+ // onLeave hooks start at the leaf route.
+ leaveRoutes.reverse();
- enterRoutes = nextRoutes.filter(function (route) {
- return prevRoutes.indexOf(route) === -1 || leaveRoutes.indexOf(route) !== -1;
- });
+ enterRoutes = [];
+ changeRoutes = [];
+
+ nextRoutes.forEach(function (route) {
+ var isNew = prevRoutes.indexOf(route) === -1;
+ var paramsChanged = leaveRoutes.indexOf(route) !== -1;
+
+ if (isNew || paramsChanged) enterRoutes.push(route);else changeRoutes.push(route);
+ });
+ })();
} else {
leaveRoutes = [];
+ changeRoutes = [];
enterRoutes = nextRoutes;
}
return {
leaveRoutes: leaveRoutes,
+ changeRoutes: changeRoutes,
enterRoutes: enterRoutes
};
}
-exports['default'] = computeChangedRoutes;
+exports.default = computeChangedRoutes;
module.exports = exports['default'];
-},{"./PatternUtils":36}],49:[function(require,module,exports){
+},{"./PatternUtils":39}],53:[function(require,module,exports){
'use strict';
exports.__esModule = true;
-exports['default'] = createMemoryHistory;
+exports.default = createMemoryHistory;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+var _useQueries = require('history/lib/useQueries');
-var _historyLibUseQueries = require('history/lib/useQueries');
+var _useQueries2 = _interopRequireDefault(_useQueries);
-var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries);
+var _useBasename = require('history/lib/useBasename');
-var _historyLibUseBasename = require('history/lib/useBasename');
+var _useBasename2 = _interopRequireDefault(_useBasename);
-var _historyLibUseBasename2 = _interopRequireDefault(_historyLibUseBasename);
+var _createMemoryHistory = require('history/lib/createMemoryHistory');
-var _historyLibCreateMemoryHistory = require('history/lib/createMemoryHistory');
+var _createMemoryHistory2 = _interopRequireDefault(_createMemoryHistory);
-var _historyLibCreateMemoryHistory2 = _interopRequireDefault(_historyLibCreateMemoryHistory);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createMemoryHistory(options) {
// signatures and type checking differ between `useRoutes` and
// `createMemoryHistory`, have to create `memoryHistory` first because
// `useQueries` doesn't understand the signature
- var memoryHistory = _historyLibCreateMemoryHistory2['default'](options);
+ var memoryHistory = (0, _createMemoryHistory2.default)(options);
var createHistory = function createHistory() {
return memoryHistory;
};
- var history = _historyLibUseQueries2['default'](_historyLibUseBasename2['default'](createHistory))(options);
+ var history = (0, _useQueries2.default)((0, _useBasename2.default)(createHistory))(options);
history.__v2_compatible__ = true;
return history;
}
-
module.exports = exports['default'];
-},{"history/lib/createMemoryHistory":17,"history/lib/useBasename":20,"history/lib/useQueries":21}],50:[function(require,module,exports){
+},{"history/lib/createMemoryHistory":17,"history/lib/useBasename":20,"history/lib/useQueries":21}],54:[function(require,module,exports){
'use strict';
exports.__esModule = true;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+exports.default = function (createHistory) {
+ var history = void 0;
+ if (canUseDOM) history = (0, _useRouterHistory2.default)(createHistory)();
+ return history;
+};
var _useRouterHistory = require('./useRouterHistory');
var _useRouterHistory2 = _interopRequireDefault(_useRouterHistory);
-var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-exports['default'] = function (createHistory) {
- var history = undefined;
- if (canUseDOM) history = _useRouterHistory2['default'](createHistory)();
- return history;
-};
+var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
module.exports = exports['default'];
-},{"./useRouterHistory":60}],51:[function(require,module,exports){
+},{"./useRouterHistory":64}],55:[function(require,module,exports){
(function (process){
'use strict';
@@ -4880,15 +5183,13 @@ exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-exports['default'] = createTransitionManager;
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+exports.default = createTransitionManager;
var _routerWarning = require('./routerWarning');
var _routerWarning2 = _interopRequireDefault(_routerWarning);
-var _historyLibActions = require('history/lib/Actions');
+var _Actions = require('history/lib/Actions');
var _computeChangedRoutes2 = require('./computeChangedRoutes');
@@ -4908,9 +5209,11 @@ var _matchRoutes = require('./matchRoutes');
var _matchRoutes2 = _interopRequireDefault(_matchRoutes);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
function hasAnyProperties(object) {
for (var p in object) {
- if (object.hasOwnProperty(p)) return true;
+ if (Object.prototype.hasOwnProperty.call(object, p)) return true;
}return false;
}
@@ -4923,9 +5226,9 @@ function createTransitionManager(history, routes) {
var indexOnlyOrDeprecatedQuery = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
var deprecatedIndexOnly = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
- var indexOnly = undefined;
+ var indexOnly = void 0;
if (indexOnlyOrDeprecatedQuery && indexOnlyOrDeprecatedQuery !== true || deprecatedIndexOnly !== null) {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, '`isActive(pathname, query, indexOnly) is deprecated; use `isActive(location, indexOnly)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, '`isActive(pathname, query, indexOnly) is deprecated; use `isActive(location, indexOnly)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : void 0;
location = { pathname: location, query: indexOnlyOrDeprecatedQuery };
indexOnly = deprecatedIndexOnly || false;
} else {
@@ -4933,21 +5236,21 @@ function createTransitionManager(history, routes) {
indexOnly = indexOnlyOrDeprecatedQuery;
}
- return _isActive3['default'](location, indexOnly, state.location, state.routes, state.params);
+ return (0, _isActive3.default)(location, indexOnly, state.location, state.routes, state.params);
}
function createLocationFromRedirectInfo(location) {
- return history.createLocation(location, _historyLibActions.REPLACE);
+ return history.createLocation(location, _Actions.REPLACE);
}
- var partialNextState = undefined;
+ var partialNextState = void 0;
function match(location, callback) {
if (partialNextState && partialNextState.location === location) {
// Continue from where we left off.
finishMatch(partialNextState, callback);
} else {
- _matchRoutes2['default'](routes, location, function (error, nextState) {
+ (0, _matchRoutes2.default)(routes, location, function (error, nextState) {
if (error) {
callback(error);
} else if (nextState) {
@@ -4960,34 +5263,45 @@ function createTransitionManager(history, routes) {
}
function finishMatch(nextState, callback) {
- var _computeChangedRoutes = _computeChangedRoutes3['default'](state, nextState);
+ var _computeChangedRoutes = (0, _computeChangedRoutes3.default)(state, nextState);
var leaveRoutes = _computeChangedRoutes.leaveRoutes;
+ var changeRoutes = _computeChangedRoutes.changeRoutes;
var enterRoutes = _computeChangedRoutes.enterRoutes;
- _TransitionUtils.runLeaveHooks(leaveRoutes);
+
+ (0, _TransitionUtils.runLeaveHooks)(leaveRoutes);
// Tear down confirmation hooks for left routes
- leaveRoutes.forEach(removeListenBeforeHooksForRoute);
+ leaveRoutes.filter(function (route) {
+ return enterRoutes.indexOf(route) === -1;
+ }).forEach(removeListenBeforeHooksForRoute);
- _TransitionUtils.runEnterHooks(enterRoutes, nextState, function (error, redirectInfo) {
- if (error) {
- callback(error);
- } else if (redirectInfo) {
- callback(null, createLocationFromRedirectInfo(redirectInfo));
- } else {
- // TODO: Fetch components after state is updated.
- _getComponents2['default'](nextState, function (error, components) {
- if (error) {
- callback(error);
- } else {
- // TODO: Make match a pure function and have some other API
- // for "match and update state".
- callback(null, null, state = _extends({}, nextState, { components: components }));
- }
- });
- }
+ // change and enter hooks are run in series
+ (0, _TransitionUtils.runChangeHooks)(changeRoutes, state, nextState, function (error, redirectInfo) {
+ if (error || redirectInfo) return handleErrorOrRedirect(error, redirectInfo);
+
+ (0, _TransitionUtils.runEnterHooks)(enterRoutes, nextState, finishEnterHooks);
});
+
+ function finishEnterHooks(error, redirectInfo) {
+ if (error || redirectInfo) return handleErrorOrRedirect(error, redirectInfo);
+
+ // TODO: Fetch components after state is updated.
+ (0, _getComponents2.default)(nextState, function (error, components) {
+ if (error) {
+ callback(error);
+ } else {
+ // TODO: Make match a pure function and have some other API
+ // for "match and update state".
+ callback(null, null, state = _extends({}, nextState, { components: components }));
+ }
+ });
+ }
+
+ function handleErrorOrRedirect(error, redirectInfo) {
+ if (error) callback(error);else callback(null, createLocationFromRedirectInfo(redirectInfo));
+ }
}
var RouteGuid = 1;
@@ -4998,7 +5312,7 @@ function createTransitionManager(history, routes) {
return route.__id__ || create && (route.__id__ = RouteGuid++);
}
- var RouteHooks = {};
+ var RouteHooks = Object.create(null);
function getRouteHooksForRoutes(routes) {
return routes.reduce(function (hooks, route) {
@@ -5008,7 +5322,7 @@ function createTransitionManager(history, routes) {
}
function transitionHook(location, callback) {
- _matchRoutes2['default'](routes, location, function (error, nextState) {
+ (0, _matchRoutes2.default)(routes, location, function (error, nextState) {
if (nextState == null) {
// TODO: We didn't actually match anything, but hang
// onto error/nextState so we don't have to matchRoutes
@@ -5021,9 +5335,9 @@ function createTransitionManager(history, routes) {
// matchRoutes() again in the listen callback.
partialNextState = _extends({}, nextState, { location: location });
- var hooks = getRouteHooksForRoutes(_computeChangedRoutes3['default'](state, partialNextState).leaveRoutes);
+ var hooks = getRouteHooksForRoutes((0, _computeChangedRoutes3.default)(state, partialNextState).leaveRoutes);
- var result = undefined;
+ var result = void 0;
for (var i = 0, len = hooks.length; result == null && i < len; ++i) {
// Passing the location arg here indicates to
// the user that this is a transition hook.
@@ -5041,7 +5355,7 @@ function createTransitionManager(history, routes) {
if (state.routes) {
var hooks = getRouteHooksForRoutes(state.routes);
- var message = undefined;
+ var message = void 0;
for (var i = 0, len = hooks.length; typeof message !== 'string' && i < len; ++i) {
// Passing no args indicates to the user that this is a
// beforeunload hook. We don't know the next location.
@@ -5052,8 +5366,8 @@ function createTransitionManager(history, routes) {
}
}
- var unlistenBefore = undefined,
- unlistenBeforeUnload = undefined;
+ var unlistenBefore = void 0,
+ unlistenBeforeUnload = void 0;
function removeListenBeforeHooksForRoute(route) {
var routeID = getRouteID(route, false);
@@ -5110,7 +5424,7 @@ function createTransitionManager(history, routes) {
}
} else {
if (hooks.indexOf(hook) === -1) {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'adding multiple leave hooks for the same route is deprecated; manage multiple confirmations in your own code instead') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'adding multiple leave hooks for the same route is deprecated; manage multiple confirmations in your own code instead') : void 0;
hooks.push(hook);
}
@@ -5153,7 +5467,7 @@ function createTransitionManager(history, routes) {
} else if (nextState) {
listener(null, nextState);
} else {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'Location "%s" did not match any routes', location.pathname + location.search + location.hash) : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'Location "%s" did not match any routes', location.pathname + location.search + location.hash) : void 0;
}
});
}
@@ -5172,84 +5486,149 @@ function createTransitionManager(history, routes) {
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./TransitionUtils":46,"./computeChangedRoutes":48,"./getComponents":53,"./isActive":56,"./matchRoutes":58,"./routerWarning":59,"_process":27,"history/lib/Actions":6}],52:[function(require,module,exports){
+},{"./TransitionUtils":49,"./computeChangedRoutes":52,"./getComponents":57,"./isActive":60,"./matchRoutes":62,"./routerWarning":63,"_process":29,"history/lib/Actions":6}],56:[function(require,module,exports){
(function (process){
-/*eslint no-empty: 0*/
'use strict';
exports.__esModule = true;
-exports['default'] = deprecateObjectProperties;
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+exports.canUseMembrane = undefined;
var _routerWarning = require('./routerWarning');
var _routerWarning2 = _interopRequireDefault(_routerWarning);
-var useMembrane = false;
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var canUseMembrane = exports.canUseMembrane = false;
+
+// No-op by default.
+var deprecateObjectProperties = function deprecateObjectProperties(object) {
+ return object;
+};
if (process.env.NODE_ENV !== 'production') {
try {
- if (Object.defineProperty({}, 'x', { get: function get() {
+ if (Object.defineProperty({}, 'x', {
+ get: function get() {
return true;
- } }).x) {
- useMembrane = true;
+ }
+ }).x) {
+ exports.canUseMembrane = canUseMembrane = true;
}
+ /* eslint-disable no-empty */
} catch (e) {}
-}
+ /* eslint-enable no-empty */
-// wraps an object in a membrane to warn about deprecated property access
+ if (canUseMembrane) {
+ deprecateObjectProperties = function deprecateObjectProperties(object, message) {
+ // Wrap the deprecated object in a membrane to warn on property access.
+ var membrane = {};
-function deprecateObjectProperties(object, message) {
- if (!useMembrane) return object;
+ var _loop = function _loop(prop) {
+ if (!Object.prototype.hasOwnProperty.call(object, prop)) {
+ return 'continue';
+ }
- var membrane = {};
+ if (typeof object[prop] === 'function') {
+ // Can't use fat arrow here because of use of arguments below.
+ membrane[prop] = function () {
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, message) : void 0;
+ return object[prop].apply(object, arguments);
+ };
+ return 'continue';
+ }
- var _loop = function (prop) {
- if (typeof object[prop] === 'function') {
- membrane[prop] = function () {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, message) : undefined;
- return object[prop].apply(object, arguments);
+ // These properties are non-enumerable to prevent React dev tools from
+ // seeing them and causing spurious warnings when accessing them. In
+ // principle this could be done with a proxy, but support for the
+ // ownKeys trap on proxies is not universal, even among browsers that
+ // otherwise support proxies.
+ Object.defineProperty(membrane, prop, {
+ get: function get() {
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, message) : void 0;
+ return object[prop];
+ }
+ });
};
- } else {
- Object.defineProperty(membrane, prop, {
- configurable: false,
- enumerable: false,
- get: function get() {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, message) : undefined;
- return object[prop];
- }
- });
- }
- };
- for (var prop in object) {
- _loop(prop);
- }
+ for (var prop in object) {
+ var _ret = _loop(prop);
+
+ if (_ret === 'continue') continue;
+ }
- return membrane;
+ return membrane;
+ };
+ }
}
-module.exports = exports['default'];
+exports.default = deprecateObjectProperties;
}).call(this,require('_process'))
-},{"./routerWarning":59,"_process":27}],53:[function(require,module,exports){
+},{"./routerWarning":63,"_process":29}],57:[function(require,module,exports){
+(function (process){
'use strict';
exports.__esModule = true;
+var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
+
var _AsyncUtils = require('./AsyncUtils');
-function getComponentsForRoute(location, route, callback) {
+var _deprecateObjectProperties = require('./deprecateObjectProperties');
+
+var _routerWarning = require('./routerWarning');
+
+var _routerWarning2 = _interopRequireDefault(_routerWarning);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function getComponentsForRoute(nextState, route, callback) {
if (route.component || route.components) {
callback(null, route.component || route.components);
- } else if (route.getComponent) {
- route.getComponent(location, callback);
- } else if (route.getComponents) {
- route.getComponents(location, callback);
- } else {
+ return;
+ }
+
+ var getComponent = route.getComponent || route.getComponents;
+ if (!getComponent) {
callback();
+ return;
}
+
+ var location = nextState.location;
+
+ var nextStateWithLocation = void 0;
+
+ if (process.env.NODE_ENV !== 'production' && _deprecateObjectProperties.canUseMembrane) {
+ nextStateWithLocation = _extends({}, nextState);
+
+ // I don't use deprecateObjectProperties here because I want to keep the
+ // same code path between development and production, in that we just
+ // assign extra properties to the copy of the state object in both cases.
+
+ var _loop = function _loop(prop) {
+ if (!Object.prototype.hasOwnProperty.call(location, prop)) {
+ return 'continue';
+ }
+
+ Object.defineProperty(nextStateWithLocation, prop, {
+ get: function get() {
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'Accessing location properties from the first argument to `getComponent` and `getComponents` is deprecated. That argument is now the router state (`nextState`) rather than the location. To access the location, use `nextState.location`.') : void 0;
+ return location[prop];
+ }
+ });
+ };
+
+ for (var prop in location) {
+ var _ret = _loop(prop);
+
+ if (_ret === 'continue') continue;
+ }
+ } else {
+ nextStateWithLocation = _extends({}, nextState, location);
+ }
+
+ getComponent.call(route, nextStateWithLocation, callback);
}
/**
@@ -5260,14 +5639,16 @@ function getComponentsForRoute(location, route, callback) {
* asynchronous getComponents method.
*/
function getComponents(nextState, callback) {
- _AsyncUtils.mapAsync(nextState.routes, function (route, index, callback) {
- getComponentsForRoute(nextState.location, route, callback);
+ (0, _AsyncUtils.mapAsync)(nextState.routes, function (route, index, callback) {
+ getComponentsForRoute(nextState, route, callback);
}, callback);
}
-exports['default'] = getComponents;
+exports.default = getComponents;
module.exports = exports['default'];
-},{"./AsyncUtils":29}],54:[function(require,module,exports){
+}).call(this,require('_process'))
+
+},{"./AsyncUtils":31,"./deprecateObjectProperties":56,"./routerWarning":63,"_process":29}],58:[function(require,module,exports){
'use strict';
exports.__esModule = true;
@@ -5283,37 +5664,44 @@ function getRouteParams(route, params) {
if (!route.path) return routeParams;
- var paramNames = _PatternUtils.getParamNames(route.path);
+ var paramNames = (0, _PatternUtils.getParamNames)(route.path);
for (var p in params) {
- if (params.hasOwnProperty(p) && paramNames.indexOf(p) !== -1) routeParams[p] = params[p];
- }return routeParams;
+ if (Object.prototype.hasOwnProperty.call(params, p) && paramNames.indexOf(p) !== -1) {
+ routeParams[p] = params[p];
+ }
+ }
+
+ return routeParams;
}
-exports['default'] = getRouteParams;
+exports.default = getRouteParams;
module.exports = exports['default'];
-},{"./PatternUtils":36}],55:[function(require,module,exports){
+},{"./PatternUtils":39}],59:[function(require,module,exports){
'use strict';
exports.__esModule = true;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+var _createHashHistory = require('history/lib/createHashHistory');
-var _historyLibCreateHashHistory = require('history/lib/createHashHistory');
-
-var _historyLibCreateHashHistory2 = _interopRequireDefault(_historyLibCreateHashHistory);
+var _createHashHistory2 = _interopRequireDefault(_createHashHistory);
var _createRouterHistory = require('./createRouterHistory');
var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory);
-exports['default'] = _createRouterHistory2['default'](_historyLibCreateHashHistory2['default']);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+exports.default = (0, _createRouterHistory2.default)(_createHashHistory2.default);
module.exports = exports['default'];
-},{"./createRouterHistory":50,"history/lib/createHashHistory":14}],56:[function(require,module,exports){
+},{"./createRouterHistory":54,"history/lib/createHashHistory":14}],60:[function(require,module,exports){
'use strict';
exports.__esModule = true;
-exports['default'] = isActive;
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
+
+exports.default = isActive;
var _PatternUtils = require('./PatternUtils');
@@ -5328,9 +5716,9 @@ function deepEqual(a, b) {
});
}
- if (typeof a === 'object') {
+ if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) === 'object') {
for (var p in a) {
- if (!a.hasOwnProperty(p)) {
+ if (!Object.prototype.hasOwnProperty.call(a, p)) {
continue;
}
@@ -5338,7 +5726,7 @@ function deepEqual(a, b) {
if (b[p] !== undefined) {
return false;
}
- } else if (!b.hasOwnProperty(p)) {
+ } else if (!Object.prototype.hasOwnProperty.call(b, p)) {
return false;
} else if (!deepEqual(a[p], b[p])) {
return false;
@@ -5351,20 +5739,42 @@ function deepEqual(a, b) {
return String(a) === String(b);
}
-function paramsAreActive(paramNames, paramValues, activeParams) {
- // FIXME: This doesn't work on repeated params in activeParams.
- return paramNames.every(function (paramName, index) {
- return String(paramValues[index]) === String(activeParams[paramName]);
- });
+/**
+ * Returns true if the current pathname matches the supplied one, net of
+ * leading and trailing slash normalization. This is sufficient for an
+ * indexOnly route match.
+ */
+function pathIsActive(pathname, currentPathname) {
+ // Normalize leading slash for consistency. Leading slash on pathname has
+ // already been normalized in isActive. See caveat there.
+ if (currentPathname.charAt(0) !== '/') {
+ currentPathname = '/' + currentPathname;
+ }
+
+ // Normalize the end of both path names too. Maybe `/foo/` shouldn't show
+ // `/foo` as active, but in this case, we would already have failed the
+ // match.
+ if (pathname.charAt(pathname.length - 1) !== '/') {
+ pathname += '/';
+ }
+ if (currentPathname.charAt(currentPathname.length - 1) !== '/') {
+ currentPathname += '/';
+ }
+
+ return currentPathname === pathname;
}
-function getMatchingRouteIndex(pathname, activeRoutes, activeParams) {
+/**
+ * Returns true if the given pathname matches the active routes and params.
+ */
+function routeIsActive(pathname, routes, params) {
var remainingPathname = pathname,
paramNames = [],
paramValues = [];
- for (var i = 0, len = activeRoutes.length; i < len; ++i) {
- var route = activeRoutes[i];
+ // for...of would work here but it's probably slower post-transpilation.
+ for (var i = 0, len = routes.length; i < len; ++i) {
+ var route = routes[i];
var pattern = route.path || '';
if (pattern.charAt(0) === '/') {
@@ -5373,39 +5783,28 @@ function getMatchingRouteIndex(pathname, activeRoutes, activeParams) {
paramValues = [];
}
- if (remainingPathname !== null) {
- var matched = _PatternUtils.matchPattern(pattern, remainingPathname);
- remainingPathname = matched.remainingPathname;
- paramNames = [].concat(paramNames, matched.paramNames);
- paramValues = [].concat(paramValues, matched.paramValues);
- }
-
- if (remainingPathname === '' && route.path && paramsAreActive(paramNames, paramValues, activeParams)) return i;
- }
-
- return null;
-}
-
-/**
- * Returns true if the given pathname matches the active routes
- * and params.
- */
-function routeIsActive(pathname, routes, params, indexOnly) {
- var i = getMatchingRouteIndex(pathname, routes, params);
+ if (remainingPathname !== null && pattern) {
+ var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);
+ if (matched) {
+ remainingPathname = matched.remainingPathname;
+ paramNames = [].concat(paramNames, matched.paramNames);
+ paramValues = [].concat(paramValues, matched.paramValues);
+ } else {
+ remainingPathname = null;
+ }
- if (i === null) {
- // No match.
- return false;
- } else if (!indexOnly) {
- // Any match is good enough.
- return true;
+ if (remainingPathname === '') {
+ // We have an exact match on the route. Just check that all the params
+ // match.
+ // FIXME: This doesn't work on repeated params.
+ return paramNames.every(function (paramName, index) {
+ return String(paramValues[index]) === String(params[paramName]);
+ });
+ }
+ }
}
- // If any remaining routes past the match index have paths, then we can't
- // be on the index route.
- return routes.slice(i + 1).every(function (route) {
- return !route.path;
- });
+ return false;
}
/**
@@ -5424,20 +5823,31 @@ function queryIsActive(query, activeQuery) {
* Returns true if a <Link> to the given pathname/query combination is
* currently active.
*/
-
function isActive(_ref, indexOnly, currentLocation, routes, params) {
var pathname = _ref.pathname;
var query = _ref.query;
if (currentLocation == null) return false;
- if (!routeIsActive(pathname, routes, params, indexOnly)) return false;
+ // TODO: This is a bit ugly. It keeps around support for treating pathnames
+ // without preceding slashes as absolute paths, but possibly also works
+ // around the same quirks with basenames as in matchRoutes.
+ if (pathname.charAt(0) !== '/') {
+ pathname = '/' + pathname;
+ }
+
+ if (!pathIsActive(pathname, currentLocation.pathname)) {
+ // The path check is necessary and sufficient for indexOnly, but otherwise
+ // we still need to check the routes.
+ if (indexOnly || !routeIsActive(pathname, routes, params)) {
+ return false;
+ }
+ }
return queryIsActive(query, currentLocation.query);
}
-
module.exports = exports['default'];
-},{"./PatternUtils":36}],57:[function(require,module,exports){
+},{"./PatternUtils":39}],61:[function(require,module,exports){
(function (process){
'use strict';
@@ -5445,10 +5855,6 @@ exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
-
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
@@ -5465,6 +5871,10 @@ var _RouteUtils = require('./RouteUtils');
var _RouterUtils = require('./RouterUtils');
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
+
/**
* A high-level API to be used for server-side rendering.
*
@@ -5481,12 +5891,12 @@ function match(_ref, callback) {
var options = _objectWithoutProperties(_ref, ['history', 'routes', 'location']);
- !(history || location) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'match needs a history or a location') : _invariant2['default'](false) : undefined;
+ !(history || location) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'match needs a history or a location') : (0, _invariant2.default)(false) : void 0;
- history = history ? history : _createMemoryHistory2['default'](options);
- var transitionManager = _createTransitionManager2['default'](history, _RouteUtils.createRoutes(routes));
+ history = history ? history : (0, _createMemoryHistory2.default)(options);
+ var transitionManager = (0, _createTransitionManager2.default)(history, (0, _RouteUtils.createRoutes)(routes));
- var unlisten = undefined;
+ var unlisten = void 0;
if (location) {
// Allow match({ location: '/the/path', ... })
@@ -5499,8 +5909,8 @@ function match(_ref, callback) {
});
}
- var router = _RouterUtils.createRouterObject(history, transitionManager);
- history = _RouterUtils.createRoutingHistory(history, transitionManager);
+ var router = (0, _RouterUtils.createRouterObject)(history, transitionManager);
+ history = (0, _RouterUtils.createRoutingHistory)(history, transitionManager);
transitionManager.match(location, function (error, redirectLocation, nextState) {
callback(error, redirectLocation, nextState && _extends({}, nextState, {
@@ -5518,17 +5928,21 @@ function match(_ref, callback) {
});
}
-exports['default'] = match;
+exports.default = match;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./RouteUtils":41,"./RouterUtils":44,"./createMemoryHistory":49,"./createTransitionManager":51,"_process":27,"invariant":22}],58:[function(require,module,exports){
+},{"./RouteUtils":44,"./RouterUtils":47,"./createMemoryHistory":53,"./createTransitionManager":55,"_process":29,"invariant":23}],62:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
+
+exports.default = matchRoutes;
var _routerWarning = require('./routerWarning');
@@ -5540,6 +5954,8 @@ var _PatternUtils = require('./PatternUtils');
var _RouteUtils = require('./RouteUtils');
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
function getChildRoutes(route, location, callback) {
if (route.childRoutes) {
return [null, route.childRoutes];
@@ -5549,10 +5965,10 @@ function getChildRoutes(route, location, callback) {
}
var sync = true,
- result = undefined;
+ result = void 0;
route.getChildRoutes(location, function (error, childRoutes) {
- childRoutes = !error && _RouteUtils.createRoutes(childRoutes);
+ childRoutes = !error && (0, _RouteUtils.createRoutes)(childRoutes);
if (sync) {
result = [error, childRoutes];
return;
@@ -5570,15 +5986,15 @@ function getIndexRoute(route, location, callback) {
callback(null, route.indexRoute);
} else if (route.getIndexRoute) {
route.getIndexRoute(location, function (error, indexRoute) {
- callback(error, !error && _RouteUtils.createRoutes(indexRoute)[0]);
+ callback(error, !error && (0, _RouteUtils.createRoutes)(indexRoute)[0]);
});
} else if (route.childRoutes) {
(function () {
- var pathless = route.childRoutes.filter(function (obj) {
- return !obj.hasOwnProperty('path');
+ var pathless = route.childRoutes.filter(function (childRoute) {
+ return !childRoute.path;
});
- _AsyncUtils.loopAsync(pathless.length, function (index, next, done) {
+ (0, _AsyncUtils.loopAsync)(pathless.length, function (index, next, done) {
getIndexRoute(pathless[index], location, function (error, indexRoute) {
if (error || indexRoute) {
var routes = [pathless[index]].concat(Array.isArray(indexRoute) ? indexRoute : [indexRoute]);
@@ -5625,14 +6041,22 @@ function matchRouteDeep(route, location, remainingPathname, paramNames, paramVal
paramValues = [];
}
- if (remainingPathname !== null) {
- var matched = _PatternUtils.matchPattern(pattern, remainingPathname);
- remainingPathname = matched.remainingPathname;
- paramNames = [].concat(paramNames, matched.paramNames);
- paramValues = [].concat(paramValues, matched.paramValues);
+ // Only try to match the path if the route actually has a pattern, and if
+ // we're not just searching for potential nested absolute paths.
+ if (remainingPathname !== null && pattern) {
+ var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);
+ if (matched) {
+ remainingPathname = matched.remainingPathname;
+ paramNames = [].concat(paramNames, matched.paramNames);
+ paramValues = [].concat(paramValues, matched.paramValues);
+ } else {
+ remainingPathname = null;
+ }
- if (remainingPathname === '' && route.path) {
- var _ret2 = (function () {
+ // By assumption, pattern is non-empty here, which is the prerequisite for
+ // actually terminating a match.
+ if (remainingPathname === '') {
+ var _ret2 = function () {
var match = {
routes: [route],
params: createParams(paramNames, paramValues)
@@ -5645,24 +6069,25 @@ function matchRouteDeep(route, location, remainingPathname, paramNames, paramVal
if (Array.isArray(indexRoute)) {
var _match$routes;
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](indexRoute.every(function (route) {
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(indexRoute.every(function (route) {
return !route.path;
- }), 'Index routes should not have paths') : undefined;
+ }), 'Index routes should not have paths') : void 0;
(_match$routes = match.routes).push.apply(_match$routes, indexRoute);
} else if (indexRoute) {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](!indexRoute.path, 'Index routes should not have paths') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(!indexRoute.path, 'Index routes should not have paths') : void 0;
match.routes.push(indexRoute);
}
callback(null, match);
}
});
+
return {
- v: undefined
+ v: void 0
};
- })();
+ }();
- if (typeof _ret2 === 'object') return _ret2.v;
+ if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v;
}
}
@@ -5711,79 +6136,97 @@ function matchRouteDeep(route, location, remainingPathname, paramNames, paramVal
* Note: This operation may finish synchronously if no routes have an
* asynchronous getChildRoutes method.
*/
-function matchRoutes(routes, location, callback) {
- var remainingPathname = arguments.length <= 3 || arguments[3] === undefined ? location.pathname : arguments[3];
+function matchRoutes(routes, location, callback, remainingPathname) {
var paramNames = arguments.length <= 4 || arguments[4] === undefined ? [] : arguments[4];
var paramValues = arguments.length <= 5 || arguments[5] === undefined ? [] : arguments[5];
- return (function () {
- _AsyncUtils.loopAsync(routes.length, function (index, next, done) {
- matchRouteDeep(routes[index], location, remainingPathname, paramNames, paramValues, function (error, match) {
- if (error || match) {
- done(error, match);
- } else {
- next();
- }
+
+ if (remainingPathname === undefined) {
+ // TODO: This is a little bit ugly, but it works around a quirk in history
+ // that strips the leading slash from pathnames when using basenames with
+ // trailing slashes.
+ if (location.pathname.charAt(0) !== '/') {
+ location = _extends({}, location, {
+ pathname: '/' + location.pathname
});
- }, callback);
- })();
-}
+ }
+ remainingPathname = location.pathname;
+ }
-exports['default'] = matchRoutes;
+ (0, _AsyncUtils.loopAsync)(routes.length, function (index, next, done) {
+ matchRouteDeep(routes[index], location, remainingPathname, paramNames, paramValues, function (error, match) {
+ if (error || match) {
+ done(error, match);
+ } else {
+ next();
+ }
+ });
+ }, callback);
+}
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./AsyncUtils":29,"./PatternUtils":36,"./RouteUtils":41,"./routerWarning":59,"_process":27}],59:[function(require,module,exports){
-(function (process){
+},{"./AsyncUtils":31,"./PatternUtils":39,"./RouteUtils":44,"./routerWarning":63,"_process":29}],63:[function(require,module,exports){
'use strict';
exports.__esModule = true;
-exports['default'] = routerWarning;
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+exports.default = routerWarning;
+exports._resetWarned = _resetWarned;
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var warned = {};
+
function routerWarning(falseToWarn, message) {
+ // Only issue deprecation warnings once.
+ if (message.indexOf('deprecated') !== -1) {
+ if (warned[message]) {
+ return;
+ }
+
+ warned[message] = true;
+ }
+
message = '[react-router] ' + message;
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
- process.env.NODE_ENV !== 'production' ? _warning2['default'].apply(undefined, [falseToWarn, message].concat(args)) : undefined;
+ _warning2.default.apply(undefined, [falseToWarn, message].concat(args));
}
-module.exports = exports['default'];
-}).call(this,require('_process'))
-
-},{"_process":27,"warning":236}],60:[function(require,module,exports){
+function _resetWarned() {
+ warned = {};
+}
+},{"warning":231}],64:[function(require,module,exports){
'use strict';
exports.__esModule = true;
-exports['default'] = useRouterHistory;
+exports.default = useRouterHistory;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+var _useQueries = require('history/lib/useQueries');
-var _historyLibUseQueries = require('history/lib/useQueries');
+var _useQueries2 = _interopRequireDefault(_useQueries);
-var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries);
+var _useBasename = require('history/lib/useBasename');
-var _historyLibUseBasename = require('history/lib/useBasename');
+var _useBasename2 = _interopRequireDefault(_useBasename);
-var _historyLibUseBasename2 = _interopRequireDefault(_historyLibUseBasename);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function useRouterHistory(createHistory) {
return function (options) {
- var history = _historyLibUseQueries2['default'](_historyLibUseBasename2['default'](createHistory))(options);
+ var history = (0, _useQueries2.default)((0, _useBasename2.default)(createHistory))(options);
history.__v2_compatible__ = true;
return history;
};
}
-
module.exports = exports['default'];
-},{"history/lib/useBasename":20,"history/lib/useQueries":21}],61:[function(require,module,exports){
+},{"history/lib/useBasename":20,"history/lib/useQueries":21}],65:[function(require,module,exports){
(function (process){
'use strict';
@@ -5791,13 +6234,9 @@ exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+var _useQueries = require('history/lib/useQueries');
-function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
-
-var _historyLibUseQueries = require('history/lib/useQueries');
-
-var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries);
+var _useQueries2 = _interopRequireDefault(_useQueries);
var _createTransitionManager = require('./createTransitionManager');
@@ -5807,6 +6246,10 @@ var _routerWarning = require('./routerWarning');
var _routerWarning2 = _interopRequireDefault(_routerWarning);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
+
/**
* Returns a new createHistory function that may be used to create
* history objects that know about routing.
@@ -5819,7 +6262,7 @@ var _routerWarning2 = _interopRequireDefault(_routerWarning);
* - isActive(pathname, query, indexOnly=false)
*/
function useRoutes(createHistory) {
- process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, '`useRoutes` is deprecated. Please use `createTransitionManager` instead.') : undefined;
+ process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, '`useRoutes` is deprecated. Please use `createTransitionManager` instead.') : void 0;
return function () {
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
@@ -5828,19 +6271,60 @@ function useRoutes(createHistory) {
var options = _objectWithoutProperties(_ref, ['routes']);
- var history = _historyLibUseQueries2['default'](createHistory)(options);
- var transitionManager = _createTransitionManager2['default'](history, routes);
+ var history = (0, _useQueries2.default)(createHistory)(options);
+ var transitionManager = (0, _createTransitionManager2.default)(history, routes);
return _extends({}, history, transitionManager);
};
}
-exports['default'] = useRoutes;
+exports.default = useRoutes;
module.exports = exports['default'];
}).call(this,require('_process'))
-},{"./createTransitionManager":51,"./routerWarning":59,"_process":27,"history/lib/useQueries":21}],62:[function(require,module,exports){
+},{"./createTransitionManager":55,"./routerWarning":63,"_process":29,"history/lib/useQueries":21}],66:[function(require,module,exports){
+'use strict';
+
+exports.__esModule = true;
+
+var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
+
+exports.default = withRouter;
+
+var _react = require('react');
+
+var _react2 = _interopRequireDefault(_react);
+
+var _hoistNonReactStatics = require('hoist-non-react-statics');
+
+var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
+
+var _PropTypes = require('./PropTypes');
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function getDisplayName(WrappedComponent) {
+ return WrappedComponent.displayName || WrappedComponent.name || 'Component';
+}
+
+function withRouter(WrappedComponent) {
+ var WithRouter = _react2.default.createClass({
+ displayName: 'WithRouter',
+
+ contextTypes: { router: _PropTypes.routerShape },
+ render: function render() {
+ return _react2.default.createElement(WrappedComponent, _extends({}, this.props, { router: this.context.router }));
+ }
+ });
+
+ WithRouter.displayName = 'withRouter(' + getDisplayName(WrappedComponent) + ')';
+ WithRouter.WrappedComponent = WrappedComponent;
+
+ return (0, _hoistNonReactStatics2.default)(WithRouter, WrappedComponent);
+}
+module.exports = exports['default'];
+},{"./PropTypes":40,"hoist-non-react-statics":22,"react":"react"}],67:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -5848,36 +6332,24 @@ module.exports = exports['default'];
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule AutoFocusUtils
- * @typechecks static-only
*/
'use strict';
-var ReactMount = require('./ReactMount');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
-var findDOMNode = require('./findDOMNode');
var focusNode = require('fbjs/lib/focusNode');
-var Mixin = {
- componentDidMount: function () {
- if (this.props.autoFocus) {
- focusNode(findDOMNode(this));
- }
- }
-};
-
var AutoFocusUtils = {
- Mixin: Mixin,
-
focusDOMComponent: function () {
- focusNode(ReactMount.getNode(this._rootNodeID));
+ focusNode(ReactDOMComponentTree.getNodeFromInstance(this));
}
};
module.exports = AutoFocusUtils;
-},{"./ReactMount":132,"./findDOMNode":183,"fbjs/lib/focusNode":216}],63:[function(require,module,exports){
+},{"./ReactDOMComponentTree":106,"fbjs/lib/focusNode":213}],68:[function(require,module,exports){
/**
- * Copyright 2013-2015 Facebook, Inc.
+ * Copyright 2013-present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -5885,7 +6357,6 @@ module.exports = AutoFocusUtils;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule BeforeInputEventPlugin
- * @typechecks static-only
*/
'use strict';
@@ -6055,13 +6526,9 @@ function getDataFromCustomEvent(nativeEvent) {
var currentComposition = null;
/**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticCompositionEvent.
*/
-function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var eventType;
var fallbackData;
@@ -6083,7 +6550,7 @@ function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID,
// The current composition is stored statically and must not be
// overwritten while composition continues.
if (!currentComposition && eventType === eventTypes.compositionStart) {
- currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
+ currentComposition = FallbackCompositionState.getPooled(nativeEventTarget);
} else if (eventType === eventTypes.compositionEnd) {
if (currentComposition) {
fallbackData = currentComposition.getData();
@@ -6091,7 +6558,7 @@ function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID,
}
}
- var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
+ var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
@@ -6217,13 +6684,9 @@ function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
* Extract a SyntheticInputEvent for `beforeInput`, based on either native
* `textInput` or fallback behavior.
*
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticInputEvent.
*/
-function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var chars;
if (canUseTextInputEvent) {
@@ -6238,7 +6701,7 @@ function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID,
return null;
}
- var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
+ var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
event.data = chars;
EventPropagators.accumulateTwoPhaseDispatches(event);
@@ -6267,23 +6730,15 @@ var BeforeInputEventPlugin = {
eventTypes: eventTypes,
- /**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
- */
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
- return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
+ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)];
}
};
module.exports = BeforeInputEventPlugin;
-},{"./EventConstants":75,"./EventPropagators":79,"./FallbackCompositionState":80,"./SyntheticCompositionEvent":164,"./SyntheticInputEvent":168,"fbjs/lib/ExecutionEnvironment":208,"fbjs/lib/keyOf":227}],64:[function(require,module,exports){
+},{"./EventConstants":82,"./EventPropagators":86,"./FallbackCompositionState":87,"./SyntheticCompositionEvent":162,"./SyntheticInputEvent":166,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/keyOf":223}],69:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -6298,8 +6753,12 @@ module.exports = BeforeInputEventPlugin;
/**
* CSS properties which accept numbers but are not in units of "px".
*/
+
var isUnitlessNumber = {
animationIterationCount: true,
+ borderImageOutset: true,
+ borderImageSlice: true,
+ borderImageWidth: true,
boxFlex: true,
boxFlexGroup: true,
boxOrdinalGroup: true,
@@ -6310,6 +6769,8 @@ var isUnitlessNumber = {
flexShrink: true,
flexNegative: true,
flexOrder: true,
+ gridRow: true,
+ gridColumn: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
@@ -6323,8 +6784,11 @@ var isUnitlessNumber = {
// SVG-related properties
fillOpacity: true,
+ floodOpacity: true,
stopOpacity: true,
+ strokeDasharray: true,
strokeDashoffset: true,
+ strokeMiterlimit: true,
strokeOpacity: true,
strokeWidth: true
};
@@ -6421,10 +6885,10 @@ var CSSProperty = {
};
module.exports = CSSProperty;
-},{}],65:[function(require,module,exports){
+},{}],70:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -6432,7 +6896,6 @@ module.exports = CSSProperty;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSPropertyOperations
- * @typechecks static-only
*/
'use strict';
@@ -6476,45 +6939,74 @@ if (process.env.NODE_ENV !== 'production') {
var warnedStyleNames = {};
var warnedStyleValues = {};
+ var warnedForNaNValue = false;
- var warnHyphenatedStyleName = function (name) {
+ var warnHyphenatedStyleName = function (name, owner) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
};
- var warnBadVendoredStyleName = function (name) {
+ var warnBadVendoredStyleName = function (name, owner) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0;
};
- var warnStyleValueWithSemicolon = function (name, value) {
+ var warnStyleValueWithSemicolon = function (name, value, owner) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
- process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
+ };
+
+ var warnStyleValueIsNaN = function (name, value, owner) {
+ if (warnedForNaNValue) {
+ return;
+ }
+
+ warnedForNaNValue = true;
+ process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
+ };
+
+ var checkRenderMessage = function (owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
+ }
+ }
+ return '';
};
/**
* @param {string} name
* @param {*} value
+ * @param {ReactDOMComponent} component
*/
- var warnValidStyle = function (name, value) {
+ var warnValidStyle = function (name, value, component) {
+ var owner;
+ if (component) {
+ owner = component._currentElement._owner;
+ }
if (name.indexOf('-') > -1) {
- warnHyphenatedStyleName(name);
+ warnHyphenatedStyleName(name, owner);
} else if (badVendoredStyleNamePattern.test(name)) {
- warnBadVendoredStyleName(name);
+ warnBadVendoredStyleName(name, owner);
} else if (badStyleValueWithSemicolonPattern.test(value)) {
- warnStyleValueWithSemicolon(name, value);
+ warnStyleValueWithSemicolon(name, value, owner);
+ }
+
+ if (typeof value === 'number' && isNaN(value)) {
+ warnStyleValueIsNaN(name, value, owner);
}
};
}
@@ -6534,9 +7026,10 @@ var CSSPropertyOperations = {
* The result should be HTML-escaped before insertion into the DOM.
*
* @param {object} styles
+ * @param {ReactDOMComponent} component
* @return {?string}
*/
- createMarkupForStyles: function (styles) {
+ createMarkupForStyles: function (styles, component) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
@@ -6544,11 +7037,11 @@ var CSSPropertyOperations = {
}
var styleValue = styles[styleName];
if (process.env.NODE_ENV !== 'production') {
- warnValidStyle(styleName, styleValue);
+ warnValidStyle(styleName, styleValue, component);
}
if (styleValue != null) {
serialized += processStyleName(styleName) + ':';
- serialized += dangerousStyleValue(styleName, styleValue) + ';';
+ serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
}
}
return serialized || null;
@@ -6560,18 +7053,19 @@ var CSSPropertyOperations = {
*
* @param {DOMElement} node
* @param {object} styles
+ * @param {ReactDOMComponent} component
*/
- setValueForStyles: function (node, styles) {
+ setValueForStyles: function (node, styles, component) {
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
if (process.env.NODE_ENV !== 'production') {
- warnValidStyle(styleName, styles[styleName]);
+ warnValidStyle(styleName, styles[styleName], component);
}
- var styleValue = dangerousStyleValue(styleName, styles[styleName]);
- if (styleName === 'float') {
+ var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
+ if (styleName === 'float' || styleName === 'cssFloat') {
styleName = styleFloatAccessor;
}
if (styleValue) {
@@ -6600,10 +7094,10 @@ ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
module.exports = CSSPropertyOperations;
}).call(this,require('_process'))
-},{"./CSSProperty":64,"./ReactPerf":138,"./dangerousStyleValue":180,"_process":27,"fbjs/lib/ExecutionEnvironment":208,"fbjs/lib/camelizeStyleName":210,"fbjs/lib/hyphenateStyleName":221,"fbjs/lib/memoizeStringOnly":229,"fbjs/lib/warning":234}],66:[function(require,module,exports){
+},{"./CSSProperty":69,"./ReactPerf":147,"./dangerousStyleValue":179,"_process":29,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/camelizeStyleName":207,"fbjs/lib/hyphenateStyleName":218,"fbjs/lib/memoizeStringOnly":225,"fbjs/lib/warning":229}],71:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -6615,9 +7109,10 @@ module.exports = CSSPropertyOperations;
'use strict';
+var _assign = require('object-assign');
+
var PooledClass = require('./PooledClass');
-var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
/**
@@ -6636,7 +7131,7 @@ function CallbackQueue() {
this._contexts = null;
}
-assign(CallbackQueue.prototype, {
+_assign(CallbackQueue.prototype, {
/**
* Enqueues a callback to be invoked when `notifyAll` is invoked.
@@ -6662,7 +7157,7 @@ assign(CallbackQueue.prototype, {
var callbacks = this._callbacks;
var contexts = this._contexts;
if (callbacks) {
- !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
+ !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : void 0;
this._callbacks = null;
this._contexts = null;
for (var i = 0; i < callbacks.length; i++) {
@@ -6673,6 +7168,17 @@ assign(CallbackQueue.prototype, {
}
},
+ checkpoint: function () {
+ return this._callbacks ? this._callbacks.length : 0;
+ },
+
+ rollback: function (len) {
+ if (this._callbacks) {
+ this._callbacks.length = len;
+ this._contexts.length = len;
+ }
+ },
+
/**
* Resets the internal queue.
*
@@ -6697,9 +7203,9 @@ PooledClass.addPoolingTo(CallbackQueue);
module.exports = CallbackQueue;
}).call(this,require('_process'))
-},{"./Object.assign":84,"./PooledClass":85,"_process":27,"fbjs/lib/invariant":222}],67:[function(require,module,exports){
+},{"./PooledClass":91,"_process":29,"fbjs/lib/invariant":219,"object-assign":28}],72:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -6715,6 +7221,7 @@ var EventConstants = require('./EventConstants');
var EventPluginHub = require('./EventPluginHub');
var EventPropagators = require('./EventPropagators');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var ReactUpdates = require('./ReactUpdates');
var SyntheticEvent = require('./SyntheticEvent');
@@ -6739,7 +7246,7 @@ var eventTypes = {
* For IE shims
*/
var activeElement = null;
-var activeElementID = null;
+var activeElementInst = null;
var activeElementValue = null;
var activeElementValueProp = null;
@@ -6758,7 +7265,7 @@ if (ExecutionEnvironment.canUseDOM) {
}
function manualDispatchChangeEvent(nativeEvent) {
- var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
+ var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change and propertychange bubbled, we'd just bind to it like all the
@@ -6780,9 +7287,9 @@ function runEventInBatch(event) {
EventPluginHub.processEventQueue(false);
}
-function startWatchingForChangeEventIE8(target, targetID) {
+function startWatchingForChangeEventIE8(target, targetInst) {
activeElement = target;
- activeElementID = targetID;
+ activeElementInst = targetInst;
activeElement.attachEvent('onchange', manualDispatchChangeEvent);
}
@@ -6792,20 +7299,20 @@ function stopWatchingForChangeEventIE8() {
}
activeElement.detachEvent('onchange', manualDispatchChangeEvent);
activeElement = null;
- activeElementID = null;
+ activeElementInst = null;
}
-function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
+function getTargetInstForChangeEvent(topLevelType, targetInst) {
if (topLevelType === topLevelTypes.topChange) {
- return topLevelTargetID;
+ return targetInst;
}
}
-function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
+function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
if (topLevelType === topLevelTypes.topFocus) {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForChangeEventIE8();
- startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
+ startWatchingForChangeEventIE8(target, targetInst);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForChangeEventIE8();
}
@@ -6817,12 +7324,14 @@ function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTar
var isInputEventSupported = false;
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
- // deleting text, so we ignore its input events
- isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
+ // deleting text, so we ignore its input events.
+ // IE10+ fire input events to often, such when a placeholder
+ // changes or when an input with a placeholder is focused.
+ isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 11);
}
/**
- * (For old IE.) Replacement getter/setter for the `value` property that gets
+ * (For IE <=11) Replacement getter/setter for the `value` property that gets
* set on the active element.
*/
var newValueProp = {
@@ -6837,24 +7346,28 @@ var newValueProp = {
};
/**
- * (For old IE.) Starts tracking propertychange events on the passed-in element
+ * (For IE <=11) Starts tracking propertychange events on the passed-in element
* and override the value property so that we can distinguish user events from
* value changes in JS.
*/
-function startWatchingForValueChange(target, targetID) {
+function startWatchingForValueChange(target, targetInst) {
activeElement = target;
- activeElementID = targetID;
+ activeElementInst = targetInst;
activeElementValue = target.value;
activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
// Not guarded in a canDefineProperty check: IE8 supports defineProperty only
// on DOM elements
Object.defineProperty(activeElement, 'value', newValueProp);
- activeElement.attachEvent('onpropertychange', handlePropertyChange);
+ if (activeElement.attachEvent) {
+ activeElement.attachEvent('onpropertychange', handlePropertyChange);
+ } else {
+ activeElement.addEventListener('propertychange', handlePropertyChange, false);
+ }
}
/**
- * (For old IE.) Removes the event listeners from the currently-tracked element,
+ * (For IE <=11) Removes the event listeners from the currently-tracked element,
* if any exists.
*/
function stopWatchingForValueChange() {
@@ -6864,16 +7377,21 @@ function stopWatchingForValueChange() {
// delete restores the original property definition
delete activeElement.value;
- activeElement.detachEvent('onpropertychange', handlePropertyChange);
+
+ if (activeElement.detachEvent) {
+ activeElement.detachEvent('onpropertychange', handlePropertyChange);
+ } else {
+ activeElement.removeEventListener('propertychange', handlePropertyChange, false);
+ }
activeElement = null;
- activeElementID = null;
+ activeElementInst = null;
activeElementValue = null;
activeElementValueProp = null;
}
/**
- * (For old IE.) Handles a propertychange event, sending a `change` event if
+ * (For IE <=11) Handles a propertychange event, sending a `change` event if
* the value of the active element has changed.
*/
function handlePropertyChange(nativeEvent) {
@@ -6892,21 +7410,20 @@ function handlePropertyChange(nativeEvent) {
/**
* If a `change` event should be fired, returns the target's ID.
*/
-function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
+function getTargetInstForInputEvent(topLevelType, targetInst) {
if (topLevelType === topLevelTypes.topInput) {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
- return topLevelTargetID;
+ return targetInst;
}
}
-// For IE8 and IE9.
-function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
+function handleEventsForInputEventIE(topLevelType, target, targetInst) {
if (topLevelType === topLevelTypes.topFocus) {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
// equal to 'value'
- // In IE9, propertychange fires for most input events but is buggy and
+ // In IE9-11, propertychange fires for most input events but is buggy and
// doesn't fire when text is deleted, but conveniently, selectionchange
// appears to fire in all of the remaining cases so we catch those and
// forward the event if the value has changed
@@ -6917,14 +7434,14 @@ function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTarge
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForValueChange();
- startWatchingForValueChange(topLevelTarget, topLevelTargetID);
+ startWatchingForValueChange(target, targetInst);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForValueChange();
}
}
// For IE8 and IE9.
-function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
+function getTargetInstForInputEventIE(topLevelType, targetInst) {
if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
@@ -6938,7 +7455,7 @@ function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTarget
// fire selectionchange normally.
if (activeElement && activeElement.value !== activeElementValue) {
activeElementValue = activeElement.value;
- return activeElementID;
+ return activeElementInst;
}
}
}
@@ -6953,9 +7470,9 @@ function shouldUseClickEvent(elem) {
return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
}
-function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
+function getTargetInstForClickEvent(topLevelType, targetInst) {
if (topLevelType === topLevelTypes.topClick) {
- return topLevelTargetID;
+ return targetInst;
}
}
@@ -6973,38 +7490,31 @@ var ChangeEventPlugin = {
eventTypes: eventTypes,
- /**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
- */
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
- var getTargetIDFunc, handleEventFunc;
- if (shouldUseChangeEvent(topLevelTarget)) {
+ var getTargetInstFunc, handleEventFunc;
+ if (shouldUseChangeEvent(targetNode)) {
if (doesChangeEventBubble) {
- getTargetIDFunc = getTargetIDForChangeEvent;
+ getTargetInstFunc = getTargetInstForChangeEvent;
} else {
handleEventFunc = handleEventsForChangeEventIE8;
}
- } else if (isTextInputElement(topLevelTarget)) {
+ } else if (isTextInputElement(targetNode)) {
if (isInputEventSupported) {
- getTargetIDFunc = getTargetIDForInputEvent;
+ getTargetInstFunc = getTargetInstForInputEvent;
} else {
- getTargetIDFunc = getTargetIDForInputEventIE;
+ getTargetInstFunc = getTargetInstForInputEventIE;
handleEventFunc = handleEventsForInputEventIE;
}
- } else if (shouldUseClickEvent(topLevelTarget)) {
- getTargetIDFunc = getTargetIDForClickEvent;
+ } else if (shouldUseClickEvent(targetNode)) {
+ getTargetInstFunc = getTargetInstForClickEvent;
}
- if (getTargetIDFunc) {
- var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
- if (targetID) {
- var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
+ if (getTargetInstFunc) {
+ var inst = getTargetInstFunc(topLevelType, targetInst);
+ if (inst) {
+ var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget);
event.type = 'change';
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
@@ -7012,41 +7522,16 @@ var ChangeEventPlugin = {
}
if (handleEventFunc) {
- handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
+ handleEventFunc(topLevelType, targetNode, targetInst);
}
}
};
module.exports = ChangeEventPlugin;
-},{"./EventConstants":75,"./EventPluginHub":76,"./EventPropagators":79,"./ReactUpdates":156,"./SyntheticEvent":166,"./getEventTarget":189,"./isEventSupported":194,"./isTextInputElement":195,"fbjs/lib/ExecutionEnvironment":208,"fbjs/lib/keyOf":227}],68:[function(require,module,exports){
+},{"./EventConstants":82,"./EventPluginHub":83,"./EventPropagators":86,"./ReactDOMComponentTree":106,"./ReactUpdates":155,"./SyntheticEvent":164,"./getEventTarget":187,"./isEventSupported":194,"./isTextInputElement":195,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/keyOf":223}],73:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ClientReactRootIndex
- * @typechecks
- */
-
-'use strict';
-
-var nextReactRootIndex = 0;
-
-var ClientReactRootIndex = {
- createReactRootIndex: function () {
- return nextReactRootIndex++;
- }
-};
-
-module.exports = ClientReactRootIndex;
-},{}],69:[function(require,module,exports){
-(function (process){
-/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -7054,18 +7539,27 @@ module.exports = ClientReactRootIndex;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DOMChildrenOperations
- * @typechecks static-only
*/
'use strict';
+var DOMLazyTree = require('./DOMLazyTree');
var Danger = require('./Danger');
var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
var ReactPerf = require('./ReactPerf');
+var createMicrosoftUnsafeLocalFunction = require('./createMicrosoftUnsafeLocalFunction');
var setInnerHTML = require('./setInnerHTML');
var setTextContent = require('./setTextContent');
-var invariant = require('fbjs/lib/invariant');
+
+function getNodeAfter(parentNode, node) {
+ // Special case for text components, which return [open, close] comments
+ // from getNativeNode.
+ if (Array.isArray(node)) {
+ node = node[1];
+ }
+ return node ? node.nextSibling : parentNode.firstChild;
+}
/**
* Inserts `childNode` as a child of `parentNode` at the `index`.
@@ -7075,17 +7569,78 @@ var invariant = require('fbjs/lib/invariant');
* @param {number} index Index at which to insert the child.
* @internal
*/
-function insertChildAt(parentNode, childNode, index) {
- // By exploiting arrays returning `undefined` for an undefined index, we can
- // rely exclusively on `insertBefore(node, null)` instead of also using
- // `appendChild(node)`. However, using `undefined` is not allowed by all
- // browsers so we must replace it with `null`.
+var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) {
+ // We rely exclusively on `insertBefore(node, null)` instead of also using
+ // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
+ // we are careful to use `null`.)
+ parentNode.insertBefore(childNode, referenceNode);
+});
+
+function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
+ DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode);
+}
+
+function moveChild(parentNode, childNode, referenceNode) {
+ if (Array.isArray(childNode)) {
+ moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode);
+ } else {
+ insertChildAt(parentNode, childNode, referenceNode);
+ }
+}
+
+function removeChild(parentNode, childNode) {
+ if (Array.isArray(childNode)) {
+ var closingComment = childNode[1];
+ childNode = childNode[0];
+ removeDelimitedText(parentNode, childNode, closingComment);
+ parentNode.removeChild(closingComment);
+ }
+ parentNode.removeChild(childNode);
+}
+
+function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) {
+ var node = openingComment;
+ while (true) {
+ var nextNode = node.nextSibling;
+ insertChildAt(parentNode, node, referenceNode);
+ if (node === closingComment) {
+ break;
+ }
+ node = nextNode;
+ }
+}
- // fix render order error in safari
- // IE8 will throw error when index out of list size.
- var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
+function removeDelimitedText(parentNode, startNode, closingComment) {
+ while (true) {
+ var node = startNode.nextSibling;
+ if (node === closingComment) {
+ // The closing comment is removed by ReactMultiChild.
+ break;
+ } else {
+ parentNode.removeChild(node);
+ }
+ }
+}
- parentNode.insertBefore(childNode, beforeChild);
+function replaceDelimitedText(openingComment, closingComment, stringText) {
+ var parentNode = openingComment.parentNode;
+ var nodeAfterComment = openingComment.nextSibling;
+ if (nodeAfterComment === closingComment) {
+ // There are no text nodes between the opening and closing comments; insert
+ // a new one if stringText isn't empty.
+ if (stringText) {
+ insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment);
+ }
+ } else {
+ if (stringText) {
+ // Set the text content of the first node after the opening comment, and
+ // remove all following nodes up until the closing comment.
+ setTextContent(nodeAfterComment, stringText);
+ removeDelimitedText(parentNode, nodeAfterComment, closingComment);
+ } else {
+ removeDelimitedText(parentNode, openingComment, closingComment);
+ }
+ }
}
/**
@@ -7095,73 +7650,33 @@ var DOMChildrenOperations = {
dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
- updateTextContent: setTextContent,
+ replaceDelimitedText: replaceDelimitedText,
/**
* Updates a component's children by processing a series of updates. The
* update configurations are each expected to have a `parentNode` property.
*
* @param {array<object>} updates List of update configurations.
- * @param {array<string>} markupList List of markup strings.
* @internal
*/
- processUpdates: function (updates, markupList) {
- var update;
- // Mapping from parent IDs to initial child orderings.
- var initialChildren = null;
- // List of children that will be moved or removed.
- var updatedChildren = null;
-
- for (var i = 0; i < updates.length; i++) {
- update = updates[i];
- if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
- var updatedIndex = update.fromIndex;
- var updatedChild = update.parentNode.childNodes[updatedIndex];
- var parentID = update.parentID;
-
- !updatedChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined;
-
- initialChildren = initialChildren || {};
- initialChildren[parentID] = initialChildren[parentID] || [];
- initialChildren[parentID][updatedIndex] = updatedChild;
-
- updatedChildren = updatedChildren || [];
- updatedChildren.push(updatedChild);
- }
- }
-
- var renderedMarkup;
- // markupList is either a list of markup or just a list of elements
- if (markupList.length && typeof markupList[0] === 'string') {
- renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
- } else {
- renderedMarkup = markupList;
- }
-
- // Remove updated children first so that `toIndex` is consistent.
- if (updatedChildren) {
- for (var j = 0; j < updatedChildren.length; j++) {
- updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
- }
- }
-
+ processUpdates: function (parentNode, updates) {
for (var k = 0; k < updates.length; k++) {
- update = updates[k];
+ var update = updates[k];
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
- insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
+ insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode));
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
- insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
+ moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode));
break;
case ReactMultiChildUpdateTypes.SET_MARKUP:
- setInnerHTML(update.parentNode, update.content);
+ setInnerHTML(parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
- setTextContent(update.parentNode, update.content);
+ setTextContent(parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
- // Already removed by the for-loop above.
+ removeChild(parentNode, update.fromNode);
break;
}
}
@@ -7170,16 +7685,141 @@ var DOMChildrenOperations = {
};
ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
- updateTextContent: 'updateTextContent'
+ replaceDelimitedText: 'replaceDelimitedText'
});
module.exports = DOMChildrenOperations;
-}).call(this,require('_process'))
+},{"./DOMLazyTree":74,"./Danger":78,"./ReactMultiChildUpdateTypes":142,"./ReactPerf":147,"./createMicrosoftUnsafeLocalFunction":178,"./setInnerHTML":199,"./setTextContent":200}],74:[function(require,module,exports){
+/**
+ * Copyright 2015-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule DOMLazyTree
+ */
+
+'use strict';
+
+var createMicrosoftUnsafeLocalFunction = require('./createMicrosoftUnsafeLocalFunction');
+var setTextContent = require('./setTextContent');
+
+/**
+ * In IE (8-11) and Edge, appending nodes with no children is dramatically
+ * faster than appending a full subtree, so we essentially queue up the
+ * .appendChild calls here and apply them so each node is added to its parent
+ * before any children are added.
+ *
+ * In other browsers, doing so is slower or neutral compared to the other order
+ * (in Firefox, twice as slow) so we only do this inversion in IE.
+ *
+ * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.
+ */
+var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent);
+
+function insertTreeChildren(tree) {
+ if (!enableLazy) {
+ return;
+ }
+ var node = tree.node;
+ var children = tree.children;
+ if (children.length) {
+ for (var i = 0; i < children.length; i++) {
+ insertTreeBefore(node, children[i], null);
+ }
+ } else if (tree.html != null) {
+ node.innerHTML = tree.html;
+ } else if (tree.text != null) {
+ setTextContent(node, tree.text);
+ }
+}
+
+var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {
+ // DocumentFragments aren't actually part of the DOM after insertion so
+ // appending children won't update the DOM. We need to ensure the fragment
+ // is properly populated first, breaking out of our lazy approach for just
+ // this level.
+ if (tree.node.nodeType === 11) {
+ insertTreeChildren(tree);
+ parentNode.insertBefore(tree.node, referenceNode);
+ } else {
+ parentNode.insertBefore(tree.node, referenceNode);
+ insertTreeChildren(tree);
+ }
+});
+
+function replaceChildWithTree(oldNode, newTree) {
+ oldNode.parentNode.replaceChild(newTree.node, oldNode);
+ insertTreeChildren(newTree);
+}
+
+function queueChild(parentTree, childTree) {
+ if (enableLazy) {
+ parentTree.children.push(childTree);
+ } else {
+ parentTree.node.appendChild(childTree.node);
+ }
+}
+
+function queueHTML(tree, html) {
+ if (enableLazy) {
+ tree.html = html;
+ } else {
+ tree.node.innerHTML = html;
+ }
+}
+
+function queueText(tree, text) {
+ if (enableLazy) {
+ tree.text = text;
+ } else {
+ setTextContent(tree.node, text);
+ }
+}
+
+function DOMLazyTree(node) {
+ return {
+ node: node,
+ children: [],
+ html: null,
+ text: null
+ };
+}
+
+DOMLazyTree.insertTreeBefore = insertTreeBefore;
+DOMLazyTree.replaceChildWithTree = replaceChildWithTree;
+DOMLazyTree.queueChild = queueChild;
+DOMLazyTree.queueHTML = queueHTML;
+DOMLazyTree.queueText = queueText;
+
+module.exports = DOMLazyTree;
+},{"./createMicrosoftUnsafeLocalFunction":178,"./setTextContent":200}],75:[function(require,module,exports){
+/**
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule DOMNamespaces
+ */
-},{"./Danger":72,"./ReactMultiChildUpdateTypes":134,"./ReactPerf":138,"./setInnerHTML":199,"./setTextContent":200,"_process":27,"fbjs/lib/invariant":222}],70:[function(require,module,exports){
+'use strict';
+
+var DOMNamespaces = {
+ html: 'http://www.w3.org/1999/xhtml',
+ mathml: 'http://www.w3.org/1998/Math/MathML',
+ svg: 'http://www.w3.org/2000/svg'
+};
+
+module.exports = DOMNamespaces;
+},{}],76:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -7187,7 +7827,6 @@ module.exports = DOMChildrenOperations;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DOMProperty
- * @typechecks static-only
*/
'use strict';
@@ -7203,13 +7842,12 @@ var DOMPropertyInjection = {
* Mapping from normalized, camelcased property names to a configuration that
* specifies how the associated DOM property should be accessed or rendered.
*/
- MUST_USE_ATTRIBUTE: 0x1,
- MUST_USE_PROPERTY: 0x2,
- HAS_SIDE_EFFECTS: 0x4,
- HAS_BOOLEAN_VALUE: 0x8,
- HAS_NUMERIC_VALUE: 0x10,
- HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
- HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
+ MUST_USE_PROPERTY: 0x1,
+ HAS_SIDE_EFFECTS: 0x2,
+ HAS_BOOLEAN_VALUE: 0x4,
+ HAS_NUMERIC_VALUE: 0x8,
+ HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
+ HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
/**
* Inject some specialized knowledge about the DOM. This takes a config object
@@ -7252,7 +7890,7 @@ var DOMPropertyInjection = {
}
for (var propName in Properties) {
- !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
+ !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : void 0;
var lowerCased = propName.toLowerCase();
var propConfig = Properties[propName];
@@ -7263,7 +7901,6 @@ var DOMPropertyInjection = {
propertyName: propName,
mutationMethod: null,
- mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
@@ -7272,9 +7909,8 @@ var DOMPropertyInjection = {
hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
};
- !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
- !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
- !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
+ !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : void 0;
+ !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : void 0;
if (process.env.NODE_ENV !== 'production') {
DOMProperty.getPossibleStandardName[lowerCased] = propName;
@@ -7304,7 +7940,10 @@ var DOMPropertyInjection = {
}
}
};
-var defaultValueCache = {};
+
+/* eslint-disable max-len */
+var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
+/* eslint-enable max-len */
/**
* DOMProperty exports lookup objects that can be used like functions:
@@ -7322,6 +7961,10 @@ var defaultValueCache = {};
var DOMProperty = {
ID_ATTRIBUTE_NAME: 'data-reactid',
+ ROOT_ATTRIBUTE_NAME: 'data-reactroot',
+
+ ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
+ ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\uB7\\u0300-\\u036F\\u203F-\\u2040',
/**
* Map from property "standard name" to an object with info about how to set
@@ -7336,9 +7979,6 @@ var DOMProperty = {
* mutationMethod:
* If non-null, used instead of the property or `setAttribute()` after
* initial render.
- * mustUseAttribute:
- * Whether the property must be accessed and mutated using `*Attribute()`.
- * (This includes anything that fails `<propName> in <element>`.)
* mustUseProperty:
* Whether the property must be accessed and mutated as an object property.
* hasSideEffects:
@@ -7387,37 +8027,16 @@ var DOMProperty = {
return false;
},
- /**
- * Returns the default property value for a DOM property (i.e., not an
- * attribute). Most default values are '' or false, but not all. Worse yet,
- * some (in particular, `type`) vary depending on the type of element.
- *
- * TODO: Is it better to grab all the possible properties when creating an
- * element to avoid having to create the same element twice?
- */
- getDefaultValueForProperty: function (nodeName, prop) {
- var nodeDefaults = defaultValueCache[nodeName];
- var testElement;
- if (!nodeDefaults) {
- defaultValueCache[nodeName] = nodeDefaults = {};
- }
- if (!(prop in nodeDefaults)) {
- testElement = document.createElement(nodeName);
- nodeDefaults[prop] = testElement[prop];
- }
- return nodeDefaults[prop];
- },
-
injection: DOMPropertyInjection
};
module.exports = DOMProperty;
}).call(this,require('_process'))
-},{"_process":27,"fbjs/lib/invariant":222}],71:[function(require,module,exports){
+},{"_process":29,"fbjs/lib/invariant":219}],77:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -7425,19 +8044,18 @@ module.exports = DOMProperty;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DOMPropertyOperations
- * @typechecks static-only
*/
'use strict';
var DOMProperty = require('./DOMProperty');
+var ReactDOMInstrumentation = require('./ReactDOMInstrumentation');
var ReactPerf = require('./ReactPerf');
var quoteAttributeValueForBrowser = require('./quoteAttributeValueForBrowser');
var warning = require('fbjs/lib/warning');
-// Simplified subset
-var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
+var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
var illegalAttributeNameCache = {};
var validatedAttributeNameCache = {};
@@ -7453,7 +8071,7 @@ function isAttributeNameSafe(attributeName) {
return true;
}
illegalAttributeNameCache[attributeName] = true;
- process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0;
return false;
}
@@ -7461,32 +8079,6 @@ function shouldIgnoreValue(propertyInfo, value) {
return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
}
-if (process.env.NODE_ENV !== 'production') {
- var reactProps = {
- children: true,
- dangerouslySetInnerHTML: true,
- key: true,
- ref: true
- };
- var warnedProperties = {};
-
- var warnUnknownProperty = function (name) {
- if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
- return;
- }
-
- warnedProperties[name] = true;
- var lowerCasedName = name.toLowerCase();
-
- // data-* attributes should be lowercase; suggest the lowercase version
- var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
-
- // For now, only warn when we have a suggested correction. This prevents
- // logging too much when using transferPropsTo.
- process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
- };
-}
-
/**
* Operations for dealing with DOM properties.
*/
@@ -7506,6 +8098,14 @@ var DOMPropertyOperations = {
node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
},
+ createMarkupForRoot: function () {
+ return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""';
+ },
+
+ setAttributeForRoot: function (node) {
+ node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, '');
+ },
+
/**
* Creates markup for a property.
*
@@ -7514,6 +8114,9 @@ var DOMPropertyOperations = {
* @return {?string} Markup string, or null if the property was invalid.
*/
createMarkupForProperty: function (name, value) {
+ if (process.env.NODE_ENV !== 'production') {
+ ReactDOMInstrumentation.debugTool.onCreateMarkupForProperty(name, value);
+ }
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
if (shouldIgnoreValue(propertyInfo, value)) {
@@ -7529,8 +8132,6 @@ var DOMPropertyOperations = {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
- } else if (process.env.NODE_ENV !== 'production') {
- warnUnknownProperty(name);
}
return null;
},
@@ -7557,6 +8158,9 @@ var DOMPropertyOperations = {
* @param {*} value
*/
setValueForProperty: function (node, name, value) {
+ if (process.env.NODE_ENV !== 'production') {
+ ReactDOMInstrumentation.debugTool.onSetValueForProperty(node, name, value);
+ }
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
var mutationMethod = propertyInfo.mutationMethod;
@@ -7564,7 +8168,16 @@ var DOMPropertyOperations = {
mutationMethod(node, value);
} else if (shouldIgnoreValue(propertyInfo, value)) {
this.deleteValueForProperty(node, name);
- } else if (propertyInfo.mustUseAttribute) {
+ } else if (propertyInfo.mustUseProperty) {
+ var propName = propertyInfo.propertyName;
+ // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
+ // property type before comparing; only `value` does and is string.
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
+ // Contrary to `setAttribute`, object properties are properly
+ // `toString`ed by IE8/9.
+ node[propName] = value;
+ }
+ } else {
var attributeName = propertyInfo.attributeName;
var namespace = propertyInfo.attributeNamespace;
// `setAttribute` with objects becomes only `[object]` in IE8/9,
@@ -7576,20 +8189,9 @@ var DOMPropertyOperations = {
} else {
node.setAttribute(attributeName, '' + value);
}
- } else {
- var propName = propertyInfo.propertyName;
- // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
- // property type before comparing; only `value` does and is string.
- if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
- // Contrary to `setAttribute`, object properties are properly
- // `toString`ed by IE8/9.
- node[propName] = value;
- }
}
} else if (DOMProperty.isCustomAttribute(name)) {
DOMPropertyOperations.setValueForAttribute(node, name, value);
- } else if (process.env.NODE_ENV !== 'production') {
- warnUnknownProperty(name);
}
},
@@ -7611,24 +8213,29 @@ var DOMPropertyOperations = {
* @param {string} name
*/
deleteValueForProperty: function (node, name) {
+ if (process.env.NODE_ENV !== 'production') {
+ ReactDOMInstrumentation.debugTool.onDeleteValueForProperty(node, name);
+ }
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, undefined);
- } else if (propertyInfo.mustUseAttribute) {
- node.removeAttribute(propertyInfo.attributeName);
- } else {
+ } else if (propertyInfo.mustUseProperty) {
var propName = propertyInfo.propertyName;
- var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
- if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
- node[propName] = defaultValue;
+ if (propertyInfo.hasBooleanValue) {
+ // No HAS_SIDE_EFFECTS logic here, only `value` has it and is string.
+ node[propName] = false;
+ } else {
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== '') {
+ node[propName] = '';
+ }
}
+ } else {
+ node.removeAttribute(propertyInfo.attributeName);
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
- } else if (process.env.NODE_ENV !== 'production') {
- warnUnknownProperty(name);
}
}
@@ -7643,10 +8250,10 @@ ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
module.exports = DOMPropertyOperations;
}).call(this,require('_process'))
-},{"./DOMProperty":70,"./ReactPerf":138,"./quoteAttributeValueForBrowser":197,"_process":27,"fbjs/lib/warning":234}],72:[function(require,module,exports){
+},{"./DOMProperty":76,"./ReactDOMInstrumentation":114,"./ReactPerf":147,"./quoteAttributeValueForBrowser":197,"_process":29,"fbjs/lib/warning":229}],78:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -7654,11 +8261,11 @@ module.exports = DOMPropertyOperations;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Danger
- * @typechecks static-only
*/
'use strict';
+var DOMLazyTree = require('./DOMLazyTree');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var createNodesFromMarkup = require('fbjs/lib/createNodesFromMarkup');
@@ -7696,12 +8303,12 @@ var Danger = {
* @internal
*/
dangerouslyRenderMarkup: function (markupList) {
- !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
+ !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : void 0;
var nodeName;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
- !markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
+ !markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : void 0;
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
@@ -7743,7 +8350,7 @@ var Danger = {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
- !!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
+ !!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : void 0;
resultList[resultIndex] = renderNode;
@@ -7758,9 +8365,9 @@ var Danger = {
// Although resultList was populated out of order, it should now be a dense
// array.
- !(resultListAssignmentCount === resultList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
+ !(resultListAssignmentCount === resultList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : void 0;
- !(resultList.length === markupList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
+ !(resultList.length === markupList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : void 0;
return resultList;
},
@@ -7774,17 +8381,16 @@ var Danger = {
* @internal
*/
dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
- !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
- !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
- !(oldChild.tagName.toLowerCase() !== 'html') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
+ !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : void 0;
+ !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : void 0;
+ !(oldChild.nodeName !== 'HTML') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : void 0;
- var newChild;
if (typeof markup === 'string') {
- newChild = createNodesFromMarkup(markup, emptyFunction)[0];
+ var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
+ oldChild.parentNode.replaceChild(newChild, oldChild);
} else {
- newChild = markup;
+ DOMLazyTree.replaceChildWithTree(oldChild, markup);
}
- oldChild.parentNode.replaceChild(newChild, oldChild);
}
};
@@ -7792,9 +8398,9 @@ var Danger = {
module.exports = Danger;
}).call(this,require('_process'))
-},{"_process":27,"fbjs/lib/ExecutionEnvironment":208,"fbjs/lib/createNodesFromMarkup":213,"fbjs/lib/emptyFunction":214,"fbjs/lib/getMarkupWrap":218,"fbjs/lib/invariant":222}],73:[function(require,module,exports){
+},{"./DOMLazyTree":74,"_process":29,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/createNodesFromMarkup":210,"fbjs/lib/emptyFunction":211,"fbjs/lib/getMarkupWrap":215,"fbjs/lib/invariant":219}],79:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -7820,9 +8426,60 @@ var keyOf = require('fbjs/lib/keyOf');
var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
module.exports = DefaultEventPluginOrder;
-},{"fbjs/lib/keyOf":227}],74:[function(require,module,exports){
+},{"fbjs/lib/keyOf":223}],80:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule DisabledInputUtils
+ */
+
+'use strict';
+
+var disableableMouseListenerNames = {
+ onClick: true,
+ onDoubleClick: true,
+ onMouseDown: true,
+ onMouseMove: true,
+ onMouseUp: true,
+
+ onClickCapture: true,
+ onDoubleClickCapture: true,
+ onMouseDownCapture: true,
+ onMouseMoveCapture: true,
+ onMouseUpCapture: true
+};
+
+/**
+ * Implements a native component that does not receive mouse events
+ * when `disabled` is set.
+ */
+var DisabledInputUtils = {
+ getNativeProps: function (inst, props) {
+ if (!props.disabled) {
+ return props;
+ }
+
+ // Copy the props, except the mouse listeners
+ var nativeProps = {};
+ for (var key in props) {
+ if (!disableableMouseListenerNames[key] && props.hasOwnProperty(key)) {
+ nativeProps[key] = props[key];
+ }
+ }
+
+ return nativeProps;
+ }
+};
+
+module.exports = DisabledInputUtils;
+},{}],81:[function(require,module,exports){
+/**
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -7830,20 +8487,18 @@ module.exports = DefaultEventPluginOrder;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EnterLeaveEventPlugin
- * @typechecks static-only
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPropagators = require('./EventPropagators');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
-var ReactMount = require('./ReactMount');
var keyOf = require('fbjs/lib/keyOf');
var topLevelTypes = EventConstants.topLevelTypes;
-var getFirstReactDOM = ReactMount.getFirstReactDOM;
var eventTypes = {
mouseEnter: {
@@ -7856,8 +8511,6 @@ var eventTypes = {
}
};
-var extractedEvents = [null, null];
-
var EnterLeaveEventPlugin = {
eventTypes: eventTypes,
@@ -7868,15 +8521,8 @@ var EnterLeaveEventPlugin = {
* we do not extract duplicate events. However, moving the mouse into the
* browser from outside will not fire a `mouseout` event. In this case, we use
* the `mouseover` top-level event.
- *
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
*/
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
@@ -7886,12 +8532,12 @@ var EnterLeaveEventPlugin = {
}
var win;
- if (topLevelTarget.window === topLevelTarget) {
- // `topLevelTarget` is probably a window object.
- win = topLevelTarget;
+ if (nativeEventTarget.window === nativeEventTarget) {
+ // `nativeEventTarget` is probably a window object.
+ win = nativeEventTarget;
} else {
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
- var doc = topLevelTarget.ownerDocument;
+ var doc = nativeEventTarget.ownerDocument;
if (doc) {
win = doc.defaultView || doc.parentWindow;
} else {
@@ -7901,22 +8547,14 @@ var EnterLeaveEventPlugin = {
var from;
var to;
- var fromID = '';
- var toID = '';
if (topLevelType === topLevelTypes.topMouseOut) {
- from = topLevelTarget;
- fromID = topLevelTargetID;
- to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
- if (to) {
- toID = ReactMount.getID(to);
- } else {
- to = win;
- }
- to = to || win;
+ from = targetInst;
+ var related = nativeEvent.relatedTarget || nativeEvent.toElement;
+ to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null;
} else {
- from = win;
- to = topLevelTarget;
- toID = topLevelTargetID;
+ // Moving to a node from outside the window.
+ from = null;
+ to = targetInst;
}
if (from === to) {
@@ -7924,30 +8562,30 @@ var EnterLeaveEventPlugin = {
return null;
}
- var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
+ var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from);
+ var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to);
+
+ var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget);
leave.type = 'mouseleave';
- leave.target = from;
- leave.relatedTarget = to;
+ leave.target = fromNode;
+ leave.relatedTarget = toNode;
- var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
+ var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget);
enter.type = 'mouseenter';
- enter.target = to;
- enter.relatedTarget = from;
-
- EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
+ enter.target = toNode;
+ enter.relatedTarget = fromNode;
- extractedEvents[0] = leave;
- extractedEvents[1] = enter;
+ EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to);
- return extractedEvents;
+ return [leave, enter];
}
};
module.exports = EnterLeaveEventPlugin;
-},{"./EventConstants":75,"./EventPropagators":79,"./ReactMount":132,"./SyntheticMouseEvent":170,"fbjs/lib/keyOf":227}],75:[function(require,module,exports){
+},{"./EventConstants":82,"./EventPropagators":86,"./ReactDOMComponentTree":106,"./SyntheticMouseEvent":168,"fbjs/lib/keyOf":223}],82:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -7968,6 +8606,9 @@ var PropagationPhases = keyMirror({ bubbled: null, captured: null });
*/
var topLevelTypes = keyMirror({
topAbort: null,
+ topAnimationEnd: null,
+ topAnimationIteration: null,
+ topAnimationStart: null,
topBlur: null,
topCanPlay: null,
topCanPlayThrough: null,
@@ -7995,6 +8636,7 @@ var topLevelTypes = keyMirror({
topError: null,
topFocus: null,
topInput: null,
+ topInvalid: null,
topKeyDown: null,
topKeyPress: null,
topKeyUp: null,
@@ -8027,6 +8669,7 @@ var topLevelTypes = keyMirror({
topTouchEnd: null,
topTouchMove: null,
topTouchStart: null,
+ topTransitionEnd: null,
topVolumeChange: null,
topWaiting: null,
topWheel: null
@@ -8038,10 +8681,10 @@ var EventConstants = {
};
module.exports = EventConstants;
-},{"fbjs/lib/keyMirror":226}],76:[function(require,module,exports){
+},{"fbjs/lib/keyMirror":222}],83:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -8060,7 +8703,6 @@ var ReactErrorUtils = require('./ReactErrorUtils');
var accumulateInto = require('./accumulateInto');
var forEachAccumulated = require('./forEachAccumulated');
var invariant = require('fbjs/lib/invariant');
-var warning = require('fbjs/lib/warning');
/**
* Internal store for event listeners
@@ -8097,17 +8739,6 @@ var executeDispatchesAndReleaseTopLevel = function (e) {
};
/**
- * - `InstanceHandle`: [required] Module that performs logical traversals of DOM
- * hierarchy given ids of the logical DOM elements involved.
- */
-var InstanceHandle = null;
-
-function validateInstanceHandle() {
- var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
- process.env.NODE_ENV !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
-}
-
-/**
* This is a unified interface for event plugins to be installed and configured.
*
* Event plugins can implement the following properties:
@@ -8137,30 +8768,6 @@ var EventPluginHub = {
injection: {
/**
- * @param {object} InjectedMount
- * @public
- */
- injectMount: EventPluginUtils.injection.injectMount,
-
- /**
- * @param {object} InjectedInstanceHandle
- * @public
- */
- injectInstanceHandle: function (InjectedInstanceHandle) {
- InstanceHandle = InjectedInstanceHandle;
- if (process.env.NODE_ENV !== 'production') {
- validateInstanceHandle();
- }
- },
-
- getInstanceHandle: function () {
- if (process.env.NODE_ENV !== 'production') {
- validateInstanceHandle();
- }
- return InstanceHandle;
- },
-
- /**
* @param {array} InjectedEventPluginOrder
* @public
*/
@@ -8173,75 +8780,71 @@ var EventPluginHub = {
},
- eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
-
- registrationNameModules: EventPluginRegistry.registrationNameModules,
-
/**
* Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
*
- * @param {string} id ID of the DOM element.
+ * @param {object} inst The instance, which is the source of events.
* @param {string} registrationName Name of listener (e.g. `onClick`).
- * @param {?function} listener The callback to store.
+ * @param {function} listener The callback to store.
*/
- putListener: function (id, registrationName, listener) {
- !(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
+ putListener: function (inst, registrationName, listener) {
+ !(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : void 0;
var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
- bankForRegistrationName[id] = listener;
+ bankForRegistrationName[inst._rootNodeID] = listener;
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.didPutListener) {
- PluginModule.didPutListener(id, registrationName, listener);
+ PluginModule.didPutListener(inst, registrationName, listener);
}
},
/**
- * @param {string} id ID of the DOM element.
+ * @param {object} inst The instance, which is the source of events.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
- getListener: function (id, registrationName) {
+ getListener: function (inst, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
- return bankForRegistrationName && bankForRegistrationName[id];
+ return bankForRegistrationName && bankForRegistrationName[inst._rootNodeID];
},
/**
* Deletes a listener from the registration bank.
*
- * @param {string} id ID of the DOM element.
+ * @param {object} inst The instance, which is the source of events.
* @param {string} registrationName Name of listener (e.g. `onClick`).
*/
- deleteListener: function (id, registrationName) {
+ deleteListener: function (inst, registrationName) {
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.willDeleteListener) {
- PluginModule.willDeleteListener(id, registrationName);
+ PluginModule.willDeleteListener(inst, registrationName);
}
var bankForRegistrationName = listenerBank[registrationName];
// TODO: This should never be null -- when is it?
if (bankForRegistrationName) {
- delete bankForRegistrationName[id];
+ delete bankForRegistrationName[inst._rootNodeID];
}
},
/**
* Deletes all listeners for the DOM element with the supplied ID.
*
- * @param {string} id ID of the DOM element.
+ * @param {object} inst The instance, which is the source of events.
*/
- deleteAllListeners: function (id) {
+ deleteAllListeners: function (inst) {
for (var registrationName in listenerBank) {
- if (!listenerBank[registrationName][id]) {
+ if (!listenerBank[registrationName][inst._rootNodeID]) {
continue;
}
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.willDeleteListener) {
- PluginModule.willDeleteListener(id, registrationName);
+ PluginModule.willDeleteListener(inst, registrationName);
}
- delete listenerBank[registrationName][id];
+ delete listenerBank[registrationName][inst._rootNodeID];
}
},
@@ -8249,21 +8852,17 @@ var EventPluginHub = {
* Allows registered plugins an opportunity to extract events from top-level
* native browser events.
*
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @internal
*/
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var events;
var plugins = EventPluginRegistry.plugins;
for (var i = 0; i < plugins.length; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
- var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
+ var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
if (extractedEvents) {
events = accumulateInto(events, extractedEvents);
}
@@ -8300,7 +8899,7 @@ var EventPluginHub = {
} else {
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
}
- !!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
+ !!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : void 0;
// This would be a good time to rethrow if any of the event handlers threw.
ReactErrorUtils.rethrowCaughtError();
},
@@ -8321,10 +8920,10 @@ var EventPluginHub = {
module.exports = EventPluginHub;
}).call(this,require('_process'))
-},{"./EventPluginRegistry":77,"./EventPluginUtils":78,"./ReactErrorUtils":121,"./accumulateInto":176,"./forEachAccumulated":185,"_process":27,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],77:[function(require,module,exports){
+},{"./EventPluginRegistry":84,"./EventPluginUtils":85,"./ReactErrorUtils":130,"./accumulateInto":175,"./forEachAccumulated":183,"_process":29,"fbjs/lib/invariant":219}],84:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -8332,7 +8931,6 @@ module.exports = EventPluginHub;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPluginRegistry
- * @typechecks static-only
*/
'use strict';
@@ -8362,15 +8960,15 @@ function recomputePluginOrdering() {
for (var pluginName in namesToPlugins) {
var PluginModule = namesToPlugins[pluginName];
var pluginIndex = EventPluginOrder.indexOf(pluginName);
- !(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
+ !(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : void 0;
if (EventPluginRegistry.plugins[pluginIndex]) {
continue;
}
- !PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
+ !PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : void 0;
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
var publishedEvents = PluginModule.eventTypes;
for (var eventName in publishedEvents) {
- !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
+ !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : void 0;
}
}
}
@@ -8384,7 +8982,7 @@ function recomputePluginOrdering() {
* @private
*/
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
- !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
+ !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : void 0;
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
@@ -8412,9 +9010,14 @@ function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
* @private
*/
function publishRegistrationName(registrationName, PluginModule, eventName) {
- !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
+ !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : void 0;
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
+
+ if (process.env.NODE_ENV !== 'production') {
+ var lowerCasedName = registrationName.toLowerCase();
+ EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
+ }
}
/**
@@ -8445,6 +9048,14 @@ var EventPluginRegistry = {
registrationNameDependencies: {},
/**
+ * Mapping from lowercase registration names to the properly cased version,
+ * used to warn in the case of missing event handlers. Available
+ * only in __DEV__.
+ * @type {Object}
+ */
+ possibleRegistrationNames: process.env.NODE_ENV !== 'production' ? {} : null,
+
+ /**
* Injects an ordering of plugins (by plugin name). This allows the ordering
* to be decoupled from injection of the actual plugins so that ordering is
* always deterministic regardless of packaging, on-the-fly injection, etc.
@@ -8454,7 +9065,7 @@ var EventPluginRegistry = {
* @see {EventPluginHub.injection.injectEventPluginOrder}
*/
injectEventPluginOrder: function (InjectedEventPluginOrder) {
- !!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
+ !!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : void 0;
// Clone the ordering so it cannot be dynamically mutated.
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
recomputePluginOrdering();
@@ -8478,7 +9089,7 @@ var EventPluginRegistry = {
}
var PluginModule = injectedNamesToPlugins[pluginName];
if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
- !!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
+ !!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : void 0;
namesToPlugins[pluginName] = PluginModule;
isOrderingDirty = true;
}
@@ -8538,6 +9149,15 @@ var EventPluginRegistry = {
delete registrationNameModules[registrationName];
}
}
+
+ if (process.env.NODE_ENV !== 'production') {
+ var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames;
+ for (var lowerCasedName in possibleRegistrationNames) {
+ if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) {
+ delete possibleRegistrationNames[lowerCasedName];
+ }
+ }
+ }
}
};
@@ -8545,10 +9165,10 @@ var EventPluginRegistry = {
module.exports = EventPluginRegistry;
}).call(this,require('_process'))
-},{"_process":27,"fbjs/lib/invariant":222}],78:[function(require,module,exports){
+},{"_process":29,"fbjs/lib/invariant":219}],85:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -8571,15 +9191,22 @@ var warning = require('fbjs/lib/warning');
*/
/**
- * - `Mount`: [required] Module that can convert between React dom IDs and
- * actual node references.
+ * - `ComponentTree`: [required] Module that can convert between React instances
+ * and actual node references.
*/
+var ComponentTree;
+var TreeTraversal;
var injection = {
- Mount: null,
- injectMount: function (InjectedMount) {
- injection.Mount = InjectedMount;
+ injectComponentTree: function (Injected) {
+ ComponentTree = Injected;
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
+ }
+ },
+ injectTreeTraversal: function (Injected) {
+ TreeTraversal = Injected;
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0;
}
}
};
@@ -8601,14 +9228,15 @@ var validateEventDispatches;
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
- var dispatchIDs = event._dispatchIDs;
+ var dispatchInstances = event._dispatchInstances;
var listenersIsArr = Array.isArray(dispatchListeners);
- var idsIsArr = Array.isArray(dispatchIDs);
- var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
- process.env.NODE_ENV !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
+ var instancesIsArr = Array.isArray(dispatchInstances);
+ var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
+
+ process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0;
};
}
@@ -8617,15 +9245,15 @@ if (process.env.NODE_ENV !== 'production') {
* @param {SyntheticEvent} event SyntheticEvent to handle
* @param {boolean} simulated If the event is simulated (changes exn behavior)
* @param {function} listener Application-level callback
- * @param {string} domID DOM id to pass to the callback.
+ * @param {*} inst Internal component instance
*/
-function executeDispatch(event, simulated, listener, domID) {
+function executeDispatch(event, simulated, listener, inst) {
var type = event.type || 'unknown-event';
- event.currentTarget = injection.Mount.getNode(domID);
+ event.currentTarget = EventPluginUtils.getNodeFromInstance(inst);
if (simulated) {
- ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
+ ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event);
} else {
- ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
+ ReactErrorUtils.invokeGuardedCallback(type, listener, event);
}
event.currentTarget = null;
}
@@ -8635,7 +9263,7 @@ function executeDispatch(event, simulated, listener, domID) {
*/
function executeDispatchesInOrder(event, simulated) {
var dispatchListeners = event._dispatchListeners;
- var dispatchIDs = event._dispatchIDs;
+ var dispatchInstances = event._dispatchInstances;
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
@@ -8644,14 +9272,14 @@ function executeDispatchesInOrder(event, simulated) {
if (event.isPropagationStopped()) {
break;
}
- // Listeners and IDs are two parallel arrays that are always in sync.
- executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
+ // Listeners and Instances are two parallel arrays that are always in sync.
+ executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);
}
} else if (dispatchListeners) {
- executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
+ executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
}
event._dispatchListeners = null;
- event._dispatchIDs = null;
+ event._dispatchInstances = null;
}
/**
@@ -8663,7 +9291,7 @@ function executeDispatchesInOrder(event, simulated) {
*/
function executeDispatchesInOrderStopAtTrueImpl(event) {
var dispatchListeners = event._dispatchListeners;
- var dispatchIDs = event._dispatchIDs;
+ var dispatchInstances = event._dispatchInstances;
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
@@ -8672,14 +9300,14 @@ function executeDispatchesInOrderStopAtTrueImpl(event) {
if (event.isPropagationStopped()) {
break;
}
- // Listeners and IDs are two parallel arrays that are always in sync.
- if (dispatchListeners[i](event, dispatchIDs[i])) {
- return dispatchIDs[i];
+ // Listeners and Instances are two parallel arrays that are always in sync.
+ if (dispatchListeners[i](event, dispatchInstances[i])) {
+ return dispatchInstances[i];
}
}
} else if (dispatchListeners) {
- if (dispatchListeners(event, dispatchIDs)) {
- return dispatchIDs;
+ if (dispatchListeners(event, dispatchInstances)) {
+ return dispatchInstances;
}
}
return null;
@@ -8690,7 +9318,7 @@ function executeDispatchesInOrderStopAtTrueImpl(event) {
*/
function executeDispatchesInOrderStopAtTrue(event) {
var ret = executeDispatchesInOrderStopAtTrueImpl(event);
- event._dispatchIDs = null;
+ event._dispatchInstances = null;
event._dispatchListeners = null;
return ret;
}
@@ -8709,11 +9337,13 @@ function executeDirectDispatch(event) {
validateEventDispatches(event);
}
var dispatchListener = event._dispatchListeners;
- var dispatchID = event._dispatchIDs;
- !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
- var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
+ var dispatchInstance = event._dispatchInstances;
+ !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : void 0;
+ event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
+ var res = dispatchListener ? dispatchListener(event) : null;
+ event.currentTarget = null;
event._dispatchListeners = null;
- event._dispatchIDs = null;
+ event._dispatchInstances = null;
return res;
}
@@ -8738,11 +9368,26 @@ var EventPluginUtils = {
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
hasDispatches: hasDispatches,
- getNode: function (id) {
- return injection.Mount.getNode(id);
+ getInstanceFromNode: function (node) {
+ return ComponentTree.getInstanceFromNode(node);
+ },
+ getNodeFromInstance: function (node) {
+ return ComponentTree.getNodeFromInstance(node);
+ },
+ isAncestor: function (a, b) {
+ return TreeTraversal.isAncestor(a, b);
+ },
+ getLowestCommonAncestor: function (a, b) {
+ return TreeTraversal.getLowestCommonAncestor(a, b);
+ },
+ getParentInstance: function (inst) {
+ return TreeTraversal.getParentInstance(inst);
+ },
+ traverseTwoPhase: function (target, fn, arg) {
+ return TreeTraversal.traverseTwoPhase(target, fn, arg);
},
- getID: function (node) {
- return injection.Mount.getID(node);
+ traverseEnterLeave: function (from, to, fn, argFrom, argTo) {
+ return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo);
},
injection: injection
@@ -8751,10 +9396,10 @@ var EventPluginUtils = {
module.exports = EventPluginUtils;
}).call(this,require('_process'))
-},{"./EventConstants":75,"./ReactErrorUtils":121,"_process":27,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],79:[function(require,module,exports){
+},{"./EventConstants":82,"./ReactErrorUtils":130,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],86:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -8768,11 +9413,11 @@ module.exports = EventPluginUtils;
var EventConstants = require('./EventConstants');
var EventPluginHub = require('./EventPluginHub');
-
-var warning = require('fbjs/lib/warning');
+var EventPluginUtils = require('./EventPluginUtils');
var accumulateInto = require('./accumulateInto');
var forEachAccumulated = require('./forEachAccumulated');
+var warning = require('fbjs/lib/warning');
var PropagationPhases = EventConstants.PropagationPhases;
var getListener = EventPluginHub.getListener;
@@ -8781,9 +9426,9 @@ var getListener = EventPluginHub.getListener;
* Some event types have a notion of different registration names for different
* "phases" of propagation. This finds listeners by a given phase.
*/
-function listenerAtPhase(id, event, propagationPhase) {
+function listenerAtPhase(inst, event, propagationPhase) {
var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
- return getListener(id, registrationName);
+ return getListener(inst, registrationName);
}
/**
@@ -8792,15 +9437,15 @@ function listenerAtPhase(id, event, propagationPhase) {
* Mutating the event's members allows us to not have to create a wrapping
* "dispatch" object that pairs the event with the listener.
*/
-function accumulateDirectionalDispatches(domID, upwards, event) {
+function accumulateDirectionalDispatches(inst, upwards, event) {
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0;
}
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
- var listener = listenerAtPhase(domID, event, phase);
+ var listener = listenerAtPhase(inst, event, phase);
if (listener) {
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
- event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
+ event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
}
}
@@ -8813,7 +9458,7 @@ function accumulateDirectionalDispatches(domID, upwards, event) {
*/
function accumulateTwoPhaseDispatchesSingle(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
- EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
+ EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
}
}
@@ -8822,7 +9467,9 @@ function accumulateTwoPhaseDispatchesSingle(event) {
*/
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
- EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
+ var targetInst = event._targetInst;
+ var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null;
+ EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
}
}
@@ -8831,13 +9478,13 @@ function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
* registration names. Same as `accumulateDirectDispatchesSingle` but without
* requiring that the `dispatchMarker` be the same as the dispatched ID.
*/
-function accumulateDispatches(id, ignoredDirection, event) {
+function accumulateDispatches(inst, ignoredDirection, event) {
if (event && event.dispatchConfig.registrationName) {
var registrationName = event.dispatchConfig.registrationName;
- var listener = getListener(id, registrationName);
+ var listener = getListener(inst, registrationName);
if (listener) {
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
- event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
+ event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
}
}
}
@@ -8849,7 +9496,7 @@ function accumulateDispatches(id, ignoredDirection, event) {
*/
function accumulateDirectDispatchesSingle(event) {
if (event && event.dispatchConfig.registrationName) {
- accumulateDispatches(event.dispatchMarker, null, event);
+ accumulateDispatches(event._targetInst, null, event);
}
}
@@ -8861,8 +9508,8 @@ function accumulateTwoPhaseDispatchesSkipTarget(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
}
-function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
- EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
+function accumulateEnterLeaveDispatches(leave, enter, from, to) {
+ EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
}
function accumulateDirectDispatches(events) {
@@ -8890,9 +9537,9 @@ var EventPropagators = {
module.exports = EventPropagators;
}).call(this,require('_process'))
-},{"./EventConstants":75,"./EventPluginHub":76,"./accumulateInto":176,"./forEachAccumulated":185,"_process":27,"fbjs/lib/warning":234}],80:[function(require,module,exports){
+},{"./EventConstants":82,"./EventPluginHub":83,"./EventPluginUtils":85,"./accumulateInto":175,"./forEachAccumulated":183,"_process":29,"fbjs/lib/warning":229}],87:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -8900,14 +9547,14 @@ module.exports = EventPropagators;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule FallbackCompositionState
- * @typechecks static-only
*/
'use strict';
+var _assign = require('object-assign');
+
var PooledClass = require('./PooledClass');
-var assign = require('./Object.assign');
var getTextContentAccessor = require('./getTextContentAccessor');
/**
@@ -8927,7 +9574,7 @@ function FallbackCompositionState(root) {
this._fallbackText = null;
}
-assign(FallbackCompositionState.prototype, {
+_assign(FallbackCompositionState.prototype, {
destructor: function () {
this._root = null;
this._startText = null;
@@ -8986,9 +9633,9 @@ assign(FallbackCompositionState.prototype, {
PooledClass.addPoolingTo(FallbackCompositionState);
module.exports = FallbackCompositionState;
-},{"./Object.assign":84,"./PooledClass":85,"./getTextContentAccessor":192}],81:[function(require,module,exports){
+},{"./PooledClass":91,"./getTextContentAccessor":191,"object-assign":28}],88:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -9001,9 +9648,7 @@ module.exports = FallbackCompositionState;
'use strict';
var DOMProperty = require('./DOMProperty');
-var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
-var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
@@ -9011,188 +9656,182 @@ var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
-var hasSVG;
-if (ExecutionEnvironment.canUseDOM) {
- var implementation = document.implementation;
- hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
-}
-
var HTMLDOMPropertyConfig = {
- isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
+ isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')),
Properties: {
/**
* Standard Properties
*/
- accept: null,
- acceptCharset: null,
- accessKey: null,
- action: null,
- allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
- allowTransparency: MUST_USE_ATTRIBUTE,
- alt: null,
+ accept: 0,
+ acceptCharset: 0,
+ accessKey: 0,
+ action: 0,
+ allowFullScreen: HAS_BOOLEAN_VALUE,
+ allowTransparency: 0,
+ alt: 0,
async: HAS_BOOLEAN_VALUE,
- autoComplete: null,
+ autoComplete: 0,
// autoFocus is polyfilled/normalized by AutoFocusUtils
// autoFocus: HAS_BOOLEAN_VALUE,
autoPlay: HAS_BOOLEAN_VALUE,
- capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
- cellPadding: null,
- cellSpacing: null,
- charSet: MUST_USE_ATTRIBUTE,
- challenge: MUST_USE_ATTRIBUTE,
+ capture: HAS_BOOLEAN_VALUE,
+ cellPadding: 0,
+ cellSpacing: 0,
+ charSet: 0,
+ challenge: 0,
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
- // browsers that support SVG and the property in browsers that don't,
- // regardless of whether the element is HTML or SVG.
- className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
- cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
- colSpan: null,
- content: null,
- contentEditable: null,
- contextMenu: MUST_USE_ATTRIBUTE,
- controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- coords: null,
- crossOrigin: null,
- data: null, // For `<object />` acts as `src`.
- dateTime: MUST_USE_ATTRIBUTE,
+ cite: 0,
+ classID: 0,
+ className: 0,
+ cols: HAS_POSITIVE_NUMERIC_VALUE,
+ colSpan: 0,
+ content: 0,
+ contentEditable: 0,
+ contextMenu: 0,
+ controls: HAS_BOOLEAN_VALUE,
+ coords: 0,
+ crossOrigin: 0,
+ data: 0, // For `<object />` acts as `src`.
+ dateTime: 0,
'default': HAS_BOOLEAN_VALUE,
defer: HAS_BOOLEAN_VALUE,
- dir: null,
- disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
+ dir: 0,
+ disabled: HAS_BOOLEAN_VALUE,
download: HAS_OVERLOADED_BOOLEAN_VALUE,
- draggable: null,
- encType: null,
- form: MUST_USE_ATTRIBUTE,
- formAction: MUST_USE_ATTRIBUTE,
- formEncType: MUST_USE_ATTRIBUTE,
- formMethod: MUST_USE_ATTRIBUTE,
+ draggable: 0,
+ encType: 0,
+ form: 0,
+ formAction: 0,
+ formEncType: 0,
+ formMethod: 0,
formNoValidate: HAS_BOOLEAN_VALUE,
- formTarget: MUST_USE_ATTRIBUTE,
- frameBorder: MUST_USE_ATTRIBUTE,
- headers: null,
- height: MUST_USE_ATTRIBUTE,
- hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
- high: null,
- href: null,
- hrefLang: null,
- htmlFor: null,
- httpEquiv: null,
- icon: null,
- id: MUST_USE_PROPERTY,
- inputMode: MUST_USE_ATTRIBUTE,
- integrity: null,
- is: MUST_USE_ATTRIBUTE,
- keyParams: MUST_USE_ATTRIBUTE,
- keyType: MUST_USE_ATTRIBUTE,
- kind: null,
- label: null,
- lang: null,
- list: MUST_USE_ATTRIBUTE,
- loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- low: null,
- manifest: MUST_USE_ATTRIBUTE,
- marginHeight: null,
- marginWidth: null,
- max: null,
- maxLength: MUST_USE_ATTRIBUTE,
- media: MUST_USE_ATTRIBUTE,
- mediaGroup: null,
- method: null,
- min: null,
- minLength: MUST_USE_ATTRIBUTE,
+ formTarget: 0,
+ frameBorder: 0,
+ headers: 0,
+ height: 0,
+ hidden: HAS_BOOLEAN_VALUE,
+ high: 0,
+ href: 0,
+ hrefLang: 0,
+ htmlFor: 0,
+ httpEquiv: 0,
+ icon: 0,
+ id: 0,
+ inputMode: 0,
+ integrity: 0,
+ is: 0,
+ keyParams: 0,
+ keyType: 0,
+ kind: 0,
+ label: 0,
+ lang: 0,
+ list: 0,
+ loop: HAS_BOOLEAN_VALUE,
+ low: 0,
+ manifest: 0,
+ marginHeight: 0,
+ marginWidth: 0,
+ max: 0,
+ maxLength: 0,
+ media: 0,
+ mediaGroup: 0,
+ method: 0,
+ min: 0,
+ minLength: 0,
+ // Caution; `option.selected` is not updated if `select.multiple` is
+ // disabled with `removeAttribute`.
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- name: null,
- nonce: MUST_USE_ATTRIBUTE,
+ name: 0,
+ nonce: 0,
noValidate: HAS_BOOLEAN_VALUE,
open: HAS_BOOLEAN_VALUE,
- optimum: null,
- pattern: null,
- placeholder: null,
- poster: null,
- preload: null,
- radioGroup: null,
- readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- rel: null,
+ optimum: 0,
+ pattern: 0,
+ placeholder: 0,
+ poster: 0,
+ preload: 0,
+ profile: 0,
+ radioGroup: 0,
+ readOnly: HAS_BOOLEAN_VALUE,
+ rel: 0,
required: HAS_BOOLEAN_VALUE,
reversed: HAS_BOOLEAN_VALUE,
- role: MUST_USE_ATTRIBUTE,
- rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
- rowSpan: null,
- sandbox: null,
- scope: null,
+ role: 0,
+ rows: HAS_POSITIVE_NUMERIC_VALUE,
+ rowSpan: HAS_NUMERIC_VALUE,
+ sandbox: 0,
+ scope: 0,
scoped: HAS_BOOLEAN_VALUE,
- scrolling: null,
- seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
+ scrolling: 0,
+ seamless: HAS_BOOLEAN_VALUE,
selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- shape: null,
- size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
- sizes: MUST_USE_ATTRIBUTE,
+ shape: 0,
+ size: HAS_POSITIVE_NUMERIC_VALUE,
+ sizes: 0,
span: HAS_POSITIVE_NUMERIC_VALUE,
- spellCheck: null,
- src: null,
- srcDoc: MUST_USE_PROPERTY,
- srcLang: null,
- srcSet: MUST_USE_ATTRIBUTE,
+ spellCheck: 0,
+ src: 0,
+ srcDoc: 0,
+ srcLang: 0,
+ srcSet: 0,
start: HAS_NUMERIC_VALUE,
- step: null,
- style: null,
- summary: null,
- tabIndex: null,
- target: null,
- title: null,
- type: null,
- useMap: null,
+ step: 0,
+ style: 0,
+ summary: 0,
+ tabIndex: 0,
+ target: 0,
+ title: 0,
+ // Setting .type throws on non-<input> tags
+ type: 0,
+ useMap: 0,
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
- width: MUST_USE_ATTRIBUTE,
- wmode: MUST_USE_ATTRIBUTE,
- wrap: null,
+ width: 0,
+ wmode: 0,
+ wrap: 0,
/**
* RDFa Properties
*/
- about: MUST_USE_ATTRIBUTE,
- datatype: MUST_USE_ATTRIBUTE,
- inlist: MUST_USE_ATTRIBUTE,
- prefix: MUST_USE_ATTRIBUTE,
+ about: 0,
+ datatype: 0,
+ inlist: 0,
+ prefix: 0,
// property is also supported for OpenGraph in meta tags.
- property: MUST_USE_ATTRIBUTE,
- resource: MUST_USE_ATTRIBUTE,
- 'typeof': MUST_USE_ATTRIBUTE,
- vocab: MUST_USE_ATTRIBUTE,
+ property: 0,
+ resource: 0,
+ 'typeof': 0,
+ vocab: 0,
/**
* Non-standard Properties
*/
// autoCapitalize and autoCorrect are supported in Mobile Safari for
// keyboard hints.
- autoCapitalize: MUST_USE_ATTRIBUTE,
- autoCorrect: MUST_USE_ATTRIBUTE,
+ autoCapitalize: 0,
+ autoCorrect: 0,
// autoSave allows WebKit/Blink to persist values of input fields on page reloads
- autoSave: null,
+ autoSave: 0,
// color is for Safari mask-icon link
- color: null,
+ color: 0,
// itemProp, itemScope, itemType are for
// Microdata support. See http://schema.org/docs/gs.html
- itemProp: MUST_USE_ATTRIBUTE,
- itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
- itemType: MUST_USE_ATTRIBUTE,
+ itemProp: 0,
+ itemScope: HAS_BOOLEAN_VALUE,
+ itemType: 0,
// itemID and itemRef are for Microdata support as well but
- // only specified in the the WHATWG spec document. See
+ // only specified in the WHATWG spec document. See
// https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
- itemID: MUST_USE_ATTRIBUTE,
- itemRef: MUST_USE_ATTRIBUTE,
+ itemID: 0,
+ itemRef: 0,
// results show looking glass icon and recent searches on input
// search fields in WebKit/Blink
- results: null,
+ results: 0,
// IE-only attribute that specifies security restrictions on an iframe
// as an alternative to the sandbox attribute on IE<10
- security: MUST_USE_ATTRIBUTE,
+ security: 0,
// IE-only attribute that controls focus behavior
- unselectable: MUST_USE_ATTRIBUTE
+ unselectable: 0
},
DOMAttributeNames: {
acceptCharset: 'accept-charset',
@@ -9200,64 +9839,73 @@ var HTMLDOMPropertyConfig = {
htmlFor: 'for',
httpEquiv: 'http-equiv'
},
- DOMPropertyNames: {
- autoComplete: 'autocomplete',
- autoFocus: 'autofocus',
- autoPlay: 'autoplay',
- autoSave: 'autosave',
- // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
- // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
- encType: 'encoding',
- hrefLang: 'hreflang',
- radioGroup: 'radiogroup',
- spellCheck: 'spellcheck',
- srcDoc: 'srcdoc',
- srcSet: 'srcset'
- }
+ DOMPropertyNames: {}
};
module.exports = HTMLDOMPropertyConfig;
-},{"./DOMProperty":70,"fbjs/lib/ExecutionEnvironment":208}],82:[function(require,module,exports){
+},{"./DOMProperty":76}],89:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the 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
+ * @providesModule KeyEscapeUtils
*/
'use strict';
-var ReactLink = require('./ReactLink');
-var ReactStateSetters = require('./ReactStateSetters');
+/**
+ * Escape and wrap key so it is safe to use as a reactid
+ *
+ * @param {*} key to be escaped.
+ * @return {string} the escaped key.
+ */
+
+function escape(key) {
+ var escapeRegex = /[=:]/g;
+ var escaperLookup = {
+ '=': '=0',
+ ':': '=2'
+ };
+ var escapedString = ('' + key).replace(escapeRegex, function (match) {
+ return escaperLookup[match];
+ });
+
+ return '$' + escapedString;
+}
/**
- * A simple mixin around ReactLink.forState().
+ * Unescape and unwrap key for human-readable display
+ *
+ * @param {string} key to unescape.
+ * @return {string} the unescaped key.
*/
-var LinkedStateMixin = {
- /**
- * Create a ReactLink that's linked to part of this component's state. The
- * ReactLink will have the current value of this.state[key] and will call
- * setState() when a change is requested.
- *
- * @param {string} key state key to update. Note: you may want to use keyOf()
- * if you're using Google Closure Compiler advanced mode.
- * @return {ReactLink} ReactLink instance linking to the state.
- */
- linkState: function (key) {
- return new ReactLink(this.state[key], ReactStateSetters.createStateKeySetter(this, key));
- }
+function unescape(key) {
+ var unescapeRegex = /(=0|=2)/g;
+ var unescaperLookup = {
+ '=0': '=',
+ '=2': ':'
+ };
+ var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
+
+ return ('' + keySubstring).replace(unescapeRegex, function (match) {
+ return unescaperLookup[match];
+ });
+}
+
+var KeyEscapeUtils = {
+ escape: escape,
+ unescape: unescape
};
-module.exports = LinkedStateMixin;
-},{"./ReactLink":130,"./ReactStateSetters":150}],83:[function(require,module,exports){
+module.exports = KeyEscapeUtils;
+},{}],90:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -9265,7 +9913,6 @@ module.exports = LinkedStateMixin;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule LinkedValueUtils
- * @typechecks static-only
*/
'use strict';
@@ -9287,16 +9934,16 @@ var hasReadOnlyValue = {
};
function _assertSingleLink(inputProps) {
- !(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
+ !(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : void 0;
}
function _assertValueLink(inputProps) {
_assertSingleLink(inputProps);
- !(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
+ !(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : void 0;
}
function _assertCheckedLink(inputProps) {
_assertSingleLink(inputProps);
- !(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
+ !(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : void 0;
}
var propTypes = {
@@ -9342,7 +9989,7 @@ var LinkedValueUtils = {
loggedTypeFailures[error.message] = true;
var addendum = getDeclarationErrorAddendum(owner);
- process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0;
}
}
},
@@ -9392,58 +10039,10 @@ var LinkedValueUtils = {
module.exports = LinkedValueUtils;
}).call(this,require('_process'))
-},{"./ReactPropTypeLocations":141,"./ReactPropTypes":142,"_process":27,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],84:[function(require,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule Object.assign
- */
-
-// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
-
-'use strict';
-
-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;
-},{}],85:[function(require,module,exports){
+},{"./ReactPropTypeLocations":149,"./ReactPropTypes":150,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],91:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -9521,7 +10120,7 @@ var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
var standardReleaser = function (instance) {
var Klass = this;
- !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
+ !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : void 0;
instance.destructor();
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
@@ -9563,9 +10162,10 @@ var PooledClass = {
module.exports = PooledClass;
}).call(this,require('_process'))
-},{"_process":27,"fbjs/lib/invariant":222}],86:[function(require,module,exports){
+},{"_process":29,"fbjs/lib/invariant":219}],92:[function(require,module,exports){
+(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -9577,76 +10177,85 @@ module.exports = PooledClass;
'use strict';
-var ReactDOM = require('./ReactDOM');
-var ReactDOMServer = require('./ReactDOMServer');
-var ReactIsomorphic = require('./ReactIsomorphic');
+var _assign = require('object-assign');
+
+var ReactChildren = require('./ReactChildren');
+var ReactComponent = require('./ReactComponent');
+var ReactClass = require('./ReactClass');
+var ReactDOMFactories = require('./ReactDOMFactories');
+var ReactElement = require('./ReactElement');
+var ReactElementValidator = require('./ReactElementValidator');
+var ReactPropTypes = require('./ReactPropTypes');
+var ReactVersion = require('./ReactVersion');
-var assign = require('./Object.assign');
-var deprecated = require('./deprecated');
+var onlyChild = require('./onlyChild');
+var warning = require('fbjs/lib/warning');
-// `version` will be added here by ReactIsomorphic.
-var React = {};
+var createElement = ReactElement.createElement;
+var createFactory = ReactElement.createFactory;
+var cloneElement = ReactElement.cloneElement;
-assign(React, ReactIsomorphic);
+if (process.env.NODE_ENV !== 'production') {
+ createElement = ReactElementValidator.createElement;
+ createFactory = ReactElementValidator.createFactory;
+ cloneElement = ReactElementValidator.cloneElement;
+}
-assign(React, {
- // ReactDOM
- findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
- render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
- unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
+var __spread = _assign;
- // ReactDOMServer
- renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
- renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
-});
+if (process.env.NODE_ENV !== 'production') {
+ var warned = false;
+ __spread = function () {
+ process.env.NODE_ENV !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0;
+ warned = true;
+ return _assign.apply(null, arguments);
+ };
+}
-React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
-React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
+var React = {
-module.exports = React;
-},{"./Object.assign":84,"./ReactDOM":100,"./ReactDOMServer":110,"./ReactIsomorphic":129,"./deprecated":181}],87:[function(require,module,exports){
-(function (process){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactBrowserComponentMixin
- */
+ // Modern
-'use strict';
+ Children: {
+ map: ReactChildren.map,
+ forEach: ReactChildren.forEach,
+ count: ReactChildren.count,
+ toArray: ReactChildren.toArray,
+ only: onlyChild
+ },
-var ReactInstanceMap = require('./ReactInstanceMap');
+ Component: ReactComponent,
-var findDOMNode = require('./findDOMNode');
-var warning = require('fbjs/lib/warning');
+ createElement: createElement,
+ cloneElement: cloneElement,
+ isValidElement: ReactElement.isValidElement,
-var didWarnKey = '_getDOMNodeDidWarn';
+ // Classic
-var ReactBrowserComponentMixin = {
- /**
- * Returns the DOM node rendered by this component.
- *
- * @return {DOMElement} The root node of this component.
- * @final
- * @protected
- */
- getDOMNode: function () {
- process.env.NODE_ENV !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
- this.constructor[didWarnKey] = true;
- return findDOMNode(this);
- }
+ PropTypes: ReactPropTypes,
+ createClass: ReactClass.createClass,
+ createFactory: createFactory,
+ createMixin: function (mixin) {
+ // Currently a noop. Will be used to validate and trace mixins.
+ return mixin;
+ },
+
+ // This looks DOM specific but these are actually isomorphic helpers
+ // since they are just generating DOM strings.
+ DOM: ReactDOMFactories,
+
+ version: ReactVersion,
+
+ // Deprecated hook for JSX spread, don't use this for anything.
+ __spread: __spread
};
-module.exports = ReactBrowserComponentMixin;
+module.exports = React;
}).call(this,require('_process'))
-},{"./ReactInstanceMap":128,"./findDOMNode":183,"_process":27,"fbjs/lib/warning":234}],88:[function(require,module,exports){
+},{"./ReactChildren":95,"./ReactClass":96,"./ReactComponent":97,"./ReactDOMFactories":110,"./ReactElement":127,"./ReactElementValidator":128,"./ReactPropTypes":150,"./ReactVersion":156,"./onlyChild":196,"_process":29,"fbjs/lib/warning":229,"object-assign":28}],93:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -9654,19 +10263,18 @@ module.exports = ReactBrowserComponentMixin;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactBrowserEventEmitter
- * @typechecks static-only
*/
'use strict';
+var _assign = require('object-assign');
+
var EventConstants = require('./EventConstants');
-var EventPluginHub = require('./EventPluginHub');
var EventPluginRegistry = require('./EventPluginRegistry');
var ReactEventEmitterMixin = require('./ReactEventEmitterMixin');
-var ReactPerf = require('./ReactPerf');
var ViewportMetrics = require('./ViewportMetrics');
-var assign = require('./Object.assign');
+var getVendorPrefixedEventName = require('./getVendorPrefixedEventName');
var isEventSupported = require('./isEventSupported');
/**
@@ -9724,6 +10332,7 @@ var isEventSupported = require('./isEventSupported');
* React Core . General Purpose Event Plugin System
*/
+var hasEventPageXY;
var alreadyListeningTo = {};
var isMonitoringScrollValue = false;
var reactTopListenersCounter = 0;
@@ -9733,6 +10342,9 @@ var reactTopListenersCounter = 0;
// events so we don't include them here
var topEventMapping = {
topAbort: 'abort',
+ topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
+ topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
+ topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
topBlur: 'blur',
topCanPlay: 'canplay',
topCanPlayThrough: 'canplaythrough',
@@ -9789,6 +10401,7 @@ var topEventMapping = {
topTouchEnd: 'touchend',
topTouchMove: 'touchmove',
topTouchStart: 'touchstart',
+ topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
topVolumeChange: 'volumechange',
topWaiting: 'waiting',
topWheel: 'wheel'
@@ -9813,13 +10426,13 @@ function getListeningForDocument(mountAt) {
* `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
* example:
*
- * ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
+ * EventPluginHub.putListener('myID', 'onClick', myFunction);
*
* This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
*
* @internal
*/
-var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
+var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
/**
* Injectable event backend
@@ -9937,292 +10550,31 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
* Listens to window scroll and resize events. We cache scroll values so that
* application code can access them without triggering reflows.
*
+ * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
+ * pageX/pageY isn't supported (legacy browsers).
+ *
* NOTE: Scroll events do not bubble.
*
* @see http://www.quirksmode.org/dom/events/scroll.html
*/
ensureScrollValueMonitoring: function () {
- if (!isMonitoringScrollValue) {
+ if (hasEventPageXY === undefined) {
+ hasEventPageXY = document.createEvent && 'pageX' in document.createEvent('MouseEvent');
+ }
+ if (!hasEventPageXY && !isMonitoringScrollValue) {
var refresh = ViewportMetrics.refreshScrollValues;
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
isMonitoringScrollValue = true;
}
- },
-
- eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
-
- registrationNameModules: EventPluginHub.registrationNameModules,
-
- putListener: EventPluginHub.putListener,
-
- getListener: EventPluginHub.getListener,
-
- deleteListener: EventPluginHub.deleteListener,
-
- deleteAllListeners: EventPluginHub.deleteAllListeners
-
-});
-
-ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
- putListener: 'putListener',
- deleteListener: 'deleteListener'
-});
-
-module.exports = ReactBrowserEventEmitter;
-},{"./EventConstants":75,"./EventPluginHub":76,"./EventPluginRegistry":77,"./Object.assign":84,"./ReactEventEmitterMixin":122,"./ReactPerf":138,"./ViewportMetrics":175,"./isEventSupported":194}],89:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @typechecks
- * @providesModule ReactCSSTransitionGroup
- */
-
-'use strict';
-
-var React = require('./React');
-
-var assign = require('./Object.assign');
-
-var ReactTransitionGroup = require('./ReactTransitionGroup');
-var ReactCSSTransitionGroupChild = require('./ReactCSSTransitionGroupChild');
-
-function createTransitionTimeoutPropValidator(transitionType) {
- var timeoutPropName = 'transition' + transitionType + 'Timeout';
- var enabledPropName = 'transition' + transitionType;
-
- return function (props) {
- // If the transition is enabled
- if (props[enabledPropName]) {
- // If no timeout duration is provided
- if (props[timeoutPropName] == null) {
- return new Error(timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.');
-
- // If the duration isn't a number
- } else if (typeof props[timeoutPropName] !== 'number') {
- return new Error(timeoutPropName + ' must be a number (in milliseconds)');
- }
- }
- };
-}
-
-var ReactCSSTransitionGroup = React.createClass({
- displayName: 'ReactCSSTransitionGroup',
-
- propTypes: {
- transitionName: ReactCSSTransitionGroupChild.propTypes.name,
-
- transitionAppear: React.PropTypes.bool,
- transitionEnter: React.PropTypes.bool,
- transitionLeave: React.PropTypes.bool,
- transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'),
- transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'),
- transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave')
- },
-
- getDefaultProps: function () {
- return {
- transitionAppear: false,
- transitionEnter: true,
- transitionLeave: true
- };
- },
-
- _wrapChild: function (child) {
- // We need to provide this childFactory so that
- // ReactCSSTransitionGroupChild can receive updates to name, enter, and
- // leave while it is leaving.
- return React.createElement(ReactCSSTransitionGroupChild, {
- name: this.props.transitionName,
- appear: this.props.transitionAppear,
- enter: this.props.transitionEnter,
- leave: this.props.transitionLeave,
- appearTimeout: this.props.transitionAppearTimeout,
- enterTimeout: this.props.transitionEnterTimeout,
- leaveTimeout: this.props.transitionLeaveTimeout
- }, child);
- },
-
- render: function () {
- return React.createElement(ReactTransitionGroup, assign({}, this.props, { childFactory: this._wrapChild }));
}
-});
-
-module.exports = ReactCSSTransitionGroup;
-},{"./Object.assign":84,"./React":86,"./ReactCSSTransitionGroupChild":90,"./ReactTransitionGroup":154}],90:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @typechecks
- * @providesModule ReactCSSTransitionGroupChild
- */
-
-'use strict';
-
-var React = require('./React');
-var ReactDOM = require('./ReactDOM');
-
-var CSSCore = require('fbjs/lib/CSSCore');
-var ReactTransitionEvents = require('./ReactTransitionEvents');
-
-var onlyChild = require('./onlyChild');
-
-// We don't remove the element from the DOM until we receive an animationend or
-// transitionend event. If the user screws up and forgets to add an animation
-// their node will be stuck in the DOM forever, so we detect if an animation
-// does not start and if it doesn't, we just call the end listener immediately.
-var TICK = 17;
-
-var ReactCSSTransitionGroupChild = React.createClass({
- displayName: 'ReactCSSTransitionGroupChild',
-
- propTypes: {
- name: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.shape({
- enter: React.PropTypes.string,
- leave: React.PropTypes.string,
- active: React.PropTypes.string
- }), React.PropTypes.shape({
- enter: React.PropTypes.string,
- enterActive: React.PropTypes.string,
- leave: React.PropTypes.string,
- leaveActive: React.PropTypes.string,
- appear: React.PropTypes.string,
- appearActive: React.PropTypes.string
- })]).isRequired,
-
- // Once we require timeouts to be specified, we can remove the
- // boolean flags (appear etc.) and just accept a number
- // or a bool for the timeout flags (appearTimeout etc.)
- appear: React.PropTypes.bool,
- enter: React.PropTypes.bool,
- leave: React.PropTypes.bool,
- appearTimeout: React.PropTypes.number,
- enterTimeout: React.PropTypes.number,
- leaveTimeout: React.PropTypes.number
- },
-
- transition: function (animationType, finishCallback, userSpecifiedDelay) {
- var node = ReactDOM.findDOMNode(this);
-
- if (!node) {
- if (finishCallback) {
- finishCallback();
- }
- return;
- }
-
- var className = this.props.name[animationType] || this.props.name + '-' + animationType;
- var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
- var timeout = null;
-
- var endListener = function (e) {
- if (e && e.target !== node) {
- return;
- }
-
- clearTimeout(timeout);
-
- CSSCore.removeClass(node, className);
- CSSCore.removeClass(node, activeClassName);
-
- ReactTransitionEvents.removeEndEventListener(node, endListener);
-
- // Usually this optional callback is used for informing an owner of
- // a leave animation and telling it to remove the child.
- if (finishCallback) {
- finishCallback();
- }
- };
-
- CSSCore.addClass(node, className);
-
- // Need to do this to actually trigger a transition.
- this.queueClass(activeClassName);
-
- // If the user specified a timeout delay.
- if (userSpecifiedDelay) {
- // Clean-up the animation after the specified delay
- timeout = setTimeout(endListener, userSpecifiedDelay);
- this.transitionTimeouts.push(timeout);
- } else {
- // DEPRECATED: this listener will be removed in a future version of react
- ReactTransitionEvents.addEndEventListener(node, endListener);
- }
- },
-
- queueClass: function (className) {
- this.classNameQueue.push(className);
-
- if (!this.timeout) {
- this.timeout = setTimeout(this.flushClassNameQueue, TICK);
- }
- },
-
- flushClassNameQueue: function () {
- if (this.isMounted()) {
- this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this)));
- }
- this.classNameQueue.length = 0;
- this.timeout = null;
- },
-
- componentWillMount: function () {
- this.classNameQueue = [];
- this.transitionTimeouts = [];
- },
-
- componentWillUnmount: function () {
- if (this.timeout) {
- clearTimeout(this.timeout);
- }
- this.transitionTimeouts.forEach(function (timeout) {
- clearTimeout(timeout);
- });
- },
-
- componentWillAppear: function (done) {
- if (this.props.appear) {
- this.transition('appear', done, this.props.appearTimeout);
- } else {
- done();
- }
- },
-
- componentWillEnter: function (done) {
- if (this.props.enter) {
- this.transition('enter', done, this.props.enterTimeout);
- } else {
- done();
- }
- },
- componentWillLeave: function (done) {
- if (this.props.leave) {
- this.transition('leave', done, this.props.leaveTimeout);
- } else {
- done();
- }
- },
-
- render: function () {
- return onlyChild(this.props.children);
- }
});
-module.exports = ReactCSSTransitionGroupChild;
-},{"./React":86,"./ReactDOM":100,"./ReactTransitionEvents":153,"./onlyChild":196,"fbjs/lib/CSSCore":206}],91:[function(require,module,exports){
+module.exports = ReactBrowserEventEmitter;
+},{"./EventConstants":82,"./EventPluginRegistry":84,"./ReactEventEmitterMixin":131,"./ViewportMetrics":174,"./getVendorPrefixedEventName":192,"./isEventSupported":194,"object-assign":28}],94:[function(require,module,exports){
(function (process){
/**
- * Copyright 2014-2015, Facebook, Inc.
+ * Copyright 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -10230,7 +10582,6 @@ module.exports = ReactCSSTransitionGroupChild;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactChildReconciler
- * @typechecks static-only
*/
'use strict';
@@ -10238,6 +10589,7 @@ module.exports = ReactCSSTransitionGroupChild;
var ReactReconciler = require('./ReactReconciler');
var instantiateReactComponent = require('./instantiateReactComponent');
+var KeyEscapeUtils = require('./KeyEscapeUtils');
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
var traverseAllChildren = require('./traverseAllChildren');
var warning = require('fbjs/lib/warning');
@@ -10246,10 +10598,10 @@ function instantiateChild(childInstances, child, name) {
// We found a component instance.
var keyUnique = childInstances[name] === undefined;
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', KeyEscapeUtils.unescape(name)) : void 0;
}
if (child != null && keyUnique) {
- childInstances[name] = instantiateReactComponent(child, null);
+ childInstances[name] = instantiateReactComponent(child);
}
}
@@ -10286,21 +10638,22 @@ var ReactChildReconciler = {
* @return {?object} A new set of child instances.
* @internal
*/
- updateChildren: function (prevChildren, nextChildren, transaction, context) {
+ updateChildren: function (prevChildren, nextChildren, removedNodes, transaction, context) {
// We currently don't have a way to track moves here but if we use iterators
// instead of for..in we can zip the iterators and check if an item has
// moved.
// TODO: If nothing has changed, return the prevChildren object so that we
// can quickly bailout if nothing has changed.
if (!nextChildren && !prevChildren) {
- return null;
+ return;
}
var name;
+ var prevChild;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
- var prevChild = prevChildren && prevChildren[name];
+ prevChild = prevChildren && prevChildren[name];
var prevElement = prevChild && prevChild._currentElement;
var nextElement = nextChildren[name];
if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
@@ -10308,20 +10661,22 @@ var ReactChildReconciler = {
nextChildren[name] = prevChild;
} else {
if (prevChild) {
- ReactReconciler.unmountComponent(prevChild, name);
+ removedNodes[name] = ReactReconciler.getNativeNode(prevChild);
+ ReactReconciler.unmountComponent(prevChild, false);
}
// The child must be instantiated before it's mounted.
- var nextChildInstance = instantiateReactComponent(nextElement, null);
+ var nextChildInstance = instantiateReactComponent(nextElement);
nextChildren[name] = nextChildInstance;
}
}
// Unmount children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
- ReactReconciler.unmountComponent(prevChildren[name]);
+ prevChild = prevChildren[name];
+ removedNodes[name] = ReactReconciler.getNativeNode(prevChild);
+ ReactReconciler.unmountComponent(prevChild, false);
}
}
- return nextChildren;
},
/**
@@ -10331,11 +10686,11 @@ var ReactChildReconciler = {
* @param {?object} renderedChildren Previously initialized set of children.
* @internal
*/
- unmountChildren: function (renderedChildren) {
+ unmountChildren: function (renderedChildren, safely) {
for (var name in renderedChildren) {
if (renderedChildren.hasOwnProperty(name)) {
var renderedChild = renderedChildren[name];
- ReactReconciler.unmountComponent(renderedChild);
+ ReactReconciler.unmountComponent(renderedChild, safely);
}
}
}
@@ -10345,9 +10700,9 @@ var ReactChildReconciler = {
module.exports = ReactChildReconciler;
}).call(this,require('_process'))
-},{"./ReactReconciler":144,"./instantiateReactComponent":193,"./shouldUpdateReactComponent":202,"./traverseAllChildren":203,"_process":27,"fbjs/lib/warning":234}],92:[function(require,module,exports){
+},{"./KeyEscapeUtils":89,"./ReactReconciler":152,"./instantiateReactComponent":193,"./shouldUpdateReactComponent":201,"./traverseAllChildren":202,"_process":29,"fbjs/lib/warning":229}],95:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -10368,9 +10723,9 @@ var traverseAllChildren = require('./traverseAllChildren');
var twoArgumentPooler = PooledClass.twoArgumentPooler;
var fourArgumentPooler = PooledClass.fourArgumentPooler;
-var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
+var userProvidedKeyEscapeRegex = /\/+/g;
function escapeUserProvidedKey(text) {
- return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
+ return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
}
/**
@@ -10450,6 +10805,7 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
var func = bookKeeping.func;
var context = bookKeeping.context;
+
var mappedChild = func.call(context, child, bookKeeping.count++);
if (Array.isArray(mappedChild)) {
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
@@ -10458,7 +10814,7 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
// Keep both the (mapped) and old keys if they differ, just as
// traverseAllChildren used to do for objects as children
- keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
+ keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
}
result.push(mappedChild);
}
@@ -10477,7 +10833,7 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
/**
* Maps children that are typically specified as `props.children`.
*
- * The provided mapFunction(child, key, index) will be called for each
+ * The provided mapFunction(child, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
@@ -10528,10 +10884,10 @@ var ReactChildren = {
};
module.exports = ReactChildren;
-},{"./PooledClass":85,"./ReactElement":117,"./traverseAllChildren":203,"fbjs/lib/emptyFunction":214}],93:[function(require,module,exports){
+},{"./PooledClass":91,"./ReactElement":127,"./traverseAllChildren":202,"fbjs/lib/emptyFunction":211}],96:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -10543,13 +10899,14 @@ module.exports = ReactChildren;
'use strict';
+var _assign = require('object-assign');
+
var ReactComponent = require('./ReactComponent');
var ReactElement = require('./ReactElement');
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
-var assign = require('./Object.assign');
var emptyObject = require('fbjs/lib/emptyObject');
var invariant = require('fbjs/lib/invariant');
var keyMirror = require('fbjs/lib/keyMirror');
@@ -10585,14 +10942,6 @@ var SpecPolicy = keyMirror({
var injectedMixins = [];
-var warnedSetProps = false;
-function warnSetProps() {
- if (!warnedSetProps) {
- warnedSetProps = true;
- process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
- }
-}
-
/**
* Composite components are higher-level components that compose other composite
* or native components.
@@ -10862,13 +11211,13 @@ var RESERVED_SPEC_KEYS = {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
}
- Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
+ Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
},
contextTypes: function (Constructor, contextTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
}
- Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
+ Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
},
/**
* Special case getDefaultProps which should move into statics but requires
@@ -10885,7 +11234,7 @@ var RESERVED_SPEC_KEYS = {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
}
- Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
+ Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
},
statics: function (Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
@@ -10897,39 +11246,40 @@ function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
// use a warning instead of an invariant so components
- // don't show up in prod but not in __DEV__
- process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
+ // don't show up in prod but only in __DEV__
+ process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0;
}
}
}
-function validateMethodOverride(proto, name) {
+function validateMethodOverride(isAlreadyDefined, name) {
var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactClassMixin.hasOwnProperty(name)) {
- !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
+ !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : void 0;
}
// Disallow defining methods more than once unless explicitly allowed.
- if (proto.hasOwnProperty(name)) {
- !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
+ if (isAlreadyDefined) {
+ !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : void 0;
}
}
/**
* Mixin helper which handles policy validation and reserved
- * specification keys when building React classses.
+ * specification keys when building React classes.
*/
function mixSpecIntoComponent(Constructor, spec) {
if (!spec) {
return;
}
- !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
- !!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
+ !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.') : invariant(false) : void 0;
+ !!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : void 0;
var proto = Constructor.prototype;
+ var autoBindPairs = proto.__reactAutoBindPairs;
// By handling mixins before any other properties, we ensure the same
// chaining order is applied to methods with DEFINE_MANY policy, whether
@@ -10949,7 +11299,8 @@ function mixSpecIntoComponent(Constructor, spec) {
}
var property = spec[name];
- validateMethodOverride(proto, name);
+ var isAlreadyDefined = proto.hasOwnProperty(name);
+ validateMethodOverride(isAlreadyDefined, name);
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
RESERVED_SPEC_KEYS[name](Constructor, property);
@@ -10959,22 +11310,18 @@ function mixSpecIntoComponent(Constructor, spec) {
// 1. Expected ReactClass methods (in the "interface").
// 2. Overridden methods (that were mixed in).
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
- var isAlreadyDefined = proto.hasOwnProperty(name);
var isFunction = typeof property === 'function';
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
if (shouldAutoBind) {
- if (!proto.__reactAutoBindMap) {
- proto.__reactAutoBindMap = {};
- }
- proto.__reactAutoBindMap[name] = property;
+ autoBindPairs.push(name, property);
proto[name] = property;
} else {
if (isAlreadyDefined) {
var specPolicy = ReactClassInterface[name];
// These cases should already be caught by validateMethodOverride.
- !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
+ !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : void 0;
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
@@ -11008,11 +11355,11 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
continue;
}
- var isReserved = (name in RESERVED_SPEC_KEYS);
- !!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
+ var isReserved = name in RESERVED_SPEC_KEYS;
+ !!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : void 0;
- var isInherited = (name in Constructor);
- !!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
+ var isInherited = name in Constructor;
+ !!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : void 0;
Constructor[name] = property;
}
}
@@ -11025,11 +11372,11 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeIntoWithNoDuplicateKeys(one, two) {
- !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
+ !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : void 0;
for (var key in two) {
if (two.hasOwnProperty(key)) {
- !(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
+ !(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : void 0;
one[key] = two[key];
}
}
@@ -11090,7 +11437,6 @@ function bindAutoBindMethod(component, method) {
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
- /* eslint-disable block-scoped-var, no-undef */
boundMethod.bind = function (newThis) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
@@ -11100,9 +11446,9 @@ function bindAutoBindMethod(component, method) {
// ignore the value of "this" that the user is trying to use, so
// let's warn.
if (newThis !== component && newThis !== null) {
- process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
} else if (!args.length) {
- process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0;
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
@@ -11110,7 +11456,6 @@ function bindAutoBindMethod(component, method) {
reboundMethod.__reactBoundMethod = method;
reboundMethod.__reactBoundArguments = args;
return reboundMethod;
- /* eslint-enable */
};
}
return boundMethod;
@@ -11122,11 +11467,11 @@ function bindAutoBindMethod(component, method) {
* @param {object} component Component whose method is going to be bound.
*/
function bindAutoBindMethods(component) {
- for (var autoBindKey in component.__reactAutoBindMap) {
- if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
- var method = component.__reactAutoBindMap[autoBindKey];
- component[autoBindKey] = bindAutoBindMethod(component, method);
- }
+ var pairs = component.__reactAutoBindPairs;
+ for (var i = 0; i < pairs.length; i += 2) {
+ var autoBindKey = pairs[i];
+ var method = pairs[i + 1];
+ component[autoBindKey] = bindAutoBindMethod(component, method);
}
}
@@ -11143,7 +11488,7 @@ var ReactClassMixin = {
replaceState: function (newState, callback) {
this.updater.enqueueReplaceState(this, newState);
if (callback) {
- this.updater.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback, 'replaceState');
}
},
@@ -11155,49 +11500,11 @@ var ReactClassMixin = {
*/
isMounted: function () {
return this.updater.isMounted(this);
- },
-
- /**
- * Sets a subset of the props.
- *
- * @param {object} partialProps Subset of the next props.
- * @param {?function} callback Called after props are updated.
- * @final
- * @public
- * @deprecated
- */
- setProps: function (partialProps, callback) {
- if (process.env.NODE_ENV !== 'production') {
- warnSetProps();
- }
- this.updater.enqueueSetProps(this, partialProps);
- if (callback) {
- this.updater.enqueueCallback(this, callback);
- }
- },
-
- /**
- * Replace all the props.
- *
- * @param {object} newProps Subset of the next props.
- * @param {?function} callback Called after props are updated.
- * @final
- * @public
- * @deprecated
- */
- replaceProps: function (newProps, callback) {
- if (process.env.NODE_ENV !== 'production') {
- warnSetProps();
- }
- this.updater.enqueueReplaceProps(this, newProps);
- if (callback) {
- this.updater.enqueueCallback(this, callback);
- }
}
};
var ReactClassComponent = function () {};
-assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
+_assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
/**
* Module for creating composite components.
@@ -11215,15 +11522,15 @@ var ReactClass = {
*/
createClass: function (spec) {
var Constructor = function (props, context, updater) {
- // This constructor is overridden by mocks. The argument is used
+ // This constructor gets overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0;
}
// Wire up auto-binding
- if (this.__reactAutoBindMap) {
+ if (this.__reactAutoBindPairs.length) {
bindAutoBindMethods(this);
}
@@ -11240,18 +11547,19 @@ var ReactClass = {
var initialState = this.getInitialState ? this.getInitialState() : null;
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
- if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
+ if (initialState === undefined && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
- !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
+ !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : void 0;
this.state = initialState;
};
Constructor.prototype = new ReactClassComponent();
Constructor.prototype.constructor = Constructor;
+ Constructor.prototype.__reactAutoBindPairs = [];
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
@@ -11275,11 +11583,11 @@ var ReactClass = {
}
}
- !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
+ !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : void 0;
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
- process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0;
+ process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0;
}
// Reduce time spent doing lookups by setting these on the prototype.
@@ -11303,10 +11611,10 @@ var ReactClass = {
module.exports = ReactClass;
}).call(this,require('_process'))
-},{"./Object.assign":84,"./ReactComponent":94,"./ReactElement":117,"./ReactNoopUpdateQueue":136,"./ReactPropTypeLocationNames":140,"./ReactPropTypeLocations":141,"_process":27,"fbjs/lib/emptyObject":215,"fbjs/lib/invariant":222,"fbjs/lib/keyMirror":226,"fbjs/lib/keyOf":227,"fbjs/lib/warning":234}],94:[function(require,module,exports){
+},{"./ReactComponent":97,"./ReactElement":127,"./ReactNoopUpdateQueue":145,"./ReactPropTypeLocationNames":148,"./ReactPropTypeLocations":149,"_process":29,"fbjs/lib/emptyObject":212,"fbjs/lib/invariant":219,"fbjs/lib/keyMirror":222,"fbjs/lib/keyOf":223,"fbjs/lib/warning":229,"object-assign":28}],97:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -11319,6 +11627,7 @@ module.exports = ReactClass;
'use strict';
var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
+var ReactInstrumentation = require('./ReactInstrumentation');
var canDefineProperty = require('./canDefineProperty');
var emptyObject = require('fbjs/lib/emptyObject');
@@ -11365,13 +11674,14 @@ ReactComponent.prototype.isReactComponent = {};
* @protected
*/
ReactComponent.prototype.setState = function (partialState, callback) {
- !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
+ !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : void 0;
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
+ ReactInstrumentation.debugTool.onSetState();
+ process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
}
this.updater.enqueueSetState(this, partialState);
if (callback) {
- this.updater.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback, 'setState');
}
};
@@ -11392,7 +11702,7 @@ ReactComponent.prototype.setState = function (partialState, callback) {
ReactComponent.prototype.forceUpdate = function (callback) {
this.updater.enqueueForceUpdate(this);
if (callback) {
- this.updater.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback, 'forceUpdate');
}
};
@@ -11403,17 +11713,14 @@ ReactComponent.prototype.forceUpdate = function (callback) {
*/
if (process.env.NODE_ENV !== 'production') {
var deprecatedAPIs = {
- getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
- replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
- replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
- setProps: ['setProps', 'Instead, call render again at the top level.']
+ replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
};
var defineDeprecationWarning = function (methodName, info) {
if (canDefineProperty) {
Object.defineProperty(ReactComponent.prototype, methodName, {
get: function () {
- process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0;
return undefined;
}
});
@@ -11429,9 +11736,9 @@ if (process.env.NODE_ENV !== 'production') {
module.exports = ReactComponent;
}).call(this,require('_process'))
-},{"./ReactNoopUpdateQueue":136,"./canDefineProperty":178,"_process":27,"fbjs/lib/emptyObject":215,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],95:[function(require,module,exports){
+},{"./ReactInstrumentation":137,"./ReactNoopUpdateQueue":145,"./canDefineProperty":177,"_process":29,"fbjs/lib/emptyObject":212,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],98:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -11443,8 +11750,9 @@ module.exports = ReactComponent;
'use strict';
+var DOMChildrenOperations = require('./DOMChildrenOperations');
var ReactDOMIDOperations = require('./ReactDOMIDOperations');
-var ReactMount = require('./ReactMount');
+var ReactPerf = require('./ReactPerf');
/**
* Abstracts away all functionality of the reconciler that requires knowledge of
@@ -11455,7 +11763,7 @@ var ReactComponentBrowserEnvironment = {
processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
- replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
+ replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup,
/**
* If a particular environment requires that some resources be cleaned up,
@@ -11464,17 +11772,19 @@ var ReactComponentBrowserEnvironment = {
*
* @private
*/
- unmountIDFromEnvironment: function (rootNodeID) {
- ReactMount.purgeID(rootNodeID);
- }
+ unmountIDFromEnvironment: function (rootNodeID) {}
};
+ReactPerf.measureMethods(ReactComponentBrowserEnvironment, 'ReactComponentBrowserEnvironment', {
+ replaceNodeWithMarkup: 'replaceNodeWithMarkup'
+});
+
module.exports = ReactComponentBrowserEnvironment;
-},{"./ReactDOMIDOperations":105,"./ReactMount":132}],96:[function(require,module,exports){
+},{"./DOMChildrenOperations":73,"./ReactDOMIDOperations":112,"./ReactPerf":147}],99:[function(require,module,exports){
(function (process){
/**
- * Copyright 2014-2015, Facebook, Inc.
+ * Copyright 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -11503,7 +11813,7 @@ var ReactComponentEnvironment = {
* Optionally injectable hook for swapping out mount images in the middle of
* the tree.
*/
- replaceNodeWithMarkupByID: null,
+ replaceNodeWithMarkup: null,
/**
* Optionally injectable hook for processing a queue of child updates. Will
@@ -11513,9 +11823,9 @@ var ReactComponentEnvironment = {
injection: {
injectEnvironment: function (environment) {
- !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
+ !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : void 0;
ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
- ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
+ ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup;
ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
injected = true;
}
@@ -11526,57 +11836,10 @@ var ReactComponentEnvironment = {
module.exports = ReactComponentEnvironment;
}).call(this,require('_process'))
-},{"_process":27,"fbjs/lib/invariant":222}],97:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactComponentWithPureRenderMixin
- */
-
-'use strict';
-
-var shallowCompare = require('./shallowCompare');
-
-/**
- * If your React component's render function is "pure", e.g. it will render the
- * same result given the same props and state, provide this Mixin for a
- * considerable performance boost.
- *
- * Most React components have pure render functions.
- *
- * Example:
- *
- * var ReactComponentWithPureRenderMixin =
- * require('ReactComponentWithPureRenderMixin');
- * React.createClass({
- * mixins: [ReactComponentWithPureRenderMixin],
- *
- * render: function() {
- * return <div className={this.props.className}>foo</div>;
- * }
- * });
- *
- * Note: This only checks shallow equality for props and state. If these contain
- * complex data structures this mixin may have false-negatives for deeper
- * differences. Only mixin to components which have simple props and state, or
- * use `forceUpdate()` when you know deep data structures have changed.
- */
-var ReactComponentWithPureRenderMixin = {
- shouldComponentUpdate: function (nextProps, nextState) {
- return shallowCompare(this, nextProps, nextState);
- }
-};
-
-module.exports = ReactComponentWithPureRenderMixin;
-},{"./shallowCompare":201}],98:[function(require,module,exports){
+},{"_process":29,"fbjs/lib/invariant":219}],100:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -11588,17 +11851,21 @@ module.exports = ReactComponentWithPureRenderMixin;
'use strict';
+var _assign = require('object-assign');
+
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactElement = require('./ReactElement');
+var ReactErrorUtils = require('./ReactErrorUtils');
var ReactInstanceMap = require('./ReactInstanceMap');
+var ReactInstrumentation = require('./ReactInstrumentation');
+var ReactNodeTypes = require('./ReactNodeTypes');
var ReactPerf = require('./ReactPerf');
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
var ReactReconciler = require('./ReactReconciler');
var ReactUpdateQueue = require('./ReactUpdateQueue');
-var assign = require('./Object.assign');
var emptyObject = require('fbjs/lib/emptyObject');
var invariant = require('fbjs/lib/invariant');
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
@@ -11618,9 +11885,21 @@ function getDeclarationErrorAddendum(component) {
function StatelessComponent(Component) {}
StatelessComponent.prototype.render = function () {
var Component = ReactInstanceMap.get(this)._currentElement.type;
- return Component(this.props, this.context, this.updater);
+ var element = Component(this.props, this.context, this.updater);
+ warnIfInvalidElement(Component, element);
+ return element;
};
+function warnIfInvalidElement(Component, element) {
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(element === null || element === false || ReactElement.isValidElement(element), '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : void 0;
+ }
+}
+
+function shouldConstruct(Component) {
+ return Component.prototype && Component.prototype.isReactComponent;
+}
+
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
@@ -11672,6 +11951,8 @@ var ReactCompositeComponentMixin = {
this._currentElement = element;
this._rootNodeID = null;
this._instance = null;
+ this._nativeParent = null;
+ this._nativeContainerInfo = null;
// See ReactUpdateQueue
this._pendingElement = null;
@@ -11679,29 +11960,35 @@ var ReactCompositeComponentMixin = {
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
+ this._renderedNodeType = null;
this._renderedComponent = null;
-
this._context = null;
this._mountOrder = 0;
this._topLevelWrapper = null;
// See ReactUpdates and ReactUpdateQueue.
this._pendingCallbacks = null;
+
+ // ComponentWillUnmount shall only be called once
+ this._calledComponentWillUnmount = false;
},
/**
* Initializes the component, renders markup, and registers event listeners.
*
- * @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {?object} nativeParent
+ * @param {?object} nativeContainerInfo
+ * @param {?object} context
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
- mountComponent: function (rootID, transaction, context) {
+ mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
this._context = context;
this._mountOrder = nextMountID++;
- this._rootNodeID = rootID;
+ this._nativeParent = nativeParent;
+ this._nativeContainerInfo = nativeContainerInfo;
var publicProps = this._processProps(this._currentElement.props);
var publicContext = this._processContext(context);
@@ -11709,30 +11996,14 @@ var ReactCompositeComponentMixin = {
var Component = this._currentElement.type;
// Initialize the public class
- var inst;
+ var inst = this._constructComponent(publicProps, publicContext);
var renderedElement;
- // This is a way to detect if Component is a stateless arrow function
- // component, which is not newable. It might not be 100% reliable but is
- // something we can do until we start detecting that Component extends
- // React.Component. We already assume that typeof Component === 'function'.
- var canInstantiate = ('prototype' in Component);
-
- if (canInstantiate) {
- if (process.env.NODE_ENV !== 'production') {
- ReactCurrentOwner.current = this;
- try {
- inst = new Component(publicProps, publicContext, ReactUpdateQueue);
- } finally {
- ReactCurrentOwner.current = null;
- }
- } else {
- inst = new Component(publicProps, publicContext, ReactUpdateQueue);
- }
- }
-
- if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) {
+ // Support functional components
+ if (!shouldConstruct(Component) && (inst == null || inst.render == null)) {
renderedElement = inst;
+ warnIfInvalidElement(Component, renderedElement);
+ !(inst === null || inst === false || ReactElement.isValidElement(inst)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : invariant(false) : void 0;
inst = new StatelessComponent(Component);
}
@@ -11740,12 +12011,13 @@ var ReactCompositeComponentMixin = {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
if (inst.render == null) {
- process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
- } else {
- // We support ES6 inheriting from React.Component, the module pattern,
- // and stateless components, but not ES6 classes that don't extend
- process.env.NODE_ENV !== 'production' ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', Component.displayName || Component.name || 'Component') : void 0;
}
+
+ var propsMutated = inst.props !== publicProps;
+ var componentName = Component.displayName || Component.name || 'Component';
+
+ process.env.NODE_ENV !== 'production' ? warning(inst.props === undefined || !propsMutated, '%s(...): When calling super() in `%s`, make sure to pass ' + 'up the same props that your component\'s constructor was passed.', componentName, componentName) : void 0;
}
// These should be set up in the constructor, but as a convenience for
@@ -11764,25 +12036,87 @@ var ReactCompositeComponentMixin = {
// Since plain JS classes are defined without any special initialization
// logic, we can not catch common errors early. Therefore, we have to
// catch them here, at initialization time, instead.
- process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
- process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
- process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
- process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
- process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
- process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
- process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0;
+ process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : void 0;
+ process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : void 0;
+ process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : void 0;
+ process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : void 0;
+ process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : void 0;
+ process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : void 0;
}
var initialState = inst.state;
if (initialState === undefined) {
inst.state = initialState = null;
}
- !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
+ !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : void 0;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
+ var markup;
+ if (inst.unstable_handleError) {
+ markup = this.performInitialMountWithErrorHandling(renderedElement, nativeParent, nativeContainerInfo, transaction, context);
+ } else {
+ markup = this.performInitialMount(renderedElement, nativeParent, nativeContainerInfo, transaction, context);
+ }
+
+ if (inst.componentDidMount) {
+ transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
+ }
+
+ return markup;
+ },
+
+ _constructComponent: function (publicProps, publicContext) {
+ if (process.env.NODE_ENV !== 'production') {
+ ReactCurrentOwner.current = this;
+ try {
+ return this._constructComponentWithoutOwner(publicProps, publicContext);
+ } finally {
+ ReactCurrentOwner.current = null;
+ }
+ } else {
+ return this._constructComponentWithoutOwner(publicProps, publicContext);
+ }
+ },
+
+ _constructComponentWithoutOwner: function (publicProps, publicContext) {
+ var Component = this._currentElement.type;
+ if (shouldConstruct(Component)) {
+ return new Component(publicProps, publicContext, ReactUpdateQueue);
+ } else {
+ return Component(publicProps, publicContext, ReactUpdateQueue);
+ }
+ },
+
+ performInitialMountWithErrorHandling: function (renderedElement, nativeParent, nativeContainerInfo, transaction, context) {
+ var markup;
+ var checkpoint = transaction.checkpoint();
+ try {
+ markup = this.performInitialMount(renderedElement, nativeParent, nativeContainerInfo, transaction, context);
+ } catch (e) {
+ // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint
+ transaction.rollback(checkpoint);
+ this._instance.unstable_handleError(e);
+ if (this._pendingStateQueue) {
+ this._instance.state = this._processPendingState(this._instance.props, this._instance.context);
+ }
+ checkpoint = transaction.checkpoint();
+
+ this._renderedComponent.unmountComponent(true);
+ transaction.rollback(checkpoint);
+
+ // Try again - we've informed the component about the error, so they can render an error message this time.
+ // If this throws again, the error will bubble up (and can be caught by a higher error boundary).
+ markup = this.performInitialMount(renderedElement, nativeParent, nativeContainerInfo, transaction, context);
+ }
+ return markup;
+ },
+
+ performInitialMount: function (renderedElement, nativeParent, nativeContainerInfo, transaction, context) {
+ var inst = this._instance;
if (inst.componentWillMount) {
inst.componentWillMount();
// When mounting, calls to `setState` by `componentWillMount` will set
@@ -11797,32 +12131,46 @@ var ReactCompositeComponentMixin = {
renderedElement = this._renderValidatedComponent();
}
+ this._renderedNodeType = ReactNodeTypes.getType(renderedElement);
this._renderedComponent = this._instantiateReactComponent(renderedElement);
- var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
- if (inst.componentDidMount) {
- transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
- }
+ var markup = ReactReconciler.mountComponent(this._renderedComponent, transaction, nativeParent, nativeContainerInfo, this._processChildContext(context));
return markup;
},
+ getNativeNode: function () {
+ return ReactReconciler.getNativeNode(this._renderedComponent);
+ },
+
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
- unmountComponent: function () {
+ unmountComponent: function (safely) {
+ if (!this._renderedComponent) {
+ return;
+ }
var inst = this._instance;
- if (inst.componentWillUnmount) {
- inst.componentWillUnmount();
+ if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
+ inst._calledComponentWillUnmount = true;
+ if (safely) {
+ var name = this.getName() + '.componentWillUnmount()';
+ ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst));
+ } else {
+ inst.componentWillUnmount();
+ }
}
- ReactReconciler.unmountComponent(this._renderedComponent);
- this._renderedComponent = null;
- this._instance = null;
+ if (this._renderedComponent) {
+ ReactReconciler.unmountComponent(this._renderedComponent, safely);
+ this._renderedNodeType = null;
+ this._renderedComponent = null;
+ this._instance = null;
+ }
// Reset pending fields
// Even if this component is scheduled for another update in ReactUpdates,
@@ -11860,13 +12208,12 @@ var ReactCompositeComponentMixin = {
* @private
*/
_maskContext: function (context) {
- var maskedContext = null;
var Component = this._currentElement.type;
var contextTypes = Component.contextTypes;
if (!contextTypes) {
return emptyObject;
}
- maskedContext = {};
+ var maskedContext = {};
for (var contextName in contextTypes) {
maskedContext[contextName] = context[contextName];
}
@@ -11900,16 +12247,22 @@ var ReactCompositeComponentMixin = {
_processChildContext: function (currentContext) {
var Component = this._currentElement.type;
var inst = this._instance;
+ if (process.env.NODE_ENV !== 'production') {
+ ReactInstrumentation.debugTool.onBeginProcessingChildContext();
+ }
var childContext = inst.getChildContext && inst.getChildContext();
+ if (process.env.NODE_ENV !== 'production') {
+ ReactInstrumentation.debugTool.onEndProcessingChildContext();
+ }
if (childContext) {
- !(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
+ !(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : void 0;
if (process.env.NODE_ENV !== 'production') {
this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
}
for (var name in childContext) {
- !(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
+ !(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : void 0;
}
- return assign({}, currentContext, childContext);
+ return _assign({}, currentContext, childContext);
}
return currentContext;
},
@@ -11951,7 +12304,7 @@ var ReactCompositeComponentMixin = {
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
- !(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
+ !(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : void 0;
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
@@ -11964,9 +12317,9 @@ var ReactCompositeComponentMixin = {
if (location === ReactPropTypeLocations.prop) {
// Preface gives us something to blacklist in warning module
- process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : void 0;
} else {
- process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : void 0;
}
}
}
@@ -11991,7 +12344,7 @@ var ReactCompositeComponentMixin = {
*/
performUpdateIfNecessary: function (transaction) {
if (this._pendingElement != null) {
- ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
+ ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
}
if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
@@ -12016,10 +12369,18 @@ var ReactCompositeComponentMixin = {
*/
updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
var inst = this._instance;
-
- var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext);
+ var willReceive = false;
+ var nextContext;
var nextProps;
+ // Determine if the context has changed or not
+ if (this._context === nextUnmaskedContext) {
+ nextContext = inst.context;
+ } else {
+ nextContext = this._processContext(nextUnmaskedContext);
+ willReceive = true;
+ }
+
// Distinguish between a props update versus a simple state update
if (prevParentElement === nextParentElement) {
// Skip checking prop types again -- we don't read inst.props to avoid
@@ -12027,13 +12388,14 @@ var ReactCompositeComponentMixin = {
nextProps = nextParentElement.props;
} else {
nextProps = this._processProps(nextParentElement.props);
- // An update here will schedule an update but immediately set
- // _pendingStateQueue which will ensure that any state updates gets
- // immediately reconciled instead of waiting for the next batch.
+ willReceive = true;
+ }
- if (inst.componentWillReceiveProps) {
- inst.componentWillReceiveProps(nextProps, nextContext);
- }
+ // An update here will schedule an update but immediately set
+ // _pendingStateQueue which will ensure that any state updates gets
+ // immediately reconciled instead of waiting for the next batch.
+ if (willReceive && inst.componentWillReceiveProps) {
+ inst.componentWillReceiveProps(nextProps, nextContext);
}
var nextState = this._processPendingState(nextProps, nextContext);
@@ -12041,7 +12403,7 @@ var ReactCompositeComponentMixin = {
var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0;
}
if (shouldUpdate) {
@@ -12074,10 +12436,10 @@ var ReactCompositeComponentMixin = {
return queue[0];
}
- var nextState = assign({}, replace ? queue[0] : inst.state);
+ var nextState = _assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
- assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
+ _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
}
return nextState;
@@ -12138,22 +12500,23 @@ var ReactCompositeComponentMixin = {
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
} else {
- // These two IDs are actually the same! But nothing should rely on that.
- var thisID = this._rootNodeID;
- var prevComponentID = prevComponentInstance._rootNodeID;
- ReactReconciler.unmountComponent(prevComponentInstance);
+ var oldNativeNode = ReactReconciler.getNativeNode(prevComponentInstance);
+ ReactReconciler.unmountComponent(prevComponentInstance, false);
+ this._renderedNodeType = ReactNodeTypes.getType(nextRenderedElement);
this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
- var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
- this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
+ var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, transaction, this._nativeParent, this._nativeContainerInfo, this._processChildContext(context));
+ this._replaceNodeWithMarkup(oldNativeNode, nextMarkup);
}
},
/**
+ * Overridden in shallow rendering.
+ *
* @protected
*/
- _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
- ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
+ _replaceNodeWithMarkup: function (oldNativeNode, nextMarkup) {
+ ReactComponentEnvironment.replaceNodeWithMarkup(oldNativeNode, nextMarkup);
},
/**
@@ -12164,7 +12527,7 @@ var ReactCompositeComponentMixin = {
var renderedComponent = inst.render();
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
- if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
+ if (renderedComponent === undefined && inst.render._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
renderedComponent = null;
@@ -12187,7 +12550,7 @@ var ReactCompositeComponentMixin = {
}
!(
// TODO: An `isValidNode` function would probably be more appropriate
- renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
+ renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : void 0;
return renderedComponent;
},
@@ -12201,11 +12564,11 @@ var ReactCompositeComponentMixin = {
*/
attachRef: function (ref, component) {
var inst = this.getPublicInstance();
- !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
+ !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : void 0;
var publicComponentInstance = component.getPublicInstance();
if (process.env.NODE_ENV !== 'production') {
var componentName = component && component.getName ? component.getName() : 'a component';
- process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : void 0;
}
var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
refs[ref] = publicComponentInstance;
@@ -12271,9 +12634,9 @@ var ReactCompositeComponent = {
module.exports = ReactCompositeComponent;
}).call(this,require('_process'))
-},{"./Object.assign":84,"./ReactComponentEnvironment":96,"./ReactCurrentOwner":99,"./ReactElement":117,"./ReactInstanceMap":128,"./ReactPerf":138,"./ReactPropTypeLocationNames":140,"./ReactPropTypeLocations":141,"./ReactReconciler":144,"./ReactUpdateQueue":155,"./shouldUpdateReactComponent":202,"_process":27,"fbjs/lib/emptyObject":215,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],99:[function(require,module,exports){
+},{"./ReactComponentEnvironment":99,"./ReactCurrentOwner":101,"./ReactElement":127,"./ReactErrorUtils":130,"./ReactInstanceMap":136,"./ReactInstrumentation":137,"./ReactNodeTypes":144,"./ReactPerf":147,"./ReactPropTypeLocationNames":148,"./ReactPropTypeLocations":149,"./ReactReconciler":152,"./ReactUpdateQueue":154,"./shouldUpdateReactComponent":201,"_process":29,"fbjs/lib/emptyObject":212,"fbjs/lib/invariant":219,"fbjs/lib/warning":229,"object-assign":28}],101:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -12291,6 +12654,7 @@ module.exports = ReactCompositeComponent;
* The current owner is the component who should own any components that are
* currently being constructed.
*/
+
var ReactCurrentOwner = {
/**
@@ -12302,10 +12666,10 @@ var ReactCurrentOwner = {
};
module.exports = ReactCurrentOwner;
-},{}],100:[function(require,module,exports){
+},{}],102:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -12319,10 +12683,8 @@ module.exports = ReactCurrentOwner;
'use strict';
-var ReactCurrentOwner = require('./ReactCurrentOwner');
-var ReactDOMTextComponent = require('./ReactDOMTextComponent');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var ReactDefaultInjection = require('./ReactDefaultInjection');
-var ReactInstanceHandles = require('./ReactInstanceHandles');
var ReactMount = require('./ReactMount');
var ReactPerf = require('./ReactPerf');
var ReactReconciler = require('./ReactReconciler');
@@ -12330,6 +12692,7 @@ var ReactUpdates = require('./ReactUpdates');
var ReactVersion = require('./ReactVersion');
var findDOMNode = require('./findDOMNode');
+var getNativeComponentFromComposite = require('./getNativeComponentFromComposite');
var renderSubtreeIntoContainer = require('./renderSubtreeIntoContainer');
var warning = require('fbjs/lib/warning');
@@ -12353,11 +12716,22 @@ var React = {
/* eslint-enable camelcase */
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
- CurrentOwner: ReactCurrentOwner,
- InstanceHandles: ReactInstanceHandles,
+ ComponentTree: {
+ getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode,
+ getNodeFromInstance: function (inst) {
+ // inst is an internal instance (but could be a composite)
+ if (inst._renderedComponent) {
+ inst = getNativeComponentFromComposite(inst);
+ }
+ if (inst) {
+ return ReactDOMComponentTree.getNodeFromInstance(inst);
+ } else {
+ return null;
+ }
+ }
+ },
Mount: ReactMount,
- Reconciler: ReactReconciler,
- TextComponent: ReactDOMTextComponent
+ Reconciler: ReactReconciler
});
}
@@ -12369,26 +12743,28 @@ if (process.env.NODE_ENV !== 'production') {
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
// If we're in Chrome or Firefox, provide a download link if not installed.
if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
- console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
+ // Firefox does not have the issue with devtools loaded over file://
+ var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1;
+ console.debug('Download the React DevTools ' + (showFileUrlMessage ? 'and use an HTTP server (instead of a file: URL) ' : '') + 'for a better development experience: ' + 'https://fb.me/react-devtools');
}
}
+ var testFunc = function testFn() {};
+ process.env.NODE_ENV !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, 'It looks like you\'re using a minified copy of the development build ' + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0;
+
// If we're in IE8, check to see if we are in compatibility mode and provide
// information on preventing compatibility mode
var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
- process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : void 0;
var expectedFeatures = [
// shims
- Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
-
- // shams
- Object.create, Object.freeze];
+ Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim];
for (var i = 0; i < expectedFeatures.length; i++) {
if (!expectedFeatures[i]) {
- console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
+ process.env.NODE_ENV !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0;
break;
}
}
@@ -12398,9 +12774,9 @@ if (process.env.NODE_ENV !== 'production') {
module.exports = React;
}).call(this,require('_process'))
-},{"./ReactCurrentOwner":99,"./ReactDOMTextComponent":111,"./ReactDefaultInjection":114,"./ReactInstanceHandles":127,"./ReactMount":132,"./ReactPerf":138,"./ReactReconciler":144,"./ReactUpdates":156,"./ReactVersion":157,"./findDOMNode":183,"./renderSubtreeIntoContainer":198,"_process":27,"fbjs/lib/ExecutionEnvironment":208,"fbjs/lib/warning":234}],101:[function(require,module,exports){
+},{"./ReactDOMComponentTree":106,"./ReactDefaultInjection":124,"./ReactMount":140,"./ReactPerf":147,"./ReactReconciler":152,"./ReactUpdates":155,"./ReactVersion":156,"./findDOMNode":181,"./getNativeComponentFromComposite":189,"./renderSubtreeIntoContainer":198,"_process":29,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/warning":229}],103:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -12412,47 +12788,21 @@ module.exports = React;
'use strict';
-var mouseListenerNames = {
- onClick: true,
- onDoubleClick: true,
- onMouseDown: true,
- onMouseMove: true,
- onMouseUp: true,
-
- onClickCapture: true,
- onDoubleClickCapture: true,
- onMouseDownCapture: true,
- onMouseMoveCapture: true,
- onMouseUpCapture: true
-};
+var DisabledInputUtils = require('./DisabledInputUtils');
/**
* Implements a <button> native component that does not receive mouse events
* when `disabled` is set.
*/
var ReactDOMButton = {
- getNativeProps: function (inst, props, context) {
- if (!props.disabled) {
- return props;
- }
-
- // Copy the props, except the mouse listeners
- var nativeProps = {};
- for (var key in props) {
- if (props.hasOwnProperty(key) && !mouseListenerNames[key]) {
- nativeProps[key] = props[key];
- }
- }
-
- return nativeProps;
- }
+ getNativeProps: DisabledInputUtils.getNativeProps
};
module.exports = ReactDOMButton;
-},{}],102:[function(require,module,exports){
+},{"./DisabledInputUtils":80}],104:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -12460,54 +12810,62 @@ module.exports = ReactDOMButton;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMComponent
- * @typechecks static-only
*/
/* global hasOwnProperty:true */
'use strict';
+var _assign = require('object-assign');
+
var AutoFocusUtils = require('./AutoFocusUtils');
var CSSPropertyOperations = require('./CSSPropertyOperations');
+var DOMLazyTree = require('./DOMLazyTree');
+var DOMNamespaces = require('./DOMNamespaces');
var DOMProperty = require('./DOMProperty');
var DOMPropertyOperations = require('./DOMPropertyOperations');
var EventConstants = require('./EventConstants');
+var EventPluginHub = require('./EventPluginHub');
+var EventPluginRegistry = require('./EventPluginRegistry');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
var ReactDOMButton = require('./ReactDOMButton');
+var ReactDOMComponentFlags = require('./ReactDOMComponentFlags');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var ReactDOMInput = require('./ReactDOMInput');
var ReactDOMOption = require('./ReactDOMOption');
var ReactDOMSelect = require('./ReactDOMSelect');
var ReactDOMTextarea = require('./ReactDOMTextarea');
-var ReactMount = require('./ReactMount');
var ReactMultiChild = require('./ReactMultiChild');
var ReactPerf = require('./ReactPerf');
-var ReactUpdateQueue = require('./ReactUpdateQueue');
-var assign = require('./Object.assign');
-var canDefineProperty = require('./canDefineProperty');
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
var invariant = require('fbjs/lib/invariant');
var isEventSupported = require('./isEventSupported');
var keyOf = require('fbjs/lib/keyOf');
-var setInnerHTML = require('./setInnerHTML');
-var setTextContent = require('./setTextContent');
var shallowEqual = require('fbjs/lib/shallowEqual');
var validateDOMNesting = require('./validateDOMNesting');
var warning = require('fbjs/lib/warning');
-var deleteListener = ReactBrowserEventEmitter.deleteListener;
+var Flags = ReactDOMComponentFlags;
+var deleteListener = EventPluginHub.deleteListener;
+var getNode = ReactDOMComponentTree.getNodeFromInstance;
var listenTo = ReactBrowserEventEmitter.listenTo;
-var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
+var registrationNameModules = EventPluginRegistry.registrationNameModules;
// For quickly matching children type, to test if can be treated as content.
var CONTENT_TYPES = { 'string': true, 'number': true };
-var CHILDREN = keyOf({ children: null });
var STYLE = keyOf({ style: null });
var HTML = keyOf({ __html: null });
+var RESERVED_PROPS = {
+ children: null,
+ dangerouslySetInnerHTML: null,
+ suppressContentEditableWarning: null
+};
-var ELEMENT_NODE_TYPE = 1;
+// Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE).
+var DOC_FRAGMENT_TYPE = 11;
function getDeclarationErrorAddendum(internalInstance) {
if (internalInstance) {
@@ -12522,71 +12880,6 @@ function getDeclarationErrorAddendum(internalInstance) {
return '';
}
-var legacyPropsDescriptor;
-if (process.env.NODE_ENV !== 'production') {
- legacyPropsDescriptor = {
- props: {
- enumerable: false,
- get: function () {
- var component = this._reactInternalComponent;
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
- return component._currentElement.props;
- }
- }
- };
-}
-
-function legacyGetDOMNode() {
- if (process.env.NODE_ENV !== 'production') {
- var component = this._reactInternalComponent;
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
- }
- return this;
-}
-
-function legacyIsMounted() {
- var component = this._reactInternalComponent;
- if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
- }
- return !!component;
-}
-
-function legacySetStateEtc() {
- if (process.env.NODE_ENV !== 'production') {
- var component = this._reactInternalComponent;
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
- }
-}
-
-function legacySetProps(partialProps, callback) {
- var component = this._reactInternalComponent;
- if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
- }
- if (!component) {
- return;
- }
- ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
- if (callback) {
- ReactUpdateQueue.enqueueCallbackInternal(component, callback);
- }
-}
-
-function legacyReplaceProps(partialProps, callback) {
- var component = this._reactInternalComponent;
- if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
- }
- if (!component) {
- return;
- }
- ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
- if (callback) {
- ReactUpdateQueue.enqueueCallbackInternal(component, callback);
- }
-}
-
function friendlyStringify(obj) {
if (typeof obj === 'object') {
if (Array.isArray(obj)) {
@@ -12606,7 +12899,7 @@ function friendlyStringify(obj) {
} else if (typeof obj === 'function') {
return '[function object]';
}
- // Differs from JSON.stringify in that undefined becauses undefined and that
+ // Differs from JSON.stringify in that undefined because undefined and that
// inf and nan don't become null
return String(obj);
}
@@ -12636,7 +12929,7 @@ function checkAndWarnForMutatedStyle(style1, style2, component) {
styleMutationWarning[hash] = true;
- process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : void 0;
}
/**
@@ -12648,35 +12941,37 @@ function assertValidProps(component, props) {
return;
}
// Note the use of `==` which checks for null or undefined.
- if (process.env.NODE_ENV !== 'production') {
- if (voidElementTags[component._tag]) {
- process.env.NODE_ENV !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
- }
+ if (voidElementTags[component._tag]) {
+ !(props.children == null && props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : invariant(false) : void 0;
}
if (props.dangerouslySetInnerHTML != null) {
- !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
- !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
+ !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : void 0;
+ !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : void 0;
}
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
- process.env.NODE_ENV !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : void 0;
+ process.env.NODE_ENV !== 'production' ? warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
+ process.env.NODE_ENV !== 'production' ? warning(props.onFocusIn == null && props.onFocusOut == null, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.') : void 0;
}
- !(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
+ !(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : void 0;
}
-function enqueuePutListener(id, registrationName, listener, transaction) {
+function enqueuePutListener(inst, registrationName, listener, transaction) {
if (process.env.NODE_ENV !== 'production') {
// IE8 has no API for event capturing and the `onScroll` event doesn't
// bubble.
- process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0;
}
- var container = ReactMount.findReactContainerForID(id);
- if (container) {
- var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
- listenTo(registrationName, doc);
+ var containerInfo = inst._nativeContainerInfo;
+ var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
+ var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
+ if (!doc) {
+ // Server rendering.
+ return;
}
+ listenTo(registrationName, doc);
transaction.getReactMountReady().enqueue(putListener, {
- id: id,
+ inst: inst,
registrationName: registrationName,
listener: listener
});
@@ -12684,7 +12979,12 @@ function enqueuePutListener(id, registrationName, listener, transaction) {
function putListener() {
var listenerToPut = this;
- ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
+ EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener);
+}
+
+function optionPostMount() {
+ var inst = this;
+ ReactDOMOption.postMountWrapper(inst);
}
// There are so many media events, it makes sense to just
@@ -12719,19 +13019,20 @@ function trapBubbledEventsLocal() {
var inst = this;
// If a component renders to null or if another component fatals and causes
// the state of the tree to be corrupted, `node` here can be null.
- !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
- var node = ReactMount.getNode(inst._rootNodeID);
- !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
+ !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : void 0;
+ var node = getNode(inst);
+ !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : void 0;
switch (inst._tag) {
case 'iframe':
+ case 'object':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
break;
case 'video':
case 'audio':
inst._wrapperState.listeners = [];
- // create listener for each media event
+ // Create listener for each media event
for (var event in mediaEvents) {
if (mediaEvents.hasOwnProperty(event)) {
inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
@@ -12745,19 +13046,20 @@ function trapBubbledEventsLocal() {
case 'form':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
break;
+ case 'input':
+ case 'select':
+ case 'textarea':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topInvalid, 'invalid', node)];
+ break;
}
}
-function mountReadyInputWrapper() {
- ReactDOMInput.mountReadyWrapper(this);
-}
-
function postUpdateSelectWrapper() {
ReactDOMSelect.postUpdateWrapper(this);
}
// For HTML, certain tags should omit their close tag. We keep a whitelist for
-// those special cased tags.
+// those special-case tags.
var omittedCloseTags = {
'area': true,
@@ -12787,7 +13089,7 @@ var newlineEatingTags = {
// For HTML, certain tags cannot have children. This has the same purpose as
// `omittedCloseTags` except that `menuitem` should still have its closing tag.
-var voidElementTags = assign({
+var voidElementTags = _assign({
'menuitem': true
}, omittedCloseTags);
@@ -12797,27 +13099,21 @@ var voidElementTags = assign({
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
var validatedTagCache = {};
-var hasOwnProperty = ({}).hasOwnProperty;
+var hasOwnProperty = {}.hasOwnProperty;
function validateDangerousTag(tag) {
if (!hasOwnProperty.call(validatedTagCache, tag)) {
- !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
+ !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : void 0;
validatedTagCache[tag] = true;
}
}
-function processChildContextDev(context, inst) {
- // Pass down our tag name to child components for validation purposes
- context = assign({}, context);
- var info = context[validateDOMNesting.ancestorInfoContextKey];
- context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
- return context;
-}
-
function isCustomComponent(tagName, props) {
return tagName.indexOf('-') >= 0 || props.is != null;
}
+var globalIdCounter = 1;
+
/**
* Creates a new React class that is idempotent and capable of containing other
* React components. It accepts event listeners and DOM properties that are
@@ -12832,19 +13128,25 @@ function isCustomComponent(tagName, props) {
* @constructor ReactDOMComponent
* @extends ReactMultiChild
*/
-function ReactDOMComponent(tag) {
+function ReactDOMComponent(element) {
+ var tag = element.type;
validateDangerousTag(tag);
+ this._currentElement = element;
this._tag = tag.toLowerCase();
+ this._namespaceURI = null;
this._renderedChildren = null;
this._previousStyle = null;
this._previousStyleCopy = null;
+ this._nativeNode = null;
+ this._nativeParent = null;
this._rootNodeID = null;
+ this._domID = null;
+ this._nativeContainerInfo = null;
this._wrapperState = null;
this._topLevelWrapper = null;
- this._nodeWithLegacyProperties = null;
+ this._flags = 0;
if (process.env.NODE_ENV !== 'production') {
- this._unprocessedContextDev = null;
- this._processedContextDev = null;
+ this._ancestorInfo = null;
}
}
@@ -12852,27 +13154,28 @@ ReactDOMComponent.displayName = 'ReactDOMComponent';
ReactDOMComponent.Mixin = {
- construct: function (element) {
- this._currentElement = element;
- },
-
/**
* Generates root tag markup then recurses. This method has side effects and
* is not idempotent.
*
* @internal
- * @param {string} rootID The root DOM ID for this node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {?ReactDOMComponent} the containing DOM component instance
+ * @param {?object} info about the native container
* @param {object} context
* @return {string} The computed markup.
*/
- mountComponent: function (rootID, transaction, context) {
- this._rootNodeID = rootID;
+ mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
+ this._rootNodeID = globalIdCounter++;
+ this._domID = nativeContainerInfo._idCounter++;
+ this._nativeParent = nativeParent;
+ this._nativeContainerInfo = nativeContainerInfo;
var props = this._currentElement.props;
switch (this._tag) {
case 'iframe':
+ case 'object':
case 'img':
case 'form':
case 'video':
@@ -12883,50 +13186,96 @@ ReactDOMComponent.Mixin = {
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
case 'button':
- props = ReactDOMButton.getNativeProps(this, props, context);
+ props = ReactDOMButton.getNativeProps(this, props, nativeParent);
break;
case 'input':
- ReactDOMInput.mountWrapper(this, props, context);
- props = ReactDOMInput.getNativeProps(this, props, context);
+ ReactDOMInput.mountWrapper(this, props, nativeParent);
+ props = ReactDOMInput.getNativeProps(this, props);
+ transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
case 'option':
- ReactDOMOption.mountWrapper(this, props, context);
- props = ReactDOMOption.getNativeProps(this, props, context);
+ ReactDOMOption.mountWrapper(this, props, nativeParent);
+ props = ReactDOMOption.getNativeProps(this, props);
break;
case 'select':
- ReactDOMSelect.mountWrapper(this, props, context);
- props = ReactDOMSelect.getNativeProps(this, props, context);
- context = ReactDOMSelect.processChildContext(this, props, context);
+ ReactDOMSelect.mountWrapper(this, props, nativeParent);
+ props = ReactDOMSelect.getNativeProps(this, props);
+ transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
case 'textarea':
- ReactDOMTextarea.mountWrapper(this, props, context);
- props = ReactDOMTextarea.getNativeProps(this, props, context);
+ ReactDOMTextarea.mountWrapper(this, props, nativeParent);
+ props = ReactDOMTextarea.getNativeProps(this, props);
+ transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
}
assertValidProps(this, props);
- if (process.env.NODE_ENV !== 'production') {
- if (context[validateDOMNesting.ancestorInfoContextKey]) {
- validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
+
+ // We create tags in the namespace of their parent container, except HTML
+ // tags get no namespace.
+ var namespaceURI;
+ var parentTag;
+ if (nativeParent != null) {
+ namespaceURI = nativeParent._namespaceURI;
+ parentTag = nativeParent._tag;
+ } else if (nativeContainerInfo._tag) {
+ namespaceURI = nativeContainerInfo._namespaceURI;
+ parentTag = nativeContainerInfo._tag;
+ }
+ if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') {
+ namespaceURI = DOMNamespaces.html;
+ }
+ if (namespaceURI === DOMNamespaces.html) {
+ if (this._tag === 'svg') {
+ namespaceURI = DOMNamespaces.svg;
+ } else if (this._tag === 'math') {
+ namespaceURI = DOMNamespaces.mathml;
}
}
+ this._namespaceURI = namespaceURI;
if (process.env.NODE_ENV !== 'production') {
- this._unprocessedContextDev = context;
- this._processedContextDev = processChildContextDev(context, this);
- context = this._processedContextDev;
+ var parentInfo;
+ if (nativeParent != null) {
+ parentInfo = nativeParent._ancestorInfo;
+ } else if (nativeContainerInfo._tag) {
+ parentInfo = nativeContainerInfo._ancestorInfo;
+ }
+ if (parentInfo) {
+ // parentInfo should always be present except for the top-level
+ // component when server rendering
+ validateDOMNesting(this._tag, this, parentInfo);
+ }
+ this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this);
}
var mountImage;
if (transaction.useCreateElement) {
- var ownerDocument = context[ReactMount.ownerDocumentContextKey];
- var el = ownerDocument.createElement(this._currentElement.type);
- DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
- // Populate node cache
- ReactMount.getID(el);
- this._updateDOMProperties({}, props, transaction, el);
- this._createInitialChildren(transaction, props, context, el);
- mountImage = el;
+ var ownerDocument = nativeContainerInfo._ownerDocument;
+ var el;
+ if (namespaceURI === DOMNamespaces.html) {
+ if (this._tag === 'script') {
+ // Create the script via .innerHTML so its "parser-inserted" flag is
+ // set to true and it does not execute
+ var div = ownerDocument.createElement('div');
+ var type = this._currentElement.type;
+ div.innerHTML = '<' + type + '></' + type + '>';
+ el = div.removeChild(div.firstChild);
+ } else {
+ el = ownerDocument.createElement(this._currentElement.type);
+ }
+ } else {
+ el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type);
+ }
+ ReactDOMComponentTree.precacheNode(this, el);
+ this._flags |= Flags.hasCachedChildNodes;
+ if (!this._nativeParent) {
+ DOMPropertyOperations.setAttributeForRoot(el);
+ }
+ this._updateDOMProperties(null, props, transaction);
+ var lazyTree = DOMLazyTree(el);
+ this._createInitialChildren(transaction, props, context, lazyTree);
+ mountImage = lazyTree;
} else {
var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
var tagContent = this._createContentMarkup(transaction, props, context);
@@ -12938,16 +13287,16 @@ ReactDOMComponent.Mixin = {
}
switch (this._tag) {
- case 'input':
- transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
- // falls through
case 'button':
+ case 'input':
case 'select':
case 'textarea':
if (props.autoFocus) {
transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
}
break;
+ case 'option':
+ transaction.getReactMountReady().enqueue(optionPostMount, this);
}
return mountImage;
@@ -12979,7 +13328,7 @@ ReactDOMComponent.Mixin = {
}
if (registrationNameModules.hasOwnProperty(propKey)) {
if (propValue) {
- enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
+ enqueuePutListener(this, propKey, propValue, transaction);
}
} else {
if (propKey === STYLE) {
@@ -12988,13 +13337,13 @@ ReactDOMComponent.Mixin = {
// See `_updateDOMProperties`. style block
this._previousStyle = propValue;
}
- propValue = this._previousStyleCopy = assign({}, props.style);
+ propValue = this._previousStyleCopy = _assign({}, props.style);
}
- propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
+ propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this);
}
var markup = null;
if (this._tag != null && isCustomComponent(this._tag, props)) {
- if (propKey !== CHILDREN) {
+ if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
}
} else {
@@ -13012,8 +13361,11 @@ ReactDOMComponent.Mixin = {
return ret;
}
- var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
- return ret + ' ' + markupForID;
+ if (!this._nativeParent) {
+ ret += ' ' + DOMPropertyOperations.createMarkupForRoot();
+ }
+ ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID);
+ return ret;
},
/**
@@ -13062,23 +13414,23 @@ ReactDOMComponent.Mixin = {
}
},
- _createInitialChildren: function (transaction, props, context, el) {
+ _createInitialChildren: function (transaction, props, context, lazyTree) {
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
- setInnerHTML(el, innerHTML.__html);
+ DOMLazyTree.queueHTML(lazyTree, innerHTML.__html);
}
} else {
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
// TODO: Validate that text is allowed as a child of this node
- setTextContent(el, contentToUse);
+ DOMLazyTree.queueText(lazyTree, contentToUse);
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(childrenToUse, transaction, context);
for (var i = 0; i < mountImages.length; i++) {
- el.appendChild(mountImages[i]);
+ DOMLazyTree.queueChild(lazyTree, mountImages[i]);
}
}
}
@@ -13137,25 +13489,10 @@ ReactDOMComponent.Mixin = {
break;
}
- if (process.env.NODE_ENV !== 'production') {
- // If the context is reference-equal to the old one, pass down the same
- // processed object so the update bailout in ReactReconciler behaves
- // correctly (and identically in dev and prod). See #5005.
- if (this._unprocessedContextDev !== context) {
- this._unprocessedContextDev = context;
- this._processedContextDev = processChildContextDev(context, this);
- }
- context = this._processedContextDev;
- }
-
assertValidProps(this, nextProps);
- this._updateDOMProperties(lastProps, nextProps, transaction, null);
+ this._updateDOMProperties(lastProps, nextProps, transaction);
this._updateDOMChildren(lastProps, nextProps, transaction, context);
- if (!canDefineProperty && this._nodeWithLegacyProperties) {
- this._nodeWithLegacyProperties.props = nextProps;
- }
-
if (this._tag === 'select') {
// <select> value update needs to occur after <option> children
// reconciliation
@@ -13177,15 +13514,14 @@ ReactDOMComponent.Mixin = {
* @private
* @param {object} lastProps
* @param {object} nextProps
- * @param {ReactReconcileTransaction} transaction
* @param {?DOMElement} node
*/
- _updateDOMProperties: function (lastProps, nextProps, transaction, node) {
+ _updateDOMProperties: function (lastProps, nextProps, transaction) {
var propKey;
var styleName;
var styleUpdates;
for (propKey in lastProps) {
- if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
+ if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
continue;
}
if (propKey === STYLE) {
@@ -13202,19 +13538,16 @@ ReactDOMComponent.Mixin = {
// Only call deleteListener if there was a listener previously or
// else willDeleteListener gets called when there wasn't actually a
// listener (e.g., onClick={null})
- deleteListener(this._rootNodeID, propKey);
+ deleteListener(this, propKey);
}
} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
- if (!node) {
- node = ReactMount.getNode(this._rootNodeID);
- }
- DOMPropertyOperations.deleteValueForProperty(node, propKey);
+ DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey);
}
}
for (propKey in nextProps) {
var nextProp = nextProps[propKey];
- var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
- if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
+ var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined;
+ if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
continue;
}
if (propKey === STYLE) {
@@ -13223,7 +13556,7 @@ ReactDOMComponent.Mixin = {
checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
this._previousStyle = nextProp;
}
- nextProp = this._previousStyleCopy = assign({}, nextProp);
+ nextProp = this._previousStyleCopy = _assign({}, nextProp);
} else {
this._previousStyleCopy = null;
}
@@ -13248,24 +13581,18 @@ ReactDOMComponent.Mixin = {
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
if (nextProp) {
- enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
+ enqueuePutListener(this, propKey, nextProp, transaction);
} else if (lastProp) {
- deleteListener(this._rootNodeID, propKey);
+ deleteListener(this, propKey);
}
} else if (isCustomComponent(this._tag, nextProps)) {
- if (!node) {
- node = ReactMount.getNode(this._rootNodeID);
+ if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
+ DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp);
}
- if (propKey === CHILDREN) {
- nextProp = null;
- }
- DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
- if (!node) {
- node = ReactMount.getNode(this._rootNodeID);
- }
+ var node = getNode(this);
// If we're updating to null or undefined, we should remove the property
- // from the DOM node instead of inadvertantly setting to a string. This
+ // from the DOM node instead of inadvertently setting to a string. This
// brings us in line with the same behavior we have on initial render.
if (nextProp != null) {
DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
@@ -13275,10 +13602,7 @@ ReactDOMComponent.Mixin = {
}
}
if (styleUpdates) {
- if (!node) {
- node = ReactMount.getNode(this._rootNodeID);
- }
- CSSPropertyOperations.setValueForStyles(node, styleUpdates);
+ CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this);
}
},
@@ -13325,15 +13649,20 @@ ReactDOMComponent.Mixin = {
}
},
+ getNativeNode: function () {
+ return getNode(this);
+ },
+
/**
* Destroys all event registrations for this instance. Does not remove from
* the DOM. That must be done by the parent.
*
* @internal
*/
- unmountComponent: function () {
+ unmountComponent: function (safely) {
switch (this._tag) {
case 'iframe':
+ case 'object':
case 'img':
case 'form':
case 'video':
@@ -13345,9 +13674,6 @@ ReactDOMComponent.Mixin = {
}
}
break;
- case 'input':
- ReactDOMInput.unmountWrapper(this);
- break;
case 'html':
case 'head':
case 'body':
@@ -13357,68 +13683,411 @@ ReactDOMComponent.Mixin = {
* take advantage of React's reconciliation for styling and <title>
* management. So we just document it and throw in dangerous cases.
*/
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : void 0;
break;
}
- this.unmountChildren();
- ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
+ this.unmountChildren(safely);
+ ReactDOMComponentTree.uncacheNode(this);
+ EventPluginHub.deleteAllListeners(this);
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
this._rootNodeID = null;
+ this._domID = null;
this._wrapperState = null;
- if (this._nodeWithLegacyProperties) {
- var node = this._nodeWithLegacyProperties;
- node._reactInternalComponent = null;
- this._nodeWithLegacyProperties = null;
- }
},
getPublicInstance: function () {
- if (!this._nodeWithLegacyProperties) {
- var node = ReactMount.getNode(this._rootNodeID);
-
- node._reactInternalComponent = this;
- node.getDOMNode = legacyGetDOMNode;
- node.isMounted = legacyIsMounted;
- node.setState = legacySetStateEtc;
- node.replaceState = legacySetStateEtc;
- node.forceUpdate = legacySetStateEtc;
- node.setProps = legacySetProps;
- node.replaceProps = legacyReplaceProps;
+ return getNode(this);
+ }
- if (process.env.NODE_ENV !== 'production') {
- if (canDefineProperty) {
- Object.defineProperties(node, legacyPropsDescriptor);
- } else {
- // updateComponent will update this property on subsequent renders
- node.props = this._currentElement.props;
- }
- } else {
- // updateComponent will update this property on subsequent renders
- node.props = this._currentElement.props;
+};
+
+ReactPerf.measureMethods(ReactDOMComponent.Mixin, 'ReactDOMComponent', {
+ mountComponent: 'mountComponent',
+ receiveComponent: 'receiveComponent'
+});
+
+_assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
+
+module.exports = ReactDOMComponent;
+}).call(this,require('_process'))
+
+},{"./AutoFocusUtils":67,"./CSSPropertyOperations":70,"./DOMLazyTree":74,"./DOMNamespaces":75,"./DOMProperty":76,"./DOMPropertyOperations":77,"./EventConstants":82,"./EventPluginHub":83,"./EventPluginRegistry":84,"./ReactBrowserEventEmitter":93,"./ReactComponentBrowserEnvironment":98,"./ReactDOMButton":103,"./ReactDOMComponentFlags":105,"./ReactDOMComponentTree":106,"./ReactDOMInput":113,"./ReactDOMOption":115,"./ReactDOMSelect":116,"./ReactDOMTextarea":119,"./ReactMultiChild":141,"./ReactPerf":147,"./escapeTextContentForBrowser":180,"./isEventSupported":194,"./validateDOMNesting":203,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/keyOf":223,"fbjs/lib/shallowEqual":228,"fbjs/lib/warning":229,"object-assign":28}],105:[function(require,module,exports){
+/**
+ * Copyright 2015-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMComponentFlags
+ */
+
+'use strict';
+
+var ReactDOMComponentFlags = {
+ hasCachedChildNodes: 1 << 0
+};
+
+module.exports = ReactDOMComponentFlags;
+},{}],106:[function(require,module,exports){
+(function (process){
+/**
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMComponentTree
+ */
+
+'use strict';
+
+var DOMProperty = require('./DOMProperty');
+var ReactDOMComponentFlags = require('./ReactDOMComponentFlags');
+
+var invariant = require('fbjs/lib/invariant');
+
+var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
+var Flags = ReactDOMComponentFlags;
+
+var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
+
+/**
+ * Drill down (through composites and empty components) until we get a native or
+ * native text component.
+ *
+ * This is pretty polymorphic but unavoidable with the current structure we have
+ * for `_renderedChildren`.
+ */
+function getRenderedNativeOrTextFromComponent(component) {
+ var rendered;
+ while (rendered = component._renderedComponent) {
+ component = rendered;
+ }
+ return component;
+}
+
+/**
+ * Populate `_nativeNode` on the rendered native/text component with the given
+ * DOM node. The passed `inst` can be a composite.
+ */
+function precacheNode(inst, node) {
+ var nativeInst = getRenderedNativeOrTextFromComponent(inst);
+ nativeInst._nativeNode = node;
+ node[internalInstanceKey] = nativeInst;
+}
+
+function uncacheNode(inst) {
+ var node = inst._nativeNode;
+ if (node) {
+ delete node[internalInstanceKey];
+ inst._nativeNode = null;
+ }
+}
+
+/**
+ * Populate `_nativeNode` on each child of `inst`, assuming that the children
+ * match up with the DOM (element) children of `node`.
+ *
+ * We cache entire levels at once to avoid an n^2 problem where we access the
+ * children of a node sequentially and have to walk from the start to our target
+ * node every time.
+ *
+ * Since we update `_renderedChildren` and the actual DOM at (slightly)
+ * different times, we could race here and see a newer `_renderedChildren` than
+ * the DOM nodes we see. To avoid this, ReactMultiChild calls
+ * `prepareToManageChildren` before we change `_renderedChildren`, at which
+ * time the container's child nodes are always cached (until it unmounts).
+ */
+function precacheChildNodes(inst, node) {
+ if (inst._flags & Flags.hasCachedChildNodes) {
+ return;
+ }
+ var children = inst._renderedChildren;
+ var childNode = node.firstChild;
+ outer: for (var name in children) {
+ if (!children.hasOwnProperty(name)) {
+ continue;
+ }
+ var childInst = children[name];
+ var childID = getRenderedNativeOrTextFromComponent(childInst)._domID;
+ if (childID == null) {
+ // We're currently unmounting this child in ReactMultiChild; skip it.
+ continue;
+ }
+ // We assume the child nodes are in the same order as the child instances.
+ for (; childNode !== null; childNode = childNode.nextSibling) {
+ if (childNode.nodeType === 1 && childNode.getAttribute(ATTR_NAME) === String(childID) || childNode.nodeType === 8 && childNode.nodeValue === ' react-text: ' + childID + ' ' || childNode.nodeType === 8 && childNode.nodeValue === ' react-empty: ' + childID + ' ') {
+ precacheNode(childInst, childNode);
+ continue outer;
}
+ }
+ // We reached the end of the DOM children without finding an ID match.
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : invariant(false) : void 0;
+ }
+ inst._flags |= Flags.hasCachedChildNodes;
+}
+
+/**
+ * Given a DOM node, return the closest ReactDOMComponent or
+ * ReactDOMTextComponent instance ancestor.
+ */
+function getClosestInstanceFromNode(node) {
+ if (node[internalInstanceKey]) {
+ return node[internalInstanceKey];
+ }
- this._nodeWithLegacyProperties = node;
+ // Walk up the tree until we find an ancestor whose instance we have cached.
+ var parents = [];
+ while (!node[internalInstanceKey]) {
+ parents.push(node);
+ if (node.parentNode) {
+ node = node.parentNode;
+ } else {
+ // Top of the tree. This node must not be part of a React tree (or is
+ // unmounted, potentially).
+ return null;
}
- return this._nodeWithLegacyProperties;
}
+ var closest;
+ var inst;
+ for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
+ closest = inst;
+ if (parents.length) {
+ precacheChildNodes(inst, node);
+ }
+ }
+
+ return closest;
+}
+
+/**
+ * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
+ * instance, or null if the node was not rendered by this React.
+ */
+function getInstanceFromNode(node) {
+ var inst = getClosestInstanceFromNode(node);
+ if (inst != null && inst._nativeNode === node) {
+ return inst;
+ } else {
+ return null;
+ }
+}
+
+/**
+ * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
+ * DOM node.
+ */
+function getNodeFromInstance(inst) {
+ // Without this first invariant, passing a non-DOM-component triggers the next
+ // invariant for a missing parent, which is super confusing.
+ !(inst._nativeNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : void 0;
+
+ if (inst._nativeNode) {
+ return inst._nativeNode;
+ }
+
+ // Walk up the tree until we find an ancestor whose DOM node we have cached.
+ var parents = [];
+ while (!inst._nativeNode) {
+ parents.push(inst);
+ !inst._nativeParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : invariant(false) : void 0;
+ inst = inst._nativeParent;
+ }
+
+ // Now parents contains each ancestor that does *not* have a cached native
+ // node, and `inst` is the deepest ancestor that does.
+ for (; parents.length; inst = parents.pop()) {
+ precacheChildNodes(inst, inst._nativeNode);
+ }
+
+ return inst._nativeNode;
+}
+
+var ReactDOMComponentTree = {
+ getClosestInstanceFromNode: getClosestInstanceFromNode,
+ getInstanceFromNode: getInstanceFromNode,
+ getNodeFromInstance: getNodeFromInstance,
+ precacheChildNodes: precacheChildNodes,
+ precacheNode: precacheNode,
+ uncacheNode: uncacheNode
};
-ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
- mountComponent: 'mountComponent',
- updateComponent: 'updateComponent'
-});
+module.exports = ReactDOMComponentTree;
+}).call(this,require('_process'))
-assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
+},{"./DOMProperty":76,"./ReactDOMComponentFlags":105,"_process":29,"fbjs/lib/invariant":219}],107:[function(require,module,exports){
+(function (process){
+/**
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMContainerInfo
+ */
-module.exports = ReactDOMComponent;
+'use strict';
+
+var validateDOMNesting = require('./validateDOMNesting');
+
+var DOC_NODE_TYPE = 9;
+
+function ReactDOMContainerInfo(topLevelWrapper, node) {
+ var info = {
+ _topLevelWrapper: topLevelWrapper,
+ _idCounter: 1,
+ _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null,
+ _node: node,
+ _tag: node ? node.nodeName.toLowerCase() : null,
+ _namespaceURI: node ? node.namespaceURI : null
+ };
+ if (process.env.NODE_ENV !== 'production') {
+ info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null;
+ }
+ return info;
+}
+
+module.exports = ReactDOMContainerInfo;
}).call(this,require('_process'))
-},{"./AutoFocusUtils":62,"./CSSPropertyOperations":65,"./DOMProperty":70,"./DOMPropertyOperations":71,"./EventConstants":75,"./Object.assign":84,"./ReactBrowserEventEmitter":88,"./ReactComponentBrowserEnvironment":95,"./ReactDOMButton":101,"./ReactDOMInput":106,"./ReactDOMOption":107,"./ReactDOMSelect":108,"./ReactDOMTextarea":112,"./ReactMount":132,"./ReactMultiChild":133,"./ReactPerf":138,"./ReactUpdateQueue":155,"./canDefineProperty":178,"./escapeTextContentForBrowser":182,"./isEventSupported":194,"./setInnerHTML":199,"./setTextContent":200,"./validateDOMNesting":205,"_process":27,"fbjs/lib/invariant":222,"fbjs/lib/keyOf":227,"fbjs/lib/shallowEqual":232,"fbjs/lib/warning":234}],103:[function(require,module,exports){
+},{"./validateDOMNesting":203,"_process":29}],108:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMDebugTool
+ */
+
+'use strict';
+
+var ReactDOMUnknownPropertyDevtool = require('./ReactDOMUnknownPropertyDevtool');
+
+var warning = require('fbjs/lib/warning');
+
+var eventHandlers = [];
+var handlerDoesThrowForEvent = {};
+
+function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) {
+ if (process.env.NODE_ENV !== 'production') {
+ eventHandlers.forEach(function (handler) {
+ try {
+ if (handler[handlerFunctionName]) {
+ handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
+ }
+ } catch (e) {
+ process.env.NODE_ENV !== 'production' ? warning(!handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e.message) : void 0;
+ handlerDoesThrowForEvent[handlerFunctionName] = true;
+ }
+ });
+ }
+}
+
+var ReactDOMDebugTool = {
+ addDevtool: function (devtool) {
+ eventHandlers.push(devtool);
+ },
+ removeDevtool: function (devtool) {
+ for (var i = 0; i < eventHandlers.length; i++) {
+ if (eventHandlers[i] === devtool) {
+ eventHandlers.splice(i, 1);
+ i--;
+ }
+ }
+ },
+ onCreateMarkupForProperty: function (name, value) {
+ emitEvent('onCreateMarkupForProperty', name, value);
+ },
+ onSetValueForProperty: function (node, name, value) {
+ emitEvent('onSetValueForProperty', node, name, value);
+ },
+ onDeleteValueForProperty: function (node, name) {
+ emitEvent('onDeleteValueForProperty', node, name);
+ }
+};
+
+ReactDOMDebugTool.addDevtool(ReactDOMUnknownPropertyDevtool);
+
+module.exports = ReactDOMDebugTool;
+}).call(this,require('_process'))
+
+},{"./ReactDOMUnknownPropertyDevtool":121,"_process":29,"fbjs/lib/warning":229}],109:[function(require,module,exports){
+/**
+ * Copyright 2014-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMEmptyComponent
+ */
+
+'use strict';
+
+var _assign = require('object-assign');
+
+var DOMLazyTree = require('./DOMLazyTree');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
+
+var ReactDOMEmptyComponent = function (instantiate) {
+ // ReactCompositeComponent uses this:
+ this._currentElement = null;
+ // ReactDOMComponentTree uses these:
+ this._nativeNode = null;
+ this._nativeParent = null;
+ this._nativeContainerInfo = null;
+ this._domID = null;
+};
+_assign(ReactDOMEmptyComponent.prototype, {
+ mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
+ var domID = nativeContainerInfo._idCounter++;
+ this._domID = domID;
+ this._nativeParent = nativeParent;
+ this._nativeContainerInfo = nativeContainerInfo;
+
+ var nodeValue = ' react-empty: ' + this._domID + ' ';
+ if (transaction.useCreateElement) {
+ var ownerDocument = nativeContainerInfo._ownerDocument;
+ var node = ownerDocument.createComment(nodeValue);
+ ReactDOMComponentTree.precacheNode(this, node);
+ return DOMLazyTree(node);
+ } else {
+ if (transaction.renderToStaticMarkup) {
+ // Normally we'd insert a comment node, but since this is a situation
+ // where React won't take over (static pages), we can simply return
+ // nothing.
+ return '';
+ }
+ return '<!--' + nodeValue + '-->';
+ }
+ },
+ receiveComponent: function () {},
+ getNativeNode: function () {
+ return ReactDOMComponentTree.getNodeFromInstance(this);
+ },
+ unmountComponent: function () {
+ ReactDOMComponentTree.uncacheNode(this);
+ }
+});
+
+module.exports = ReactDOMEmptyComponent;
+},{"./DOMLazyTree":74,"./ReactDOMComponentTree":106,"object-assign":28}],110:[function(require,module,exports){
+(function (process){
+/**
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -13426,7 +14095,6 @@ module.exports = ReactDOMComponent;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMFactories
- * @typechecks static-only
*/
'use strict';
@@ -13596,9 +14264,9 @@ var ReactDOMFactories = mapObject({
module.exports = ReactDOMFactories;
}).call(this,require('_process'))
-},{"./ReactElement":117,"./ReactElementValidator":118,"_process":27,"fbjs/lib/mapObject":228}],104:[function(require,module,exports){
+},{"./ReactElement":127,"./ReactElementValidator":128,"_process":29,"fbjs/lib/mapObject":224}],111:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -13611,14 +14279,13 @@ module.exports = ReactDOMFactories;
'use strict';
var ReactDOMFeatureFlags = {
- useCreateElement: false
+ useCreateElement: true
};
module.exports = ReactDOMFeatureFlags;
-},{}],105:[function(require,module,exports){
-(function (process){
+},{}],112:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -13626,97 +14293,40 @@ module.exports = ReactDOMFeatureFlags;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMIDOperations
- * @typechecks static-only
*/
'use strict';
var DOMChildrenOperations = require('./DOMChildrenOperations');
-var DOMPropertyOperations = require('./DOMPropertyOperations');
-var ReactMount = require('./ReactMount');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var ReactPerf = require('./ReactPerf');
-var invariant = require('fbjs/lib/invariant');
-
-/**
- * Errors for properties that should not be updated with `updatePropertyByID()`.
- *
- * @type {object}
- * @private
- */
-var INVALID_PROPERTY_ERRORS = {
- dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
- style: '`style` must be set using `updateStylesByID()`.'
-};
-
/**
* Operations used to process updates to DOM nodes.
*/
var ReactDOMIDOperations = {
/**
- * Updates a DOM node with new property values. This should only be used to
- * update DOM properties in `DOMProperty`.
- *
- * @param {string} id ID of the node to update.
- * @param {string} name A valid property name, see `DOMProperty`.
- * @param {*} value New value of the property.
- * @internal
- */
- updatePropertyByID: function (id, name, value) {
- var node = ReactMount.getNode(id);
- !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
-
- // If we're updating to null or undefined, we should remove the property
- // from the DOM node instead of inadvertantly setting to a string. This
- // brings us in line with the same behavior we have on initial render.
- if (value != null) {
- DOMPropertyOperations.setValueForProperty(node, name, value);
- } else {
- DOMPropertyOperations.deleteValueForProperty(node, name);
- }
- },
-
- /**
- * Replaces a DOM node that exists in the document with markup.
- *
- * @param {string} id ID of child to be replaced.
- * @param {string} markup Dangerous markup to inject in place of child.
- * @internal
- * @see {Danger.dangerouslyReplaceNodeWithMarkup}
- */
- dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
- var node = ReactMount.getNode(id);
- DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
- },
-
- /**
* Updates a component's children by processing a series of updates.
*
* @param {array<object>} updates List of update configurations.
- * @param {array<string>} markup List of markup strings.
* @internal
*/
- dangerouslyProcessChildrenUpdates: function (updates, markup) {
- for (var i = 0; i < updates.length; i++) {
- updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
- }
- DOMChildrenOperations.processUpdates(updates, markup);
+ dangerouslyProcessChildrenUpdates: function (parentInst, updates) {
+ var node = ReactDOMComponentTree.getNodeFromInstance(parentInst);
+ DOMChildrenOperations.processUpdates(node, updates);
}
};
ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
- dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
});
module.exports = ReactDOMIDOperations;
-}).call(this,require('_process'))
-
-},{"./DOMChildrenOperations":69,"./DOMPropertyOperations":71,"./ReactMount":132,"./ReactPerf":138,"_process":27,"fbjs/lib/invariant":222}],106:[function(require,module,exports){
+},{"./DOMChildrenOperations":73,"./ReactDOMComponentTree":106,"./ReactPerf":147}],113:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -13728,15 +14338,24 @@ module.exports = ReactDOMIDOperations;
'use strict';
-var ReactDOMIDOperations = require('./ReactDOMIDOperations');
+var _assign = require('object-assign');
+
+var DisabledInputUtils = require('./DisabledInputUtils');
+var DOMPropertyOperations = require('./DOMPropertyOperations');
var LinkedValueUtils = require('./LinkedValueUtils');
-var ReactMount = require('./ReactMount');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var ReactUpdates = require('./ReactUpdates');
-var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
+var warning = require('fbjs/lib/warning');
-var instancesByReactID = {};
+var didWarnValueLink = false;
+var didWarnCheckedLink = false;
+var didWarnValueNull = false;
+var didWarnValueDefaultValue = false;
+var didWarnCheckedDefaultChecked = false;
+var didWarnControlledToUncontrolled = false;
+var didWarnUncontrolledToControlled = false;
function forceUpdateIfMounted() {
if (this._rootNodeID) {
@@ -13745,6 +14364,14 @@ function forceUpdateIfMounted() {
}
}
+function warnIfValueIsNull(props) {
+ if (props != null && props.value === null && !didWarnValueNull) {
+ process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `input` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : void 0;
+
+ didWarnValueNull = true;
+ }
+}
+
/**
* Implements an <input> native component that allows setting these optional
* props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
@@ -13762,11 +14389,15 @@ function forceUpdateIfMounted() {
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
*/
var ReactDOMInput = {
- getNativeProps: function (inst, props, context) {
+ getNativeProps: function (inst, props) {
var value = LinkedValueUtils.getValue(props);
var checked = LinkedValueUtils.getChecked(props);
- var nativeProps = assign({}, props, {
+ var nativeProps = _assign({
+ // Make sure we set .type before any other properties (setting .value
+ // before .type means .value is lost in IE11 and below)
+ type: undefined
+ }, DisabledInputUtils.getNativeProps(inst, props), {
defaultChecked: undefined,
defaultValue: undefined,
value: value != null ? value : inst._wrapperState.initialValue,
@@ -13780,39 +14411,71 @@ var ReactDOMInput = {
mountWrapper: function (inst, props) {
if (process.env.NODE_ENV !== 'production') {
LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
+
+ if (props.valueLink !== undefined && !didWarnValueLink) {
+ process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
+ didWarnValueLink = true;
+ }
+ if (props.checkedLink !== undefined && !didWarnCheckedLink) {
+ process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
+ didWarnCheckedLink = true;
+ }
+ if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
+ didWarnCheckedDefaultChecked = true;
+ }
+ if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
+ didWarnValueDefaultValue = true;
+ }
+ warnIfValueIsNull(props);
}
var defaultValue = props.defaultValue;
inst._wrapperState = {
initialChecked: props.defaultChecked || false,
initialValue: defaultValue != null ? defaultValue : null,
+ listeners: null,
onChange: _handleChange.bind(inst)
};
- },
- mountReadyWrapper: function (inst) {
- // Can't be in mountWrapper or else server rendering leaks.
- instancesByReactID[inst._rootNodeID] = inst;
- },
-
- unmountWrapper: function (inst) {
- delete instancesByReactID[inst._rootNodeID];
+ if (process.env.NODE_ENV !== 'production') {
+ inst._wrapperState.controlled = props.checked !== undefined || props.value !== undefined;
+ }
},
updateWrapper: function (inst) {
var props = inst._currentElement.props;
+ if (process.env.NODE_ENV !== 'production') {
+ warnIfValueIsNull(props);
+
+ var initialValue = inst._wrapperState.initialChecked || inst._wrapperState.initialValue;
+ var defaultValue = props.defaultChecked || props.defaultValue;
+ var controlled = props.checked !== undefined || props.value !== undefined;
+ var owner = inst._currentElement._owner;
+
+ if ((initialValue || !inst._wrapperState.controlled) && controlled && !didWarnUncontrolledToControlled) {
+ process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
+ didWarnUncontrolledToControlled = true;
+ }
+ if (inst._wrapperState.controlled && (defaultValue || !controlled) && !didWarnControlledToUncontrolled) {
+ process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
+ didWarnControlledToUncontrolled = true;
+ }
+ }
+
// TODO: Shouldn't this be getChecked(props)?
var checked = props.checked;
if (checked != null) {
- ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false);
+ DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false);
}
var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
- ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
+ DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'value', '' + value);
}
}
};
@@ -13829,7 +14492,7 @@ function _handleChange(event) {
var name = props.name;
if (props.type === 'radio' && name != null) {
- var rootNode = ReactMount.getNode(this._rootNodeID);
+ var rootNode = ReactDOMComponentTree.getNodeFromInstance(this);
var queryRoot = rootNode;
while (queryRoot.parentNode) {
@@ -13852,11 +14515,9 @@ function _handleChange(event) {
// This will throw if radio buttons rendered by different copies of React
// and the same name are rendered into the same form (same as #1939).
// That's probably okay; we don't support it just as we don't support
- // mixing React with non-React.
- var otherID = ReactMount.getID(otherNode);
- !otherID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
- var otherInstance = instancesByReactID[otherID];
- !otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
+ // mixing React radio buttons with non-React ones.
+ var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode);
+ !otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : void 0;
// 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.
@@ -13870,10 +14531,27 @@ function _handleChange(event) {
module.exports = ReactDOMInput;
}).call(this,require('_process'))
-},{"./LinkedValueUtils":83,"./Object.assign":84,"./ReactDOMIDOperations":105,"./ReactMount":132,"./ReactUpdates":156,"_process":27,"fbjs/lib/invariant":222}],107:[function(require,module,exports){
+},{"./DOMPropertyOperations":77,"./DisabledInputUtils":80,"./LinkedValueUtils":90,"./ReactDOMComponentTree":106,"./ReactUpdates":155,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229,"object-assign":28}],114:[function(require,module,exports){
+/**
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMInstrumentation
+ */
+
+'use strict';
+
+var ReactDOMDebugTool = require('./ReactDOMDebugTool');
+
+module.exports = { debugTool: ReactDOMDebugTool };
+},{"./ReactDOMDebugTool":108}],115:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -13885,28 +14563,39 @@ module.exports = ReactDOMInput;
'use strict';
+var _assign = require('object-assign');
+
var ReactChildren = require('./ReactChildren');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var ReactDOMSelect = require('./ReactDOMSelect');
-var assign = require('./Object.assign');
var warning = require('fbjs/lib/warning');
-var valueContextKey = ReactDOMSelect.valueContextKey;
-
/**
* Implements an <option> native component that warns when `selected` is set.
*/
var ReactDOMOption = {
- mountWrapper: function (inst, props, context) {
+ mountWrapper: function (inst, props, nativeParent) {
// TODO (yungsters): Remove support for `selected` in <option>.
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : void 0;
}
- // Look up whether this option is 'selected' via context
- var selectValue = context[valueContextKey];
+ // Look up whether this option is 'selected'
+ var selectValue = null;
+ if (nativeParent != null) {
+ var selectParent = nativeParent;
+
+ if (selectParent._tag === 'optgroup') {
+ selectParent = selectParent._nativeParent;
+ }
+
+ if (selectParent != null && selectParent._tag === 'select') {
+ selectValue = ReactDOMSelect.getSelectValueContext(selectParent);
+ }
+ }
- // If context key is null (e.g., no specified value or after initial mount)
+ // If the value is null (e.g., no specified value or after initial mount)
// or missing (e.g., for <datalist>), we don't change props.selected
var selected = null;
if (selectValue != null) {
@@ -13927,8 +14616,17 @@ var ReactDOMOption = {
inst._wrapperState = { selected: selected };
},
- getNativeProps: function (inst, props, context) {
- var nativeProps = assign({ selected: undefined, children: undefined }, props);
+ postMountWrapper: function (inst) {
+ // value="" should make a value attribute (#6219)
+ var props = inst._currentElement.props;
+ if (props.value != null) {
+ var node = ReactDOMComponentTree.getNodeFromInstance(inst);
+ node.setAttribute('value', props.value);
+ }
+ },
+
+ getNativeProps: function (inst, props) {
+ var nativeProps = _assign({ selected: undefined, children: undefined }, props);
// Read state only from initial mount because <select> updates value
// manually; we need the initial state only for server rendering
@@ -13947,7 +14645,7 @@ var ReactDOMOption = {
if (typeof child === 'string' || typeof child === 'number') {
content += child;
} else {
- process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0;
}
});
@@ -13963,10 +14661,10 @@ var ReactDOMOption = {
module.exports = ReactDOMOption;
}).call(this,require('_process'))
-},{"./Object.assign":84,"./ReactChildren":92,"./ReactDOMSelect":108,"_process":27,"fbjs/lib/warning":234}],108:[function(require,module,exports){
+},{"./ReactChildren":95,"./ReactDOMComponentTree":106,"./ReactDOMSelect":116,"_process":29,"fbjs/lib/warning":229,"object-assign":28}],116:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -13978,14 +14676,18 @@ module.exports = ReactDOMOption;
'use strict';
+var _assign = require('object-assign');
+
+var DisabledInputUtils = require('./DisabledInputUtils');
var LinkedValueUtils = require('./LinkedValueUtils');
-var ReactMount = require('./ReactMount');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var ReactUpdates = require('./ReactUpdates');
-var assign = require('./Object.assign');
var warning = require('fbjs/lib/warning');
-var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
+var didWarnValueLink = false;
+var didWarnValueNull = false;
+var didWarnValueDefaultValue = false;
function updateOptionsIfPendingUpdateAndMounted() {
if (this._rootNodeID && this._wrapperState.pendingUpdate) {
@@ -14010,6 +14712,14 @@ function getDeclarationErrorAddendum(owner) {
return '';
}
+function warnIfValueIsNull(props) {
+ if (props != null && props.value === null && !didWarnValueNull) {
+ process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `select` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : void 0;
+
+ didWarnValueNull = true;
+ }
+}
+
var valuePropNames = ['value', 'defaultValue'];
/**
@@ -14020,15 +14730,20 @@ function checkSelectPropTypes(inst, props) {
var owner = inst._currentElement._owner;
LinkedValueUtils.checkPropTypes('select', props, owner);
+ if (props.valueLink !== undefined && !didWarnValueLink) {
+ process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0;
+ didWarnValueLink = true;
+ }
+
for (var i = 0; i < valuePropNames.length; i++) {
var propName = valuePropNames[i];
if (props[propName] == null) {
continue;
}
if (props.multiple) {
- process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
} else {
- process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
}
}
}
@@ -14041,7 +14756,7 @@ function checkSelectPropTypes(inst, props) {
*/
function updateOptions(inst, multiple, propValue) {
var selectedValue, i;
- var options = ReactMount.getNode(inst._rootNodeID).options;
+ var options = ReactDOMComponentTree.getNodeFromInstance(inst).options;
if (multiple) {
selectedValue = {};
@@ -14086,10 +14801,8 @@ function updateOptions(inst, multiple, propValue) {
* selected.
*/
var ReactDOMSelect = {
- valueContextKey: valueContextKey,
-
- getNativeProps: function (inst, props, context) {
- return assign({}, props, {
+ getNativeProps: function (inst, props) {
+ return _assign({}, DisabledInputUtils.getNativeProps(inst, props), {
onChange: inst._wrapperState.onChange,
value: undefined
});
@@ -14098,30 +14811,38 @@ var ReactDOMSelect = {
mountWrapper: function (inst, props) {
if (process.env.NODE_ENV !== 'production') {
checkSelectPropTypes(inst, props);
+ warnIfValueIsNull(props);
}
var value = LinkedValueUtils.getValue(props);
inst._wrapperState = {
pendingUpdate: false,
initialValue: value != null ? value : props.defaultValue,
+ listeners: null,
onChange: _handleChange.bind(inst),
wasMultiple: Boolean(props.multiple)
};
+
+ if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
+ didWarnValueDefaultValue = true;
+ }
},
- processChildContext: function (inst, props, context) {
- // Pass down initial value so initial generated markup has correct
- // `selected` attributes
- var childContext = assign({}, context);
- childContext[valueContextKey] = inst._wrapperState.initialValue;
- return childContext;
+ getSelectValueContext: function (inst) {
+ // ReactDOMOption looks at this initial value so the initial generated
+ // markup has correct `selected` attributes
+ return inst._wrapperState.initialValue;
},
postUpdateWrapper: function (inst) {
var props = inst._currentElement.props;
+ if (process.env.NODE_ENV !== 'production') {
+ warnIfValueIsNull(props);
+ }
// After the initial mount, we control selected-ness manually so don't pass
- // the context value down
+ // this value down
inst._wrapperState.initialValue = undefined;
var wasMultiple = inst._wrapperState.wasMultiple;
@@ -14147,7 +14868,9 @@ function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
- this._wrapperState.pendingUpdate = true;
+ if (this._rootNodeID) {
+ this._wrapperState.pendingUpdate = true;
+ }
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
return returnValue;
}
@@ -14155,9 +14878,9 @@ function _handleChange(event) {
module.exports = ReactDOMSelect;
}).call(this,require('_process'))
-},{"./LinkedValueUtils":83,"./Object.assign":84,"./ReactMount":132,"./ReactUpdates":156,"_process":27,"fbjs/lib/warning":234}],109:[function(require,module,exports){
+},{"./DisabledInputUtils":80,"./LinkedValueUtils":90,"./ReactDOMComponentTree":106,"./ReactUpdates":155,"_process":29,"fbjs/lib/warning":229,"object-assign":28}],117:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -14286,7 +15009,7 @@ function setIEOffsets(node, offsets) {
var range = document.selection.createRange().duplicate();
var start, end;
- if (typeof offsets.end === 'undefined') {
+ if (offsets.end === undefined) {
start = offsets.start;
end = start;
} else if (offsets.start > offsets.end) {
@@ -14310,7 +15033,7 @@ function setIEOffsets(node, offsets) {
*
* Note: IE10+ supports the Selection object, but it does not support
* the `extend` method, which means that even in modern IE, it's not possible
- * to programatically create a backward selection. Thus, for all IE
+ * to programmatically create a backward selection. Thus, for all IE
* versions, we use the old IE API to create our selections.
*
* @param {DOMElement|DOMTextNode} node
@@ -14324,7 +15047,7 @@ function setModernOffsets(node, offsets) {
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
- var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
+ var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
// IE 11 uses modern selection, but doesn't support the extend method.
// Flip backward selections, so we can set with a single range.
@@ -14368,37 +15091,10 @@ var ReactDOMSelection = {
};
module.exports = ReactDOMSelection;
-},{"./getNodeForCharacterOffset":191,"./getTextContentAccessor":192,"fbjs/lib/ExecutionEnvironment":208}],110:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactDOMServer
- */
-
-'use strict';
-
-var ReactDefaultInjection = require('./ReactDefaultInjection');
-var ReactServerRendering = require('./ReactServerRendering');
-var ReactVersion = require('./ReactVersion');
-
-ReactDefaultInjection.inject();
-
-var ReactDOMServer = {
- renderToString: ReactServerRendering.renderToString,
- renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
- version: ReactVersion
-};
-
-module.exports = ReactDOMServer;
-},{"./ReactDefaultInjection":114,"./ReactServerRendering":148,"./ReactVersion":157}],111:[function(require,module,exports){
+},{"./getNodeForCharacterOffset":190,"./getTextContentAccessor":191,"fbjs/lib/ExecutionEnvironment":205}],118:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -14406,19 +15102,19 @@ module.exports = ReactDOMServer;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMTextComponent
- * @typechecks static-only
*/
'use strict';
+var _assign = require('object-assign');
+
var DOMChildrenOperations = require('./DOMChildrenOperations');
-var DOMPropertyOperations = require('./DOMPropertyOperations');
-var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
-var ReactMount = require('./ReactMount');
+var DOMLazyTree = require('./DOMLazyTree');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
+var ReactPerf = require('./ReactPerf');
-var assign = require('./Object.assign');
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
-var setTextContent = require('./setTextContent');
+var invariant = require('fbjs/lib/invariant');
var validateDOMNesting = require('./validateDOMNesting');
/**
@@ -14427,8 +15123,8 @@ var validateDOMNesting = require('./validateDOMNesting');
* - When mounting text into the DOM, adjacent text nodes are merged.
* - Text nodes cannot be assigned a React root ID.
*
- * This component is used to wrap strings in elements so that they can undergo
- * the same reconciliation that is applied to elements.
+ * This component is used to wrap strings between comment nodes so that they
+ * can undergo the same reconciliation that is applied to elements.
*
* TODO: Investigate representing React components in the DOM with text nodes.
*
@@ -14436,62 +15132,75 @@ var validateDOMNesting = require('./validateDOMNesting');
* @extends ReactComponent
* @internal
*/
-var ReactDOMTextComponent = function (props) {
- // This constructor and its argument is currently used by mocks.
-};
-
-assign(ReactDOMTextComponent.prototype, {
+var ReactDOMTextComponent = function (text) {
+ // TODO: This is really a ReactText (ReactNode), not a ReactElement
+ this._currentElement = text;
+ this._stringText = '' + text;
+ // ReactDOMComponentTree uses these:
+ this._nativeNode = null;
+ this._nativeParent = null;
- /**
- * @param {ReactText} text
- * @internal
- */
- construct: function (text) {
- // TODO: This is really a ReactText (ReactNode), not a ReactElement
- this._currentElement = text;
- this._stringText = '' + text;
+ // Properties
+ this._domID = null;
+ this._mountIndex = 0;
+ this._closingComment = null;
+ this._commentNodes = null;
+};
- // Properties
- this._rootNodeID = null;
- this._mountIndex = 0;
- },
+_assign(ReactDOMTextComponent.prototype, {
/**
* Creates the markup for this text node. This node is not intended to have
* any features besides containing text content.
*
- * @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {string} Markup for this text node.
* @internal
*/
- mountComponent: function (rootID, transaction, context) {
+ mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
if (process.env.NODE_ENV !== 'production') {
- if (context[validateDOMNesting.ancestorInfoContextKey]) {
- validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
+ var parentInfo;
+ if (nativeParent != null) {
+ parentInfo = nativeParent._ancestorInfo;
+ } else if (nativeContainerInfo != null) {
+ parentInfo = nativeContainerInfo._ancestorInfo;
+ }
+ if (parentInfo) {
+ // parentInfo should always be present except for the top-level
+ // component when server rendering
+ validateDOMNesting('#text', this, parentInfo);
}
}
- this._rootNodeID = rootID;
+ var domID = nativeContainerInfo._idCounter++;
+ var openingValue = ' react-text: ' + domID + ' ';
+ var closingValue = ' /react-text ';
+ this._domID = domID;
+ this._nativeParent = nativeParent;
if (transaction.useCreateElement) {
- var ownerDocument = context[ReactMount.ownerDocumentContextKey];
- var el = ownerDocument.createElement('span');
- DOMPropertyOperations.setAttributeForID(el, rootID);
- // Populate node cache
- ReactMount.getID(el);
- setTextContent(el, this._stringText);
- return el;
+ var ownerDocument = nativeContainerInfo._ownerDocument;
+ var openingComment = ownerDocument.createComment(openingValue);
+ var closingComment = ownerDocument.createComment(closingValue);
+ var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment());
+ DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment));
+ if (this._stringText) {
+ DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText)));
+ }
+ DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment));
+ ReactDOMComponentTree.precacheNode(this, openingComment);
+ this._closingComment = closingComment;
+ return lazyTree;
} else {
var escapedText = escapeTextContentForBrowser(this._stringText);
if (transaction.renderToStaticMarkup) {
- // Normally we'd wrap this in a `span` for the reasons stated above, but
- // since this is a situation where React won't take over (static pages),
- // we can simply return the text as it is.
+ // Normally we'd wrap this between comment nodes for the reasons stated
+ // above, but since this is a situation where React won't take over
+ // (static pages), we can simply return the text as it is.
return escapedText;
}
- return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
+ return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->';
}
},
@@ -14511,25 +15220,54 @@ assign(ReactDOMTextComponent.prototype, {
// and/or updateComponent to do the actual update for consistency with
// other component types?
this._stringText = nextStringText;
- var node = ReactMount.getNode(this._rootNodeID);
- DOMChildrenOperations.updateTextContent(node, nextStringText);
+ var commentNodes = this.getNativeNode();
+ DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText);
}
}
},
+ getNativeNode: function () {
+ var nativeNode = this._commentNodes;
+ if (nativeNode) {
+ return nativeNode;
+ }
+ if (!this._closingComment) {
+ var openingComment = ReactDOMComponentTree.getNodeFromInstance(this);
+ var node = openingComment.nextSibling;
+ while (true) {
+ !(node != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Missing closing comment for text component %s', this._domID) : invariant(false) : void 0;
+ if (node.nodeType === 8 && node.nodeValue === ' /react-text ') {
+ this._closingComment = node;
+ break;
+ }
+ node = node.nextSibling;
+ }
+ }
+ nativeNode = [this._nativeNode, this._closingComment];
+ this._commentNodes = nativeNode;
+ return nativeNode;
+ },
+
unmountComponent: function () {
- ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
+ this._closingComment = null;
+ this._commentNodes = null;
+ ReactDOMComponentTree.uncacheNode(this);
}
});
+ReactPerf.measureMethods(ReactDOMTextComponent.prototype, 'ReactDOMTextComponent', {
+ mountComponent: 'mountComponent',
+ receiveComponent: 'receiveComponent'
+});
+
module.exports = ReactDOMTextComponent;
}).call(this,require('_process'))
-},{"./DOMChildrenOperations":69,"./DOMPropertyOperations":71,"./Object.assign":84,"./ReactComponentBrowserEnvironment":95,"./ReactMount":132,"./escapeTextContentForBrowser":182,"./setTextContent":200,"./validateDOMNesting":205,"_process":27}],112:[function(require,module,exports){
+},{"./DOMChildrenOperations":73,"./DOMLazyTree":74,"./ReactDOMComponentTree":106,"./ReactPerf":147,"./escapeTextContentForBrowser":180,"./validateDOMNesting":203,"_process":29,"fbjs/lib/invariant":219,"object-assign":28}],119:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -14541,14 +15279,21 @@ module.exports = ReactDOMTextComponent;
'use strict';
+var _assign = require('object-assign');
+
+var DisabledInputUtils = require('./DisabledInputUtils');
+var DOMPropertyOperations = require('./DOMPropertyOperations');
var LinkedValueUtils = require('./LinkedValueUtils');
-var ReactDOMIDOperations = require('./ReactDOMIDOperations');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var ReactUpdates = require('./ReactUpdates');
-var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
+var didWarnValueLink = false;
+var didWarnValueNull = false;
+var didWarnValDefaultVal = false;
+
function forceUpdateIfMounted() {
if (this._rootNodeID) {
// DOM component is still mounted; update
@@ -14556,6 +15301,14 @@ function forceUpdateIfMounted() {
}
}
+function warnIfValueIsNull(props) {
+ if (props != null && props.value === null && !didWarnValueNull) {
+ process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `textarea` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : void 0;
+
+ didWarnValueNull = true;
+ }
+}
+
/**
* Implements a <textarea> native component that allows setting `value`, and
* `defaultValue`. This differs from the traditional DOM API because value is
@@ -14572,12 +15325,12 @@ function forceUpdateIfMounted() {
* `defaultValue` if specified, or the children content (deprecated).
*/
var ReactDOMTextarea = {
- getNativeProps: function (inst, props, context) {
- !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
+ getNativeProps: function (inst, props) {
+ !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : void 0;
// Always set children to the same thing. In IE9, the selection range will
// get reset if `textContent` is mutated.
- var nativeProps = assign({}, props, {
+ var nativeProps = _assign({}, DisabledInputUtils.getNativeProps(inst, props), {
defaultValue: undefined,
value: undefined,
children: inst._wrapperState.initialValue,
@@ -14590,6 +15343,15 @@ var ReactDOMTextarea = {
mountWrapper: function (inst, props) {
if (process.env.NODE_ENV !== 'production') {
LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
+ if (props.valueLink !== undefined && !didWarnValueLink) {
+ process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0;
+ didWarnValueLink = true;
+ }
+ if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
+ didWarnValDefaultVal = true;
+ }
+ warnIfValueIsNull(props);
}
var defaultValue = props.defaultValue;
@@ -14597,11 +15359,11 @@ var ReactDOMTextarea = {
var children = props.children;
if (children != null) {
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0;
}
- !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
+ !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : void 0;
if (Array.isArray(children)) {
- !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
+ !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : void 0;
children = children[0];
}
@@ -14611,24 +15373,29 @@ var ReactDOMTextarea = {
defaultValue = '';
}
var value = LinkedValueUtils.getValue(props);
-
inst._wrapperState = {
// We save the initial value so that `ReactDOMComponent` doesn't update
// `textContent` (unnecessary since we update value).
// The initial value can be a boolean or object so that's why it's
// forced to be a string.
initialValue: '' + (value != null ? value : defaultValue),
+ listeners: null,
onChange: _handleChange.bind(inst)
};
},
updateWrapper: function (inst) {
var props = inst._currentElement.props;
+
+ if (process.env.NODE_ENV !== 'production') {
+ warnIfValueIsNull(props);
+ }
+
var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
- ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
+ DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'value', '' + value);
}
}
};
@@ -14643,9 +15410,291 @@ function _handleChange(event) {
module.exports = ReactDOMTextarea;
}).call(this,require('_process'))
-},{"./LinkedValueUtils":83,"./Object.assign":84,"./ReactDOMIDOperations":105,"./ReactUpdates":156,"_process":27,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],113:[function(require,module,exports){
+},{"./DOMPropertyOperations":77,"./DisabledInputUtils":80,"./LinkedValueUtils":90,"./ReactDOMComponentTree":106,"./ReactUpdates":155,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229,"object-assign":28}],120:[function(require,module,exports){
+(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2015-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMTreeTraversal
+ */
+
+'use strict';
+
+var invariant = require('fbjs/lib/invariant');
+
+/**
+ * Return the lowest common ancestor of A and B, or null if they are in
+ * different trees.
+ */
+function getLowestCommonAncestor(instA, instB) {
+ !('_nativeNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : void 0;
+ !('_nativeNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : void 0;
+
+ var depthA = 0;
+ for (var tempA = instA; tempA; tempA = tempA._nativeParent) {
+ depthA++;
+ }
+ var depthB = 0;
+ for (var tempB = instB; tempB; tempB = tempB._nativeParent) {
+ depthB++;
+ }
+
+ // If A is deeper, crawl up.
+ while (depthA - depthB > 0) {
+ instA = instA._nativeParent;
+ depthA--;
+ }
+
+ // If B is deeper, crawl up.
+ while (depthB - depthA > 0) {
+ instB = instB._nativeParent;
+ depthB--;
+ }
+
+ // Walk in lockstep until we find a match.
+ var depth = depthA;
+ while (depth--) {
+ if (instA === instB) {
+ return instA;
+ }
+ instA = instA._nativeParent;
+ instB = instB._nativeParent;
+ }
+ return null;
+}
+
+/**
+ * Return if A is an ancestor of B.
+ */
+function isAncestor(instA, instB) {
+ !('_nativeNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : invariant(false) : void 0;
+ !('_nativeNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : invariant(false) : void 0;
+
+ while (instB) {
+ if (instB === instA) {
+ return true;
+ }
+ instB = instB._nativeParent;
+ }
+ return false;
+}
+
+/**
+ * Return the parent instance of the passed-in instance.
+ */
+function getParentInstance(inst) {
+ !('_nativeNode' in inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : invariant(false) : void 0;
+
+ return inst._nativeParent;
+}
+
+/**
+ * Simulates the traversal of a two-phase, capture/bubble event dispatch.
+ */
+function traverseTwoPhase(inst, fn, arg) {
+ var path = [];
+ while (inst) {
+ path.push(inst);
+ inst = inst._nativeParent;
+ }
+ var i;
+ for (i = path.length; i-- > 0;) {
+ fn(path[i], false, arg);
+ }
+ for (i = 0; i < path.length; i++) {
+ fn(path[i], true, arg);
+ }
+}
+
+/**
+ * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
+ * should would receive a `mouseEnter` or `mouseLeave` event.
+ *
+ * Does not invoke the callback on the nearest common ancestor because nothing
+ * "entered" or "left" that element.
+ */
+function traverseEnterLeave(from, to, fn, argFrom, argTo) {
+ var common = from && to ? getLowestCommonAncestor(from, to) : null;
+ var pathFrom = [];
+ while (from && from !== common) {
+ pathFrom.push(from);
+ from = from._nativeParent;
+ }
+ var pathTo = [];
+ while (to && to !== common) {
+ pathTo.push(to);
+ to = to._nativeParent;
+ }
+ var i;
+ for (i = 0; i < pathFrom.length; i++) {
+ fn(pathFrom[i], true, argFrom);
+ }
+ for (i = pathTo.length; i-- > 0;) {
+ fn(pathTo[i], false, argTo);
+ }
+}
+
+module.exports = {
+ isAncestor: isAncestor,
+ getLowestCommonAncestor: getLowestCommonAncestor,
+ getParentInstance: getParentInstance,
+ traverseTwoPhase: traverseTwoPhase,
+ traverseEnterLeave: traverseEnterLeave
+};
+}).call(this,require('_process'))
+
+},{"_process":29,"fbjs/lib/invariant":219}],121:[function(require,module,exports){
+(function (process){
+/**
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMUnknownPropertyDevtool
+ */
+
+'use strict';
+
+var DOMProperty = require('./DOMProperty');
+var EventPluginRegistry = require('./EventPluginRegistry');
+
+var warning = require('fbjs/lib/warning');
+
+if (process.env.NODE_ENV !== 'production') {
+ var reactProps = {
+ children: true,
+ dangerouslySetInnerHTML: true,
+ key: true,
+ ref: true
+ };
+ var warnedProperties = {};
+
+ var warnUnknownProperty = function (name) {
+ if (DOMProperty.properties.hasOwnProperty(name) || DOMProperty.isCustomAttribute(name)) {
+ return;
+ }
+ if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
+ return;
+ }
+
+ warnedProperties[name] = true;
+ var lowerCasedName = name.toLowerCase();
+
+ // data-* attributes should be lowercase; suggest the lowercase version
+ var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
+
+ // For now, only warn when we have a suggested correction. This prevents
+ // logging too much when using transferPropsTo.
+ process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : void 0;
+
+ var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry.possibleRegistrationNames[lowerCasedName] : null;
+
+ process.env.NODE_ENV !== 'production' ? warning(registrationName == null, 'Unknown event handler property %s. Did you mean `%s`?', name, registrationName) : void 0;
+ };
+}
+
+var ReactDOMUnknownPropertyDevtool = {
+ onCreateMarkupForProperty: function (name, value) {
+ warnUnknownProperty(name);
+ },
+ onSetValueForProperty: function (node, name, value) {
+ warnUnknownProperty(name);
+ },
+ onDeleteValueForProperty: function (node, name) {
+ warnUnknownProperty(name);
+ }
+};
+
+module.exports = ReactDOMUnknownPropertyDevtool;
+}).call(this,require('_process'))
+
+},{"./DOMProperty":76,"./EventPluginRegistry":84,"_process":29,"fbjs/lib/warning":229}],122:[function(require,module,exports){
+(function (process){
+/**
+ * Copyright 2016-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDebugTool
+ */
+
+'use strict';
+
+var ReactInvalidSetStateWarningDevTool = require('./ReactInvalidSetStateWarningDevTool');
+var warning = require('fbjs/lib/warning');
+
+var eventHandlers = [];
+var handlerDoesThrowForEvent = {};
+
+function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) {
+ if (process.env.NODE_ENV !== 'production') {
+ eventHandlers.forEach(function (handler) {
+ try {
+ if (handler[handlerFunctionName]) {
+ handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
+ }
+ } catch (e) {
+ process.env.NODE_ENV !== 'production' ? warning(!handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e.message) : void 0;
+ handlerDoesThrowForEvent[handlerFunctionName] = true;
+ }
+ });
+ }
+}
+
+var ReactDebugTool = {
+ addDevtool: function (devtool) {
+ eventHandlers.push(devtool);
+ },
+ removeDevtool: function (devtool) {
+ for (var i = 0; i < eventHandlers.length; i++) {
+ if (eventHandlers[i] === devtool) {
+ eventHandlers.splice(i, 1);
+ i--;
+ }
+ }
+ },
+ onBeginProcessingChildContext: function () {
+ emitEvent('onBeginProcessingChildContext');
+ },
+ onEndProcessingChildContext: function () {
+ emitEvent('onEndProcessingChildContext');
+ },
+ onSetState: function () {
+ emitEvent('onSetState');
+ },
+ onMountRootComponent: function (internalInstance) {
+ emitEvent('onMountRootComponent', internalInstance);
+ },
+ onMountComponent: function (internalInstance) {
+ emitEvent('onMountComponent', internalInstance);
+ },
+ onUpdateComponent: function (internalInstance) {
+ emitEvent('onUpdateComponent', internalInstance);
+ },
+ onUnmountComponent: function (internalInstance) {
+ emitEvent('onUnmountComponent', internalInstance);
+ }
+};
+
+ReactDebugTool.addDevtool(ReactInvalidSetStateWarningDevTool);
+
+module.exports = ReactDebugTool;
+}).call(this,require('_process'))
+
+},{"./ReactInvalidSetStateWarningDevTool":138,"_process":29,"fbjs/lib/warning":229}],123:[function(require,module,exports){
+/**
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -14657,10 +15706,11 @@ module.exports = ReactDOMTextarea;
'use strict';
+var _assign = require('object-assign');
+
var ReactUpdates = require('./ReactUpdates');
var Transaction = require('./Transaction');
-var assign = require('./Object.assign');
var emptyFunction = require('fbjs/lib/emptyFunction');
var RESET_BATCHED_UPDATES = {
@@ -14681,7 +15731,7 @@ function ReactDefaultBatchingStrategyTransaction() {
this.reinitializeTransaction();
}
-assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
+_assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
}
@@ -14711,10 +15761,10 @@ var ReactDefaultBatchingStrategy = {
};
module.exports = ReactDefaultBatchingStrategy;
-},{"./Object.assign":84,"./ReactUpdates":156,"./Transaction":174,"fbjs/lib/emptyFunction":214}],114:[function(require,module,exports){
+},{"./ReactUpdates":155,"./Transaction":173,"fbjs/lib/emptyFunction":211,"object-assign":28}],124:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -14728,25 +15778,23 @@ module.exports = ReactDefaultBatchingStrategy;
var BeforeInputEventPlugin = require('./BeforeInputEventPlugin');
var ChangeEventPlugin = require('./ChangeEventPlugin');
-var ClientReactRootIndex = require('./ClientReactRootIndex');
var DefaultEventPluginOrder = require('./DefaultEventPluginOrder');
var EnterLeaveEventPlugin = require('./EnterLeaveEventPlugin');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var HTMLDOMPropertyConfig = require('./HTMLDOMPropertyConfig');
-var ReactBrowserComponentMixin = require('./ReactBrowserComponentMixin');
var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
-var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
var ReactDOMComponent = require('./ReactDOMComponent');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
+var ReactDOMEmptyComponent = require('./ReactDOMEmptyComponent');
+var ReactDOMTreeTraversal = require('./ReactDOMTreeTraversal');
var ReactDOMTextComponent = require('./ReactDOMTextComponent');
+var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
var ReactEventListener = require('./ReactEventListener');
var ReactInjection = require('./ReactInjection');
-var ReactInstanceHandles = require('./ReactInstanceHandles');
-var ReactMount = require('./ReactMount');
var ReactReconcileTransaction = require('./ReactReconcileTransaction');
+var SVGDOMPropertyConfig = require('./SVGDOMPropertyConfig');
var SelectEventPlugin = require('./SelectEventPlugin');
-var ServerReactRootIndex = require('./ServerReactRootIndex');
var SimpleEventPlugin = require('./SimpleEventPlugin');
-var SVGDOMPropertyConfig = require('./SVGDOMPropertyConfig');
var alreadyInjected = false;
@@ -14765,8 +15813,8 @@ function inject() {
* Inject modules for resolving DOM hierarchy and plugin ordering.
*/
ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
- ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
- ReactInjection.EventPluginHub.injectMount(ReactMount);
+ ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
+ ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
/**
* Some important event plugins included by default (without having to require
@@ -14784,18 +15832,16 @@ function inject() {
ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
- ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
-
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
- ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
+ ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
+ return new ReactDOMEmptyComponent(instantiate);
+ });
ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
- ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
-
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
if (process.env.NODE_ENV !== 'production') {
@@ -14812,9 +15858,10 @@ module.exports = {
};
}).call(this,require('_process'))
-},{"./BeforeInputEventPlugin":63,"./ChangeEventPlugin":67,"./ClientReactRootIndex":68,"./DefaultEventPluginOrder":73,"./EnterLeaveEventPlugin":74,"./HTMLDOMPropertyConfig":81,"./ReactBrowserComponentMixin":87,"./ReactComponentBrowserEnvironment":95,"./ReactDOMComponent":102,"./ReactDOMTextComponent":111,"./ReactDefaultBatchingStrategy":113,"./ReactDefaultPerf":115,"./ReactEventListener":123,"./ReactInjection":125,"./ReactInstanceHandles":127,"./ReactMount":132,"./ReactReconcileTransaction":143,"./SVGDOMPropertyConfig":159,"./SelectEventPlugin":160,"./ServerReactRootIndex":161,"./SimpleEventPlugin":162,"_process":27,"fbjs/lib/ExecutionEnvironment":208}],115:[function(require,module,exports){
+},{"./BeforeInputEventPlugin":68,"./ChangeEventPlugin":72,"./DefaultEventPluginOrder":79,"./EnterLeaveEventPlugin":81,"./HTMLDOMPropertyConfig":88,"./ReactComponentBrowserEnvironment":98,"./ReactDOMComponent":104,"./ReactDOMComponentTree":106,"./ReactDOMEmptyComponent":109,"./ReactDOMTextComponent":118,"./ReactDOMTreeTraversal":120,"./ReactDefaultBatchingStrategy":123,"./ReactDefaultPerf":125,"./ReactEventListener":132,"./ReactInjection":134,"./ReactReconcileTransaction":151,"./SVGDOMPropertyConfig":157,"./SelectEventPlugin":158,"./SimpleEventPlugin":159,"_process":29,"fbjs/lib/ExecutionEnvironment":205}],125:[function(require,module,exports){
+(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -14822,17 +15869,18 @@ module.exports = {
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultPerf
- * @typechecks static-only
*/
'use strict';
var DOMProperty = require('./DOMProperty');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var ReactDefaultPerfAnalysis = require('./ReactDefaultPerfAnalysis');
var ReactMount = require('./ReactMount');
var ReactPerf = require('./ReactPerf');
var performanceNow = require('fbjs/lib/performanceNow');
+var warning = require('fbjs/lib/warning');
function roundFloat(val) {
return Math.floor(val * 100) / 100;
@@ -14842,9 +15890,59 @@ function addValue(obj, key, val) {
obj[key] = (obj[key] || 0) + val;
}
+// Composite/text components don't have any built-in ID: we have to make our own
+var compositeIDMap;
+var compositeIDCounter = 17000;
+function getIDOfComposite(inst) {
+ if (!compositeIDMap) {
+ compositeIDMap = new WeakMap();
+ }
+ if (compositeIDMap.has(inst)) {
+ return compositeIDMap.get(inst);
+ } else {
+ var id = compositeIDCounter++;
+ compositeIDMap.set(inst, id);
+ return id;
+ }
+}
+
+function getID(inst) {
+ if (inst.hasOwnProperty('_rootNodeID')) {
+ return inst._rootNodeID;
+ } else {
+ return getIDOfComposite(inst);
+ }
+}
+
+function stripComplexValues(key, value) {
+ if (typeof value !== 'object' || Array.isArray(value) || value == null) {
+ return value;
+ }
+ var prototype = Object.getPrototypeOf(value);
+ if (!prototype || prototype === Object.prototype) {
+ return value;
+ }
+ return '<not serializable>';
+}
+
+// This implementation of ReactPerf is going away some time mid 15.x.
+// While we plan to keep most of the API, the actual format of measurements
+// will change dramatically. To signal this, we wrap them into an opaque-ish
+// object to discourage reaching into it until the API stabilizes.
+function wrapLegacyMeasurements(measurements) {
+ return { __unstable_this_format_will_change: measurements };
+}
+function unwrapLegacyMeasurements(measurements) {
+ return measurements && measurements.__unstable_this_format_will_change || measurements;
+}
+
+var warnedAboutPrintDOM = false;
+var warnedAboutGetMeasurementsSummaryMap = false;
+
var ReactDefaultPerf = {
_allMeasurements: [], // last item in the list is the current one
_mountStack: [0],
+ _compositeStack: [],
_injected: false,
start: function () {
@@ -14861,11 +15959,11 @@ var ReactDefaultPerf = {
},
getLastMeasurements: function () {
- return ReactDefaultPerf._allMeasurements;
+ return wrapLegacyMeasurements(ReactDefaultPerf._allMeasurements);
},
printExclusive: function (measurements) {
- measurements = measurements || ReactDefaultPerf._allMeasurements;
+ measurements = unwrapLegacyMeasurements(measurements || ReactDefaultPerf._allMeasurements);
var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
console.table(summary.map(function (item) {
return {
@@ -14883,7 +15981,7 @@ var ReactDefaultPerf = {
},
printInclusive: function (measurements) {
- measurements = measurements || ReactDefaultPerf._allMeasurements;
+ measurements = unwrapLegacyMeasurements(measurements || ReactDefaultPerf._allMeasurements);
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
console.table(summary.map(function (item) {
return {
@@ -14896,6 +15994,13 @@ var ReactDefaultPerf = {
},
getMeasurementsSummaryMap: function (measurements) {
+ process.env.NODE_ENV !== 'production' ? warning(warnedAboutGetMeasurementsSummaryMap, '`ReactPerf.getMeasurementsSummaryMap(...)` is deprecated. Use ' + '`ReactPerf.getWasted(...)` instead.') : void 0;
+ warnedAboutGetMeasurementsSummaryMap = true;
+ return ReactDefaultPerf.getWasted(measurements);
+ },
+
+ getWasted: function (measurements) {
+ measurements = unwrapLegacyMeasurements(measurements);
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
return summary.map(function (item) {
return {
@@ -14907,19 +16012,25 @@ var ReactDefaultPerf = {
},
printWasted: function (measurements) {
- measurements = measurements || ReactDefaultPerf._allMeasurements;
- console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
+ measurements = unwrapLegacyMeasurements(measurements || ReactDefaultPerf._allMeasurements);
+ console.table(ReactDefaultPerf.getWasted(measurements));
console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
printDOM: function (measurements) {
- measurements = measurements || ReactDefaultPerf._allMeasurements;
+ process.env.NODE_ENV !== 'production' ? warning(warnedAboutPrintDOM, '`ReactPerf.printDOM(...)` is deprecated. Use ' + '`ReactPerf.printOperations(...)` instead.') : void 0;
+ warnedAboutPrintDOM = true;
+ return ReactDefaultPerf.printOperations(measurements);
+ },
+
+ printOperations: function (measurements) {
+ measurements = unwrapLegacyMeasurements(measurements || ReactDefaultPerf._allMeasurements);
var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
console.table(summary.map(function (item) {
var result = {};
result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
result.type = item.type;
- result.args = JSON.stringify(item.args);
+ result.args = JSON.stringify(item.args, stripComplexValues);
return result;
}));
console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
@@ -14927,7 +16038,8 @@ var ReactDefaultPerf = {
_recordWrite: function (id, fnName, totalTime, args) {
// TODO: totalTime isn't that useful since it doesn't count paints/reflows
- var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
+ var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
+ var writes = entry.writes;
writes[id] = writes[id] || [];
writes[id].push({
type: fnName,
@@ -14946,36 +16058,38 @@ var ReactDefaultPerf = {
var rv;
var start;
+ var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
+
if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
// A "measurement" is a set of metrics recorded for each flush. We want
// to group the metrics for a given flush together so we can look at the
// components that rendered and the DOM operations that actually
// happened to determine the amount of "wasted work" performed.
- ReactDefaultPerf._allMeasurements.push({
+ ReactDefaultPerf._allMeasurements.push(entry = {
exclusive: {},
inclusive: {},
render: {},
counts: {},
writes: {},
displayNames: {},
+ hierarchy: {},
totalTime: 0,
created: {}
});
start = performanceNow();
rv = func.apply(this, args);
- ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
+ entry.totalTime = performanceNow() - start;
return rv;
- } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
+ } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations' || moduleName === 'ReactComponentBrowserEnvironment') {
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
if (fnName === '_mountImageIntoNode') {
- var mountID = ReactMount.getID(args[1]);
- ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
+ ReactDefaultPerf._recordWrite('', fnName, totalTime, args[0]);
} else if (fnName === 'dangerouslyProcessChildrenUpdates') {
// special format
- args[0].forEach(function (update) {
+ args[1].forEach(function (update) {
var writeArgs = {};
if (update.fromIndex !== null) {
writeArgs.fromIndex = update.fromIndex;
@@ -14983,19 +16097,23 @@ var ReactDefaultPerf = {
if (update.toIndex !== null) {
writeArgs.toIndex = update.toIndex;
}
- if (update.textContent !== null) {
- writeArgs.textContent = update.textContent;
- }
- if (update.markupIndex !== null) {
- writeArgs.markup = args[1][update.markupIndex];
+ if (update.content !== null) {
+ writeArgs.content = update.content;
}
- ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
+ ReactDefaultPerf._recordWrite(args[0]._rootNodeID, update.type, totalTime, writeArgs);
});
} else {
// basic format
var id = args[0];
- if (typeof id === 'object') {
- id = ReactMount.getID(args[0]);
+ if (moduleName === 'EventPluginHub') {
+ id = id._rootNodeID;
+ } else if (fnName === 'replaceNodeWithMarkup') {
+ // Old node is already unmounted; can't get its instance
+ id = ReactDOMComponentTree.getInstanceFromNode(args[1].node)._rootNodeID;
+ } else if (fnName === 'replaceDelimitedText') {
+ id = getID(ReactDOMComponentTree.getInstanceFromNode(args[0]));
+ } else if (typeof id === 'object') {
+ id = getID(ReactDOMComponentTree.getInstanceFromNode(args[0]));
}
ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
}
@@ -15007,12 +16125,11 @@ var ReactDefaultPerf = {
return func.apply(this, args);
}
- var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
+ var rootNodeID = getIDOfComposite(this);
var isRender = fnName === '_renderValidatedComponent';
var isMount = fnName === 'mountComponent';
var mountStack = ReactDefaultPerf._mountStack;
- var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
if (isRender) {
addValue(entry.counts, rootNodeID, 1);
@@ -15021,10 +16138,14 @@ var ReactDefaultPerf = {
mountStack.push(0);
}
+ ReactDefaultPerf._compositeStack.push(rootNodeID);
+
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
+ ReactDefaultPerf._compositeStack.pop();
+
if (isRender) {
addValue(entry.render, rootNodeID, totalTime);
} else if (isMount) {
@@ -15042,6 +16163,11 @@ var ReactDefaultPerf = {
};
return rv;
+ } else if ((moduleName === 'ReactDOMComponent' || moduleName === 'ReactDOMTextComponent') && (fnName === 'mountComponent' || fnName === 'receiveComponent')) {
+
+ rv = func.apply(this, args);
+ entry.hierarchy[getID(this)] = ReactDefaultPerf._compositeStack.slice();
+ return rv;
} else {
return func.apply(this, args);
}
@@ -15050,9 +16176,11 @@ var ReactDefaultPerf = {
};
module.exports = ReactDefaultPerf;
-},{"./DOMProperty":70,"./ReactDefaultPerfAnalysis":116,"./ReactMount":132,"./ReactPerf":138,"fbjs/lib/performanceNow":231}],116:[function(require,module,exports){
+}).call(this,require('_process'))
+
+},{"./DOMProperty":76,"./ReactDOMComponentTree":106,"./ReactDefaultPerfAnalysis":126,"./ReactMount":140,"./ReactPerf":147,"_process":29,"fbjs/lib/performanceNow":227,"fbjs/lib/warning":229}],126:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -15064,9 +16192,10 @@ module.exports = ReactDefaultPerf;
'use strict';
-var assign = require('./Object.assign');
-
// Don't try to save users less than 1.2ms (a number I made up)
+
+var _assign = require('object-assign');
+
var DONT_CARE_THRESHOLD = 1.2;
var DOM_OPERATION_TYPES = {
'_mountImageIntoNode': 'set innerHTML',
@@ -15080,7 +16209,7 @@ var DOM_OPERATION_TYPES = {
'deleteValueForProperty': 'remove attribute',
'setValueForStyles': 'update styles',
'replaceNodeWithMarkup': 'replace',
- 'updateTextContent': 'set textContent'
+ 'replaceDelimitedText': 'replace'
};
function getTotalTime(measurements) {
@@ -15118,7 +16247,7 @@ function getExclusiveSummary(measurements) {
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
- var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
+ var allIDs = _assign({}, measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
displayName = measurement.displayNames[id].current;
@@ -15166,7 +16295,7 @@ function getInclusiveSummary(measurements, onlyClean) {
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
- var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
+ var allIDs = _assign({}, measurement.exclusive, measurement.inclusive);
var cleanComponents;
if (onlyClean) {
@@ -15220,18 +16349,26 @@ function getUnchangedComponents(measurement) {
// render anything to the DOM and return a mapping of their ID to
// the amount of time it took to render the entire subtree.
var cleanComponents = {};
- var dirtyLeafIDs = Object.keys(measurement.writes);
- var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
+ var writes = measurement.writes;
+ var hierarchy = measurement.hierarchy;
+ var dirtyComposites = {};
+ Object.keys(writes).forEach(function (id) {
+ writes[id].forEach(function (write) {
+ // Root mounting (innerHTML set) is recorded with an ID of ''
+ if (id !== '' && hierarchy.hasOwnProperty(id)) {
+ hierarchy[id].forEach(function (c) {
+ return dirtyComposites[c] = true;
+ });
+ }
+ });
+ });
+ 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 triggered
- // a DOM op is in its subtree.
- for (var i = 0; i < dirtyLeafIDs.length; i++) {
- if (dirtyLeafIDs[i].indexOf(id) === 0) {
- isDirty = true;
- break;
- }
+ // See if any of the DOM operations applied to this component's subtree.
+ if (dirtyComposites[id]) {
+ isDirty = true;
}
// check if component newly created
if (measurement.created[id]) {
@@ -15252,10 +16389,10 @@ var ReactDefaultPerfAnalysis = {
};
module.exports = ReactDefaultPerfAnalysis;
-},{"./Object.assign":84}],117:[function(require,module,exports){
+},{"object-assign":28}],127:[function(require,module,exports){
(function (process){
/**
- * Copyright 2014-2015, Facebook, Inc.
+ * Copyright 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -15267,9 +16404,11 @@ module.exports = ReactDefaultPerfAnalysis;
'use strict';
+var _assign = require('object-assign');
+
var ReactCurrentOwner = require('./ReactCurrentOwner');
-var assign = require('./Object.assign');
+var warning = require('fbjs/lib/warning');
var canDefineProperty = require('./canDefineProperty');
// The Symbol used to tag the ReactElement type. If there is no native Symbol
@@ -15283,9 +16422,13 @@ var RESERVED_PROPS = {
__source: true
};
+var specialPropKeyWarningShown, specialPropRefWarningShown;
+
/**
- * 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.
+ * Factory method to create a new React element. This no longer adheres to
+ * the class pattern, so do not use new to call it. Also, no instanceof check
+ * will work. Instead test $$typeof field against Symbol.for('react.element') to check
+ * if something is a React Element.
*
* @param {*} type
* @param {*} key
@@ -15354,8 +16497,10 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
element._self = self;
element._source = source;
}
- Object.freeze(element.props);
- Object.freeze(element);
+ if (Object.freeze) {
+ Object.freeze(element.props);
+ Object.freeze(element);
+ }
}
return element;
@@ -15373,8 +16518,13 @@ ReactElement.createElement = function (type, config, children) {
var source = null;
if (config != null) {
- ref = config.ref === undefined ? null : config.ref;
- key = config.key === undefined ? null : '' + config.key;
+ if (process.env.NODE_ENV !== 'production') {
+ ref = !config.hasOwnProperty('ref') || Object.getOwnPropertyDescriptor(config, 'ref').get ? null : config.ref;
+ key = !config.hasOwnProperty('key') || Object.getOwnPropertyDescriptor(config, 'key').get ? null : '' + config.key;
+ } else {
+ ref = config.ref === undefined ? null : config.ref;
+ key = config.key === undefined ? null : '' + config.key;
+ }
self = config.__self === undefined ? null : config.__self;
source = config.__source === undefined ? null : config.__source;
// Remaining properties are added to a new props object
@@ -15402,12 +16552,41 @@ ReactElement.createElement = function (type, config, children) {
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
- if (typeof props[propName] === 'undefined') {
+ if (props[propName] === undefined) {
props[propName] = defaultProps[propName];
}
}
}
-
+ if (process.env.NODE_ENV !== 'production') {
+ // Create dummy `key` and `ref` property to `props` to warn users
+ // against its use
+ if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
+ if (!props.hasOwnProperty('key')) {
+ Object.defineProperty(props, 'key', {
+ get: function () {
+ if (!specialPropKeyWarningShown) {
+ specialPropKeyWarningShown = true;
+ process.env.NODE_ENV !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', typeof type === 'function' && 'displayName' in type ? type.displayName : 'Element') : void 0;
+ }
+ return undefined;
+ },
+ configurable: true
+ });
+ }
+ if (!props.hasOwnProperty('ref')) {
+ Object.defineProperty(props, 'ref', {
+ get: function () {
+ if (!specialPropRefWarningShown) {
+ specialPropRefWarningShown = true;
+ process.env.NODE_ENV !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', typeof type === 'function' && 'displayName' in type ? type.displayName : 'Element') : void 0;
+ }
+ return undefined;
+ },
+ configurable: true
+ });
+ }
+ }
+ }
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
};
@@ -15428,22 +16607,11 @@ ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
return newElement;
};
-ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
- var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);
-
- if (process.env.NODE_ENV !== 'production') {
- // If the key on the original is valid, then the clone is valid
- newElement._store.validated = oldElement._store.validated;
- }
-
- return newElement;
-};
-
ReactElement.cloneElement = function (element, config, children) {
var propName;
// Original props are copied
- var props = assign({}, element.props);
+ var props = _assign({}, element.props);
// Reserved names are extracted
var key = element.key;
@@ -15468,9 +16636,18 @@ ReactElement.cloneElement = function (element, config, children) {
key = '' + config.key;
}
// Remaining properties override existing props
+ var defaultProps;
+ if (element.type && element.type.defaultProps) {
+ defaultProps = element.type.defaultProps;
+ }
for (propName in config) {
if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
- props[propName] = config[propName];
+ if (config[propName] === undefined && defaultProps !== undefined) {
+ // Resolve default props
+ props[propName] = defaultProps[propName];
+ } else {
+ props[propName] = config[propName];
+ }
}
}
}
@@ -15503,10 +16680,10 @@ ReactElement.isValidElement = function (object) {
module.exports = ReactElement;
}).call(this,require('_process'))
-},{"./Object.assign":84,"./ReactCurrentOwner":99,"./canDefineProperty":178,"_process":27}],118:[function(require,module,exports){
+},{"./ReactCurrentOwner":101,"./canDefineProperty":177,"_process":29,"fbjs/lib/warning":229,"object-assign":28}],128:[function(require,module,exports){
(function (process){
/**
- * Copyright 2014-2015, Facebook, Inc.
+ * Copyright 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -15575,7 +16752,7 @@ function validateExplicitKey(element, parentType) {
// we already showed the warning
return;
}
- process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : void 0;
}
/**
@@ -15681,19 +16858,19 @@ function checkPropTypes(componentName, propTypes, props, location) {
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
- !(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
+ !(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : void 0;
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
}
- process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : void 0;
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var addendum = getDeclarationErrorAddendum();
- process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : void 0;
}
}
}
@@ -15715,7 +16892,7 @@ function validatePropTypes(element) {
checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
}
if (typeof componentClass.getDefaultProps === 'function') {
- process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
}
}
@@ -15725,7 +16902,7 @@ var ReactElementValidator = {
var validType = typeof type === 'string' || typeof type === 'function';
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
- process.env.NODE_ENV !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : void 0;
var element = ReactElement.createElement.apply(this, arguments);
@@ -15761,7 +16938,7 @@ var ReactElementValidator = {
Object.defineProperty(validatedFactory, 'type', {
enumerable: false,
get: function () {
- process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0;
Object.defineProperty(this, 'type', {
value: type
});
@@ -15788,9 +16965,9 @@ var ReactElementValidator = {
module.exports = ReactElementValidator;
}).call(this,require('_process'))
-},{"./ReactCurrentOwner":99,"./ReactElement":117,"./ReactPropTypeLocationNames":140,"./ReactPropTypeLocations":141,"./canDefineProperty":178,"./getIteratorFn":190,"_process":27,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],119:[function(require,module,exports){
+},{"./ReactCurrentOwner":101,"./ReactElement":127,"./ReactPropTypeLocationNames":148,"./ReactPropTypeLocations":149,"./canDefineProperty":177,"./getIteratorFn":188,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],129:[function(require,module,exports){
/**
- * Copyright 2014-2015, Facebook, Inc.
+ * Copyright 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -15802,97 +16979,27 @@ module.exports = ReactElementValidator;
'use strict';
-var ReactElement = require('./ReactElement');
-var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
-var ReactReconciler = require('./ReactReconciler');
-
-var assign = require('./Object.assign');
-
-var placeholderElement;
+var emptyComponentFactory;
var ReactEmptyComponentInjection = {
- injectEmptyComponent: function (component) {
- placeholderElement = ReactElement.createElement(component);
+ injectEmptyComponentFactory: function (factory) {
+ emptyComponentFactory = factory;
}
};
-var ReactEmptyComponent = function (instantiate) {
- this._currentElement = null;
- this._rootNodeID = null;
- this._renderedComponent = instantiate(placeholderElement);
-};
-assign(ReactEmptyComponent.prototype, {
- construct: function (element) {},
- mountComponent: function (rootID, transaction, context) {
- ReactEmptyComponentRegistry.registerNullComponentID(rootID);
- this._rootNodeID = rootID;
- return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
- },
- receiveComponent: function () {},
- unmountComponent: function (rootID, transaction, context) {
- ReactReconciler.unmountComponent(this._renderedComponent);
- ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
- this._rootNodeID = null;
- this._renderedComponent = null;
+var ReactEmptyComponent = {
+ create: function (instantiate) {
+ return emptyComponentFactory(instantiate);
}
-});
+};
ReactEmptyComponent.injection = ReactEmptyComponentInjection;
module.exports = ReactEmptyComponent;
-},{"./Object.assign":84,"./ReactElement":117,"./ReactEmptyComponentRegistry":120,"./ReactReconciler":144}],120:[function(require,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactEmptyComponentRegistry
- */
-
-'use strict';
-
-// This registry keeps track of the React IDs of the components that rendered to
-// `null` (in reality a placeholder such as `noscript`)
-var nullComponentIDsRegistry = {};
-
-/**
- * @param {string} id Component's `_rootNodeID`.
- * @return {boolean} True if the component is rendered to null.
- */
-function isNullComponentID(id) {
- return !!nullComponentIDsRegistry[id];
-}
-
-/**
- * Mark the component as having rendered to null.
- * @param {string} id Component's `_rootNodeID`.
- */
-function registerNullComponentID(id) {
- nullComponentIDsRegistry[id] = true;
-}
-
-/**
- * Unmark the component as having rendered to null: it renders to something now.
- * @param {string} id Component's `_rootNodeID`.
- */
-function deregisterNullComponentID(id) {
- delete nullComponentIDsRegistry[id];
-}
-
-var ReactEmptyComponentRegistry = {
- isNullComponentID: isNullComponentID,
- registerNullComponentID: registerNullComponentID,
- deregisterNullComponentID: deregisterNullComponentID
-};
-
-module.exports = ReactEmptyComponentRegistry;
-},{}],121:[function(require,module,exports){
+},{}],130:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -15900,7 +17007,6 @@ module.exports = ReactEmptyComponentRegistry;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactErrorUtils
- * @typechecks
*/
'use strict';
@@ -15970,9 +17076,9 @@ if (process.env.NODE_ENV !== 'production') {
module.exports = ReactErrorUtils;
}).call(this,require('_process'))
-},{"_process":27}],122:[function(require,module,exports){
+},{"_process":29}],131:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -15996,22 +17102,17 @@ var ReactEventEmitterMixin = {
/**
* Streams a fired top-level event to `EventPluginHub` where plugins have the
* opportunity to create `ReactEvent`s to be dispatched.
- *
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {object} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native environment event.
*/
- handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
- var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
+ handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
runEventQueueInBatch(events);
}
};
module.exports = ReactEventEmitterMixin;
-},{"./EventPluginHub":76}],123:[function(require,module,exports){
+},{"./EventPluginHub":83}],132:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -16019,40 +17120,36 @@ module.exports = ReactEventEmitterMixin;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEventListener
- * @typechecks static-only
*/
'use strict';
+var _assign = require('object-assign');
+
var EventListener = require('fbjs/lib/EventListener');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var PooledClass = require('./PooledClass');
-var ReactInstanceHandles = require('./ReactInstanceHandles');
-var ReactMount = require('./ReactMount');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var ReactUpdates = require('./ReactUpdates');
-var assign = require('./Object.assign');
var getEventTarget = require('./getEventTarget');
var getUnboundedScrollPosition = require('fbjs/lib/getUnboundedScrollPosition');
-var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
-
/**
- * Finds the parent React component of `node`.
- *
- * @param {*} node
- * @return {?DOMEventTarget} Parent container, or `null` if the specified node
- * is not nested.
+ * Find the deepest React component completely containing the root of the
+ * passed-in instance (for use when entire React trees are nested within each
+ * other). If React trees are not nested, returns null.
*/
-function findParent(node) {
+function findParent(inst) {
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
// traversal, but caching is difficult to do correctly without using a
// mutation observer to listen for all DOM changes.
- var nodeID = ReactMount.getID(node);
- var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
- var container = ReactMount.findReactContainerForID(rootID);
- var parent = ReactMount.getFirstReactDOM(container);
- return parent;
+ while (inst._nativeParent) {
+ inst = inst._nativeParent;
+ }
+ var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
+ var container = rootNode.parentNode;
+ return ReactDOMComponentTree.getClosestInstanceFromNode(container);
}
// Used to store ancestor hierarchy in top level callback
@@ -16061,7 +17158,7 @@ function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
this.nativeEvent = nativeEvent;
this.ancestors = [];
}
-assign(TopLevelCallbackBookKeeping.prototype, {
+_assign(TopLevelCallbackBookKeeping.prototype, {
destructor: function () {
this.topLevelType = null;
this.nativeEvent = null;
@@ -16071,72 +17168,22 @@ assign(TopLevelCallbackBookKeeping.prototype, {
PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
function handleTopLevelImpl(bookKeeping) {
- // TODO: Re-enable event.path handling
- //
- // if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
- // // New browsers have a path attribute on native events
- // handleTopLevelWithPath(bookKeeping);
- // } else {
- // // Legacy browsers don't have a path attribute on native events
- // handleTopLevelWithoutPath(bookKeeping);
- // }
-
- void handleTopLevelWithPath; // temporarily unused
- handleTopLevelWithoutPath(bookKeeping);
-}
-
-// Legacy browsers don't have a path attribute on native events
-function handleTopLevelWithoutPath(bookKeeping) {
- var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
+ var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
+ var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
// Loop through the hierarchy, in case there's any nested components.
// It's important that we build the array of ancestors before calling any
// event handlers, because event handlers can modify the DOM, leading to
// inconsistencies with ReactMount's node cache. See #1105.
- var ancestor = topLevelTarget;
- while (ancestor) {
+ var ancestor = targetInst;
+ do {
bookKeeping.ancestors.push(ancestor);
- ancestor = findParent(ancestor);
- }
+ ancestor = ancestor && findParent(ancestor);
+ } while (ancestor);
for (var i = 0; i < bookKeeping.ancestors.length; i++) {
- topLevelTarget = bookKeeping.ancestors[i];
- var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
- ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
- }
-}
-
-// New browsers have a path attribute on native events
-function handleTopLevelWithPath(bookKeeping) {
- var path = bookKeeping.nativeEvent.path;
- var currentNativeTarget = path[0];
- var eventsFired = 0;
- for (var i = 0; i < path.length; i++) {
- var currentPathElement = path[i];
- if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
- currentNativeTarget = path[i + 1];
- }
- // TODO: slow
- var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
- if (reactParent === currentPathElement) {
- var currentPathElementID = ReactMount.getID(currentPathElement);
- var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
- bookKeeping.ancestors.push(currentPathElement);
-
- var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
- eventsFired++;
- ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
-
- // Jump to the root of this React render tree
- while (currentPathElementID !== newRootID) {
- i++;
- currentPathElement = path[i];
- currentPathElementID = ReactMount.getID(currentPathElement);
- }
- }
- }
- if (eventsFired === 0) {
- ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
+ targetInst = bookKeeping.ancestors[i];
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
@@ -16221,77 +17268,31 @@ var ReactEventListener = {
};
module.exports = ReactEventListener;
-},{"./Object.assign":84,"./PooledClass":85,"./ReactInstanceHandles":127,"./ReactMount":132,"./ReactUpdates":156,"./getEventTarget":189,"fbjs/lib/EventListener":207,"fbjs/lib/ExecutionEnvironment":208,"fbjs/lib/getUnboundedScrollPosition":219}],124:[function(require,module,exports){
-(function (process){
+},{"./PooledClass":91,"./ReactDOMComponentTree":106,"./ReactUpdates":155,"./getEventTarget":187,"fbjs/lib/EventListener":204,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/getUnboundedScrollPosition":216,"object-assign":28}],133:[function(require,module,exports){
/**
- * Copyright 2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule ReactFragment
+ * @providesModule ReactFeatureFlags
*/
'use strict';
-var ReactChildren = require('./ReactChildren');
-var ReactElement = require('./ReactElement');
-
-var emptyFunction = require('fbjs/lib/emptyFunction');
-var invariant = require('fbjs/lib/invariant');
-var warning = require('fbjs/lib/warning');
-
-/**
- * We used to allow keyed objects to serve as a collection of ReactElements,
- * or nested sets. This allowed us a way to explicitly key a set a fragment of
- * components. This is now being replaced with an opaque data structure.
- * The upgrade path is to call React.addons.createFragment({ key: value }) to
- * create a keyed fragment. The resulting data structure is an array.
- */
-
-var numericPropertyRegex = /^\d+$/;
-
-var warnedAboutNumeric = false;
-
-var ReactFragment = {
- // Wrap a keyed object in an opaque proxy that warns you if you access any
- // of its properties.
- create: function (object) {
- if (typeof object !== 'object' || !object || Array.isArray(object)) {
- process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : undefined;
- return object;
- }
- if (ReactElement.isValidElement(object)) {
- process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
- return object;
- }
-
- !(object.nodeType !== 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.addons.createFragment(...): Encountered an invalid child; DOM ' + 'elements are not valid children of React components.') : invariant(false) : undefined;
-
- var result = [];
-
- for (var key in object) {
- if (process.env.NODE_ENV !== 'production') {
- if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
- process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment(...): Child objects should have ' + 'non-numeric keys so ordering is preserved.') : undefined;
- warnedAboutNumeric = true;
- }
- }
- ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument);
- }
-
- return result;
- }
+var ReactFeatureFlags = {
+ // When true, call console.time() before and .timeEnd() after each top-level
+ // render (both initial renders and updates). Useful when looking at prod-mode
+ // timeline profiles in Chrome, for example.
+ logTopLevelRenders: false
};
-module.exports = ReactFragment;
-}).call(this,require('_process'))
-
-},{"./ReactChildren":92,"./ReactElement":117,"_process":27,"fbjs/lib/emptyFunction":214,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],125:[function(require,module,exports){
+module.exports = ReactFeatureFlags;
+},{}],134:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -16305,13 +17306,13 @@ module.exports = ReactFragment;
var DOMProperty = require('./DOMProperty');
var EventPluginHub = require('./EventPluginHub');
+var EventPluginUtils = require('./EventPluginUtils');
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
var ReactClass = require('./ReactClass');
var ReactEmptyComponent = require('./ReactEmptyComponent');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
var ReactNativeComponent = require('./ReactNativeComponent');
var ReactPerf = require('./ReactPerf');
-var ReactRootIndex = require('./ReactRootIndex');
var ReactUpdates = require('./ReactUpdates');
var ReactInjection = {
@@ -16320,17 +17321,17 @@ var ReactInjection = {
DOMProperty: DOMProperty.injection,
EmptyComponent: ReactEmptyComponent.injection,
EventPluginHub: EventPluginHub.injection,
+ EventPluginUtils: EventPluginUtils.injection,
EventEmitter: ReactBrowserEventEmitter.injection,
NativeComponent: ReactNativeComponent.injection,
Perf: ReactPerf.injection,
- RootIndex: ReactRootIndex.injection,
Updates: ReactUpdates.injection
};
module.exports = ReactInjection;
-},{"./DOMProperty":70,"./EventPluginHub":76,"./ReactBrowserEventEmitter":88,"./ReactClass":93,"./ReactComponentEnvironment":96,"./ReactEmptyComponent":119,"./ReactNativeComponent":135,"./ReactPerf":138,"./ReactRootIndex":146,"./ReactUpdates":156}],126:[function(require,module,exports){
+},{"./DOMProperty":76,"./EventPluginHub":83,"./EventPluginUtils":85,"./ReactBrowserEventEmitter":93,"./ReactClass":96,"./ReactComponentEnvironment":99,"./ReactEmptyComponent":129,"./ReactNativeComponent":143,"./ReactPerf":147,"./ReactUpdates":155}],135:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -16405,7 +17406,7 @@ var ReactInputSelection = {
start: input.selectionStart,
end: input.selectionEnd
};
- } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
+ } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
// IE8 input.
var range = document.selection.createRange();
// There can only be one selection per document in IE, so it must
@@ -16433,14 +17434,14 @@ var ReactInputSelection = {
setSelection: function (input, offsets) {
var start = offsets.start;
var end = offsets.end;
- if (typeof end === 'undefined') {
+ if (end === undefined) {
end = start;
}
if ('selectionStart' in input) {
input.selectionStart = start;
input.selectionEnd = Math.min(end, input.value.length);
- } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
+ } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
var range = input.createTextRange();
range.collapse(true);
range.moveStart('character', start);
@@ -16453,315 +17454,9 @@ var ReactInputSelection = {
};
module.exports = ReactInputSelection;
-},{"./ReactDOMSelection":109,"fbjs/lib/containsNode":211,"fbjs/lib/focusNode":216,"fbjs/lib/getActiveElement":217}],127:[function(require,module,exports){
-(function (process){
+},{"./ReactDOMSelection":117,"fbjs/lib/containsNode":208,"fbjs/lib/focusNode":213,"fbjs/lib/getActiveElement":214}],136:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactInstanceHandles
- * @typechecks static-only
- */
-
-'use strict';
-
-var ReactRootIndex = require('./ReactRootIndex');
-
-var invariant = require('fbjs/lib/invariant');
-
-var SEPARATOR = '.';
-var SEPARATOR_LENGTH = SEPARATOR.length;
-
-/**
- * Maximum depth of traversals before we consider the possibility of a bad ID.
- */
-var MAX_TREE_DEPTH = 10000;
-
-/**
- * Creates a DOM ID prefix to use when mounting React components.
- *
- * @param {number} index A unique integer
- * @return {string} React root ID.
- * @internal
- */
-function getReactRootIDString(index) {
- return SEPARATOR + index.toString(36);
-}
-
-/**
- * Checks if a character in the supplied ID is a separator or the end.
- *
- * @param {string} id A React DOM ID.
- * @param {number} index Index of the character to check.
- * @return {boolean} True if the character is a separator or end of the ID.
- * @private
- */
-function isBoundary(id, index) {
- return id.charAt(index) === SEPARATOR || index === id.length;
-}
-
-/**
- * Checks if the supplied string is a valid React DOM ID.
- *
- * @param {string} id A React DOM ID, maybe.
- * @return {boolean} True if the string is a valid React DOM ID.
- * @private
- */
-function isValidID(id) {
- return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
-}
-
-/**
- * Checks if the first ID is an ancestor of or equal to the second ID.
- *
- * @param {string} ancestorID
- * @param {string} descendantID
- * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
- * @internal
- */
-function isAncestorIDOf(ancestorID, descendantID) {
- return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
-}
-
-/**
- * Gets the parent ID of the supplied React DOM ID, `id`.
- *
- * @param {string} id ID of a component.
- * @return {string} ID of the parent, or an empty string.
- * @private
- */
-function getParentID(id) {
- return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
-}
-
-/**
- * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
- * supplied `destinationID`. If they are equal, the ID is returned.
- *
- * @param {string} ancestorID ID of an ancestor node of `destinationID`.
- * @param {string} destinationID ID of the destination node.
- * @return {string} Next ID on the path from `ancestorID` to `destinationID`.
- * @private
- */
-function getNextDescendantID(ancestorID, destinationID) {
- !(isValidID(ancestorID) && isValidID(destinationID)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
- !isAncestorIDOf(ancestorID, destinationID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
- if (ancestorID === destinationID) {
- return ancestorID;
- }
- // Skip over the ancestor and the immediate separator. Traverse until we hit
- // another separator or we reach the end of `destinationID`.
- var start = ancestorID.length + SEPARATOR_LENGTH;
- var i;
- for (i = start; i < destinationID.length; i++) {
- if (isBoundary(destinationID, i)) {
- break;
- }
- }
- return destinationID.substr(0, i);
-}
-
-/**
- * Gets the nearest common ancestor ID of two IDs.
- *
- * Using this ID scheme, the nearest common ancestor ID is the longest common
- * prefix of the two IDs that immediately preceded a "marker" in both strings.
- *
- * @param {string} oneID
- * @param {string} twoID
- * @return {string} Nearest common ancestor ID, or the empty string if none.
- * @private
- */
-function getFirstCommonAncestorID(oneID, twoID) {
- var minLength = Math.min(oneID.length, twoID.length);
- if (minLength === 0) {
- return '';
- }
- var lastCommonMarkerIndex = 0;
- // Use `<=` to traverse until the "EOL" of the shorter string.
- for (var i = 0; i <= minLength; i++) {
- if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
- lastCommonMarkerIndex = i;
- } else if (oneID.charAt(i) !== twoID.charAt(i)) {
- break;
- }
- }
- var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
- !isValidID(longestCommonID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
- return longestCommonID;
-}
-
-/**
- * Traverses the parent path between two IDs (either up or down). The IDs must
- * not be the same, and there must exist a parent path between them. If the
- * callback returns `false`, traversal is stopped.
- *
- * @param {?string} start ID at which to start traversal.
- * @param {?string} stop ID at which to end traversal.
- * @param {function} cb Callback to invoke each ID with.
- * @param {*} arg Argument to invoke the callback with.
- * @param {?boolean} skipFirst Whether or not to skip the first node.
- * @param {?boolean} skipLast Whether or not to skip the last node.
- * @private
- */
-function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
- start = start || '';
- stop = stop || '';
- !(start !== stop) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
- var traverseUp = isAncestorIDOf(stop, start);
- !(traverseUp || isAncestorIDOf(start, stop)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
- // Traverse from `start` to `stop` one depth at a time.
- var depth = 0;
- var traverse = traverseUp ? getParentID : getNextDescendantID;
- for (var id = start;; /* until break */id = traverse(id, stop)) {
- var ret;
- if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
- ret = cb(id, traverseUp, arg);
- }
- if (ret === false || id === stop) {
- // Only break //after// visiting `stop`.
- break;
- }
- !(depth++ < MAX_TREE_DEPTH) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
- }
-}
-
-/**
- * Manages the IDs assigned to DOM representations of React components. This
- * uses a specific scheme in order to traverse the DOM efficiently (e.g. in
- * order to simulate events).
- *
- * @internal
- */
-var ReactInstanceHandles = {
-
- /**
- * Constructs a React root ID
- * @return {string} A React root ID.
- */
- createReactRootID: function () {
- return getReactRootIDString(ReactRootIndex.createReactRootIndex());
- },
-
- /**
- * Constructs a React ID by joining a root ID with a name.
- *
- * @param {string} rootID Root ID of a parent component.
- * @param {string} name A component's name (as flattened children).
- * @return {string} A React ID.
- * @internal
- */
- createReactID: function (rootID, name) {
- return rootID + name;
- },
-
- /**
- * Gets the DOM ID of the React component that is the root of the tree that
- * contains the React component with the supplied DOM ID.
- *
- * @param {string} id DOM ID of a React component.
- * @return {?string} DOM ID of the React component that is the root.
- * @internal
- */
- getReactRootIDFromNodeID: function (id) {
- if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
- var index = id.indexOf(SEPARATOR, 1);
- return index > -1 ? id.substr(0, index) : id;
- }
- return null;
- },
-
- /**
- * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
- * should would receive a `mouseEnter` or `mouseLeave` event.
- *
- * NOTE: Does not invoke the callback on the nearest common ancestor because
- * nothing "entered" or "left" that element.
- *
- * @param {string} leaveID ID being left.
- * @param {string} enterID ID being entered.
- * @param {function} cb Callback to invoke on each entered/left ID.
- * @param {*} upArg Argument to invoke the callback with on left IDs.
- * @param {*} downArg Argument to invoke the callback with on entered IDs.
- * @internal
- */
- traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
- var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
- if (ancestorID !== leaveID) {
- traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
- }
- if (ancestorID !== enterID) {
- traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
- }
- },
-
- /**
- * Simulates the traversal of a two-phase, capture/bubble event dispatch.
- *
- * NOTE: This traversal happens on IDs without touching the DOM.
- *
- * @param {string} targetID ID of the target node.
- * @param {function} cb Callback to invoke.
- * @param {*} arg Argument to invoke the callback with.
- * @internal
- */
- traverseTwoPhase: function (targetID, cb, arg) {
- if (targetID) {
- traverseParentPath('', targetID, cb, arg, true, false);
- traverseParentPath(targetID, '', cb, arg, false, true);
- }
- },
-
- /**
- * Same as `traverseTwoPhase` but skips the `targetID`.
- */
- traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
- if (targetID) {
- traverseParentPath('', targetID, cb, arg, true, true);
- traverseParentPath(targetID, '', cb, arg, true, true);
- }
- },
-
- /**
- * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
- * example, passing `.0.$row-0.1` would result in `cb` getting called
- * with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
- *
- * NOTE: This traversal happens on IDs without touching the DOM.
- *
- * @param {string} targetID ID of the target node.
- * @param {function} cb Callback to invoke.
- * @param {*} arg Argument to invoke the callback with.
- * @internal
- */
- traverseAncestors: function (targetID, cb, arg) {
- traverseParentPath('', targetID, cb, arg, true, false);
- },
-
- getFirstCommonAncestorID: getFirstCommonAncestorID,
-
- /**
- * Exposed for unit testing.
- * @private
- */
- _getNextDescendantID: getNextDescendantID,
-
- isAncestorIDOf: isAncestorIDOf,
-
- SEPARATOR: SEPARATOR
-
-};
-
-module.exports = ReactInstanceHandles;
-}).call(this,require('_process'))
-
-},{"./ReactRootIndex":146,"_process":27,"fbjs/lib/invariant":222}],128:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -16781,6 +17476,7 @@ module.exports = ReactInstanceHandles;
*/
// TODO: Replace this with ES6: var ReactInstanceMap = new Map();
+
var ReactInstanceMap = {
/**
@@ -16807,157 +17503,66 @@ var ReactInstanceMap = {
};
module.exports = ReactInstanceMap;
-},{}],129:[function(require,module,exports){
-(function (process){
+},{}],137:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule ReactIsomorphic
+ * @providesModule ReactInstrumentation
*/
'use strict';
-var ReactChildren = require('./ReactChildren');
-var ReactComponent = require('./ReactComponent');
-var ReactClass = require('./ReactClass');
-var ReactDOMFactories = require('./ReactDOMFactories');
-var ReactElement = require('./ReactElement');
-var ReactElementValidator = require('./ReactElementValidator');
-var ReactPropTypes = require('./ReactPropTypes');
-var ReactVersion = require('./ReactVersion');
-
-var assign = require('./Object.assign');
-var onlyChild = require('./onlyChild');
-
-var createElement = ReactElement.createElement;
-var createFactory = ReactElement.createFactory;
-var cloneElement = ReactElement.cloneElement;
-
-if (process.env.NODE_ENV !== 'production') {
- createElement = ReactElementValidator.createElement;
- createFactory = ReactElementValidator.createFactory;
- cloneElement = ReactElementValidator.cloneElement;
-}
-
-var React = {
-
- // Modern
-
- Children: {
- map: ReactChildren.map,
- forEach: ReactChildren.forEach,
- count: ReactChildren.count,
- toArray: ReactChildren.toArray,
- only: onlyChild
- },
-
- Component: ReactComponent,
-
- createElement: createElement,
- cloneElement: cloneElement,
- isValidElement: ReactElement.isValidElement,
-
- // Classic
-
- PropTypes: ReactPropTypes,
- createClass: ReactClass.createClass,
- createFactory: createFactory,
- createMixin: function (mixin) {
- // Currently a noop. Will be used to validate and trace mixins.
- return mixin;
- },
-
- // This looks DOM specific but these are actually isomorphic helpers
- // since they are just generating DOM strings.
- DOM: ReactDOMFactories,
+var ReactDebugTool = require('./ReactDebugTool');
- version: ReactVersion,
-
- // Hook for JSX spread, don't use this for anything else.
- __spread: assign
-};
-
-module.exports = React;
-}).call(this,require('_process'))
-
-},{"./Object.assign":84,"./ReactChildren":92,"./ReactClass":93,"./ReactComponent":94,"./ReactDOMFactories":103,"./ReactElement":117,"./ReactElementValidator":118,"./ReactPropTypes":142,"./ReactVersion":157,"./onlyChild":196,"_process":27}],130:[function(require,module,exports){
+module.exports = { debugTool: ReactDebugTool };
+},{"./ReactDebugTool":122}],138:[function(require,module,exports){
+(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the 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
+ * @providesModule ReactInvalidSetStateWarningDevTool
*/
'use strict';
-/**
- * ReactLink encapsulates a common pattern in which a component wants to modify
- * a prop received from its parent. ReactLink allows the parent to pass down a
- * value coupled with a callback that, when invoked, expresses an intent to
- * modify that value. For example:
- *
- * React.createClass({
- * getInitialState: function() {
- * return {value: ''};
- * },
- * render: function() {
- * var valueLink = new ReactLink(this.state.value, this._handleValueChange);
- * return <input valueLink={valueLink} />;
- * },
- * _handleValueChange: function(newValue) {
- * this.setState({value: newValue});
- * }
- * });
- *
- * We have provided some sugary mixins to make the creation and
- * consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
- */
-
-var React = require('./React');
+var warning = require('fbjs/lib/warning');
-/**
- * @param {*} value current value of the link
- * @param {function} requestChange callback to request a change
- */
-function ReactLink(value, requestChange) {
- this.value = value;
- this.requestChange = requestChange;
-}
+if (process.env.NODE_ENV !== 'production') {
+ var processingChildContext = false;
-/**
- * Creates a PropType that enforces the ReactLink API and optionally checks the
- * type of the value being passed inside the link. Example:
- *
- * MyComponent.propTypes = {
- * tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number)
- * }
- */
-function createLinkTypeChecker(linkType) {
- var shapes = {
- value: typeof linkType === 'undefined' ? React.PropTypes.any.isRequired : linkType.isRequired,
- requestChange: React.PropTypes.func.isRequired
+ var warnInvalidSetState = function () {
+ process.env.NODE_ENV !== 'production' ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0;
};
- return React.PropTypes.shape(shapes);
}
-ReactLink.PropTypes = {
- link: createLinkTypeChecker
+var ReactInvalidSetStateWarningDevTool = {
+ onBeginProcessingChildContext: function () {
+ processingChildContext = true;
+ },
+ onEndProcessingChildContext: function () {
+ processingChildContext = false;
+ },
+ onSetState: function () {
+ warnInvalidSetState();
+ }
};
-module.exports = ReactLink;
-},{"./React":86}],131:[function(require,module,exports){
+module.exports = ReactInvalidSetStateWarningDevTool;
+}).call(this,require('_process'))
+
+},{"_process":29,"fbjs/lib/warning":229}],139:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -16972,6 +17577,7 @@ module.exports = ReactLink;
var adler32 = require('./adler32');
var TAG_END = /\/?>/;
+var COMMENT_START = /^<\!\-\-/;
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
@@ -16983,8 +17589,12 @@ var ReactMarkupChecksum = {
addChecksumToMarkup: function (markup) {
var checksum = adler32(markup);
- // Add checksum (handle both parent tags and self-closing tags)
- return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
+ // Add checksum (handle both parent tags, comments and self-closing tags)
+ if (COMMENT_START.test(markup)) {
+ return markup;
+ } else {
+ return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
+ }
},
/**
@@ -17001,10 +17611,10 @@ var ReactMarkupChecksum = {
};
module.exports = ReactMarkupChecksum;
-},{"./adler32":177}],132:[function(require,module,exports){
+},{"./adler32":176}],140:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -17016,53 +17626,38 @@ module.exports = ReactMarkupChecksum;
'use strict';
+var DOMLazyTree = require('./DOMLazyTree');
var DOMProperty = require('./DOMProperty');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
var ReactCurrentOwner = require('./ReactCurrentOwner');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
+var ReactDOMContainerInfo = require('./ReactDOMContainerInfo');
var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
var ReactElement = require('./ReactElement');
-var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
-var ReactInstanceHandles = require('./ReactInstanceHandles');
-var ReactInstanceMap = require('./ReactInstanceMap');
+var ReactFeatureFlags = require('./ReactFeatureFlags');
+var ReactInstrumentation = require('./ReactInstrumentation');
var ReactMarkupChecksum = require('./ReactMarkupChecksum');
var ReactPerf = require('./ReactPerf');
var ReactReconciler = require('./ReactReconciler');
var ReactUpdateQueue = require('./ReactUpdateQueue');
var ReactUpdates = require('./ReactUpdates');
-var assign = require('./Object.assign');
var emptyObject = require('fbjs/lib/emptyObject');
-var containsNode = require('fbjs/lib/containsNode');
var instantiateReactComponent = require('./instantiateReactComponent');
var invariant = require('fbjs/lib/invariant');
var setInnerHTML = require('./setInnerHTML');
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
-var validateDOMNesting = require('./validateDOMNesting');
var warning = require('fbjs/lib/warning');
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
-var nodeCache = {};
+var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME;
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
-var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
-
-/** Mapping from reactRootID to React component instance. */
var instancesByReactRootID = {};
-/** Mapping from reactRootID to `container` nodes. */
-var containersByReactRootID = {};
-
-if (process.env.NODE_ENV !== 'production') {
- /** __DEV__-only mapping from reactRootID to root elements. */
- var rootElementsByReactRootID = {};
-}
-
-// Used to store breadth-first search state in findComponentRoot.
-var findComponentRootReusableArray = [];
-
/**
* Finds the index of the first character
* that's not common between the two given strings.
@@ -17096,195 +17691,52 @@ function getReactRootElementInContainer(container) {
}
}
-/**
- * @param {DOMElement} container DOM element that may contain a React component.
- * @return {?string} A "reactRoot" ID, if a React component is rendered.
- */
-function getReactRootID(container) {
- var rootElement = getReactRootElementInContainer(container);
- return rootElement && ReactMount.getID(rootElement);
-}
-
-/**
- * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
- * element can return its control whose name or ID equals ATTR_NAME. All
- * DOM nodes support `getAttributeNode` but this can also get called on
- * other objects so just return '' if we're given something other than a
- * DOM node (such as window).
- *
- * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
- * @return {string} ID of the supplied `domNode`.
- */
-function getID(node) {
- var id = internalGetID(node);
- if (id) {
- if (nodeCache.hasOwnProperty(id)) {
- var cached = nodeCache[id];
- if (cached !== node) {
- !!isValid(cached, id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
-
- nodeCache[id] = node;
- }
- } else {
- nodeCache[id] = node;
- }
- }
-
- return id;
-}
-
function internalGetID(node) {
// If node is something like a window, document, or text node, none of
// which support attributes or a .getAttribute method, gracefully return
// the empty string, as if the attribute were missing.
- return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
-}
-
-/**
- * Sets the React-specific ID of the given node.
- *
- * @param {DOMElement} node The DOM node whose ID will be set.
- * @param {string} id The value of the ID attribute.
- */
-function setID(node, id) {
- var oldID = internalGetID(node);
- if (oldID !== id) {
- delete nodeCache[oldID];
- }
- node.setAttribute(ATTR_NAME, id);
- nodeCache[id] = node;
-}
-
-/**
- * Finds the node with the supplied React-generated DOM ID.
- *
- * @param {string} id A React-generated DOM ID.
- * @return {DOMElement} DOM node with the suppled `id`.
- * @internal
- */
-function getNode(id) {
- if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
- nodeCache[id] = ReactMount.findReactNodeByID(id);
- }
- return nodeCache[id];
-}
-
-/**
- * Finds the node with the supplied public React instance.
- *
- * @param {*} instance A public React instance.
- * @return {?DOMElement} DOM node with the suppled `id`.
- * @internal
- */
-function getNodeFromInstance(instance) {
- var id = ReactInstanceMap.get(instance)._rootNodeID;
- if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
- return null;
- }
- if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
- nodeCache[id] = ReactMount.findReactNodeByID(id);
- }
- return nodeCache[id];
-}
-
-/**
- * A node is "valid" if it is contained by a currently mounted container.
- *
- * This means that the node does not have to be contained by a document in
- * order to be considered valid.
- *
- * @param {?DOMElement} node The candidate DOM node.
- * @param {string} id The expected ID of the node.
- * @return {boolean} Whether the node is contained by a mounted container.
- */
-function isValid(node, id) {
- if (node) {
- !(internalGetID(node) === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
-
- var container = ReactMount.findReactContainerForID(id);
- if (container && containsNode(container, node)) {
- return true;
- }
- }
-
- return false;
-}
-
-/**
- * Causes the cache to forget about one React-specific ID.
- *
- * @param {string} id The ID to forget.
- */
-function purgeID(id) {
- delete nodeCache[id];
-}
-
-var deepestNodeSoFar = null;
-function findDeepestCachedAncestorImpl(ancestorID) {
- var ancestor = nodeCache[ancestorID];
- if (ancestor && isValid(ancestor, ancestorID)) {
- deepestNodeSoFar = ancestor;
- } else {
- // This node isn't populated in the cache, so presumably none of its
- // descendants are. Break out of the loop.
- return false;
- }
-}
-
-/**
- * Return the deepest cached node whose ID is a prefix of `targetID`.
- */
-function findDeepestCachedAncestor(targetID) {
- deepestNodeSoFar = null;
- ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
-
- var foundNode = deepestNodeSoFar;
- deepestNodeSoFar = null;
- return foundNode;
+ return node.getAttribute && node.getAttribute(ATTR_NAME) || '';
}
/**
* Mounts this component and inserts it into the DOM.
*
* @param {ReactComponent} componentInstance The instance to mount.
- * @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {ReactReconcileTransaction} transaction
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
-function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
- if (ReactDOMFeatureFlags.useCreateElement) {
- context = assign({}, context);
- if (container.nodeType === DOC_NODE_TYPE) {
- context[ownerDocumentContextKey] = container;
- } else {
- context[ownerDocumentContextKey] = container.ownerDocument;
- }
+function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {
+ var markerName;
+ if (ReactFeatureFlags.logTopLevelRenders) {
+ var wrappedElement = wrapperInstance._currentElement.props;
+ var type = wrappedElement.type;
+ markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name);
+ console.time(markerName);
}
- if (process.env.NODE_ENV !== 'production') {
- if (context === emptyObject) {
- context = {};
- }
- var tag = container.nodeName.toLowerCase();
- context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
+
+ var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context);
+
+ if (markerName) {
+ console.timeEnd(markerName);
}
- var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
- componentInstance._renderedComponent._topLevelWrapper = componentInstance;
- ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
+
+ wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance;
+ ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction);
}
/**
* Batched mount.
*
* @param {ReactComponent} componentInstance The instance to mount.
- * @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
-function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
+function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
- /* forceHTML */shouldReuseMarkup);
- transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
+ /* useCreateElement */
+ !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);
+ transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
}
@@ -17297,8 +17749,8 @@ function batchedMountComponentIntoNode(componentInstance, rootID, container, sho
* @internal
* @see {ReactMount.unmountComponentAtNode}
*/
-function unmountComponentFromNode(instance, container) {
- ReactReconciler.unmountComponent(instance);
+function unmountComponentFromNode(instance, container, safely) {
+ ReactReconciler.unmountComponent(instance, safely);
if (container.nodeType === DOC_NODE_TYPE) {
container = container.documentElement;
@@ -17320,50 +17772,23 @@ function unmountComponentFromNode(instance, container) {
* rendered by React but is not a root element.
* @internal
*/
-function hasNonRootReactChild(node) {
- var reactRootID = getReactRootID(node);
- return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false;
+function hasNonRootReactChild(container) {
+ var rootEl = getReactRootElementInContainer(container);
+ if (rootEl) {
+ var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
+ return !!(inst && inst._nativeParent);
+ }
}
-/**
- * Returns the first (deepest) ancestor of a node which is rendered by this copy
- * of React.
- */
-function findFirstReactDOMImpl(node) {
- // This node might be from another React instance, so we make sure not to
- // examine the node cache here
- for (; node && node.parentNode !== node; node = node.parentNode) {
- if (node.nodeType !== 1) {
- // Not a DOMElement, therefore not a React component
- continue;
- }
- var nodeID = internalGetID(node);
- if (!nodeID) {
- continue;
- }
- var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
-
- // If containersByReactRootID contains the container we find by crawling up
- // the tree, we know that this instance of React rendered the node.
- // nb. isValid's strategy (with containsNode) does not work because render
- // trees may be nested and we don't want a false positive in that case.
- var current = node;
- var lastID;
- do {
- lastID = internalGetID(current);
- current = current.parentNode;
- if (current == null) {
- // The passed-in node has been detached from the container it was
- // originally rendered into.
- return null;
- }
- } while (lastID !== reactRootID);
+function getNativeRootInstanceInContainer(container) {
+ var rootEl = getReactRootElementInContainer(container);
+ var prevNativeInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl);
+ return prevNativeInstance && !prevNativeInstance._nativeParent ? prevNativeInstance : null;
+}
- if (current === containersByReactRootID[reactRootID]) {
- return node;
- }
- }
- return null;
+function getTopLevelWrapperInContainer(container) {
+ var root = getNativeRootInstanceInContainer(container);
+ return root ? root._nativeContainerInfo._topLevelWrapper : null;
}
/**
@@ -17371,7 +17796,10 @@ function findFirstReactDOMImpl(node) {
* composites instead of having to worry about different types of components
* here.
*/
-var TopLevelWrapper = function () {};
+var topLevelRootCounter = 1;
+var TopLevelWrapper = function () {
+ this.rootID = topLevelRootCounter++;
+};
TopLevelWrapper.prototype.isReactComponent = {};
if (process.env.NODE_ENV !== 'production') {
TopLevelWrapper.displayName = 'TopLevelWrapper';
@@ -17403,7 +17831,9 @@ var ReactMount = {
TopLevelWrapper: TopLevelWrapper,
- /** Exposed for debugging purposes **/
+ /**
+ * Used by devtools. The keys are not important.
+ */
_instancesByReactRootID: instancesByReactRootID,
/**
@@ -17433,33 +17863,12 @@ var ReactMount = {
}
});
- if (process.env.NODE_ENV !== 'production') {
- // Record the root element in case it later gets transplanted.
- rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
- }
-
return prevComponent;
},
/**
- * Register a component into the instance map and starts scroll value
- * monitoring
- * @param {ReactComponent} nextComponent component instance to render
- * @param {DOMElement} container container to render into
- * @return {string} reactRoot ID prefix
- */
- _registerComponent: function (nextComponent, container) {
- !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
-
- ReactBrowserEventEmitter.ensureScrollValueMonitoring();
-
- var reactRootID = ReactMount.registerContainer(container);
- instancesByReactRootID[reactRootID] = nextComponent;
- return reactRootID;
- },
-
- /**
- * Render a new component into the DOM.
+ * Render a new component into the DOM. Hooked by devtools!
+ *
* @param {ReactElement} nextElement element to render
* @param {DOMElement} container container to render into
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
@@ -17469,20 +17878,24 @@ var ReactMount = {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
- process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;
+
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : void 0;
- var componentInstance = instantiateReactComponent(nextElement, null);
- var reactRootID = ReactMount._registerComponent(componentInstance, container);
+ ReactBrowserEventEmitter.ensureScrollValueMonitoring();
+ var componentInstance = instantiateReactComponent(nextElement);
// The initial render is synchronous but any updates that happen during
// rendering, in componentWillMount or componentDidMount, will be batched
// according to the current batching strategy.
- ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
+ ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context);
+
+ var wrapperID = componentInstance._instance.rootID;
+ instancesByReactRootID[wrapperID] = componentInstance;
if (process.env.NODE_ENV !== 'production') {
- // Record the root element in case it later gets transplanted.
- rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
+ ReactInstrumentation.debugTool.onMountRootComponent(componentInstance);
}
return componentInstance;
@@ -17502,20 +17915,21 @@ var ReactMount = {
* @return {ReactComponent} Component instance rendered in `container`.
*/
renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
- !(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
+ !(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : void 0;
return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
},
_renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
- !ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
+ ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render');
+ !ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' :
// Check if it quacks like an element
- nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
+ nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : void 0;
- process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
- var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
+ var nextWrappedElement = ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
- var prevComponent = instancesByReactRootID[getReactRootID(container)];
+ var prevComponent = getTopLevelWrapperInContainer(container);
if (prevComponent) {
var prevWrappedElement = prevComponent._currentElement;
@@ -17537,13 +17951,13 @@ var ReactMount = {
var containerHasNonRootReactChild = hasNonRootReactChild(container);
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0;
if (!containerHasReactMarkup || reactRootElement.nextSibling) {
var rootElementSibling = reactRootElement;
while (rootElementSibling) {
if (internalGetID(rootElementSibling)) {
- process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : void 0;
break;
}
rootElementSibling = rootElementSibling.nextSibling;
@@ -17576,28 +17990,6 @@ var ReactMount = {
},
/**
- * Registers a container node into which React components will be rendered.
- * This also creates the "reactRoot" ID that will be assigned to the element
- * rendered within.
- *
- * @param {DOMElement} container DOM element to register as a container.
- * @return {string} The "reactRoot" ID of elements rendered within.
- */
- registerContainer: function (container) {
- var reactRootID = getReactRootID(container);
- if (reactRootID) {
- // If one exists, make sure it is a valid "reactRoot" ID.
- reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
- }
- if (!reactRootID) {
- // No valid "reactRoot" ID found, create one.
- reactRootID = ReactInstanceHandles.createReactRootID();
- }
- containersByReactRootID[reactRootID] = container;
- return reactRootID;
- },
-
- /**
* Unmounts and destroys the React component rendered in the `container`.
*
* @param {DOMElement} container DOM element containing a React component.
@@ -17609,172 +18001,37 @@ var ReactMount = {
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (Strictly speaking, unmounting won't cause a
// render but we still don't expect to be in a render call here.)
- process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;
- !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : void 0;
- var reactRootID = getReactRootID(container);
- var component = instancesByReactRootID[reactRootID];
- if (!component) {
+ var prevComponent = getTopLevelWrapperInContainer(container);
+ if (!prevComponent) {
// Check if the node being unmounted was rendered by React, but isn't a
// root node.
var containerHasNonRootReactChild = hasNonRootReactChild(container);
// Check if the container itself is a React root node.
- var containerID = internalGetID(container);
- var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID);
+ var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME);
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;
}
return false;
}
- ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
- delete instancesByReactRootID[reactRootID];
- delete containersByReactRootID[reactRootID];
- if (process.env.NODE_ENV !== 'production') {
- delete rootElementsByReactRootID[reactRootID];
- }
+ delete instancesByReactRootID[prevComponent._instance.rootID];
+ ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false);
return true;
},
- /**
- * Finds the container DOM element that contains React component to which the
- * supplied DOM `id` belongs.
- *
- * @param {string} id The ID of an element rendered by a React component.
- * @return {?DOMElement} DOM element that contains the `id`.
- */
- findReactContainerForID: function (id) {
- var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
- var container = containersByReactRootID[reactRootID];
-
- if (process.env.NODE_ENV !== 'production') {
- var rootElement = rootElementsByReactRootID[reactRootID];
- if (rootElement && rootElement.parentNode !== container) {
- process.env.NODE_ENV !== 'production' ? warning(
- // Call internalGetID here because getID calls isValid which calls
- // findReactContainerForID (this function).
- internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
- var containerChild = container.firstChild;
- if (containerChild && reactRootID === internalGetID(containerChild)) {
- // If the container has a new child with the same ID as the old
- // root element, then rootElementsByReactRootID[reactRootID] is
- // just stale and needs to be updated. The case that deserves a
- // warning is when the container is empty.
- rootElementsByReactRootID[reactRootID] = containerChild;
- } else {
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
- }
- }
- }
-
- return container;
- },
-
- /**
- * Finds an element rendered by React with the supplied ID.
- *
- * @param {string} id ID of a DOM node in the React component.
- * @return {DOMElement} Root DOM node of the React component.
- */
- findReactNodeByID: function (id) {
- var reactRoot = ReactMount.findReactContainerForID(id);
- return ReactMount.findComponentRoot(reactRoot, id);
- },
-
- /**
- * Traverses up the ancestors of the supplied node to find a node that is a
- * DOM representation of a React component rendered by this copy of React.
- *
- * @param {*} node
- * @return {?DOMEventTarget}
- * @internal
- */
- getFirstReactDOM: function (node) {
- return findFirstReactDOMImpl(node);
- },
-
- /**
- * Finds a node with the supplied `targetID` inside of the supplied
- * `ancestorNode`. Exploits the ID naming scheme to perform the search
- * quickly.
- *
- * @param {DOMEventTarget} ancestorNode Search from this root.
- * @pararm {string} targetID ID of the DOM representation of the component.
- * @return {DOMEventTarget} DOM node with the supplied `targetID`.
- * @internal
- */
- findComponentRoot: function (ancestorNode, targetID) {
- var firstChildren = findComponentRootReusableArray;
- var childIndex = 0;
-
- var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
-
- if (process.env.NODE_ENV !== 'production') {
- // This will throw on the next line; give an early warning
- process.env.NODE_ENV !== 'production' ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined;
- }
-
- firstChildren[0] = deepestAncestor.firstChild;
- firstChildren.length = 1;
-
- while (childIndex < firstChildren.length) {
- var child = firstChildren[childIndex++];
- var targetChild;
-
- while (child) {
- var childID = ReactMount.getID(child);
- if (childID) {
- // Even if we find the node we're looking for, we finish looping
- // through its siblings to ensure they're cached so that we don't have
- // to revisit this node again. Otherwise, we make n^2 calls to getID
- // when visiting the many children of a single node in order.
-
- if (targetID === childID) {
- targetChild = child;
- } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
- // If we find a child whose ID is an ancestor of the given ID,
- // then we can be sure that we only want to search the subtree
- // rooted at this child, so we can throw out the rest of the
- // search state.
- firstChildren.length = childIndex = 0;
- firstChildren.push(child.firstChild);
- }
- } else {
- // If this child had no ID, then there's a chance that it was
- // injected automatically by the browser, as when a `<table>`
- // element sprouts an extra `<tbody>` child as a side effect of
- // `.innerHTML` parsing. Optimistically continue down this
- // branch, but not before examining the other siblings.
- firstChildren.push(child.firstChild);
- }
-
- child = child.nextSibling;
- }
-
- if (targetChild) {
- // Emptying firstChildren/findComponentRootReusableArray is
- // not necessary for correctness, but it helps the GC reclaim
- // any nodes that were left at the end of the search.
- firstChildren.length = 0;
-
- return targetChild;
- }
- }
-
- firstChildren.length = 0;
-
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
- },
-
- _mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
- !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
+ _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) {
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : void 0;
if (shouldReuseMarkup) {
var rootElement = getReactRootElementInContainer(container);
if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
+ ReactDOMComponentTree.precacheNode(instance, rootElement);
return;
} else {
var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
@@ -17806,45 +18063,26 @@ var ReactMount = {
var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
- !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
+ !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : void 0;
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : void 0;
}
}
}
- !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
+ !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : void 0;
if (transaction.useCreateElement) {
while (container.lastChild) {
container.removeChild(container.lastChild);
}
- container.appendChild(markup);
+ DOMLazyTree.insertTreeBefore(container, markup, null);
} else {
setInnerHTML(container, markup);
+ ReactDOMComponentTree.precacheNode(instance, container.firstChild);
}
- },
-
- ownerDocumentContextKey: ownerDocumentContextKey,
-
- /**
- * React ID utilities.
- */
-
- getReactRootID: getReactRootID,
-
- getID: getID,
-
- setID: setID,
-
- getNode: getNode,
-
- getNodeFromInstance: getNodeFromInstance,
-
- isValid: isValid,
-
- purgeID: purgeID
+ }
};
ReactPerf.measureMethods(ReactMount, 'ReactMount', {
@@ -17855,10 +18093,10 @@ ReactPerf.measureMethods(ReactMount, 'ReactMount', {
module.exports = ReactMount;
}).call(this,require('_process'))
-},{"./DOMProperty":70,"./Object.assign":84,"./ReactBrowserEventEmitter":88,"./ReactCurrentOwner":99,"./ReactDOMFeatureFlags":104,"./ReactElement":117,"./ReactEmptyComponentRegistry":120,"./ReactInstanceHandles":127,"./ReactInstanceMap":128,"./ReactMarkupChecksum":131,"./ReactPerf":138,"./ReactReconciler":144,"./ReactUpdateQueue":155,"./ReactUpdates":156,"./instantiateReactComponent":193,"./setInnerHTML":199,"./shouldUpdateReactComponent":202,"./validateDOMNesting":205,"_process":27,"fbjs/lib/containsNode":211,"fbjs/lib/emptyObject":215,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],133:[function(require,module,exports){
+},{"./DOMLazyTree":74,"./DOMProperty":76,"./ReactBrowserEventEmitter":93,"./ReactCurrentOwner":101,"./ReactDOMComponentTree":106,"./ReactDOMContainerInfo":107,"./ReactDOMFeatureFlags":111,"./ReactElement":127,"./ReactFeatureFlags":133,"./ReactInstrumentation":137,"./ReactMarkupChecksum":139,"./ReactPerf":147,"./ReactReconciler":152,"./ReactUpdateQueue":154,"./ReactUpdates":155,"./instantiateReactComponent":193,"./setInnerHTML":199,"./shouldUpdateReactComponent":201,"_process":29,"fbjs/lib/emptyObject":212,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],141:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -17866,7 +18104,6 @@ module.exports = ReactMount;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMultiChild
- * @typechecks static-only
*/
'use strict';
@@ -17879,156 +18116,119 @@ var ReactReconciler = require('./ReactReconciler');
var ReactChildReconciler = require('./ReactChildReconciler');
var flattenChildren = require('./flattenChildren');
+var invariant = require('fbjs/lib/invariant');
/**
- * Updating children of a component may trigger recursive updates. The depth is
- * used to batch recursive updates to render markup more efficiently.
- *
- * @type {number}
- * @private
- */
-var updateDepth = 0;
-
-/**
- * Queue of update configuration objects.
- *
- * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
- *
- * @type {array<object>}
- * @private
- */
-var updateQueue = [];
-
-/**
- * Queue of markup to be rendered.
- *
- * @type {array<string>}
- * @private
- */
-var markupQueue = [];
-
-/**
- * Enqueues markup to be rendered and inserted at a supplied index.
+ * Make an update for markup to be rendered and inserted at a supplied index.
*
- * @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @param {number} toIndex Destination index.
* @private
*/
-function enqueueInsertMarkup(parentID, markup, toIndex) {
+function makeInsertMarkup(markup, afterNode, toIndex) {
// NOTE: Null values reduce hidden classes.
- updateQueue.push({
- parentID: parentID,
- parentNode: null,
+ return {
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
- markupIndex: markupQueue.push(markup) - 1,
- content: null,
+ content: markup,
fromIndex: null,
- toIndex: toIndex
- });
+ fromNode: null,
+ toIndex: toIndex,
+ afterNode: afterNode
+ };
}
/**
- * Enqueues moving an existing element to another index.
+ * Make an update for moving an existing element to another index.
*
- * @param {string} parentID ID of the parent component.
* @param {number} fromIndex Source index of the existing element.
* @param {number} toIndex Destination index of the element.
* @private
*/
-function enqueueMove(parentID, fromIndex, toIndex) {
+function makeMove(child, afterNode, toIndex) {
// NOTE: Null values reduce hidden classes.
- updateQueue.push({
- parentID: parentID,
- parentNode: null,
+ return {
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
- markupIndex: null,
content: null,
- fromIndex: fromIndex,
- toIndex: toIndex
- });
+ fromIndex: child._mountIndex,
+ fromNode: ReactReconciler.getNativeNode(child),
+ toIndex: toIndex,
+ afterNode: afterNode
+ };
}
/**
- * Enqueues removing an element at an index.
+ * Make an update for removing an element at an index.
*
- * @param {string} parentID ID of the parent component.
* @param {number} fromIndex Index of the element to remove.
* @private
*/
-function enqueueRemove(parentID, fromIndex) {
+function makeRemove(child, node) {
// NOTE: Null values reduce hidden classes.
- updateQueue.push({
- parentID: parentID,
- parentNode: null,
+ return {
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
- markupIndex: null,
content: null,
- fromIndex: fromIndex,
- toIndex: null
- });
+ fromIndex: child._mountIndex,
+ fromNode: node,
+ toIndex: null,
+ afterNode: null
+ };
}
/**
- * Enqueues setting the markup of a node.
+ * Make an update for setting the markup of a node.
*
- * @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @private
*/
-function enqueueSetMarkup(parentID, markup) {
+function makeSetMarkup(markup) {
// NOTE: Null values reduce hidden classes.
- updateQueue.push({
- parentID: parentID,
- parentNode: null,
+ return {
type: ReactMultiChildUpdateTypes.SET_MARKUP,
- markupIndex: null,
content: markup,
fromIndex: null,
- toIndex: null
- });
+ fromNode: null,
+ toIndex: null,
+ afterNode: null
+ };
}
/**
- * Enqueues setting the text content.
+ * Make an update for setting the text content.
*
- * @param {string} parentID ID of the parent component.
* @param {string} textContent Text content to set.
* @private
*/
-function enqueueTextContent(parentID, textContent) {
+function makeTextContent(textContent) {
// NOTE: Null values reduce hidden classes.
- updateQueue.push({
- parentID: parentID,
- parentNode: null,
+ return {
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
- markupIndex: null,
content: textContent,
fromIndex: null,
- toIndex: null
- });
+ fromNode: null,
+ toIndex: null,
+ afterNode: null
+ };
}
/**
- * Processes any enqueued updates.
- *
- * @private
+ * Push an update, if any, onto the queue. Creates a new queue if none is
+ * passed and always returns the queue. Mutative.
*/
-function processQueue() {
- if (updateQueue.length) {
- ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
- clearQueue();
+function enqueue(queue, update) {
+ if (update) {
+ queue = queue || [];
+ queue.push(update);
}
+ return queue;
}
/**
- * Clears any enqueued updates.
+ * Processes any enqueued updates.
*
* @private
*/
-function clearQueue() {
- updateQueue.length = 0;
- markupQueue.length = 0;
+function processQueue(inst, updateQueue) {
+ ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
}
/**
@@ -18062,7 +18262,7 @@ var ReactMultiChild = {
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
},
- _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
+ _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, removedNodes, transaction, context) {
var nextChildren;
if (process.env.NODE_ENV !== 'production') {
if (this._currentElement) {
@@ -18072,11 +18272,13 @@ var ReactMultiChild = {
} finally {
ReactCurrentOwner.current = null;
}
- return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
+ ReactChildReconciler.updateChildren(prevChildren, nextChildren, removedNodes, transaction, context);
+ return nextChildren;
}
}
nextChildren = flattenChildren(nextNestedChildrenElements);
- return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
+ ReactChildReconciler.updateChildren(prevChildren, nextChildren, removedNodes, transaction, context);
+ return nextChildren;
},
/**
@@ -18095,9 +18297,7 @@ var ReactMultiChild = {
for (var name in children) {
if (children.hasOwnProperty(name)) {
var child = children[name];
- // Inlined for performance, see `ReactInstanceHandles.createReactID`.
- var rootID = this._rootNodeID + name;
- var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
+ var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._nativeContainerInfo, context);
child._mountIndex = index++;
mountImages.push(mountImage);
}
@@ -18112,31 +18312,17 @@ var ReactMultiChild = {
* @internal
*/
updateTextContent: function (nextContent) {
- updateDepth++;
- var errorThrown = true;
- try {
- var prevChildren = this._renderedChildren;
- // Remove any rendered children.
- ReactChildReconciler.unmountChildren(prevChildren);
- // TODO: The setTextContent operation should be enough
- for (var name in prevChildren) {
- if (prevChildren.hasOwnProperty(name)) {
- this._unmountChild(prevChildren[name]);
- }
- }
- // Set new text content.
- this.setTextContent(nextContent);
- errorThrown = false;
- } finally {
- updateDepth--;
- if (!updateDepth) {
- if (errorThrown) {
- clearQueue();
- } else {
- processQueue();
- }
+ var prevChildren = this._renderedChildren;
+ // Remove any rendered children.
+ ReactChildReconciler.unmountChildren(prevChildren, false);
+ for (var name in prevChildren) {
+ if (prevChildren.hasOwnProperty(name)) {
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : invariant(false) : void 0;
}
}
+ // Set new text content.
+ var updates = [makeTextContent(nextContent)];
+ processQueue(this, updates);
},
/**
@@ -18146,29 +18332,16 @@ var ReactMultiChild = {
* @internal
*/
updateMarkup: function (nextMarkup) {
- updateDepth++;
- var errorThrown = true;
- try {
- var prevChildren = this._renderedChildren;
- // Remove any rendered children.
- ReactChildReconciler.unmountChildren(prevChildren);
- for (var name in prevChildren) {
- if (prevChildren.hasOwnProperty(name)) {
- this._unmountChildByName(prevChildren[name], name);
- }
- }
- this.setMarkup(nextMarkup);
- errorThrown = false;
- } finally {
- updateDepth--;
- if (!updateDepth) {
- if (errorThrown) {
- clearQueue();
- } else {
- processQueue();
- }
+ var prevChildren = this._renderedChildren;
+ // Remove any rendered children.
+ ReactChildReconciler.unmountChildren(prevChildren, false);
+ for (var name in prevChildren) {
+ if (prevChildren.hasOwnProperty(name)) {
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : invariant(false) : void 0;
}
}
+ var updates = [makeSetMarkup(nextMarkup)];
+ processQueue(this, updates);
},
/**
@@ -18179,27 +18352,11 @@ var ReactMultiChild = {
* @internal
*/
updateChildren: function (nextNestedChildrenElements, transaction, context) {
- updateDepth++;
- var errorThrown = true;
- try {
- this._updateChildren(nextNestedChildrenElements, transaction, context);
- errorThrown = false;
- } finally {
- updateDepth--;
- if (!updateDepth) {
- if (errorThrown) {
- clearQueue();
- } else {
- processQueue();
- }
- }
- }
+ // Hook used by React ART
+ this._updateChildren(nextNestedChildrenElements, transaction, context);
},
/**
- * Improve performance by isolating this hot code path from the try/catch
- * block in `updateChildren`.
- *
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @final
@@ -18207,16 +18364,18 @@ var ReactMultiChild = {
*/
_updateChildren: function (nextNestedChildrenElements, transaction, context) {
var prevChildren = this._renderedChildren;
- var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
- this._renderedChildren = nextChildren;
+ var removedNodes = {};
+ var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, removedNodes, transaction, context);
if (!nextChildren && !prevChildren) {
return;
}
+ var updates = null;
var name;
// `nextIndex` will increment for each child in `nextChildren`, but
// `lastIndex` will be the last index visited in `prevChildren`.
var lastIndex = 0;
var nextIndex = 0;
+ var lastPlacedNode = null;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
@@ -18224,37 +18383,43 @@ var ReactMultiChild = {
var prevChild = prevChildren && prevChildren[name];
var nextChild = nextChildren[name];
if (prevChild === nextChild) {
- this.moveChild(prevChild, nextIndex, lastIndex);
+ updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex));
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
prevChild._mountIndex = nextIndex;
} else {
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
- this._unmountChild(prevChild);
+ // The `removedNodes` loop below will actually remove the child.
}
// The child must be instantiated before it's mounted.
- this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
+ updates = enqueue(updates, this._mountChildAtIndex(nextChild, lastPlacedNode, nextIndex, transaction, context));
}
nextIndex++;
+ lastPlacedNode = ReactReconciler.getNativeNode(nextChild);
}
// Remove children that are no longer present.
- for (name in prevChildren) {
- if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
- this._unmountChild(prevChildren[name]);
+ for (name in removedNodes) {
+ if (removedNodes.hasOwnProperty(name)) {
+ updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name]));
}
}
+ if (updates) {
+ processQueue(this, updates);
+ }
+ this._renderedChildren = nextChildren;
},
/**
* Unmounts all rendered children. This should be used to clean up children
- * when this component is unmounted.
+ * when this component is unmounted. It does not actually perform any
+ * backend operations.
*
* @internal
*/
- unmountChildren: function () {
+ unmountChildren: function (safely) {
var renderedChildren = this._renderedChildren;
- ReactChildReconciler.unmountChildren(renderedChildren);
+ ReactChildReconciler.unmountChildren(renderedChildren, safely);
this._renderedChildren = null;
},
@@ -18266,12 +18431,12 @@ var ReactMultiChild = {
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
- moveChild: function (child, toIndex, lastIndex) {
+ moveChild: function (child, afterNode, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
if (child._mountIndex < lastIndex) {
- enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
+ return makeMove(child, afterNode, toIndex);
}
},
@@ -18282,8 +18447,8 @@ var ReactMultiChild = {
* @param {string} mountImage Markup to insert.
* @protected
*/
- createChild: function (child, mountImage) {
- enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
+ createChild: function (child, afterNode, mountImage) {
+ return makeInsertMarkup(mountImage, afterNode, child._mountIndex);
},
/**
@@ -18292,28 +18457,8 @@ var ReactMultiChild = {
* @param {ReactComponent} child Child to remove.
* @protected
*/
- removeChild: function (child) {
- enqueueRemove(this._rootNodeID, child._mountIndex);
- },
-
- /**
- * Sets this text content string.
- *
- * @param {string} textContent Text content to set.
- * @protected
- */
- setTextContent: function (textContent) {
- enqueueTextContent(this._rootNodeID, textContent);
- },
-
- /**
- * Sets this markup string.
- *
- * @param {string} markup Markup to set.
- * @protected
- */
- setMarkup: function (markup) {
- enqueueSetMarkup(this._rootNodeID, markup);
+ removeChild: function (child, node) {
+ return makeRemove(child, node);
},
/**
@@ -18327,12 +18472,10 @@ var ReactMultiChild = {
* @param {ReactReconcileTransaction} transaction
* @private
*/
- _mountChildByNameAtIndex: function (child, name, index, transaction, context) {
- // Inlined for performance, see `ReactInstanceHandles.createReactID`.
- var rootID = this._rootNodeID + name;
- var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
+ _mountChildAtIndex: function (child, afterNode, index, transaction, context) {
+ var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._nativeContainerInfo, context);
child._mountIndex = index;
- this.createChild(child, mountImage);
+ return this.createChild(child, afterNode, mountImage);
},
/**
@@ -18343,9 +18486,10 @@ var ReactMultiChild = {
* @param {ReactComponent} child Component to unmount.
* @private
*/
- _unmountChild: function (child) {
- this.removeChild(child);
+ _unmountChild: function (child, node) {
+ var update = this.removeChild(child, node);
child._mountIndex = null;
+ return update;
}
}
@@ -18355,9 +18499,9 @@ var ReactMultiChild = {
module.exports = ReactMultiChild;
}).call(this,require('_process'))
-},{"./ReactChildReconciler":91,"./ReactComponentEnvironment":96,"./ReactCurrentOwner":99,"./ReactMultiChildUpdateTypes":134,"./ReactReconciler":144,"./flattenChildren":184,"_process":27}],134:[function(require,module,exports){
+},{"./ReactChildReconciler":94,"./ReactComponentEnvironment":99,"./ReactCurrentOwner":101,"./ReactMultiChildUpdateTypes":142,"./ReactReconciler":152,"./flattenChildren":182,"_process":29,"fbjs/lib/invariant":219}],142:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -18388,10 +18532,10 @@ var ReactMultiChildUpdateTypes = keyMirror({
});
module.exports = ReactMultiChildUpdateTypes;
-},{"fbjs/lib/keyMirror":226}],135:[function(require,module,exports){
+},{"fbjs/lib/keyMirror":222}],143:[function(require,module,exports){
(function (process){
/**
- * Copyright 2014-2015, Facebook, Inc.
+ * Copyright 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -18403,7 +18547,8 @@ module.exports = ReactMultiChildUpdateTypes;
'use strict';
-var assign = require('./Object.assign');
+var _assign = require('object-assign');
+
var invariant = require('fbjs/lib/invariant');
var autoGenerateWrapperClass = null;
@@ -18426,7 +18571,7 @@ var ReactNativeComponentInjection = {
// 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);
+ _assign(tagToComponentClass, componentClasses);
}
};
@@ -18455,8 +18600,8 @@ function getComponentClassForElement(element) {
* @return {function} The internal class constructor function.
*/
function createInternalComponent(element) {
- !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
- return new genericComponentClass(element.type, element.props);
+ !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : void 0;
+ return new genericComponentClass(element);
}
/**
@@ -18486,10 +18631,51 @@ var ReactNativeComponent = {
module.exports = ReactNativeComponent;
}).call(this,require('_process'))
-},{"./Object.assign":84,"_process":27,"fbjs/lib/invariant":222}],136:[function(require,module,exports){
+},{"_process":29,"fbjs/lib/invariant":219,"object-assign":28}],144:[function(require,module,exports){
(function (process){
/**
- * Copyright 2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactNodeTypes
+ */
+
+'use strict';
+
+var ReactElement = require('./ReactElement');
+
+var invariant = require('fbjs/lib/invariant');
+
+var ReactNodeTypes = {
+ NATIVE: 0,
+ COMPOSITE: 1,
+ EMPTY: 2,
+
+ getType: function (node) {
+ if (node === null || node === false) {
+ return ReactNodeTypes.EMPTY;
+ } else if (ReactElement.isValidElement(node)) {
+ if (typeof node.type === 'function') {
+ return ReactNodeTypes.COMPOSITE;
+ } else {
+ return ReactNodeTypes.NATIVE;
+ }
+ }
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) : invariant(false) : void 0;
+ }
+};
+
+module.exports = ReactNodeTypes;
+}).call(this,require('_process'))
+
+},{"./ReactElement":127,"_process":29,"fbjs/lib/invariant":219}],145:[function(require,module,exports){
+(function (process){
+/**
+ * Copyright 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -18505,7 +18691,7 @@ var warning = require('fbjs/lib/warning');
function warnTDZ(publicInstance, callerName) {
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : void 0;
}
}
@@ -18579,39 +18765,16 @@ var ReactNoopUpdateQueue = {
*/
enqueueSetState: function (publicInstance, partialState) {
warnTDZ(publicInstance, 'setState');
- },
-
- /**
- * Sets a subset of the props.
- *
- * @param {ReactClass} publicInstance The instance that should rerender.
- * @param {object} partialProps Subset of the next props.
- * @internal
- */
- enqueueSetProps: function (publicInstance, partialProps) {
- warnTDZ(publicInstance, 'setProps');
- },
-
- /**
- * Replaces all of the props.
- *
- * @param {ReactClass} publicInstance The instance that should rerender.
- * @param {object} props New props.
- * @internal
- */
- enqueueReplaceProps: function (publicInstance, props) {
- warnTDZ(publicInstance, 'replaceProps');
}
-
};
module.exports = ReactNoopUpdateQueue;
}).call(this,require('_process'))
-},{"_process":27,"fbjs/lib/warning":234}],137:[function(require,module,exports){
+},{"_process":29,"fbjs/lib/warning":229}],146:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -18676,7 +18839,7 @@ var ReactOwner = {
* @internal
*/
addComponentAsRefTo: function (component, ref, owner) {
- !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
+ !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : void 0;
owner.attachRef(ref, component);
},
@@ -18690,10 +18853,11 @@ var ReactOwner = {
* @internal
*/
removeComponentAsRefFrom: function (component, ref, owner) {
- !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
- // Check that `component` is still the current ref because we do not want to
- // detach the ref if another component stole it.
- if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
+ !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : void 0;
+ var ownerPublicInstance = owner.getPublicInstance();
+ // Check that `component`'s owner is still alive and that `component` is still the current ref
+ // because we do not want to detach the ref if another component stole it.
+ if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) {
owner.detachRef(ref);
}
}
@@ -18703,10 +18867,10 @@ var ReactOwner = {
module.exports = ReactOwner;
}).call(this,require('_process'))
-},{"_process":27,"fbjs/lib/invariant":222}],138:[function(require,module,exports){
+},{"_process":29,"fbjs/lib/invariant":219}],147:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -18714,7 +18878,6 @@ module.exports = ReactOwner;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPerf
- * @typechecks static-only
*/
'use strict';
@@ -18723,6 +18886,7 @@ module.exports = ReactOwner;
* ReactPerf is a general AOP system designed to measure performance. This
* module only has the hooks: see ReactDefaultPerf for the analysis tool.
*/
+
var ReactPerf = {
/**
* Boolean to enable/disable measurement. Set to false by default to prevent
@@ -18803,119 +18967,10 @@ function _noMeasure(objName, fnName, func) {
module.exports = ReactPerf;
}).call(this,require('_process'))
-},{"_process":27}],139:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactPropTransferer
- */
-
-'use strict';
-
-var assign = require('./Object.assign');
-var emptyFunction = require('fbjs/lib/emptyFunction');
-var joinClasses = require('fbjs/lib/joinClasses');
-
-/**
- * Creates a transfer strategy that will merge prop values using the supplied
- * `mergeStrategy`. If a prop was previously unset, this just sets it.
- *
- * @param {function} mergeStrategy
- * @return {function}
- */
-function createTransferStrategy(mergeStrategy) {
- return function (props, key, value) {
- if (!props.hasOwnProperty(key)) {
- props[key] = value;
- } else {
- props[key] = mergeStrategy(props[key], value);
- }
- };
-}
-
-var transferStrategyMerge = createTransferStrategy(function (a, b) {
- // `merge` overrides the first object's (`props[key]` above) keys using the
- // second object's (`value`) keys. An object's style's existing `propA` would
- // get overridden. Flip the order here.
- return assign({}, b, a);
-});
-
-/**
- * Transfer strategies dictate how props are transferred by `transferPropsTo`.
- * NOTE: if you add any more exceptions to this list you should be sure to
- * update `cloneWithProps()` accordingly.
- */
-var TransferStrategies = {
- /**
- * Never transfer `children`.
- */
- children: emptyFunction,
- /**
- * Transfer the `className` prop by merging them.
- */
- className: createTransferStrategy(joinClasses),
- /**
- * Transfer the `style` prop (which is an object) by merging them.
- */
- style: transferStrategyMerge
-};
-
-/**
- * Mutates the first argument by transferring the properties from the second
- * argument.
- *
- * @param {object} props
- * @param {object} newProps
- * @return {object}
- */
-function transferInto(props, newProps) {
- for (var thisKey in newProps) {
- if (!newProps.hasOwnProperty(thisKey)) {
- continue;
- }
-
- var transferStrategy = TransferStrategies[thisKey];
-
- if (transferStrategy && TransferStrategies.hasOwnProperty(thisKey)) {
- transferStrategy(props, thisKey, newProps[thisKey]);
- } else if (!props.hasOwnProperty(thisKey)) {
- props[thisKey] = newProps[thisKey];
- }
- }
- return props;
-}
-
-/**
- * ReactPropTransferer are capable of transferring props to another component
- * using a `transferPropsTo` method.
- *
- * @class ReactPropTransferer
- */
-var ReactPropTransferer = {
-
- /**
- * Merge two props objects using TransferStrategies.
- *
- * @param {object} oldProps original props (they take precedence)
- * @param {object} newProps new props to merge in
- * @return {object} a new object containing both sets of props merged.
- */
- mergeProps: function (oldProps, newProps) {
- return transferInto(assign({}, oldProps), newProps);
- }
-
-};
-
-module.exports = ReactPropTransferer;
-},{"./Object.assign":84,"fbjs/lib/emptyFunction":214,"fbjs/lib/joinClasses":225}],140:[function(require,module,exports){
+},{"_process":29}],148:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -18940,9 +18995,9 @@ if (process.env.NODE_ENV !== 'production') {
module.exports = ReactPropTypeLocationNames;
}).call(this,require('_process'))
-},{"_process":27}],141:[function(require,module,exports){
+},{"_process":29}],149:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -18963,9 +19018,9 @@ var ReactPropTypeLocations = keyMirror({
});
module.exports = ReactPropTypeLocations;
-},{"fbjs/lib/keyMirror":226}],142:[function(require,module,exports){
+},{"fbjs/lib/keyMirror":222}],150:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -19051,6 +19106,24 @@ var ReactPropTypes = {
shape: createShapeTypeChecker
};
+/**
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
+ */
+/*eslint-disable no-self-compare*/
+function is(x, y) {
+ // SameValue algorithm
+ if (x === y) {
+ // Steps 1-5, 7-10
+ // Steps 6.b-6.e: +0 != -0
+ return x !== 0 || 1 / x === 1 / y;
+ } else {
+ // Step 6.a: NaN == NaN
+ return x !== x && y !== y;
+ }
+}
+/*eslint-enable no-self-compare*/
+
function createChainableTypeChecker(validate) {
function checkType(isRequired, props, propName, componentName, location, propFullName) {
componentName = componentName || ANONYMOUS;
@@ -19096,6 +19169,9 @@ function createAnyTypeChecker() {
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
+ if (typeof typeChecker !== 'function') {
+ return new Error('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
+ }
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var locationName = ReactPropTypeLocationNames[location];
@@ -19147,7 +19223,7 @@ function createEnumTypeChecker(expectedValues) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
- if (propValue === expectedValues[i]) {
+ if (is(propValue, expectedValues[i])) {
return null;
}
}
@@ -19161,6 +19237,9 @@ function createEnumTypeChecker(expectedValues) {
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
+ if (typeof typeChecker !== 'function') {
+ return new Error('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
+ }
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
@@ -19314,15 +19393,15 @@ function getPreciseType(propValue) {
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
- return '<<anonymous>>';
+ return ANONYMOUS;
}
return propValue.constructor.name;
}
module.exports = ReactPropTypes;
-},{"./ReactElement":117,"./ReactPropTypeLocationNames":140,"./getIteratorFn":190,"fbjs/lib/emptyFunction":214}],143:[function(require,module,exports){
+},{"./ReactElement":127,"./ReactPropTypeLocationNames":148,"./getIteratorFn":188,"fbjs/lib/emptyFunction":211}],151:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -19330,20 +19409,18 @@ module.exports = ReactPropTypes;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactReconcileTransaction
- * @typechecks static-only
*/
'use strict';
+var _assign = require('object-assign');
+
var CallbackQueue = require('./CallbackQueue');
var PooledClass = require('./PooledClass');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
-var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
var ReactInputSelection = require('./ReactInputSelection');
var Transaction = require('./Transaction');
-var assign = require('./Object.assign');
-
/**
* Ensures that, when possible, the selection range (currently selected text
* input) is not disturbed by performing the transaction.
@@ -19387,7 +19464,7 @@ var EVENT_SUPPRESSION = {
/**
* Provides a queue for collecting `componentDidMount` and
- * `componentDidUpdate` callbacks during the the transaction.
+ * `componentDidUpdate` callbacks during the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
@@ -19426,7 +19503,7 @@ var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_REA
*
* @class ReactReconcileTransaction
*/
-function ReactReconcileTransaction(forceHTML) {
+function ReactReconcileTransaction(useCreateElement) {
this.reinitializeTransaction();
// Only server-side rendering really needs this option (see
// `ReactServerRendering`), but server-side uses
@@ -19435,7 +19512,7 @@ function ReactReconcileTransaction(forceHTML) {
// `ReactTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = CallbackQueue.getPooled(null);
- this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
+ this.useCreateElement = useCreateElement;
}
var Mixin = {
@@ -19458,6 +19535,19 @@ var Mixin = {
},
/**
+ * Save current transaction state -- if the return value from this method is
+ * passed to `rollback`, the transaction will be reset to that state.
+ */
+ checkpoint: function () {
+ // reactMountReady is the our only stateful wrapper
+ return this.reactMountReady.checkpoint();
+ },
+
+ rollback: function (checkpoint) {
+ this.reactMountReady.rollback(checkpoint);
+ },
+
+ /**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be reused.
*/
@@ -19467,14 +19557,15 @@ var Mixin = {
}
};
-assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
+_assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactReconcileTransaction);
module.exports = ReactReconcileTransaction;
-},{"./CallbackQueue":66,"./Object.assign":84,"./PooledClass":85,"./ReactBrowserEventEmitter":88,"./ReactDOMFeatureFlags":104,"./ReactInputSelection":126,"./Transaction":174}],144:[function(require,module,exports){
+},{"./CallbackQueue":71,"./PooledClass":91,"./ReactBrowserEventEmitter":93,"./ReactInputSelection":135,"./Transaction":173,"object-assign":28}],152:[function(require,module,exports){
+(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -19487,6 +19578,7 @@ module.exports = ReactReconcileTransaction;
'use strict';
var ReactRef = require('./ReactRef');
+var ReactInstrumentation = require('./ReactInstrumentation');
/**
* Helper to call ReactRef.attachRefs with this composite component, split out
@@ -19502,29 +19594,44 @@ var ReactReconciler = {
* Initializes the component, renders markup, and registers event listeners.
*
* @param {ReactComponent} internalInstance
- * @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {?object} the containing native component instance
+ * @param {?object} info about the native container
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
- mountComponent: function (internalInstance, rootID, transaction, context) {
- var markup = internalInstance.mountComponent(rootID, transaction, context);
+ mountComponent: function (internalInstance, transaction, nativeParent, nativeContainerInfo, context) {
+ var markup = internalInstance.mountComponent(transaction, nativeParent, nativeContainerInfo, context);
if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
+ if (process.env.NODE_ENV !== 'production') {
+ ReactInstrumentation.debugTool.onMountComponent(internalInstance);
+ }
return markup;
},
/**
+ * Returns a value that can be passed to
+ * ReactComponentEnvironment.replaceNodeWithMarkup.
+ */
+ getNativeNode: function (internalInstance) {
+ return internalInstance.getNativeNode();
+ },
+
+ /**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
- unmountComponent: function (internalInstance) {
+ unmountComponent: function (internalInstance, safely) {
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
- internalInstance.unmountComponent();
+ internalInstance.unmountComponent(safely);
+ if (process.env.NODE_ENV !== 'production') {
+ ReactInstrumentation.debugTool.onUnmountComponent(internalInstance);
+ }
},
/**
@@ -19564,6 +19671,10 @@ var ReactReconciler = {
if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
+
+ if (process.env.NODE_ENV !== 'production') {
+ ReactInstrumentation.debugTool.onUpdateComponent(internalInstance);
+ }
},
/**
@@ -19575,14 +19686,19 @@ var ReactReconciler = {
*/
performUpdateIfNecessary: function (internalInstance, transaction) {
internalInstance.performUpdateIfNecessary(transaction);
+ if (process.env.NODE_ENV !== 'production') {
+ ReactInstrumentation.debugTool.onUpdateComponent(internalInstance);
+ }
}
};
module.exports = ReactReconciler;
-},{"./ReactRef":145}],145:[function(require,module,exports){
+}).call(this,require('_process'))
+
+},{"./ReactInstrumentation":137,"./ReactRef":153,"_process":29}],153:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -19659,1240 +19775,10 @@ ReactRef.detachRefs = function (instance, element) {
};
module.exports = ReactRef;
-},{"./ReactOwner":137}],146:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactRootIndex
- * @typechecks
- */
-
-'use strict';
-
-var ReactRootIndexInjection = {
- /**
- * @param {function} _createReactRootIndex
- */
- injectCreateReactRootIndex: function (_createReactRootIndex) {
- ReactRootIndex.createReactRootIndex = _createReactRootIndex;
- }
-};
-
-var ReactRootIndex = {
- createReactRootIndex: null,
- injection: ReactRootIndexInjection
-};
-
-module.exports = ReactRootIndex;
-},{}],147:[function(require,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactServerBatchingStrategy
- * @typechecks
- */
-
-'use strict';
-
-var ReactServerBatchingStrategy = {
- isBatchingUpdates: false,
- batchedUpdates: function (callback) {
- // Don't do anything here. During the server rendering we don't want to
- // schedule any updates. We will simply ignore them.
- }
-};
-
-module.exports = ReactServerBatchingStrategy;
-},{}],148:[function(require,module,exports){
-(function (process){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @typechecks static-only
- * @providesModule ReactServerRendering
- */
-'use strict';
-
-var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
-var ReactElement = require('./ReactElement');
-var ReactInstanceHandles = require('./ReactInstanceHandles');
-var ReactMarkupChecksum = require('./ReactMarkupChecksum');
-var ReactServerBatchingStrategy = require('./ReactServerBatchingStrategy');
-var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction');
-var ReactUpdates = require('./ReactUpdates');
-
-var emptyObject = require('fbjs/lib/emptyObject');
-var instantiateReactComponent = require('./instantiateReactComponent');
-var invariant = require('fbjs/lib/invariant');
-
-/**
- * @param {ReactElement} element
- * @return {string} the HTML markup
- */
-function renderToString(element) {
- !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
-
- var transaction;
- try {
- ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
-
- var id = ReactInstanceHandles.createReactRootID();
- transaction = ReactServerRenderingTransaction.getPooled(false);
-
- return transaction.perform(function () {
- var componentInstance = instantiateReactComponent(element, null);
- var markup = componentInstance.mountComponent(id, transaction, emptyObject);
- return ReactMarkupChecksum.addChecksumToMarkup(markup);
- }, null);
- } finally {
- ReactServerRenderingTransaction.release(transaction);
- // Revert to the DOM batching strategy since these two renderers
- // currently share these stateful modules.
- ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
- }
-}
-
-/**
- * @param {ReactElement} element
- * @return {string} the HTML markup, without the extra React ID and checksum
- * (for generating static pages)
- */
-function renderToStaticMarkup(element) {
- !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
-
- var transaction;
- try {
- ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
-
- var id = ReactInstanceHandles.createReactRootID();
- transaction = ReactServerRenderingTransaction.getPooled(true);
-
- return transaction.perform(function () {
- var componentInstance = instantiateReactComponent(element, null);
- return componentInstance.mountComponent(id, transaction, emptyObject);
- }, null);
- } finally {
- ReactServerRenderingTransaction.release(transaction);
- // Revert to the DOM batching strategy since these two renderers
- // currently share these stateful modules.
- ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
- }
-}
-
-module.exports = {
- renderToString: renderToString,
- renderToStaticMarkup: renderToStaticMarkup
-};
-}).call(this,require('_process'))
-
-},{"./ReactDefaultBatchingStrategy":113,"./ReactElement":117,"./ReactInstanceHandles":127,"./ReactMarkupChecksum":131,"./ReactServerBatchingStrategy":147,"./ReactServerRenderingTransaction":149,"./ReactUpdates":156,"./instantiateReactComponent":193,"_process":27,"fbjs/lib/emptyObject":215,"fbjs/lib/invariant":222}],149:[function(require,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactServerRenderingTransaction
- * @typechecks
- */
-
-'use strict';
-
-var PooledClass = require('./PooledClass');
-var CallbackQueue = require('./CallbackQueue');
-var Transaction = require('./Transaction');
-
-var assign = require('./Object.assign');
-var emptyFunction = require('fbjs/lib/emptyFunction');
-
-/**
- * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
- * during the performing of the transaction.
- */
-var ON_DOM_READY_QUEUEING = {
- /**
- * Initializes the internal `onDOMReady` queue.
- */
- initialize: function () {
- this.reactMountReady.reset();
- },
-
- close: emptyFunction
-};
-
-/**
- * Executed within the scope of the `Transaction` instance. Consider these as
- * being member methods, but with an implied ordering while being isolated from
- * each other.
- */
-var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
-
-/**
- * @class ReactServerRenderingTransaction
- * @param {boolean} renderToStaticMarkup
- */
-function ReactServerRenderingTransaction(renderToStaticMarkup) {
- this.reinitializeTransaction();
- this.renderToStaticMarkup = renderToStaticMarkup;
- this.reactMountReady = CallbackQueue.getPooled(null);
- this.useCreateElement = false;
-}
-
-var Mixin = {
- /**
- * @see Transaction
- * @abstract
- * @final
- * @return {array} Empty list of operation wrap procedures.
- */
- getTransactionWrappers: function () {
- return TRANSACTION_WRAPPERS;
- },
-
- /**
- * @return {object} The queue to collect `onDOMReady` callbacks with.
- */
- getReactMountReady: function () {
- return this.reactMountReady;
- },
-
- /**
- * `PooledClass` looks for this, and will invoke this before allowing this
- * instance to be reused.
- */
- destructor: function () {
- CallbackQueue.release(this.reactMountReady);
- this.reactMountReady = null;
- }
-};
-
-assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
-
-PooledClass.addPoolingTo(ReactServerRenderingTransaction);
-
-module.exports = ReactServerRenderingTransaction;
-},{"./CallbackQueue":66,"./Object.assign":84,"./PooledClass":85,"./Transaction":174,"fbjs/lib/emptyFunction":214}],150:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactStateSetters
- */
-
-'use strict';
-
-var ReactStateSetters = {
- /**
- * Returns a function that calls the provided function, and uses the result
- * of that to set the component's state.
- *
- * @param {ReactCompositeComponent} component
- * @param {function} funcReturningState Returned callback uses this to
- * determine how to update state.
- * @return {function} callback that when invoked uses funcReturningState to
- * determined the object literal to setState.
- */
- createStateSetter: function (component, funcReturningState) {
- return function (a, b, c, d, e, f) {
- var partialState = funcReturningState.call(component, a, b, c, d, e, f);
- if (partialState) {
- component.setState(partialState);
- }
- };
- },
-
- /**
- * Returns a single-argument callback that can be used to update a single
- * key in the component's state.
- *
- * Note: this is memoized function, which makes it inexpensive to call.
- *
- * @param {ReactCompositeComponent} component
- * @param {string} key The key in the state that you should update.
- * @return {function} callback of 1 argument which calls setState() with
- * the provided keyName and callback argument.
- */
- createStateKeySetter: function (component, key) {
- // Memoize the setters.
- var cache = component.__keySetters || (component.__keySetters = {});
- return cache[key] || (cache[key] = createStateKeySetter(component, key));
- }
-};
-
-function createStateKeySetter(component, key) {
- // Partial state is allocated outside of the function closure so it can be
- // reused with every call, avoiding memory allocation when this function
- // is called.
- var partialState = {};
- return function stateKeySetter(value) {
- partialState[key] = value;
- component.setState(partialState);
- };
-}
-
-ReactStateSetters.Mixin = {
- /**
- * Returns a function that calls the provided function, and uses the result
- * of that to set the component's state.
- *
- * For example, these statements are equivalent:
- *
- * this.setState({x: 1});
- * this.createStateSetter(function(xValue) {
- * return {x: xValue};
- * })(1);
- *
- * @param {function} funcReturningState Returned callback uses this to
- * determine how to update state.
- * @return {function} callback that when invoked uses funcReturningState to
- * determined the object literal to setState.
- */
- createStateSetter: function (funcReturningState) {
- return ReactStateSetters.createStateSetter(this, funcReturningState);
- },
-
- /**
- * Returns a single-argument callback that can be used to update a single
- * key in the component's state.
- *
- * For example, these statements are equivalent:
- *
- * this.setState({x: 1});
- * this.createStateKeySetter('x')(1);
- *
- * Note: this is memoized function, which makes it inexpensive to call.
- *
- * @param {string} key The key in the state that you should update.
- * @return {function} callback of 1 argument which calls setState() with
- * the provided keyName and callback argument.
- */
- createStateKeySetter: function (key) {
- return ReactStateSetters.createStateKeySetter(this, key);
- }
-};
-
-module.exports = ReactStateSetters;
-},{}],151:[function(require,module,exports){
+},{"./ReactOwner":146}],154:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactTestUtils
- */
-
-'use strict';
-
-var EventConstants = require('./EventConstants');
-var EventPluginHub = require('./EventPluginHub');
-var EventPropagators = require('./EventPropagators');
-var React = require('./React');
-var ReactDOM = require('./ReactDOM');
-var ReactElement = require('./ReactElement');
-var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
-var ReactCompositeComponent = require('./ReactCompositeComponent');
-var ReactInstanceHandles = require('./ReactInstanceHandles');
-var ReactInstanceMap = require('./ReactInstanceMap');
-var ReactMount = require('./ReactMount');
-var ReactUpdates = require('./ReactUpdates');
-var SyntheticEvent = require('./SyntheticEvent');
-
-var assign = require('./Object.assign');
-var emptyObject = require('fbjs/lib/emptyObject');
-var findDOMNode = require('./findDOMNode');
-var invariant = require('fbjs/lib/invariant');
-
-var topLevelTypes = EventConstants.topLevelTypes;
-
-function Event(suffix) {}
-
-/**
- * @class ReactTestUtils
- */
-
-function findAllInRenderedTreeInternal(inst, test) {
- if (!inst || !inst.getPublicInstance) {
- return [];
- }
- var publicInst = inst.getPublicInstance();
- var ret = test(publicInst) ? [publicInst] : [];
- var currentElement = inst._currentElement;
- if (ReactTestUtils.isDOMComponent(publicInst)) {
- var renderedChildren = inst._renderedChildren;
- var key;
- for (key in renderedChildren) {
- if (!renderedChildren.hasOwnProperty(key)) {
- continue;
- }
- ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
- }
- } else if (ReactElement.isValidElement(currentElement) && typeof currentElement.type === 'function') {
- ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
- }
- return ret;
-}
-
-/**
- * Todo: Support the entire DOM.scry query syntax. For now, these simple
- * utilities will suffice for testing purposes.
- * @lends ReactTestUtils
- */
-var ReactTestUtils = {
- renderIntoDocument: function (instance) {
- var div = document.createElement('div');
- // None of our tests actually require attaching the container to the
- // DOM, and doing so creates a mess that we rely on test isolation to
- // clean up, so we're going to stop honoring the name of this method
- // (and probably rename it eventually) if no problems arise.
- // document.documentElement.appendChild(div);
- return ReactDOM.render(instance, div);
- },
-
- isElement: function (element) {
- return ReactElement.isValidElement(element);
- },
-
- isElementOfType: function (inst, convenienceConstructor) {
- return ReactElement.isValidElement(inst) && inst.type === convenienceConstructor;
- },
-
- isDOMComponent: function (inst) {
- return !!(inst && inst.nodeType === 1 && inst.tagName);
- },
-
- isDOMComponentElement: function (inst) {
- return !!(inst && ReactElement.isValidElement(inst) && !!inst.tagName);
- },
-
- isCompositeComponent: function (inst) {
- if (ReactTestUtils.isDOMComponent(inst)) {
- // Accessing inst.setState warns; just return false as that'll be what
- // this returns when we have DOM nodes as refs directly
- return false;
- }
- return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
- },
-
- isCompositeComponentWithType: function (inst, type) {
- if (!ReactTestUtils.isCompositeComponent(inst)) {
- return false;
- }
- var internalInstance = ReactInstanceMap.get(inst);
- var constructor = internalInstance._currentElement.type;
-
- return constructor === type;
- },
-
- isCompositeComponentElement: function (inst) {
- if (!ReactElement.isValidElement(inst)) {
- return false;
- }
- // We check the prototype of the type that will get mounted, not the
- // instance itself. This is a future proof way of duck typing.
- var prototype = inst.type.prototype;
- return typeof prototype.render === 'function' && typeof prototype.setState === 'function';
- },
-
- isCompositeComponentElementWithType: function (inst, type) {
- var internalInstance = ReactInstanceMap.get(inst);
- var constructor = internalInstance._currentElement.type;
-
- return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type);
- },
-
- getRenderedChildOfCompositeComponent: function (inst) {
- if (!ReactTestUtils.isCompositeComponent(inst)) {
- return null;
- }
- var internalInstance = ReactInstanceMap.get(inst);
- return internalInstance._renderedComponent.getPublicInstance();
- },
-
- findAllInRenderedTree: function (inst, test) {
- if (!inst) {
- return [];
- }
- !ReactTestUtils.isCompositeComponent(inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : undefined;
- return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
- },
-
- /**
- * Finds all instance of components in the rendered tree that are DOM
- * components with the class name matching `className`.
- * @return {array} an array of all the matches.
- */
- scryRenderedDOMComponentsWithClass: function (root, classNames) {
- if (!Array.isArray(classNames)) {
- classNames = classNames.split(/\s+/);
- }
- return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
- if (ReactTestUtils.isDOMComponent(inst)) {
- var className = inst.className;
- if (typeof className !== 'string') {
- // SVG, probably.
- className = inst.getAttribute('class') || '';
- }
- var classList = className.split(/\s+/);
- return classNames.every(function (name) {
- return classList.indexOf(name) !== -1;
- });
- }
- return false;
- });
- },
-
- /**
- * Like scryRenderedDOMComponentsWithClass but expects there to be one result,
- * and returns that one result, or throws exception if there is any other
- * number of matches besides one.
- * @return {!ReactDOMComponent} The one match.
- */
- findRenderedDOMComponentWithClass: function (root, className) {
- var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
- if (all.length !== 1) {
- throw new Error('Did not find exactly one match ' + '(found: ' + all.length + ') for class:' + className);
- }
- return all[0];
- },
-
- /**
- * Finds all instance of components in the rendered tree that are DOM
- * components with the tag name matching `tagName`.
- * @return {array} an array of all the matches.
- */
- scryRenderedDOMComponentsWithTag: function (root, tagName) {
- return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
- return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
- });
- },
-
- /**
- * Like scryRenderedDOMComponentsWithTag but expects there to be one result,
- * and returns that one result, or throws exception if there is any other
- * number of matches besides one.
- * @return {!ReactDOMComponent} The one match.
- */
- findRenderedDOMComponentWithTag: function (root, tagName) {
- var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
- if (all.length !== 1) {
- throw new Error('Did not find exactly one match for tag:' + tagName);
- }
- return all[0];
- },
-
- /**
- * Finds all instances of components with type equal to `componentType`.
- * @return {array} an array of all the matches.
- */
- scryRenderedComponentsWithType: function (root, componentType) {
- return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
- return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
- });
- },
-
- /**
- * Same as `scryRenderedComponentsWithType` but expects there to be one result
- * and returns that one result, or throws exception if there is any other
- * number of matches besides one.
- * @return {!ReactComponent} The one match.
- */
- findRenderedComponentWithType: function (root, componentType) {
- var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
- if (all.length !== 1) {
- throw new Error('Did not find exactly one match for componentType:' + componentType + ' (found ' + all.length + ')');
- }
- return all[0];
- },
-
- /**
- * Pass a mocked component module to this method to augment it with
- * useful methods that allow it to be used as a dummy React component.
- * Instead of rendering as usual, the component will become a simple
- * <div> containing any provided children.
- *
- * @param {object} module the mock function object exported from a
- * module that defines the component to be mocked
- * @param {?string} mockTagName optional dummy root tag name to return
- * from render method (overrides
- * module.mockTagName if provided)
- * @return {object} the ReactTestUtils object (for chaining)
- */
- mockComponent: function (module, mockTagName) {
- mockTagName = mockTagName || module.mockTagName || 'div';
-
- module.prototype.render.mockImplementation(function () {
- return React.createElement(mockTagName, null, this.props.children);
- });
-
- return this;
- },
-
- /**
- * Simulates a top level event being dispatched from a raw event that occurred
- * on an `Element` node.
- * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
- * @param {!Element} node The dom to simulate an event occurring on.
- * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
- */
- simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
- fakeNativeEvent.target = node;
- ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
- },
-
- /**
- * Simulates a top level event being dispatched from a raw event that occurred
- * on the `ReactDOMComponent` `comp`.
- * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
- * @param {!ReactDOMComponent} comp
- * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
- */
- simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
- ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
- },
-
- nativeTouchData: function (x, y) {
- return {
- touches: [{ pageX: x, pageY: y }]
- };
- },
-
- createRenderer: function () {
- return new ReactShallowRenderer();
- },
-
- Simulate: null,
- SimulateNative: {}
-};
-
-/**
- * @class ReactShallowRenderer
- */
-var ReactShallowRenderer = function () {
- this._instance = null;
-};
-
-ReactShallowRenderer.prototype.getRenderOutput = function () {
- return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
-};
-
-var NoopInternalComponent = function (element) {
- this._renderedOutput = element;
- this._currentElement = element;
-};
-
-NoopInternalComponent.prototype = {
-
- mountComponent: function () {},
-
- receiveComponent: function (element) {
- this._renderedOutput = element;
- this._currentElement = element;
- },
-
- unmountComponent: function () {},
-
- getPublicInstance: function () {
- return null;
- }
-};
-
-var ShallowComponentWrapper = function () {};
-assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
- _instantiateReactComponent: function (element) {
- return new NoopInternalComponent(element);
- },
- _replaceNodeWithMarkupByID: function () {},
- _renderValidatedComponent: ReactCompositeComponent.Mixin._renderValidatedComponentWithoutOwnerOrContext
-});
-
-ReactShallowRenderer.prototype.render = function (element, context) {
- !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : invariant(false) : undefined;
- !(typeof element.type !== 'string') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom ' + 'components, not primitives (%s). Instead of calling `.render(el)` and ' + 'inspecting the rendered output, look at `el.props` directly instead.', element.type) : invariant(false) : undefined;
-
- if (!context) {
- context = emptyObject;
- }
- ReactUpdates.batchedUpdates(_batchedRender, this, element, context);
-};
-
-function _batchedRender(renderer, element, context) {
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false);
- renderer._render(element, transaction, context);
- ReactUpdates.ReactReconcileTransaction.release(transaction);
-}
-
-ReactShallowRenderer.prototype.unmount = function () {
- if (this._instance) {
- this._instance.unmountComponent();
- }
-};
-
-ReactShallowRenderer.prototype._render = function (element, transaction, context) {
- if (this._instance) {
- this._instance.receiveComponent(element, transaction, context);
- } else {
- var rootID = ReactInstanceHandles.createReactRootID();
- var instance = new ShallowComponentWrapper(element.type);
- instance.construct(element);
-
- instance.mountComponent(rootID, transaction, context);
-
- this._instance = instance;
- }
-};
-
-/**
- * Exports:
- *
- * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`
- * - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`
- * - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)`
- * - ... (All keys from event plugin `eventTypes` objects)
- */
-function makeSimulator(eventType) {
- return function (domComponentOrNode, eventData) {
- var node;
- if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
- node = findDOMNode(domComponentOrNode);
- } else if (domComponentOrNode.tagName) {
- node = domComponentOrNode;
- }
-
- var dispatchConfig = ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType];
-
- var fakeNativeEvent = new Event();
- fakeNativeEvent.target = node;
- // We don't use SyntheticEvent.getPooled in order to not have to worry about
- // properly destroying any properties assigned from `eventData` upon release
- var event = new SyntheticEvent(dispatchConfig, ReactMount.getID(node), fakeNativeEvent, node);
- assign(event, eventData);
-
- if (dispatchConfig.phasedRegistrationNames) {
- EventPropagators.accumulateTwoPhaseDispatches(event);
- } else {
- EventPropagators.accumulateDirectDispatches(event);
- }
-
- ReactUpdates.batchedUpdates(function () {
- EventPluginHub.enqueueEvents(event);
- EventPluginHub.processEventQueue(true);
- });
- };
-}
-
-function buildSimulators() {
- ReactTestUtils.Simulate = {};
-
- var eventType;
- for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
- /**
- * @param {!Element|ReactDOMComponent} domComponentOrNode
- * @param {?object} eventData Fake event data to use in SyntheticEvent.
- */
- ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
- }
-}
-
-// Rebuild ReactTestUtils.Simulate whenever event plugins are injected
-var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
-EventPluginHub.injection.injectEventPluginOrder = function () {
- oldInjectEventPluginOrder.apply(this, arguments);
- buildSimulators();
-};
-var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
-EventPluginHub.injection.injectEventPluginsByName = function () {
- oldInjectEventPlugins.apply(this, arguments);
- buildSimulators();
-};
-
-buildSimulators();
-
-/**
- * Exports:
- *
- * - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`
- * - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`
- * - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`
- * - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`
- * - ... (All keys from `EventConstants.topLevelTypes`)
- *
- * Note: Top level event types are a subset of the entire set of handler types
- * (which include a broader set of "synthetic" events). For example, onDragDone
- * is a synthetic event. Except when testing an event plugin or React's event
- * handling code specifically, you probably want to use ReactTestUtils.Simulate
- * to dispatch synthetic events.
- */
-
-function makeNativeSimulator(eventType) {
- return function (domComponentOrNode, nativeEventData) {
- var fakeNativeEvent = new Event(eventType);
- assign(fakeNativeEvent, nativeEventData);
- if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
- ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
- } else if (domComponentOrNode.tagName) {
- // Will allow on actual dom nodes.
- ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
- }
- };
-}
-
-Object.keys(topLevelTypes).forEach(function (eventType) {
- // Event type is stored as 'topClick' - we transform that to 'click'
- var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
- /**
- * @param {!Element|ReactDOMComponent} domComponentOrNode
- * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
- */
- ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
-});
-
-module.exports = ReactTestUtils;
-}).call(this,require('_process'))
-
-},{"./EventConstants":75,"./EventPluginHub":76,"./EventPropagators":79,"./Object.assign":84,"./React":86,"./ReactBrowserEventEmitter":88,"./ReactCompositeComponent":98,"./ReactDOM":100,"./ReactElement":117,"./ReactInstanceHandles":127,"./ReactInstanceMap":128,"./ReactMount":132,"./ReactUpdates":156,"./SyntheticEvent":166,"./findDOMNode":183,"_process":27,"fbjs/lib/emptyObject":215,"fbjs/lib/invariant":222}],152:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @typechecks static-only
- * @providesModule ReactTransitionChildMapping
- */
-
-'use strict';
-
-var flattenChildren = require('./flattenChildren');
-
-var ReactTransitionChildMapping = {
- /**
- * Given `this.props.children`, return an object mapping key to child. Just
- * simple syntactic sugar around flattenChildren().
- *
- * @param {*} children `this.props.children`
- * @return {object} Mapping of key to child
- */
- getChildMapping: function (children) {
- if (!children) {
- return children;
- }
- return flattenChildren(children);
- },
-
- /**
- * When you're adding or removing children some may be added or removed in the
- * same render pass. We want to show *both* since we want to simultaneously
- * animate elements in and out. This function takes a previous set of keys
- * and a new set of keys and merges them with its best guess of the correct
- * ordering. In the future we may expose some of the utilities in
- * ReactMultiChild to make this easy, but for now React itself does not
- * directly have this concept of the union of prevChildren and nextChildren
- * so we implement it here.
- *
- * @param {object} prev prev children as returned from
- * `ReactTransitionChildMapping.getChildMapping()`.
- * @param {object} next next children as returned from
- * `ReactTransitionChildMapping.getChildMapping()`.
- * @return {object} a key set that contains all keys in `prev` and all keys
- * in `next` in a reasonable order.
- */
- mergeChildMappings: function (prev, next) {
- prev = prev || {};
- next = next || {};
-
- function getValueForKey(key) {
- if (next.hasOwnProperty(key)) {
- return next[key];
- } else {
- return prev[key];
- }
- }
-
- // For each key of `next`, the list of keys to insert before that key in
- // the combined list
- var nextKeysPending = {};
-
- var pendingKeys = [];
- for (var prevKey in prev) {
- if (next.hasOwnProperty(prevKey)) {
- if (pendingKeys.length) {
- nextKeysPending[prevKey] = pendingKeys;
- pendingKeys = [];
- }
- } else {
- pendingKeys.push(prevKey);
- }
- }
-
- var i;
- var childMapping = {};
- for (var nextKey in next) {
- if (nextKeysPending.hasOwnProperty(nextKey)) {
- for (i = 0; i < nextKeysPending[nextKey].length; i++) {
- var pendingNextKey = nextKeysPending[nextKey][i];
- childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
- }
- }
- childMapping[nextKey] = getValueForKey(nextKey);
- }
-
- // Finally, add the keys which didn't appear before any key in `next`
- for (i = 0; i < pendingKeys.length; i++) {
- childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
- }
-
- return childMapping;
- }
-};
-
-module.exports = ReactTransitionChildMapping;
-},{"./flattenChildren":184}],153:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactTransitionEvents
- */
-
-'use strict';
-
-var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
-
-/**
- * EVENT_NAME_MAP is used to determine which event fired when a
- * transition/animation ends, based on the style property used to
- * define that event.
- */
-var EVENT_NAME_MAP = {
- transitionend: {
- 'transition': 'transitionend',
- 'WebkitTransition': 'webkitTransitionEnd',
- 'MozTransition': 'mozTransitionEnd',
- 'OTransition': 'oTransitionEnd',
- 'msTransition': 'MSTransitionEnd'
- },
-
- animationend: {
- 'animation': 'animationend',
- 'WebkitAnimation': 'webkitAnimationEnd',
- 'MozAnimation': 'mozAnimationEnd',
- 'OAnimation': 'oAnimationEnd',
- 'msAnimation': 'MSAnimationEnd'
- }
-};
-
-var endEvents = [];
-
-function detectEvents() {
- var testEl = document.createElement('div');
- var style = testEl.style;
-
- // On some platforms, in particular some releases of Android 4.x,
- // the un-prefixed "animation" and "transition" properties are defined on the
- // style object but the events that fire will still be prefixed, so we need
- // to check if the un-prefixed events are useable, and if not remove them
- // from the map
- if (!('AnimationEvent' in window)) {
- delete EVENT_NAME_MAP.animationend.animation;
- }
-
- if (!('TransitionEvent' in window)) {
- delete EVENT_NAME_MAP.transitionend.transition;
- }
-
- for (var baseEventName in EVENT_NAME_MAP) {
- var baseEvents = EVENT_NAME_MAP[baseEventName];
- for (var styleName in baseEvents) {
- if (styleName in style) {
- endEvents.push(baseEvents[styleName]);
- break;
- }
- }
- }
-}
-
-if (ExecutionEnvironment.canUseDOM) {
- detectEvents();
-}
-
-// We use the raw {add|remove}EventListener() call because EventListener
-// does not know how to remove event listeners and we really should
-// clean up. Also, these events are not triggered in older browsers
-// so we should be A-OK here.
-
-function addEventListener(node, eventName, eventListener) {
- node.addEventListener(eventName, eventListener, false);
-}
-
-function removeEventListener(node, eventName, eventListener) {
- node.removeEventListener(eventName, eventListener, false);
-}
-
-var ReactTransitionEvents = {
- addEndEventListener: function (node, eventListener) {
- if (endEvents.length === 0) {
- // If CSS transitions are not supported, trigger an "end animation"
- // event immediately.
- window.setTimeout(eventListener, 0);
- return;
- }
- endEvents.forEach(function (endEvent) {
- addEventListener(node, endEvent, eventListener);
- });
- },
-
- removeEndEventListener: function (node, eventListener) {
- if (endEvents.length === 0) {
- return;
- }
- endEvents.forEach(function (endEvent) {
- removeEventListener(node, endEvent, eventListener);
- });
- }
-};
-
-module.exports = ReactTransitionEvents;
-},{"fbjs/lib/ExecutionEnvironment":208}],154:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactTransitionGroup
- */
-
-'use strict';
-
-var React = require('./React');
-var ReactTransitionChildMapping = require('./ReactTransitionChildMapping');
-
-var assign = require('./Object.assign');
-var emptyFunction = require('fbjs/lib/emptyFunction');
-
-var ReactTransitionGroup = React.createClass({
- displayName: 'ReactTransitionGroup',
-
- propTypes: {
- component: React.PropTypes.any,
- childFactory: React.PropTypes.func
- },
-
- getDefaultProps: function () {
- return {
- component: 'span',
- childFactory: emptyFunction.thatReturnsArgument
- };
- },
-
- getInitialState: function () {
- return {
- children: ReactTransitionChildMapping.getChildMapping(this.props.children)
- };
- },
-
- componentWillMount: function () {
- this.currentlyTransitioningKeys = {};
- this.keysToEnter = [];
- this.keysToLeave = [];
- },
-
- componentDidMount: function () {
- var initialChildMapping = this.state.children;
- for (var key in initialChildMapping) {
- if (initialChildMapping[key]) {
- this.performAppear(key);
- }
- }
- },
-
- componentWillReceiveProps: function (nextProps) {
- var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
- var prevChildMapping = this.state.children;
-
- this.setState({
- children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping)
- });
-
- var key;
-
- for (key in nextChildMapping) {
- var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
- if (nextChildMapping[key] && !hasPrev && !this.currentlyTransitioningKeys[key]) {
- this.keysToEnter.push(key);
- }
- }
-
- for (key in prevChildMapping) {
- var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
- if (prevChildMapping[key] && !hasNext && !this.currentlyTransitioningKeys[key]) {
- this.keysToLeave.push(key);
- }
- }
-
- // If we want to someday check for reordering, we could do it here.
- },
-
- componentDidUpdate: function () {
- var keysToEnter = this.keysToEnter;
- this.keysToEnter = [];
- keysToEnter.forEach(this.performEnter);
-
- var keysToLeave = this.keysToLeave;
- this.keysToLeave = [];
- keysToLeave.forEach(this.performLeave);
- },
-
- performAppear: function (key) {
- this.currentlyTransitioningKeys[key] = true;
-
- var component = this.refs[key];
-
- if (component.componentWillAppear) {
- component.componentWillAppear(this._handleDoneAppearing.bind(this, key));
- } else {
- this._handleDoneAppearing(key);
- }
- },
-
- _handleDoneAppearing: function (key) {
- var component = this.refs[key];
- if (component.componentDidAppear) {
- component.componentDidAppear();
- }
-
- delete this.currentlyTransitioningKeys[key];
-
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
-
- if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
- // This was removed before it had fully appeared. Remove it.
- this.performLeave(key);
- }
- },
-
- performEnter: function (key) {
- this.currentlyTransitioningKeys[key] = true;
-
- var component = this.refs[key];
-
- if (component.componentWillEnter) {
- component.componentWillEnter(this._handleDoneEntering.bind(this, key));
- } else {
- this._handleDoneEntering(key);
- }
- },
-
- _handleDoneEntering: function (key) {
- var component = this.refs[key];
- if (component.componentDidEnter) {
- component.componentDidEnter();
- }
-
- delete this.currentlyTransitioningKeys[key];
-
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
-
- if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
- // This was removed before it had fully entered. Remove it.
- this.performLeave(key);
- }
- },
-
- performLeave: function (key) {
- this.currentlyTransitioningKeys[key] = true;
-
- var component = this.refs[key];
- if (component.componentWillLeave) {
- component.componentWillLeave(this._handleDoneLeaving.bind(this, key));
- } else {
- // Note that this is somewhat dangerous b/c it calls setState()
- // again, effectively mutating the component before all the work
- // is done.
- this._handleDoneLeaving(key);
- }
- },
-
- _handleDoneLeaving: function (key) {
- var component = this.refs[key];
-
- if (component.componentDidLeave) {
- component.componentDidLeave();
- }
-
- delete this.currentlyTransitioningKeys[key];
-
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
-
- if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
- // This entered again before it fully left. Add it again.
- this.performEnter(key);
- } else {
- this.setState(function (state) {
- var newChildren = assign({}, state.children);
- delete newChildren[key];
- return { children: newChildren };
- });
- }
- },
-
- render: function () {
- // TODO: we could get rid of the need for the wrapper node
- // by cloning a single child
- var childrenToRender = [];
- for (var key in this.state.children) {
- var child = this.state.children[key];
- if (child) {
- // You may need to apply reactive updates to a child as it is leaving.
- // The normal React way to do it won't work since the child will have
- // already been removed. In case you need this behavior you can provide
- // a childFactory function to wrap every child, even the ones that are
- // leaving.
- childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key }));
- }
- }
- return React.createElement(this.props.component, this.props, childrenToRender);
- }
-});
-
-module.exports = ReactTransitionGroup;
-},{"./Object.assign":84,"./React":86,"./ReactTransitionChildMapping":152,"fbjs/lib/emptyFunction":214}],155:[function(require,module,exports){
-(function (process){
-/**
- * Copyright 2015, Facebook, Inc.
+ * Copyright 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -20905,11 +19791,9 @@ module.exports = ReactTransitionGroup;
'use strict';
var ReactCurrentOwner = require('./ReactCurrentOwner');
-var ReactElement = require('./ReactElement');
var ReactInstanceMap = require('./ReactInstanceMap');
var ReactUpdates = require('./ReactUpdates');
-var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
@@ -20917,6 +19801,19 @@ function enqueueUpdate(internalInstance) {
ReactUpdates.enqueueUpdate(internalInstance);
}
+function formatUnexpectedArgument(arg) {
+ var type = typeof arg;
+ if (type !== 'object') {
+ return type;
+ }
+ var displayName = arg.constructor && arg.constructor.name || type;
+ var keys = Object.keys(arg);
+ if (keys.length > 0 && keys.length < 20) {
+ return displayName + ' (keys: ' + keys.join(', ') + ')';
+ }
+ return displayName;
+}
+
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
var internalInstance = ReactInstanceMap.get(publicInstance);
if (!internalInstance) {
@@ -20924,13 +19821,13 @@ function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
// Only warn when we have a callerName. Otherwise we should be silent.
// We're probably calling from enqueueCallback. We don't want to warn
// there because we already warned for the corresponding lifecycle method.
- process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : void 0;
}
return null;
}
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + 'within `render` or another component\'s constructor). Render methods ' + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0;
}
return internalInstance;
@@ -20953,7 +19850,7 @@ var ReactUpdateQueue = {
if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
- process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
owner._warnedAboutRefsInRender = true;
}
}
@@ -20974,10 +19871,11 @@ var ReactUpdateQueue = {
*
* @param {ReactClass} publicInstance The instance to use as `this` context.
* @param {?function} callback Called after state is updated.
+ * @param {string} callerName Name of the calling function in the public API.
* @internal
*/
- enqueueCallback: function (publicInstance, callback) {
- !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
+ enqueueCallback: function (publicInstance, callback, callerName) {
+ ReactUpdateQueue.validateCallback(callback, callerName);
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
// Previously we would throw an error if we didn't have an internal
@@ -21002,7 +19900,6 @@ var ReactUpdateQueue = {
},
enqueueCallbackInternal: function (internalInstance, callback) {
- !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
@@ -21083,66 +19980,13 @@ var ReactUpdateQueue = {
enqueueUpdate(internalInstance);
},
- /**
- * Sets a subset of the props.
- *
- * @param {ReactClass} publicInstance The instance that should rerender.
- * @param {object} partialProps Subset of the next props.
- * @internal
- */
- enqueueSetProps: function (publicInstance, partialProps) {
- var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
- if (!internalInstance) {
- return;
- }
- ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
- },
-
- enqueueSetPropsInternal: function (internalInstance, partialProps) {
- var topLevelWrapper = internalInstance._topLevelWrapper;
- !topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
-
- // Merge with the pending element if it exists, otherwise with existing
- // element props.
- var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
- var element = wrapElement.props;
- var props = assign({}, element.props, partialProps);
- topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
-
- enqueueUpdate(topLevelWrapper);
- },
-
- /**
- * Replaces all of the props.
- *
- * @param {ReactClass} publicInstance The instance that should rerender.
- * @param {object} props New props.
- * @internal
- */
- enqueueReplaceProps: function (publicInstance, props) {
- var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
- if (!internalInstance) {
- return;
- }
- ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
- },
-
- enqueueReplacePropsInternal: function (internalInstance, props) {
- var topLevelWrapper = internalInstance._topLevelWrapper;
- !topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
-
- // Merge with the pending element if it exists, otherwise with existing
- // element props.
- var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
- var element = wrapElement.props;
- topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
-
- enqueueUpdate(topLevelWrapper);
- },
-
enqueueElementInternal: function (internalInstance, newElement) {
internalInstance._pendingElement = newElement;
enqueueUpdate(internalInstance);
+ },
+
+ validateCallback: function (callback, callerName) {
+ !(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : invariant(false) : void 0;
}
};
@@ -21150,10 +19994,10 @@ var ReactUpdateQueue = {
module.exports = ReactUpdateQueue;
}).call(this,require('_process'))
-},{"./Object.assign":84,"./ReactCurrentOwner":99,"./ReactElement":117,"./ReactInstanceMap":128,"./ReactUpdates":156,"_process":27,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],156:[function(require,module,exports){
+},{"./ReactCurrentOwner":101,"./ReactInstanceMap":136,"./ReactUpdates":155,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],155:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -21165,13 +20009,15 @@ module.exports = ReactUpdateQueue;
'use strict';
+var _assign = require('object-assign');
+
var CallbackQueue = require('./CallbackQueue');
var PooledClass = require('./PooledClass');
+var ReactFeatureFlags = require('./ReactFeatureFlags');
var ReactPerf = require('./ReactPerf');
var ReactReconciler = require('./ReactReconciler');
var Transaction = require('./Transaction');
-var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var dirtyComponents = [];
@@ -21181,7 +20027,7 @@ var asapEnqueued = false;
var batchingStrategy = null;
function ensureInjected() {
- !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
+ !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : void 0;
}
var NESTED_UPDATES = {
@@ -21218,10 +20064,11 @@ function ReactUpdatesFlushTransaction() {
this.reinitializeTransaction();
this.dirtyComponentsLength = null;
this.callbackQueue = CallbackQueue.getPooled();
- this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
+ this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(
+ /* useCreateElement */true);
}
-assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
+_assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
@@ -21261,7 +20108,7 @@ function mountOrderComparator(c1, c2) {
function runBatchedUpdates(transaction) {
var len = transaction.dirtyComponentsLength;
- !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
+ !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : void 0;
// Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
@@ -21280,8 +20127,23 @@ function runBatchedUpdates(transaction) {
var callbacks = component._pendingCallbacks;
component._pendingCallbacks = null;
+ var markerName;
+ if (ReactFeatureFlags.logTopLevelRenders) {
+ var namedComponent = component;
+ // Duck type TopLevelWrapper. This is probably always true.
+ if (component._currentElement.props === component._renderedComponent._currentElement) {
+ namedComponent = component._renderedComponent;
+ }
+ markerName = 'React update: ' + namedComponent.getName();
+ console.time(markerName);
+ }
+
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
+ if (markerName) {
+ console.timeEnd(markerName);
+ }
+
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
@@ -21339,21 +20201,21 @@ function enqueueUpdate(component) {
* if no updates are currently being performed.
*/
function asap(callback, context) {
- !batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
+ !batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : void 0;
asapCallbackQueue.enqueue(callback, context);
asapEnqueued = true;
}
var ReactUpdatesInjection = {
injectReconcileTransaction: function (ReconcileTransaction) {
- !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
+ !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : void 0;
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
},
injectBatchingStrategy: function (_batchingStrategy) {
- !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
- !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
- !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
+ !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : void 0;
+ !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : void 0;
+ !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : void 0;
batchingStrategy = _batchingStrategy;
}
};
@@ -21377,9 +20239,9 @@ var ReactUpdates = {
module.exports = ReactUpdates;
}).call(this,require('_process'))
-},{"./CallbackQueue":66,"./Object.assign":84,"./PooledClass":85,"./ReactPerf":138,"./ReactReconciler":144,"./Transaction":174,"_process":27,"fbjs/lib/invariant":222}],157:[function(require,module,exports){
+},{"./CallbackQueue":71,"./PooledClass":91,"./ReactFeatureFlags":133,"./ReactPerf":147,"./ReactReconciler":152,"./Transaction":173,"_process":29,"fbjs/lib/invariant":219,"object-assign":28}],156:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -21391,74 +20253,10 @@ module.exports = ReactUpdates;
'use strict';
-module.exports = '0.14.7';
-},{}],158:[function(require,module,exports){
-(function (process){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule 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 = require('./LinkedStateMixin');
-var React = require('./React');
-var ReactComponentWithPureRenderMixin = require('./ReactComponentWithPureRenderMixin');
-var ReactCSSTransitionGroup = require('./ReactCSSTransitionGroup');
-var ReactFragment = require('./ReactFragment');
-var ReactTransitionGroup = require('./ReactTransitionGroup');
-var ReactUpdates = require('./ReactUpdates');
-
-var cloneWithProps = require('./cloneWithProps');
-var shallowCompare = require('./shallowCompare');
-var update = require('./update');
-var warning = require('fbjs/lib/warning');
-
-var warnedAboutBatchedUpdates = false;
-
-React.addons = {
- CSSTransitionGroup: ReactCSSTransitionGroup,
- LinkedStateMixin: LinkedStateMixin,
- PureRenderMixin: ReactComponentWithPureRenderMixin,
- TransitionGroup: ReactTransitionGroup,
-
- batchedUpdates: function () {
- if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(warnedAboutBatchedUpdates, 'React.addons.batchedUpdates is deprecated. Use ' + 'ReactDOM.unstable_batchedUpdates instead.') : undefined;
- warnedAboutBatchedUpdates = true;
- }
- return ReactUpdates.batchedUpdates.apply(this, arguments);
- },
- cloneWithProps: cloneWithProps,
- createFragment: ReactFragment.create,
- shallowCompare: shallowCompare,
- update: update
-};
-
-if (process.env.NODE_ENV !== 'production') {
- React.addons.Perf = require('./ReactDefaultPerf');
- React.addons.TestUtils = require('./ReactTestUtils');
-}
-
-module.exports = React;
-}).call(this,require('_process'))
-
-},{"./LinkedStateMixin":82,"./React":86,"./ReactCSSTransitionGroup":89,"./ReactComponentWithPureRenderMixin":97,"./ReactDefaultPerf":115,"./ReactFragment":124,"./ReactTestUtils":151,"./ReactTransitionGroup":154,"./ReactUpdates":156,"./cloneWithProps":179,"./shallowCompare":201,"./update":204,"_process":27,"fbjs/lib/warning":234}],159:[function(require,module,exports){
+module.exports = '15.0.2';
+},{}],157:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -21470,72 +20268,270 @@ module.exports = React;
'use strict';
-var DOMProperty = require('./DOMProperty');
-
-var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
-
var NS = {
xlink: 'http://www.w3.org/1999/xlink',
xml: 'http://www.w3.org/XML/1998/namespace'
};
+// We use attributes for everything SVG so let's avoid some duplication and run
+// code instead.
+// The following are all specified in the HTML config already so we exclude here.
+// - class (as className)
+// - color
+// - height
+// - id
+// - lang
+// - max
+// - media
+// - method
+// - min
+// - name
+// - style
+// - target
+// - type
+// - width
+var ATTRS = {
+ accentHeight: 'accent-height',
+ accumulate: 0,
+ additive: 0,
+ alignmentBaseline: 'alignment-baseline',
+ allowReorder: 'allowReorder',
+ alphabetic: 0,
+ amplitude: 0,
+ arabicForm: 'arabic-form',
+ ascent: 0,
+ attributeName: 'attributeName',
+ attributeType: 'attributeType',
+ autoReverse: 'autoReverse',
+ azimuth: 0,
+ baseFrequency: 'baseFrequency',
+ baseProfile: 'baseProfile',
+ baselineShift: 'baseline-shift',
+ bbox: 0,
+ begin: 0,
+ bias: 0,
+ by: 0,
+ calcMode: 'calcMode',
+ capHeight: 'cap-height',
+ clip: 0,
+ clipPath: 'clip-path',
+ clipRule: 'clip-rule',
+ clipPathUnits: 'clipPathUnits',
+ colorInterpolation: 'color-interpolation',
+ colorInterpolationFilters: 'color-interpolation-filters',
+ colorProfile: 'color-profile',
+ colorRendering: 'color-rendering',
+ contentScriptType: 'contentScriptType',
+ contentStyleType: 'contentStyleType',
+ cursor: 0,
+ cx: 0,
+ cy: 0,
+ d: 0,
+ decelerate: 0,
+ descent: 0,
+ diffuseConstant: 'diffuseConstant',
+ direction: 0,
+ display: 0,
+ divisor: 0,
+ dominantBaseline: 'dominant-baseline',
+ dur: 0,
+ dx: 0,
+ dy: 0,
+ edgeMode: 'edgeMode',
+ elevation: 0,
+ enableBackground: 'enable-background',
+ end: 0,
+ exponent: 0,
+ externalResourcesRequired: 'externalResourcesRequired',
+ fill: 0,
+ fillOpacity: 'fill-opacity',
+ fillRule: 'fill-rule',
+ filter: 0,
+ filterRes: 'filterRes',
+ filterUnits: 'filterUnits',
+ floodColor: 'flood-color',
+ floodOpacity: 'flood-opacity',
+ focusable: 0,
+ fontFamily: 'font-family',
+ fontSize: 'font-size',
+ fontSizeAdjust: 'font-size-adjust',
+ fontStretch: 'font-stretch',
+ fontStyle: 'font-style',
+ fontVariant: 'font-variant',
+ fontWeight: 'font-weight',
+ format: 0,
+ from: 0,
+ fx: 0,
+ fy: 0,
+ g1: 0,
+ g2: 0,
+ glyphName: 'glyph-name',
+ glyphOrientationHorizontal: 'glyph-orientation-horizontal',
+ glyphOrientationVertical: 'glyph-orientation-vertical',
+ glyphRef: 'glyphRef',
+ gradientTransform: 'gradientTransform',
+ gradientUnits: 'gradientUnits',
+ hanging: 0,
+ horizAdvX: 'horiz-adv-x',
+ horizOriginX: 'horiz-origin-x',
+ ideographic: 0,
+ imageRendering: 'image-rendering',
+ 'in': 0,
+ in2: 0,
+ intercept: 0,
+ k: 0,
+ k1: 0,
+ k2: 0,
+ k3: 0,
+ k4: 0,
+ kernelMatrix: 'kernelMatrix',
+ kernelUnitLength: 'kernelUnitLength',
+ kerning: 0,
+ keyPoints: 'keyPoints',
+ keySplines: 'keySplines',
+ keyTimes: 'keyTimes',
+ lengthAdjust: 'lengthAdjust',
+ letterSpacing: 'letter-spacing',
+ lightingColor: 'lighting-color',
+ limitingConeAngle: 'limitingConeAngle',
+ local: 0,
+ markerEnd: 'marker-end',
+ markerMid: 'marker-mid',
+ markerStart: 'marker-start',
+ markerHeight: 'markerHeight',
+ markerUnits: 'markerUnits',
+ markerWidth: 'markerWidth',
+ mask: 0,
+ maskContentUnits: 'maskContentUnits',
+ maskUnits: 'maskUnits',
+ mathematical: 0,
+ mode: 0,
+ numOctaves: 'numOctaves',
+ offset: 0,
+ opacity: 0,
+ operator: 0,
+ order: 0,
+ orient: 0,
+ orientation: 0,
+ origin: 0,
+ overflow: 0,
+ overlinePosition: 'overline-position',
+ overlineThickness: 'overline-thickness',
+ paintOrder: 'paint-order',
+ panose1: 'panose-1',
+ pathLength: 'pathLength',
+ patternContentUnits: 'patternContentUnits',
+ patternTransform: 'patternTransform',
+ patternUnits: 'patternUnits',
+ pointerEvents: 'pointer-events',
+ points: 0,
+ pointsAtX: 'pointsAtX',
+ pointsAtY: 'pointsAtY',
+ pointsAtZ: 'pointsAtZ',
+ preserveAlpha: 'preserveAlpha',
+ preserveAspectRatio: 'preserveAspectRatio',
+ primitiveUnits: 'primitiveUnits',
+ r: 0,
+ radius: 0,
+ refX: 'refX',
+ refY: 'refY',
+ renderingIntent: 'rendering-intent',
+ repeatCount: 'repeatCount',
+ repeatDur: 'repeatDur',
+ requiredExtensions: 'requiredExtensions',
+ requiredFeatures: 'requiredFeatures',
+ restart: 0,
+ result: 0,
+ rotate: 0,
+ rx: 0,
+ ry: 0,
+ scale: 0,
+ seed: 0,
+ shapeRendering: 'shape-rendering',
+ slope: 0,
+ spacing: 0,
+ specularConstant: 'specularConstant',
+ specularExponent: 'specularExponent',
+ speed: 0,
+ spreadMethod: 'spreadMethod',
+ startOffset: 'startOffset',
+ stdDeviation: 'stdDeviation',
+ stemh: 0,
+ stemv: 0,
+ stitchTiles: 'stitchTiles',
+ stopColor: 'stop-color',
+ stopOpacity: 'stop-opacity',
+ strikethroughPosition: 'strikethrough-position',
+ strikethroughThickness: 'strikethrough-thickness',
+ string: 0,
+ stroke: 0,
+ strokeDasharray: 'stroke-dasharray',
+ strokeDashoffset: 'stroke-dashoffset',
+ strokeLinecap: 'stroke-linecap',
+ strokeLinejoin: 'stroke-linejoin',
+ strokeMiterlimit: 'stroke-miterlimit',
+ strokeOpacity: 'stroke-opacity',
+ strokeWidth: 'stroke-width',
+ surfaceScale: 'surfaceScale',
+ systemLanguage: 'systemLanguage',
+ tableValues: 'tableValues',
+ targetX: 'targetX',
+ targetY: 'targetY',
+ textAnchor: 'text-anchor',
+ textDecoration: 'text-decoration',
+ textRendering: 'text-rendering',
+ textLength: 'textLength',
+ to: 0,
+ transform: 0,
+ u1: 0,
+ u2: 0,
+ underlinePosition: 'underline-position',
+ underlineThickness: 'underline-thickness',
+ unicode: 0,
+ unicodeBidi: 'unicode-bidi',
+ unicodeRange: 'unicode-range',
+ unitsPerEm: 'units-per-em',
+ vAlphabetic: 'v-alphabetic',
+ vHanging: 'v-hanging',
+ vIdeographic: 'v-ideographic',
+ vMathematical: 'v-mathematical',
+ values: 0,
+ vectorEffect: 'vector-effect',
+ version: 0,
+ vertAdvY: 'vert-adv-y',
+ vertOriginX: 'vert-origin-x',
+ vertOriginY: 'vert-origin-y',
+ viewBox: 'viewBox',
+ viewTarget: 'viewTarget',
+ visibility: 0,
+ widths: 0,
+ wordSpacing: 'word-spacing',
+ writingMode: 'writing-mode',
+ x: 0,
+ xHeight: 'x-height',
+ x1: 0,
+ x2: 0,
+ xChannelSelector: 'xChannelSelector',
+ xlinkActuate: 'xlink:actuate',
+ xlinkArcrole: 'xlink:arcrole',
+ xlinkHref: 'xlink:href',
+ xlinkRole: 'xlink:role',
+ xlinkShow: 'xlink:show',
+ xlinkTitle: 'xlink:title',
+ xlinkType: 'xlink:type',
+ xmlBase: 'xml:base',
+ xmlLang: 'xml:lang',
+ xmlSpace: 'xml:space',
+ y: 0,
+ y1: 0,
+ y2: 0,
+ yChannelSelector: 'yChannelSelector',
+ z: 0,
+ zoomAndPan: 'zoomAndPan'
+};
+
var SVGDOMPropertyConfig = {
- Properties: {
- clipPath: MUST_USE_ATTRIBUTE,
- cx: MUST_USE_ATTRIBUTE,
- cy: MUST_USE_ATTRIBUTE,
- d: MUST_USE_ATTRIBUTE,
- dx: MUST_USE_ATTRIBUTE,
- dy: MUST_USE_ATTRIBUTE,
- fill: MUST_USE_ATTRIBUTE,
- fillOpacity: MUST_USE_ATTRIBUTE,
- fontFamily: MUST_USE_ATTRIBUTE,
- fontSize: MUST_USE_ATTRIBUTE,
- fx: MUST_USE_ATTRIBUTE,
- fy: MUST_USE_ATTRIBUTE,
- gradientTransform: MUST_USE_ATTRIBUTE,
- gradientUnits: MUST_USE_ATTRIBUTE,
- markerEnd: MUST_USE_ATTRIBUTE,
- markerMid: MUST_USE_ATTRIBUTE,
- markerStart: MUST_USE_ATTRIBUTE,
- offset: MUST_USE_ATTRIBUTE,
- opacity: MUST_USE_ATTRIBUTE,
- patternContentUnits: MUST_USE_ATTRIBUTE,
- patternUnits: MUST_USE_ATTRIBUTE,
- points: MUST_USE_ATTRIBUTE,
- preserveAspectRatio: MUST_USE_ATTRIBUTE,
- r: MUST_USE_ATTRIBUTE,
- rx: MUST_USE_ATTRIBUTE,
- ry: MUST_USE_ATTRIBUTE,
- spreadMethod: MUST_USE_ATTRIBUTE,
- stopColor: MUST_USE_ATTRIBUTE,
- stopOpacity: MUST_USE_ATTRIBUTE,
- stroke: MUST_USE_ATTRIBUTE,
- strokeDasharray: MUST_USE_ATTRIBUTE,
- strokeLinecap: MUST_USE_ATTRIBUTE,
- strokeOpacity: MUST_USE_ATTRIBUTE,
- strokeWidth: MUST_USE_ATTRIBUTE,
- textAnchor: MUST_USE_ATTRIBUTE,
- transform: MUST_USE_ATTRIBUTE,
- version: MUST_USE_ATTRIBUTE,
- viewBox: MUST_USE_ATTRIBUTE,
- x1: MUST_USE_ATTRIBUTE,
- x2: MUST_USE_ATTRIBUTE,
- x: MUST_USE_ATTRIBUTE,
- xlinkActuate: MUST_USE_ATTRIBUTE,
- xlinkArcrole: MUST_USE_ATTRIBUTE,
- xlinkHref: MUST_USE_ATTRIBUTE,
- xlinkRole: MUST_USE_ATTRIBUTE,
- xlinkShow: MUST_USE_ATTRIBUTE,
- xlinkTitle: MUST_USE_ATTRIBUTE,
- xlinkType: MUST_USE_ATTRIBUTE,
- xmlBase: MUST_USE_ATTRIBUTE,
- xmlLang: MUST_USE_ATTRIBUTE,
- xmlSpace: MUST_USE_ATTRIBUTE,
- y1: MUST_USE_ATTRIBUTE,
- y2: MUST_USE_ATTRIBUTE,
- y: MUST_USE_ATTRIBUTE
- },
+ Properties: {},
DOMAttributeNamespaces: {
xlinkActuate: NS.xlink,
xlinkArcrole: NS.xlink,
@@ -21548,45 +20544,20 @@ var SVGDOMPropertyConfig = {
xmlLang: NS.xml,
xmlSpace: NS.xml
},
- DOMAttributeNames: {
- clipPath: 'clip-path',
- fillOpacity: 'fill-opacity',
- fontFamily: 'font-family',
- fontSize: 'font-size',
- gradientTransform: 'gradientTransform',
- gradientUnits: 'gradientUnits',
- markerEnd: 'marker-end',
- markerMid: 'marker-mid',
- markerStart: 'marker-start',
- patternContentUnits: 'patternContentUnits',
- patternUnits: 'patternUnits',
- preserveAspectRatio: 'preserveAspectRatio',
- spreadMethod: 'spreadMethod',
- stopColor: 'stop-color',
- stopOpacity: 'stop-opacity',
- strokeDasharray: 'stroke-dasharray',
- strokeLinecap: 'stroke-linecap',
- strokeOpacity: 'stroke-opacity',
- strokeWidth: 'stroke-width',
- textAnchor: 'text-anchor',
- viewBox: 'viewBox',
- xlinkActuate: 'xlink:actuate',
- xlinkArcrole: 'xlink:arcrole',
- xlinkHref: 'xlink:href',
- xlinkRole: 'xlink:role',
- xlinkShow: 'xlink:show',
- xlinkTitle: 'xlink:title',
- xlinkType: 'xlink:type',
- xmlBase: 'xml:base',
- xmlLang: 'xml:lang',
- xmlSpace: 'xml:space'
- }
+ DOMAttributeNames: {}
};
+Object.keys(ATTRS).forEach(function (key) {
+ SVGDOMPropertyConfig.Properties[key] = 0;
+ if (ATTRS[key]) {
+ SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
+ }
+});
+
module.exports = SVGDOMPropertyConfig;
-},{"./DOMProperty":70}],160:[function(require,module,exports){
+},{}],158:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -21601,6 +20572,7 @@ module.exports = SVGDOMPropertyConfig;
var EventConstants = require('./EventConstants');
var EventPropagators = require('./EventPropagators');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var ReactInputSelection = require('./ReactInputSelection');
var SyntheticEvent = require('./SyntheticEvent');
@@ -21624,12 +20596,12 @@ var eventTypes = {
};
var activeElement = null;
-var activeElementID = null;
+var activeElementInst = null;
var lastSelection = null;
var mouseDown = false;
// Track whether a listener exists for this plugin. If none exist, we do
-// not extract events.
+// not extract events. See #3639.
var hasListener = false;
var ON_SELECT_KEY = keyOf({ onSelect: null });
@@ -21687,7 +20659,7 @@ function constructSelectEvent(nativeEvent, nativeEventTarget) {
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
- var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
+ var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
@@ -21718,31 +20690,25 @@ var SelectEventPlugin = {
eventTypes: eventTypes,
- /**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
- */
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
if (!hasListener) {
return null;
}
+ var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
+
switch (topLevelType) {
// Track the input node that has focus.
case topLevelTypes.topFocus:
- if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
- activeElement = topLevelTarget;
- activeElementID = topLevelTargetID;
+ if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
+ activeElement = targetNode;
+ activeElementInst = targetInst;
lastSelection = null;
}
break;
case topLevelTypes.topBlur:
activeElement = null;
- activeElementID = null;
+ activeElementInst = null;
lastSelection = null;
break;
@@ -21778,7 +20744,7 @@ var SelectEventPlugin = {
return null;
},
- didPutListener: function (id, registrationName, listener) {
+ didPutListener: function (inst, registrationName, listener) {
if (registrationName === ON_SELECT_KEY) {
hasListener = true;
}
@@ -21786,40 +20752,10 @@ var SelectEventPlugin = {
};
module.exports = SelectEventPlugin;
-},{"./EventConstants":75,"./EventPropagators":79,"./ReactInputSelection":126,"./SyntheticEvent":166,"./isTextInputElement":195,"fbjs/lib/ExecutionEnvironment":208,"fbjs/lib/getActiveElement":217,"fbjs/lib/keyOf":227,"fbjs/lib/shallowEqual":232}],161:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ServerReactRootIndex
- * @typechecks
- */
-
-'use strict';
-
-/**
- * Size of the reactRoot ID space. We generate random numbers for React root
- * IDs and if there's a collision the events and DOM update system will
- * get confused. In the future we need a way to generate GUIDs but for
- * now this will work on a smaller scale.
- */
-var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
-
-var ServerReactRootIndex = {
- createReactRootIndex: function () {
- return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
- }
-};
-
-module.exports = ServerReactRootIndex;
-},{}],162:[function(require,module,exports){
+},{"./EventConstants":82,"./EventPropagators":86,"./ReactDOMComponentTree":106,"./ReactInputSelection":135,"./SyntheticEvent":164,"./isTextInputElement":195,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/getActiveElement":214,"fbjs/lib/keyOf":223,"fbjs/lib/shallowEqual":228}],159:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -21834,7 +20770,8 @@ module.exports = ServerReactRootIndex;
var EventConstants = require('./EventConstants');
var EventListener = require('fbjs/lib/EventListener');
var EventPropagators = require('./EventPropagators');
-var ReactMount = require('./ReactMount');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
+var SyntheticAnimationEvent = require('./SyntheticAnimationEvent');
var SyntheticClipboardEvent = require('./SyntheticClipboardEvent');
var SyntheticEvent = require('./SyntheticEvent');
var SyntheticFocusEvent = require('./SyntheticFocusEvent');
@@ -21842,6 +20779,7 @@ var SyntheticKeyboardEvent = require('./SyntheticKeyboardEvent');
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
var SyntheticDragEvent = require('./SyntheticDragEvent');
var SyntheticTouchEvent = require('./SyntheticTouchEvent');
+var SyntheticTransitionEvent = require('./SyntheticTransitionEvent');
var SyntheticUIEvent = require('./SyntheticUIEvent');
var SyntheticWheelEvent = require('./SyntheticWheelEvent');
@@ -21859,6 +20797,24 @@ var eventTypes = {
captured: keyOf({ onAbortCapture: true })
}
},
+ animationEnd: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onAnimationEnd: true }),
+ captured: keyOf({ onAnimationEndCapture: true })
+ }
+ },
+ animationIteration: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onAnimationIteration: true }),
+ captured: keyOf({ onAnimationIterationCapture: true })
+ }
+ },
+ animationStart: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onAnimationStart: true }),
+ captured: keyOf({ onAnimationStartCapture: true })
+ }
+ },
blur: {
phasedRegistrationNames: {
bubbled: keyOf({ onBlur: true }),
@@ -21997,6 +20953,12 @@ var eventTypes = {
captured: keyOf({ onInputCapture: true })
}
},
+ invalid: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onInvalid: true }),
+ captured: keyOf({ onInvalidCapture: true })
+ }
+ },
keyDown: {
phasedRegistrationNames: {
bubbled: keyOf({ onKeyDown: true }),
@@ -22179,6 +21141,12 @@ var eventTypes = {
captured: keyOf({ onTouchStartCapture: true })
}
},
+ transitionEnd: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onTransitionEnd: true }),
+ captured: keyOf({ onTransitionEndCapture: true })
+ }
+ },
volumeChange: {
phasedRegistrationNames: {
bubbled: keyOf({ onVolumeChange: true }),
@@ -22201,6 +21169,9 @@ var eventTypes = {
var topLevelEventsToDispatchConfig = {
topAbort: eventTypes.abort,
+ topAnimationEnd: eventTypes.animationEnd,
+ topAnimationIteration: eventTypes.animationIteration,
+ topAnimationStart: eventTypes.animationStart,
topBlur: eventTypes.blur,
topCanPlay: eventTypes.canPlay,
topCanPlayThrough: eventTypes.canPlayThrough,
@@ -22224,6 +21195,7 @@ var topLevelEventsToDispatchConfig = {
topError: eventTypes.error,
topFocus: eventTypes.focus,
topInput: eventTypes.input,
+ topInvalid: eventTypes.invalid,
topKeyDown: eventTypes.keyDown,
topKeyPress: eventTypes.keyPress,
topKeyUp: eventTypes.keyUp,
@@ -22254,6 +21226,7 @@ var topLevelEventsToDispatchConfig = {
topTouchEnd: eventTypes.touchEnd,
topTouchMove: eventTypes.touchMove,
topTouchStart: eventTypes.touchStart,
+ topTransitionEnd: eventTypes.transitionEnd,
topVolumeChange: eventTypes.volumeChange,
topWaiting: eventTypes.waiting,
topWheel: eventTypes.wheel
@@ -22270,15 +21243,7 @@ var SimpleEventPlugin = {
eventTypes: eventTypes,
- /**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
- */
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
return null;
@@ -22294,6 +21259,7 @@ var SimpleEventPlugin = {
case topLevelTypes.topEnded:
case topLevelTypes.topError:
case topLevelTypes.topInput:
+ case topLevelTypes.topInvalid:
case topLevelTypes.topLoad:
case topLevelTypes.topLoadedData:
case topLevelTypes.topLoadedMetadata:
@@ -22317,7 +21283,7 @@ var SimpleEventPlugin = {
EventConstructor = SyntheticEvent;
break;
case topLevelTypes.topKeyPress:
- // FireFox creates a keypress event for function keys too. This removes
+ // Firefox creates a keypress event for function keys too. This removes
// 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) {
@@ -22364,6 +21330,14 @@ var SimpleEventPlugin = {
case topLevelTypes.topTouchStart:
EventConstructor = SyntheticTouchEvent;
break;
+ case topLevelTypes.topAnimationEnd:
+ case topLevelTypes.topAnimationIteration:
+ case topLevelTypes.topAnimationStart:
+ EventConstructor = SyntheticAnimationEvent;
+ break;
+ case topLevelTypes.topTransitionEnd:
+ EventConstructor = SyntheticTransitionEvent;
+ break;
case topLevelTypes.topScroll:
EventConstructor = SyntheticUIEvent;
break;
@@ -22376,27 +21350,29 @@ var SimpleEventPlugin = {
EventConstructor = SyntheticClipboardEvent;
break;
}
- !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
- var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
+ !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : void 0;
+ var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
},
- didPutListener: function (id, registrationName, listener) {
+ didPutListener: function (inst, registrationName, listener) {
// Mobile Safari does not fire properly bubble click events on
// non-interactive elements, which means delegated click listeners do not
// fire. The workaround for this bug involves attaching an empty click
// listener on the target node.
if (registrationName === ON_CLICK_KEY) {
- var node = ReactMount.getNode(id);
+ var id = inst._rootNodeID;
+ var node = ReactDOMComponentTree.getNodeFromInstance(inst);
if (!onClickListeners[id]) {
onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
}
}
},
- willDeleteListener: function (id, registrationName) {
+ willDeleteListener: function (inst, registrationName) {
if (registrationName === ON_CLICK_KEY) {
+ var id = inst._rootNodeID;
onClickListeners[id].remove();
delete onClickListeners[id];
}
@@ -22407,9 +21383,49 @@ var SimpleEventPlugin = {
module.exports = SimpleEventPlugin;
}).call(this,require('_process'))
-},{"./EventConstants":75,"./EventPropagators":79,"./ReactMount":132,"./SyntheticClipboardEvent":163,"./SyntheticDragEvent":165,"./SyntheticEvent":166,"./SyntheticFocusEvent":167,"./SyntheticKeyboardEvent":169,"./SyntheticMouseEvent":170,"./SyntheticTouchEvent":171,"./SyntheticUIEvent":172,"./SyntheticWheelEvent":173,"./getEventCharCode":186,"_process":27,"fbjs/lib/EventListener":207,"fbjs/lib/emptyFunction":214,"fbjs/lib/invariant":222,"fbjs/lib/keyOf":227}],163:[function(require,module,exports){
+},{"./EventConstants":82,"./EventPropagators":86,"./ReactDOMComponentTree":106,"./SyntheticAnimationEvent":160,"./SyntheticClipboardEvent":161,"./SyntheticDragEvent":163,"./SyntheticEvent":164,"./SyntheticFocusEvent":165,"./SyntheticKeyboardEvent":167,"./SyntheticMouseEvent":168,"./SyntheticTouchEvent":169,"./SyntheticTransitionEvent":170,"./SyntheticUIEvent":171,"./SyntheticWheelEvent":172,"./getEventCharCode":184,"_process":29,"fbjs/lib/EventListener":204,"fbjs/lib/emptyFunction":211,"fbjs/lib/invariant":219,"fbjs/lib/keyOf":223}],160:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule SyntheticAnimationEvent
+ */
+
+'use strict';
+
+var SyntheticEvent = require('./SyntheticEvent');
+
+/**
+ * @interface Event
+ * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
+ */
+var AnimationEventInterface = {
+ animationName: null,
+ elapsedTime: null,
+ pseudoElement: null
+};
+
+/**
+ * @param {object} dispatchConfig Configuration used to dispatch this event.
+ * @param {string} dispatchMarker Marker identifying the event target.
+ * @param {object} nativeEvent Native browser event.
+ * @extends {SyntheticEvent}
+ */
+function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+}
+
+SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface);
+
+module.exports = SyntheticAnimationEvent;
+},{"./SyntheticEvent":164}],161:[function(require,module,exports){
+/**
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -22417,7 +21433,6 @@ module.exports = SimpleEventPlugin;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticClipboardEvent
- * @typechecks static-only
*/
'use strict';
@@ -22441,15 +21456,15 @@ var ClipboardEventInterface = {
* @extends {SyntheticUIEvent}
*/
function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+ return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
module.exports = SyntheticClipboardEvent;
-},{"./SyntheticEvent":166}],164:[function(require,module,exports){
+},{"./SyntheticEvent":164}],162:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -22457,7 +21472,6 @@ module.exports = SyntheticClipboardEvent;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticCompositionEvent
- * @typechecks static-only
*/
'use strict';
@@ -22479,15 +21493,15 @@ var CompositionEventInterface = {
* @extends {SyntheticUIEvent}
*/
function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+ return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
module.exports = SyntheticCompositionEvent;
-},{"./SyntheticEvent":166}],165:[function(require,module,exports){
+},{"./SyntheticEvent":164}],163:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -22495,7 +21509,6 @@ module.exports = SyntheticCompositionEvent;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticDragEvent
- * @typechecks static-only
*/
'use strict';
@@ -22517,16 +21530,16 @@ var DragEventInterface = {
* @extends {SyntheticUIEvent}
*/
function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+ return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
module.exports = SyntheticDragEvent;
-},{"./SyntheticMouseEvent":170}],166:[function(require,module,exports){
+},{"./SyntheticMouseEvent":168}],164:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -22534,17 +21547,22 @@ module.exports = SyntheticDragEvent;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticEvent
- * @typechecks static-only
*/
'use strict';
+var _assign = require('object-assign');
+
var PooledClass = require('./PooledClass');
-var assign = require('./Object.assign');
var emptyFunction = require('fbjs/lib/emptyFunction');
var warning = require('fbjs/lib/warning');
+var didWarnForAddedNewProperty = false;
+var isProxySupported = typeof Proxy === 'function';
+
+var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
+
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
@@ -22578,12 +21596,20 @@ var EventInterface = {
* DOM interface; custom application-specific events can also subclass this.
*
* @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
+ * @param {*} targetInst Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
+ * @param {DOMEventTarget} nativeEventTarget Target node.
*/
-function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
+ if (process.env.NODE_ENV !== 'production') {
+ // these have a getter/setter for warnings
+ delete this.nativeEvent;
+ delete this.preventDefault;
+ delete this.stopPropagation;
+ }
+
this.dispatchConfig = dispatchConfig;
- this.dispatchMarker = dispatchMarker;
+ this._targetInst = targetInst;
this.nativeEvent = nativeEvent;
var Interface = this.constructor.Interface;
@@ -22591,6 +21617,9 @@ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEvent
if (!Interface.hasOwnProperty(propName)) {
continue;
}
+ if (process.env.NODE_ENV !== 'production') {
+ delete this[propName]; // this has a getter/setter for warnings
+ }
var normalize = Interface[propName];
if (normalize) {
this[propName] = normalize(nativeEvent);
@@ -22610,16 +21639,14 @@ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEvent
this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
}
this.isPropagationStopped = emptyFunction.thatReturnsFalse;
+ return this;
}
-assign(SyntheticEvent.prototype, {
+_assign(SyntheticEvent.prototype, {
preventDefault: function () {
this.defaultPrevented = true;
var event = this.nativeEvent;
- if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
- }
if (!event) {
return;
}
@@ -22634,9 +21661,6 @@ assign(SyntheticEvent.prototype, {
stopPropagation: function () {
var event = this.nativeEvent;
- if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
- }
if (!event) {
return;
}
@@ -22671,17 +21695,50 @@ assign(SyntheticEvent.prototype, {
destructor: function () {
var Interface = this.constructor.Interface;
for (var propName in Interface) {
- this[propName] = null;
+ if (process.env.NODE_ENV !== 'production') {
+ Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
+ } else {
+ this[propName] = null;
+ }
+ }
+ for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
+ this[shouldBeReleasedProperties[i]] = null;
+ }
+ if (process.env.NODE_ENV !== 'production') {
+ var noop = require('fbjs/lib/emptyFunction');
+ Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
+ Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', noop));
+ Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', noop));
}
- this.dispatchConfig = null;
- this.dispatchMarker = null;
- this.nativeEvent = null;
}
});
SyntheticEvent.Interface = EventInterface;
+if (process.env.NODE_ENV !== 'production') {
+ if (isProxySupported) {
+ /*eslint-disable no-func-assign */
+ SyntheticEvent = new Proxy(SyntheticEvent, {
+ construct: function (target, args) {
+ return this.apply(target, Object.create(target.prototype), args);
+ },
+ apply: function (constructor, that, args) {
+ return new Proxy(constructor.apply(that, args), {
+ set: function (target, prop, value) {
+ if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
+ process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re adding a new property in the synthetic event object. ' + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;
+ didWarnForAddedNewProperty = true;
+ }
+ target[prop] = value;
+ return true;
+ }
+ });
+ }
+ });
+ /*eslint-enable no-func-assign */
+ }
+}
/**
* Helper to reduce boilerplate when creating subclasses.
*
@@ -22691,12 +21748,15 @@ SyntheticEvent.Interface = EventInterface;
SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;
- var prototype = Object.create(Super.prototype);
- assign(prototype, Class.prototype);
+ var E = function () {};
+ E.prototype = Super.prototype;
+ var prototype = new E();
+
+ _assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
- Class.Interface = assign({}, Super.Interface, Interface);
+ Class.Interface = _assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;
PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
@@ -22705,11 +21765,45 @@ SyntheticEvent.augmentClass = function (Class, Interface) {
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
module.exports = SyntheticEvent;
+
+/**
+ * Helper to nullify syntheticEvent instance properties when destructing
+ *
+ * @param {object} SyntheticEvent
+ * @param {String} propName
+ * @return {object} defineProperty object
+ */
+function getPooledWarningPropertyDefinition(propName, getVal) {
+ var isFunction = typeof getVal === 'function';
+ return {
+ configurable: true,
+ set: set,
+ get: get
+ };
+
+ function set(val) {
+ var action = isFunction ? 'setting the method' : 'setting the property';
+ warn(action, 'This is effectively a no-op');
+ return val;
+ }
+
+ function get() {
+ var action = isFunction ? 'accessing the method' : 'accessing the property';
+ var result = isFunction ? 'This is a no-op function' : 'This is set to null';
+ warn(action, result);
+ return getVal;
+ }
+
+ function warn(action, result) {
+ var warningCondition = false;
+ process.env.NODE_ENV !== 'production' ? warning(warningCondition, 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
+ }
+}
}).call(this,require('_process'))
-},{"./Object.assign":84,"./PooledClass":85,"_process":27,"fbjs/lib/emptyFunction":214,"fbjs/lib/warning":234}],167:[function(require,module,exports){
+},{"./PooledClass":91,"_process":29,"fbjs/lib/emptyFunction":211,"fbjs/lib/warning":229,"object-assign":28}],165:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -22717,7 +21811,6 @@ module.exports = SyntheticEvent;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticFocusEvent
- * @typechecks static-only
*/
'use strict';
@@ -22739,15 +21832,15 @@ var FocusEventInterface = {
* @extends {SyntheticUIEvent}
*/
function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+ return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
module.exports = SyntheticFocusEvent;
-},{"./SyntheticUIEvent":172}],168:[function(require,module,exports){
+},{"./SyntheticUIEvent":171}],166:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -22755,7 +21848,6 @@ module.exports = SyntheticFocusEvent;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticInputEvent
- * @typechecks static-only
*/
'use strict';
@@ -22778,15 +21870,15 @@ var InputEventInterface = {
* @extends {SyntheticUIEvent}
*/
function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+ return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
module.exports = SyntheticInputEvent;
-},{"./SyntheticEvent":166}],169:[function(require,module,exports){
+},{"./SyntheticEvent":164}],167:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -22794,7 +21886,6 @@ module.exports = SyntheticInputEvent;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticKeyboardEvent
- * @typechecks static-only
*/
'use strict';
@@ -22864,15 +21955,15 @@ var KeyboardEventInterface = {
* @extends {SyntheticUIEvent}
*/
function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+ return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
module.exports = SyntheticKeyboardEvent;
-},{"./SyntheticUIEvent":172,"./getEventCharCode":186,"./getEventKey":187,"./getEventModifierState":188}],170:[function(require,module,exports){
+},{"./SyntheticUIEvent":171,"./getEventCharCode":184,"./getEventKey":185,"./getEventModifierState":186}],168:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -22880,7 +21971,6 @@ module.exports = SyntheticKeyboardEvent;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticMouseEvent
- * @typechecks static-only
*/
'use strict';
@@ -22938,15 +22028,15 @@ var MouseEventInterface = {
* @extends {SyntheticUIEvent}
*/
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+ return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
module.exports = SyntheticMouseEvent;
-},{"./SyntheticUIEvent":172,"./ViewportMetrics":175,"./getEventModifierState":188}],171:[function(require,module,exports){
+},{"./SyntheticUIEvent":171,"./ViewportMetrics":174,"./getEventModifierState":186}],169:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -22954,7 +22044,6 @@ module.exports = SyntheticMouseEvent;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticTouchEvent
- * @typechecks static-only
*/
'use strict';
@@ -22985,15 +22074,55 @@ var TouchEventInterface = {
* @extends {SyntheticUIEvent}
*/
function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+ return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
module.exports = SyntheticTouchEvent;
-},{"./SyntheticUIEvent":172,"./getEventModifierState":188}],172:[function(require,module,exports){
+},{"./SyntheticUIEvent":171,"./getEventModifierState":186}],170:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule SyntheticTransitionEvent
+ */
+
+'use strict';
+
+var SyntheticEvent = require('./SyntheticEvent');
+
+/**
+ * @interface Event
+ * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
+ */
+var TransitionEventInterface = {
+ propertyName: null,
+ elapsedTime: null,
+ pseudoElement: null
+};
+
+/**
+ * @param {object} dispatchConfig Configuration used to dispatch this event.
+ * @param {string} dispatchMarker Marker identifying the event target.
+ * @param {object} nativeEvent Native browser event.
+ * @extends {SyntheticEvent}
+ */
+function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+}
+
+SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface);
+
+module.exports = SyntheticTransitionEvent;
+},{"./SyntheticEvent":164}],171:[function(require,module,exports){
+/**
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23001,7 +22130,6 @@ module.exports = SyntheticTouchEvent;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticUIEvent
- * @typechecks static-only
*/
'use strict';
@@ -23046,15 +22174,15 @@ var UIEventInterface = {
* @extends {SyntheticEvent}
*/
function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+ return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
module.exports = SyntheticUIEvent;
-},{"./SyntheticEvent":166,"./getEventTarget":189}],173:[function(require,module,exports){
+},{"./SyntheticEvent":164,"./getEventTarget":187}],172:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23062,7 +22190,6 @@ module.exports = SyntheticUIEvent;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticWheelEvent
- * @typechecks static-only
*/
'use strict';
@@ -23102,16 +22229,16 @@ var WheelEventInterface = {
* @extends {SyntheticMouseEvent}
*/
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+ return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
module.exports = SyntheticWheelEvent;
-},{"./SyntheticMouseEvent":170}],174:[function(require,module,exports){
+},{"./SyntheticMouseEvent":168}],173:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23234,7 +22361,7 @@ var Mixin = {
* @return {*} Return value from `method`.
*/
perform: function (method, scope, a, b, c, d, e, f) {
- !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
+ !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : void 0;
var errorThrown;
var ret;
try {
@@ -23298,7 +22425,7 @@ var Mixin = {
* invoked).
*/
closeAll: function (startIndex) {
- !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
+ !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : void 0;
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
@@ -23343,9 +22470,9 @@ var Transaction = {
module.exports = Transaction;
}).call(this,require('_process'))
-},{"_process":27,"fbjs/lib/invariant":222}],175:[function(require,module,exports){
+},{"_process":29,"fbjs/lib/invariant":219}],174:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23371,10 +22498,10 @@ var ViewportMetrics = {
};
module.exports = ViewportMetrics;
-},{}],176:[function(require,module,exports){
+},{}],175:[function(require,module,exports){
(function (process){
/**
- * Copyright 2014-2015, Facebook, Inc.
+ * Copyright 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23403,7 +22530,7 @@ var invariant = require('fbjs/lib/invariant');
*/
function accumulateInto(current, next) {
- !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
+ !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : void 0;
if (current == null) {
return next;
}
@@ -23434,9 +22561,9 @@ function accumulateInto(current, next) {
module.exports = accumulateInto;
}).call(this,require('_process'))
-},{"_process":27,"fbjs/lib/invariant":222}],177:[function(require,module,exports){
+},{"_process":29,"fbjs/lib/invariant":219}],176:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23462,7 +22589,8 @@ function adler32(data) {
var l = data.length;
var m = l & ~0x3;
while (i < m) {
- for (; i < Math.min(i + 4096, m); i += 4) {
+ var n = Math.min(i + 4096, m);
+ for (; i < n; i += 4) {
b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
}
a %= MOD;
@@ -23477,10 +22605,10 @@ function adler32(data) {
}
module.exports = adler32;
-},{}],178:[function(require,module,exports){
+},{}],177:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23505,67 +22633,43 @@ if (process.env.NODE_ENV !== 'production') {
module.exports = canDefineProperty;
}).call(this,require('_process'))
-},{"_process":27}],179:[function(require,module,exports){
-(function (process){
+},{"_process":29}],178:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @typechecks static-only
- * @providesModule cloneWithProps
+ * @providesModule createMicrosoftUnsafeLocalFunction
*/
-'use strict';
-
-var ReactElement = require('./ReactElement');
-var ReactPropTransferer = require('./ReactPropTransferer');
-
-var keyOf = require('fbjs/lib/keyOf');
-var warning = require('fbjs/lib/warning');
-
-var CHILDREN_PROP = keyOf({ children: null });
+/* globals MSApp */
-var didDeprecatedWarn = false;
+'use strict';
/**
- * Sometimes you want to change the props of a child passed to you. Usually
- * this is to add a CSS class.
- *
- * @param {ReactElement} child child element you'd like to clone
- * @param {object} props props you'd like to modify. className and style will be
- * merged automatically.
- * @return {ReactElement} a clone of child with props merged in.
- * @deprecated
+ * Create a function which has 'unsafe' privileges (required by windows8 apps)
*/
-function cloneWithProps(child, props) {
- if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(didDeprecatedWarn, 'cloneWithProps(...) is deprecated. ' + 'Please use React.cloneElement instead.') : undefined;
- didDeprecatedWarn = true;
- process.env.NODE_ENV !== 'production' ? warning(!child.ref, 'You are calling cloneWithProps() on a child with a ref. This is ' + 'dangerous because you\'re creating a new child which will not be ' + 'added as a ref to its parent.') : undefined;
- }
- var newProps = ReactPropTransferer.mergeProps(props, child.props);
-
- // Use `child.props.children` if it is provided.
- if (!newProps.hasOwnProperty(CHILDREN_PROP) && child.props.hasOwnProperty(CHILDREN_PROP)) {
- newProps.children = child.props.children;
+var createMicrosoftUnsafeLocalFunction = function (func) {
+ if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
+ return function (arg0, arg1, arg2, arg3) {
+ MSApp.execUnsafeLocalFunction(function () {
+ return func(arg0, arg1, arg2, arg3);
+ });
+ };
+ } else {
+ return func;
}
+};
- // The current API doesn't retain _owner, which is why this
- // doesn't use ReactElement.cloneAndReplaceProps.
- return ReactElement.createElement(child.type, newProps);
-}
-
-module.exports = cloneWithProps;
-}).call(this,require('_process'))
-
-},{"./ReactElement":117,"./ReactPropTransferer":139,"_process":27,"fbjs/lib/keyOf":227,"fbjs/lib/warning":234}],180:[function(require,module,exports){
+module.exports = createMicrosoftUnsafeLocalFunction;
+},{}],179:[function(require,module,exports){
+(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23573,14 +22677,15 @@ module.exports = cloneWithProps;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule dangerousStyleValue
- * @typechecks static-only
*/
'use strict';
var CSSProperty = require('./CSSProperty');
+var warning = require('fbjs/lib/warning');
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
+var styleWarnings = {};
/**
* Convert a value into the proper css writable value. The style name `name`
@@ -23589,9 +22694,10 @@ var isUnitlessNumber = CSSProperty.isUnitlessNumber;
*
* @param {string} name CSS property name such as `topMargin`.
* @param {*} value CSS property value such as `10px`.
+ * @param {ReactDOMComponent} component
* @return {string} Normalized style value with dimensions applied.
*/
-function dangerousStyleValue(name, value) {
+function dangerousStyleValue(name, value, component) {
// Note that we've removed escapeTextForBrowser() calls here since the
// whole string will be escaped when the attribute is injected into
// the markup. If you provide unsafe user data here they can inject
@@ -23613,67 +22719,37 @@ function dangerousStyleValue(name, value) {
}
if (typeof value === 'string') {
+ if (process.env.NODE_ENV !== 'production') {
+ if (component) {
+ var owner = component._currentElement._owner;
+ var ownerName = owner ? owner.getName() : null;
+ if (ownerName && !styleWarnings[ownerName]) {
+ styleWarnings[ownerName] = {};
+ }
+ var warned = false;
+ if (ownerName) {
+ var warnings = styleWarnings[ownerName];
+ warned = warnings[name];
+ if (!warned) {
+ warnings[name] = true;
+ }
+ }
+ if (!warned) {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0;
+ }
+ }
+ }
value = value.trim();
}
return value + 'px';
}
module.exports = dangerousStyleValue;
-},{"./CSSProperty":64}],181:[function(require,module,exports){
-(function (process){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule deprecated
- */
-
-'use strict';
-
-var assign = require('./Object.assign');
-var warning = require('fbjs/lib/warning');
-
-/**
- * This will log a single deprecation notice per function and forward the call
- * on to the new API.
- *
- * @param {string} fnName The name of the function
- * @param {string} newModule The module that fn will exist in
- * @param {string} newPackage The module that fn will exist in
- * @param {*} ctx The context this forwarded call should run in
- * @param {function} fn The function to forward on to
- * @return {function} The function that will warn once and then call fn
- */
-function deprecated(fnName, newModule, newPackage, ctx, fn) {
- var warned = false;
- if (process.env.NODE_ENV !== 'production') {
- var newFn = function () {
- process.env.NODE_ENV !== 'production' ? warning(warned,
- // Require examples in this string must be split to prevent React's
- // build tools from mistaking them for real requires.
- // Otherwise the build tools will attempt to build a '%s' module.
- 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
- warned = true;
- return fn.apply(ctx, arguments);
- };
- // We need to make sure all properties of the original fn are copied over.
- // In particular, this is needed to support PropTypes
- return assign(newFn, fn);
- }
-
- return fn;
-}
-
-module.exports = deprecated;
}).call(this,require('_process'))
-},{"./Object.assign":84,"_process":27,"fbjs/lib/warning":234}],182:[function(require,module,exports){
+},{"./CSSProperty":69,"_process":29,"fbjs/lib/warning":229}],180:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23710,10 +22786,10 @@ function escapeTextContentForBrowser(text) {
}
module.exports = escapeTextContentForBrowser;
-},{}],183:[function(require,module,exports){
+},{}],181:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23721,15 +22797,15 @@ module.exports = escapeTextContentForBrowser;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule findDOMNode
- * @typechecks static-only
*/
'use strict';
var ReactCurrentOwner = require('./ReactCurrentOwner');
+var ReactDOMComponentTree = require('./ReactDOMComponentTree');
var ReactInstanceMap = require('./ReactInstanceMap');
-var ReactMount = require('./ReactMount');
+var getNativeComponentFromComposite = require('./getNativeComponentFromComposite');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
@@ -23743,7 +22819,7 @@ function findDOMNode(componentOrElement) {
if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
- process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
owner._warnedAboutRefsInRender = true;
}
}
@@ -23753,20 +22829,27 @@ function findDOMNode(componentOrElement) {
if (componentOrElement.nodeType === 1) {
return componentOrElement;
}
- if (ReactInstanceMap.has(componentOrElement)) {
- return ReactMount.getNodeFromInstance(componentOrElement);
+
+ var inst = ReactInstanceMap.get(componentOrElement);
+ if (inst) {
+ inst = getNativeComponentFromComposite(inst);
+ return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
+ }
+
+ if (typeof componentOrElement.render === 'function') {
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : void 0;
+ } else {
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : void 0;
}
- !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
}
module.exports = findDOMNode;
}).call(this,require('_process'))
-},{"./ReactCurrentOwner":99,"./ReactInstanceMap":128,"./ReactMount":132,"_process":27,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],184:[function(require,module,exports){
+},{"./ReactCurrentOwner":101,"./ReactDOMComponentTree":106,"./ReactInstanceMap":136,"./getNativeComponentFromComposite":189,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],182:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23778,6 +22861,7 @@ module.exports = findDOMNode;
'use strict';
+var KeyEscapeUtils = require('./KeyEscapeUtils');
var traverseAllChildren = require('./traverseAllChildren');
var warning = require('fbjs/lib/warning');
@@ -23791,7 +22875,7 @@ function flattenSingleChildIntoContext(traverseContext, child, name) {
var result = traverseContext;
var keyUnique = result[name] === undefined;
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', KeyEscapeUtils.unescape(name)) : void 0;
}
if (keyUnique && child != null) {
result[name] = child;
@@ -23815,9 +22899,9 @@ function flattenChildren(children) {
module.exports = flattenChildren;
}).call(this,require('_process'))
-},{"./traverseAllChildren":203,"_process":27,"fbjs/lib/warning":234}],185:[function(require,module,exports){
+},{"./KeyEscapeUtils":89,"./traverseAllChildren":202,"_process":29,"fbjs/lib/warning":229}],183:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23836,6 +22920,7 @@ module.exports = flattenChildren;
* handling the case when there is exactly one item (and we do not need to
* allocate an array).
*/
+
var forEachAccumulated = function (arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
@@ -23845,9 +22930,9 @@ var forEachAccumulated = function (arr, cb, scope) {
};
module.exports = forEachAccumulated;
-},{}],186:[function(require,module,exports){
+},{}],184:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23855,7 +22940,6 @@ module.exports = forEachAccumulated;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventCharCode
- * @typechecks static-only
*/
'use strict';
@@ -23870,6 +22954,7 @@ module.exports = forEachAccumulated;
* @param {object} nativeEvent Native browser event.
* @return {number} Normalized `charCode` property.
*/
+
function getEventCharCode(nativeEvent) {
var charCode;
var keyCode = nativeEvent.keyCode;
@@ -23896,9 +22981,9 @@ function getEventCharCode(nativeEvent) {
}
module.exports = getEventCharCode;
-},{}],187:[function(require,module,exports){
+},{}],185:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -23906,7 +22991,6 @@ module.exports = getEventCharCode;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventKey
- * @typechecks static-only
*/
'use strict';
@@ -24000,9 +23084,9 @@ function getEventKey(nativeEvent) {
}
module.exports = getEventKey;
-},{"./getEventCharCode":186}],188:[function(require,module,exports){
+},{"./getEventCharCode":184}],186:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24010,7 +23094,6 @@ module.exports = getEventKey;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventModifierState
- * @typechecks static-only
*/
'use strict';
@@ -24045,9 +23128,9 @@ function getEventModifierState(nativeEvent) {
}
module.exports = getEventModifierState;
-},{}],189:[function(require,module,exports){
+},{}],187:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24055,7 +23138,6 @@ module.exports = getEventModifierState;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventTarget
- * @typechecks static-only
*/
'use strict';
@@ -24067,17 +23149,24 @@ module.exports = getEventModifierState;
* @param {object} nativeEvent Native browser event.
* @return {DOMEventTarget} Target node.
*/
+
function getEventTarget(nativeEvent) {
var target = nativeEvent.target || nativeEvent.srcElement || window;
+
+ // Normalize SVG <use> element events #4963
+ if (target.correspondingUseElement) {
+ target = target.correspondingUseElement;
+ }
+
// Safari may fire events on text nodes (Node.TEXT_NODE is 3).
// @see http://www.quirksmode.org/js/events_properties.html
return target.nodeType === 3 ? target.parentNode : target;
}
module.exports = getEventTarget;
-},{}],190:[function(require,module,exports){
+},{}],188:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24085,12 +23174,12 @@ module.exports = getEventTarget;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getIteratorFn
- * @typechecks static-only
*/
'use strict';
/* global Symbol */
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
@@ -24116,9 +23205,40 @@ function getIteratorFn(maybeIterable) {
}
module.exports = getIteratorFn;
-},{}],191:[function(require,module,exports){
+},{}],189:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule getNativeComponentFromComposite
+ */
+
+'use strict';
+
+var ReactNodeTypes = require('./ReactNodeTypes');
+
+function getNativeComponentFromComposite(inst) {
+ var type;
+
+ while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) {
+ inst = inst._renderedComponent;
+ }
+
+ if (type === ReactNodeTypes.NATIVE) {
+ return inst._renderedComponent;
+ } else if (type === ReactNodeTypes.EMPTY) {
+ return null;
+ }
+}
+
+module.exports = getNativeComponentFromComposite;
+},{"./ReactNodeTypes":144}],190:[function(require,module,exports){
+/**
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24136,6 +23256,7 @@ module.exports = getIteratorFn;
* @param {DOMElement|DOMTextNode} node
* @return {DOMElement|DOMTextNode}
*/
+
function getLeafNode(node) {
while (node && node.firstChild) {
node = node.firstChild;
@@ -24190,9 +23311,9 @@ function getNodeForCharacterOffset(root, offset) {
}
module.exports = getNodeForCharacterOffset;
-},{}],192:[function(require,module,exports){
+},{}],191:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24224,10 +23345,112 @@ function getTextContentAccessor() {
}
module.exports = getTextContentAccessor;
-},{"fbjs/lib/ExecutionEnvironment":208}],193:[function(require,module,exports){
+},{"fbjs/lib/ExecutionEnvironment":205}],192:[function(require,module,exports){
+/**
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule getVendorPrefixedEventName
+ */
+
+'use strict';
+
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
+
+/**
+ * Generate a mapping of standard vendor prefixes using the defined style property and event name.
+ *
+ * @param {string} styleProp
+ * @param {string} eventName
+ * @returns {object}
+ */
+function makePrefixMap(styleProp, eventName) {
+ var prefixes = {};
+
+ prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
+ prefixes['Webkit' + styleProp] = 'webkit' + eventName;
+ prefixes['Moz' + styleProp] = 'moz' + eventName;
+ prefixes['ms' + styleProp] = 'MS' + eventName;
+ prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
+
+ return prefixes;
+}
+
+/**
+ * A list of event names to a configurable list of vendor prefixes.
+ */
+var vendorPrefixes = {
+ animationend: makePrefixMap('Animation', 'AnimationEnd'),
+ animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
+ animationstart: makePrefixMap('Animation', 'AnimationStart'),
+ transitionend: makePrefixMap('Transition', 'TransitionEnd')
+};
+
+/**
+ * Event names that have already been detected and prefixed (if applicable).
+ */
+var prefixedEventNames = {};
+
+/**
+ * Element to check for prefixes on.
+ */
+var style = {};
+
+/**
+ * Bootstrap if a DOM exists.
+ */
+if (ExecutionEnvironment.canUseDOM) {
+ style = document.createElement('div').style;
+
+ // On some platforms, in particular some releases of Android 4.x,
+ // the un-prefixed "animation" and "transition" properties are defined on the
+ // style object but the events that fire will still be prefixed, so we need
+ // to check if the un-prefixed events are usable, and if not remove them from the map.
+ if (!('AnimationEvent' in window)) {
+ delete vendorPrefixes.animationend.animation;
+ delete vendorPrefixes.animationiteration.animation;
+ delete vendorPrefixes.animationstart.animation;
+ }
+
+ // Same as above
+ if (!('TransitionEvent' in window)) {
+ delete vendorPrefixes.transitionend.transition;
+ }
+}
+
+/**
+ * Attempts to determine the correct vendor prefixed event name.
+ *
+ * @param {string} eventName
+ * @returns {string}
+ */
+function getVendorPrefixedEventName(eventName) {
+ if (prefixedEventNames[eventName]) {
+ return prefixedEventNames[eventName];
+ } else if (!vendorPrefixes[eventName]) {
+ return eventName;
+ }
+
+ var prefixMap = vendorPrefixes[eventName];
+
+ for (var styleProp in prefixMap) {
+ if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
+ return prefixedEventNames[eventName] = prefixMap[styleProp];
+ }
+ }
+
+ return '';
+}
+
+module.exports = getVendorPrefixedEventName;
+},{"fbjs/lib/ExecutionEnvironment":205}],193:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24235,22 +23458,24 @@ module.exports = getTextContentAccessor;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule instantiateReactComponent
- * @typechecks static-only
*/
'use strict';
+var _assign = require('object-assign');
+
var ReactCompositeComponent = require('./ReactCompositeComponent');
var ReactEmptyComponent = require('./ReactEmptyComponent');
var ReactNativeComponent = require('./ReactNativeComponent');
-var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
// To avoid a cyclic dependency, we create the final class in this module
-var ReactCompositeComponentWrapper = function () {};
-assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
+var ReactCompositeComponentWrapper = function (element) {
+ this.construct(element);
+};
+_assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
_instantiateReactComponent: instantiateReactComponent
});
@@ -24286,10 +23511,10 @@ function instantiateReactComponent(node) {
var instance;
if (node === null || node === false) {
- instance = new ReactEmptyComponent(instantiateReactComponent);
+ instance = ReactEmptyComponent.create(instantiateReactComponent);
} else if (typeof node === 'object') {
var element = node;
- !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;
+ !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : void 0;
// Special case string values
if (typeof element.type === 'string') {
@@ -24300,21 +23525,18 @@ function instantiateReactComponent(node) {
// representation, we can drop this code path.
instance = new element.type(element);
} else {
- instance = new ReactCompositeComponentWrapper();
+ instance = new ReactCompositeComponentWrapper(element);
}
} else if (typeof node === 'string' || typeof node === 'number') {
instance = ReactNativeComponent.createInstanceForText(node);
} else {
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : void 0;
}
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getNativeNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0;
}
- // Sets up the instance. This can probably just move into the constructor now.
- instance.construct(node);
-
// These two fields are used by the DOM and ART diffing algorithms
// respectively. Instead of using expandos on components, we should be
// storing the state needed by the diffing algorithms elsewhere.
@@ -24340,9 +23562,9 @@ function instantiateReactComponent(node) {
module.exports = instantiateReactComponent;
}).call(this,require('_process'))
-},{"./Object.assign":84,"./ReactCompositeComponent":98,"./ReactEmptyComponent":119,"./ReactNativeComponent":135,"_process":27,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],194:[function(require,module,exports){
+},{"./ReactCompositeComponent":100,"./ReactEmptyComponent":129,"./ReactNativeComponent":143,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229,"object-assign":28}],194:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24384,7 +23606,7 @@ function isEventSupported(eventNameSuffix, capture) {
}
var eventName = 'on' + eventNameSuffix;
- var isSupported = (eventName in document);
+ var isSupported = eventName in document;
if (!isSupported) {
var element = document.createElement('div');
@@ -24401,9 +23623,9 @@ function isEventSupported(eventNameSuffix, capture) {
}
module.exports = isEventSupported;
-},{"fbjs/lib/ExecutionEnvironment":208}],195:[function(require,module,exports){
+},{"fbjs/lib/ExecutionEnvironment":205}],195:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24418,6 +23640,7 @@ module.exports = isEventSupported;
/**
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
*/
+
var supportedInputTypes = {
'color': true,
'date': true,
@@ -24445,7 +23668,7 @@ module.exports = isTextInputElement;
},{}],196:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24468,20 +23691,20 @@ var invariant = require('fbjs/lib/invariant');
* of children.
*
* @param {?object} children Child collection structure.
- * @return {ReactComponent} The first and only `ReactComponent` contained in the
+ * @return {ReactElement} The first and only `ReactElement` contained in the
* structure.
*/
function onlyChild(children) {
- !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
+ !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : void 0;
return children;
}
module.exports = onlyChild;
}).call(this,require('_process'))
-},{"./ReactElement":117,"_process":27,"fbjs/lib/invariant":222}],197:[function(require,module,exports){
+},{"./ReactElement":127,"_process":29,"fbjs/lib/invariant":219}],197:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24506,9 +23729,9 @@ function quoteAttributeValueForBrowser(value) {
}
module.exports = quoteAttributeValueForBrowser;
-},{"./escapeTextContentForBrowser":182}],198:[function(require,module,exports){
+},{"./escapeTextContentForBrowser":180}],198:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24523,9 +23746,9 @@ module.exports = quoteAttributeValueForBrowser;
var ReactMount = require('./ReactMount');
module.exports = ReactMount.renderSubtreeIntoContainer;
-},{"./ReactMount":132}],199:[function(require,module,exports){
+},{"./ReactMount":140}],199:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24535,8 +23758,6 @@ module.exports = ReactMount.renderSubtreeIntoContainer;
* @providesModule setInnerHTML
*/
-/* globals MSApp */
-
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
@@ -24544,6 +23765,8 @@ var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
+var createMicrosoftUnsafeLocalFunction = require('./createMicrosoftUnsafeLocalFunction');
+
/**
* Set the innerHTML property of a node, ensuring that whitespace is preserved
* even in IE8.
@@ -24552,18 +23775,9 @@ var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
* @param {string} html
* @internal
*/
-var setInnerHTML = function (node, html) {
+var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
node.innerHTML = html;
-};
-
-// Win8 apps: Allow all html to be inserted
-if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
- setInnerHTML = function (node, html) {
- MSApp.execUnsafeLocalFunction(function () {
- node.innerHTML = html;
- });
- };
-}
+});
if (ExecutionEnvironment.canUseDOM) {
// IE8: When updating a just created node with innerHTML only leading
@@ -24611,12 +23825,13 @@ if (ExecutionEnvironment.canUseDOM) {
}
};
}
+ testElement = null;
}
module.exports = setInnerHTML;
-},{"fbjs/lib/ExecutionEnvironment":208}],200:[function(require,module,exports){
+},{"./createMicrosoftUnsafeLocalFunction":178,"fbjs/lib/ExecutionEnvironment":205}],200:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24655,34 +23870,9 @@ if (ExecutionEnvironment.canUseDOM) {
}
module.exports = setTextContent;
-},{"./escapeTextContentForBrowser":182,"./setInnerHTML":199,"fbjs/lib/ExecutionEnvironment":208}],201:[function(require,module,exports){
+},{"./escapeTextContentForBrowser":180,"./setInnerHTML":199,"fbjs/lib/ExecutionEnvironment":205}],201:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
-* @providesModule shallowCompare
-*/
-
-'use strict';
-
-var shallowEqual = require('fbjs/lib/shallowEqual');
-
-/**
- * Does a shallow comparison for props and state.
- * See ReactComponentWithPureRenderMixin
- */
-function shallowCompare(instance, nextProps, nextState) {
- return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
-}
-
-module.exports = shallowCompare;
-},{"fbjs/lib/shallowEqual":232}],202:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24690,7 +23880,6 @@ module.exports = shallowCompare;
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule shouldUpdateReactComponent
- * @typechecks static-only
*/
'use strict';
@@ -24706,6 +23895,7 @@ module.exports = shallowCompare;
* @return {boolean} True if the existing instance should be updated.
* @protected
*/
+
function shouldUpdateReactComponent(prevElement, nextElement) {
var prevEmpty = prevElement === null || prevElement === false;
var nextEmpty = nextElement === null || nextElement === false;
@@ -24720,14 +23910,13 @@ function shouldUpdateReactComponent(prevElement, nextElement) {
} else {
return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
}
- return false;
}
module.exports = shouldUpdateReactComponent;
-},{}],203:[function(require,module,exports){
+},{}],202:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -24741,13 +23930,13 @@ module.exports = shouldUpdateReactComponent;
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactElement = require('./ReactElement');
-var ReactInstanceHandles = require('./ReactInstanceHandles');
var getIteratorFn = require('./getIteratorFn');
var invariant = require('fbjs/lib/invariant');
+var KeyEscapeUtils = require('./KeyEscapeUtils');
var warning = require('fbjs/lib/warning');
-var SEPARATOR = ReactInstanceHandles.SEPARATOR;
+var SEPARATOR = '.';
var SUBSEPARATOR = ':';
/**
@@ -24755,20 +23944,8 @@ var SUBSEPARATOR = ':';
* pattern.
*/
-var userProvidedKeyEscaperLookup = {
- '=': '=0',
- '.': '=1',
- ':': '=2'
-};
-
-var userProvidedKeyEscapeRegex = /[=.:]/g;
-
var didWarnAboutMaps = false;
-function userProvidedKeyEscaper(match) {
- return userProvidedKeyEscaperLookup[match];
-}
-
/**
* Generate a key string that identifies a component within a set.
*
@@ -24777,36 +23954,17 @@ function userProvidedKeyEscaper(match) {
* @return {string}
*/
function getComponentKey(component, index) {
- if (component && component.key != null) {
+ // Do some typechecking here since we call this blindly. We want to ensure
+ // that we don't block potential future ES APIs.
+ if (component && typeof component === 'object' && component.key != null) {
// Explicit key
- return wrapUserProvidedKey(component.key);
+ return KeyEscapeUtils.escape(component.key);
}
// Implicit key determined by the index in the set
return index.toString(36);
}
/**
- * Escape a component key so that it is safe to use in a reactid.
- *
- * @param {*} text Component key to be escaped.
- * @return {string} An escaped string.
- */
-function escapeUserProvidedKey(text) {
- return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper);
-}
-
-/**
- * Wrap a `key` value explicitly provided by the user to distinguish it from
- * implicitly-generated keys generated by a component's index in its parent.
- *
- * @param {string} key Value of a user-provided `key` attribute
- * @return {string}
- */
-function wrapUserProvidedKey(key) {
- return '$' + escapeUserProvidedKey(key);
-}
-
-/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
* @param {!function} callback Callback to invoke with each child found.
@@ -24855,7 +24013,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
}
} else {
if (process.env.NODE_ENV !== 'production') {
- process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : void 0;
didWarnAboutMaps = true;
}
// Iterator will provide entry [k,v] tuples rather than values.
@@ -24863,7 +24021,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
var entry = step.value;
if (entry) {
child = entry[1];
- nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
+ nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
}
@@ -24883,7 +24041,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
}
}
var childrenString = String(children);
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : void 0;
}
}
@@ -24917,121 +24075,10 @@ function traverseAllChildren(children, callback, traverseContext) {
module.exports = traverseAllChildren;
}).call(this,require('_process'))
-},{"./ReactCurrentOwner":99,"./ReactElement":117,"./ReactInstanceHandles":127,"./getIteratorFn":190,"_process":27,"fbjs/lib/invariant":222,"fbjs/lib/warning":234}],204:[function(require,module,exports){
+},{"./KeyEscapeUtils":89,"./ReactCurrentOwner":101,"./ReactElement":127,"./getIteratorFn":188,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],203:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule update
- */
-
-/* global hasOwnProperty:true */
-
-'use strict';
-
-var assign = require('./Object.assign');
-var keyOf = require('fbjs/lib/keyOf');
-var invariant = require('fbjs/lib/invariant');
-var hasOwnProperty = ({}).hasOwnProperty;
-
-function shallowCopy(x) {
- if (Array.isArray(x)) {
- return x.concat();
- } else if (x && typeof x === 'object') {
- return assign(new x.constructor(), x);
- } else {
- return x;
- }
-}
-
-var COMMAND_PUSH = keyOf({ $push: null });
-var COMMAND_UNSHIFT = keyOf({ $unshift: null });
-var COMMAND_SPLICE = keyOf({ $splice: null });
-var COMMAND_SET = keyOf({ $set: null });
-var COMMAND_MERGE = keyOf({ $merge: null });
-var COMMAND_APPLY = keyOf({ $apply: null });
-
-var ALL_COMMANDS_LIST = [COMMAND_PUSH, COMMAND_UNSHIFT, COMMAND_SPLICE, COMMAND_SET, COMMAND_MERGE, COMMAND_APPLY];
-
-var ALL_COMMANDS_SET = {};
-
-ALL_COMMANDS_LIST.forEach(function (command) {
- ALL_COMMANDS_SET[command] = true;
-});
-
-function invariantArrayCase(value, spec, command) {
- !Array.isArray(value) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : invariant(false) : undefined;
- var specValue = spec[command];
- !Array.isArray(specValue) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array; got %s. ' + 'Did you forget to wrap your parameter in an array?', command, specValue) : invariant(false) : undefined;
-}
-
-function update(value, spec) {
- !(typeof spec === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): You provided a key path to update() that did not contain one ' + 'of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : invariant(false) : undefined;
-
- if (hasOwnProperty.call(spec, COMMAND_SET)) {
- !(Object.keys(spec).length === 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : invariant(false) : undefined;
-
- return spec[COMMAND_SET];
- }
-
- var nextValue = shallowCopy(value);
-
- if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
- var mergeObj = spec[COMMAND_MERGE];
- !(mergeObj && typeof mergeObj === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : invariant(false) : undefined;
- !(nextValue && typeof nextValue === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : invariant(false) : undefined;
- assign(nextValue, spec[COMMAND_MERGE]);
- }
-
- if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
- invariantArrayCase(value, spec, COMMAND_PUSH);
- spec[COMMAND_PUSH].forEach(function (item) {
- nextValue.push(item);
- });
- }
-
- if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
- invariantArrayCase(value, spec, COMMAND_UNSHIFT);
- spec[COMMAND_UNSHIFT].forEach(function (item) {
- nextValue.unshift(item);
- });
- }
-
- if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
- !Array.isArray(value) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : invariant(false) : undefined;
- !Array.isArray(spec[COMMAND_SPLICE]) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
- spec[COMMAND_SPLICE].forEach(function (args) {
- !Array.isArray(args) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
- nextValue.splice.apply(nextValue, args);
- });
- }
-
- if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
- !(typeof spec[COMMAND_APPLY] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : invariant(false) : undefined;
- nextValue = spec[COMMAND_APPLY](nextValue);
- }
-
- for (var k in spec) {
- if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) {
- nextValue[k] = update(value[k], spec[k]);
- }
- }
-
- return nextValue;
-}
-
-module.exports = update;
-}).call(this,require('_process'))
-
-},{"./Object.assign":84,"_process":27,"fbjs/lib/invariant":222,"fbjs/lib/keyOf":227}],205:[function(require,module,exports){
-(function (process){
-/**
- * Copyright 2015, Facebook, Inc.
+ * Copyright 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
@@ -25043,7 +24090,8 @@ module.exports = update;
'use strict';
-var assign = require('./Object.assign');
+var _assign = require('object-assign');
+
var emptyFunction = require('fbjs/lib/emptyFunction');
var warning = require('fbjs/lib/warning');
@@ -25079,7 +24127,7 @@ if (process.env.NODE_ENV !== 'production') {
var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
var emptyAncestorInfo = {
- parentTag: null,
+ current: null,
formTag: null,
aTagInScope: null,
@@ -25092,7 +24140,7 @@ if (process.env.NODE_ENV !== 'production') {
};
var updatedAncestorInfo = function (oldInfo, tag, instance) {
- var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
+ var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
var info = { tag: tag, instance: instance };
if (inScopeTags.indexOf(tag) !== -1) {
@@ -25111,7 +24159,7 @@ if (process.env.NODE_ENV !== 'production') {
ancestorInfo.dlItemTagAutoclosing = null;
}
- ancestorInfo.parentTag = info;
+ ancestorInfo.current = info;
if (tag === 'form') {
ancestorInfo.formTag = info;
@@ -25184,6 +24232,8 @@ if (process.env.NODE_ENV !== 'production') {
// https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
case 'html':
return tag === 'head' || tag === 'body';
+ case '#document':
+ return tag === 'html';
}
// Probably in the "in body" parsing mode, so we outlaw only tag combos
@@ -25202,11 +24252,13 @@ if (process.env.NODE_ENV !== 'production') {
case 'rt':
return impliedEndTags.indexOf(parentTag) === -1;
+ case 'body':
case 'caption':
case 'col':
case 'colgroup':
case 'frame':
case 'head':
+ case 'html':
case 'tbody':
case 'td':
case 'tfoot':
@@ -25305,9 +24357,7 @@ if (process.env.NODE_ENV !== 'production') {
}
var stack = [];
- /*eslint-disable space-after-keywords */
do {
- /*eslint-enable space-after-keywords */
stack.push(instance);
} while (instance = instance._currentElement._owner);
stack.reverse();
@@ -25318,7 +24368,7 @@ if (process.env.NODE_ENV !== 'production') {
validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
ancestorInfo = ancestorInfo || emptyAncestorInfo;
- var parentInfo = ancestorInfo.parentTag;
+ var parentInfo = ancestorInfo.current;
var parentTag = parentInfo && parentInfo.tag;
var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
@@ -25367,26 +24417,29 @@ if (process.env.NODE_ENV !== 'production') {
}
didWarn[warnKey] = true;
+ var tagDisplayName = childTag;
+ if (childTag !== '#text') {
+ tagDisplayName = '<' + childTag + '>';
+ }
+
if (invalidParent) {
var info = '';
if (ancestorTag === 'table' && childTag === 'tr') {
info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
}
- process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>. ' + 'See %s.%s', tagDisplayName, ancestorTag, ownerInfo, info) : void 0;
} else {
- process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0;
}
}
};
- validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2);
-
validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
// For testing
validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
ancestorInfo = ancestorInfo || emptyAncestorInfo;
- var parentInfo = ancestorInfo.parentTag;
+ var parentInfo = ancestorInfo.current;
var parentTag = parentInfo && parentInfo.tag;
return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
};
@@ -25395,111 +24448,12 @@ if (process.env.NODE_ENV !== 'production') {
module.exports = validateDOMNesting;
}).call(this,require('_process'))
-},{"./Object.assign":84,"_process":27,"fbjs/lib/emptyFunction":214,"fbjs/lib/warning":234}],206:[function(require,module,exports){
+},{"_process":29,"fbjs/lib/emptyFunction":211,"fbjs/lib/warning":229,"object-assign":28}],204:[function(require,module,exports){
(function (process){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule CSSCore
- * @typechecks
- */
-
'use strict';
-var invariant = require('./invariant');
-
-/**
- * The CSSCore module specifies the API (and implements most of the methods)
- * that should be used when dealing with the display of elements (via their
- * CSS classes and visibility on screen. It is an API focused on mutating the
- * display and not reading it as no logical state should be encoded in the
- * display of elements.
- */
-
-var CSSCore = {
-
- /**
- * Adds the class passed in to the element if it doesn't already have it.
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @return {DOMElement} the element passed in
- */
- addClass: function (element, className) {
- !!/\s/.test(className) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'CSSCore.addClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : undefined;
-
- if (className) {
- if (element.classList) {
- element.classList.add(className);
- } else if (!CSSCore.hasClass(element, className)) {
- element.className = element.className + ' ' + className;
- }
- }
- return element;
- },
-
- /**
- * Removes the class passed in from the element
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @return {DOMElement} the element passed in
- */
- removeClass: function (element, className) {
- !!/\s/.test(className) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'CSSCore.removeClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : undefined;
-
- if (className) {
- if (element.classList) {
- element.classList.remove(className);
- } else if (CSSCore.hasClass(element, className)) {
- element.className = element.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ') // multiple spaces to one
- .replace(/^\s*|\s*$/g, ''); // trim the ends
- }
- }
- return element;
- },
-
- /**
- * Helper to add or remove a class from an element based on a condition.
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @param {*} bool condition to whether to add or remove the class
- * @return {DOMElement} the element passed in
- */
- conditionClass: function (element, className, bool) {
- return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
- },
-
- /**
- * Tests whether the element has the class specified.
- *
- * @param {DOMNode|DOMWindow} element the element to set the class on
- * @param {string} className the CSS className
- * @return {boolean} true if the element has the class, false if not
- */
- hasClass: function (element, className) {
- !!/\s/.test(className) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'CSS.hasClass takes only a single class name.') : invariant(false) : undefined;
- if (element.classList) {
- return !!className && element.classList.contains(className);
- }
- return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
- }
-
-};
-
-module.exports = CSSCore;
-}).call(this,require('_process'))
-
-},{"./invariant":222,"_process":27}],207:[function(require,module,exports){
-(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25513,12 +24467,9 @@ module.exports = CSSCore;
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * @providesModule EventListener
* @typechecks
*/
-'use strict';
-
var emptyFunction = require('./emptyFunction');
/**
@@ -25584,16 +24535,15 @@ var EventListener = {
module.exports = EventListener;
}).call(this,require('_process'))
-},{"./emptyFunction":214,"_process":27}],208:[function(require,module,exports){
+},{"./emptyFunction":211,"_process":29}],205:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule ExecutionEnvironment
*/
'use strict';
@@ -25621,21 +24571,20 @@ var ExecutionEnvironment = {
};
module.exports = ExecutionEnvironment;
-},{}],209:[function(require,module,exports){
+},{}],206:[function(require,module,exports){
+"use strict";
+
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule camelize
* @typechecks
*/
-"use strict";
-
var _hyphenPattern = /-(.)/g;
/**
@@ -25654,16 +24603,15 @@ function camelize(string) {
}
module.exports = camelize;
-},{}],210:[function(require,module,exports){
+},{}],207:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the 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
*/
@@ -25695,21 +24643,20 @@ function camelizeStyleName(string) {
}
module.exports = camelizeStyleName;
-},{"./camelize":209}],211:[function(require,module,exports){
+},{"./camelize":206}],208:[function(require,module,exports){
+'use strict';
+
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule containsNode
* @typechecks
*/
-'use strict';
-
var isTextNode = require('./isTextNode');
/*eslint-disable no-bitwise */
@@ -25721,52 +24668,83 @@ var isTextNode = require('./isTextNode');
* @param {?DOMNode} innerNode Inner DOM node.
* @return {boolean} True if `outerNode` contains or is `innerNode`.
*/
-function containsNode(_x, _x2) {
- var _again = true;
-
- _function: while (_again) {
- var outerNode = _x,
- innerNode = _x2;
- _again = false;
-
- if (!outerNode || !innerNode) {
- return false;
- } else if (outerNode === innerNode) {
- return true;
- } else if (isTextNode(outerNode)) {
- return false;
- } else if (isTextNode(innerNode)) {
- _x = outerNode;
- _x2 = innerNode.parentNode;
- _again = true;
- continue _function;
- } else if (outerNode.contains) {
- return outerNode.contains(innerNode);
- } else if (outerNode.compareDocumentPosition) {
- return !!(outerNode.compareDocumentPosition(innerNode) & 16);
- } else {
- return false;
- }
+function containsNode(outerNode, innerNode) {
+ if (!outerNode || !innerNode) {
+ return false;
+ } else if (outerNode === innerNode) {
+ return true;
+ } else if (isTextNode(outerNode)) {
+ return false;
+ } else if (isTextNode(innerNode)) {
+ return containsNode(outerNode, innerNode.parentNode);
+ } else if (outerNode.contains) {
+ return outerNode.contains(innerNode);
+ } else if (outerNode.compareDocumentPosition) {
+ return !!(outerNode.compareDocumentPosition(innerNode) & 16);
+ } else {
+ return false;
}
}
module.exports = containsNode;
-},{"./isTextNode":224}],212:[function(require,module,exports){
+},{"./isTextNode":221}],209:[function(require,module,exports){
+(function (process){
+'use strict';
+
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule createArrayFromMixed
* @typechecks
*/
-'use strict';
+var invariant = require('./invariant');
+
+/**
+ * Convert array-like objects to arrays.
+ *
+ * This API assumes the caller knows the contents of the data type. For less
+ * well defined inputs use createArrayFromMixed.
+ *
+ * @param {object|function|filelist} obj
+ * @return {array}
+ */
+function toArray(obj) {
+ var length = obj.length;
-var toArray = require('./toArray');
+ // Some browsers builtin objects can report typeof 'function' (e.g. NodeList
+ // in old versions of Safari).
+ !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;
+
+ !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;
+
+ !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;
+
+ !(typeof obj.callee !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0;
+
+ // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
+ // without method will throw during the slice call and skip straight to the
+ // fallback.
+ if (obj.hasOwnProperty) {
+ try {
+ return Array.prototype.slice.call(obj);
+ } catch (e) {
+ // IE < 9 does not support Array#slice on collections objects
+ }
+ }
+
+ // Fall back to copying key by key. This assumes all keys have a value,
+ // so will not preserve sparsely populated inputs.
+ var ret = Array(length);
+ for (var ii = 0; ii < length; ii++) {
+ ret[ii] = obj[ii];
+ }
+ return ret;
+}
/**
* Perform a heuristic test to determine if an object is "array-like".
@@ -25837,24 +24815,25 @@ function createArrayFromMixed(obj) {
}
module.exports = createArrayFromMixed;
-},{"./toArray":233}],213:[function(require,module,exports){
+}).call(this,require('_process'))
+
+},{"./invariant":219,"_process":29}],210:[function(require,module,exports){
(function (process){
+'use strict';
+
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule createNodesFromMarkup
* @typechecks
*/
/*eslint-disable fb-www/unsafe-html*/
-'use strict';
-
var ExecutionEnvironment = require('./ExecutionEnvironment');
var createArrayFromMixed = require('./createArrayFromMixed');
@@ -25894,7 +24873,7 @@ function getNodeName(markup) {
*/
function createNodesFromMarkup(markup, handleScript) {
var node = dummyNode;
- !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
+ !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0;
var nodeName = getNodeName(markup);
var wrap = nodeName && getMarkupWrap(nodeName);
@@ -25911,11 +24890,11 @@ function createNodesFromMarkup(markup, handleScript) {
var scripts = node.getElementsByTagName('script');
if (scripts.length) {
- !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
+ !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0;
createArrayFromMixed(scripts).forEach(handleScript);
}
- var nodes = createArrayFromMixed(node.childNodes);
+ var nodes = Array.from(node.childNodes);
while (node.lastChild) {
node.removeChild(node.lastChild);
}
@@ -25925,20 +24904,19 @@ function createNodesFromMarkup(markup, handleScript) {
module.exports = createNodesFromMarkup;
}).call(this,require('_process'))
-},{"./ExecutionEnvironment":208,"./createArrayFromMixed":212,"./getMarkupWrap":218,"./invariant":222,"_process":27}],214:[function(require,module,exports){
+},{"./ExecutionEnvironment":205,"./createArrayFromMixed":209,"./getMarkupWrap":215,"./invariant":219,"_process":29}],211:[function(require,module,exports){
+"use strict";
+
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule emptyFunction
*/
-"use strict";
-
function makeEmptyFunction(arg) {
return function () {
return arg;
@@ -25964,17 +24942,16 @@ emptyFunction.thatReturnsArgument = function (arg) {
};
module.exports = emptyFunction;
-},{}],215:[function(require,module,exports){
+},{}],212:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule emptyObject
*/
'use strict';
@@ -25988,16 +24965,15 @@ if (process.env.NODE_ENV !== 'production') {
module.exports = emptyObject;
}).call(this,require('_process'))
-},{"_process":27}],216:[function(require,module,exports){
+},{"_process":29}],213:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule focusNode
*/
'use strict';
@@ -26005,6 +24981,7 @@ module.exports = emptyObject;
/**
* @param {DOMElement} node input/textarea to focus
*/
+
function focusNode(node) {
// IE8 can throw "Can't move focus to the control because it is invisible,
// not enabled, or of a type that does not accept the focus." for all kinds of
@@ -26015,16 +24992,17 @@ function focusNode(node) {
}
module.exports = focusNode;
-},{}],217:[function(require,module,exports){
+},{}],214:[function(require,module,exports){
+'use strict';
+
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the 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
*/
@@ -26037,8 +25015,6 @@ module.exports = focusNode;
* The activeElement will be null only if the document or document body is not
* yet defined.
*/
-'use strict';
-
function getActiveElement() /*?DOMElement*/{
if (typeof document === 'undefined') {
return null;
@@ -26051,23 +25027,22 @@ function getActiveElement() /*?DOMElement*/{
}
module.exports = getActiveElement;
-},{}],218:[function(require,module,exports){
+},{}],215:[function(require,module,exports){
(function (process){
+'use strict';
+
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule getMarkupWrap
*/
/*eslint-disable fb-www/unsafe-html */
-'use strict';
-
var ExecutionEnvironment = require('./ExecutionEnvironment');
var invariant = require('./invariant');
@@ -26132,7 +25107,7 @@ svgElements.forEach(function (nodeName) {
* @return {?array} Markup wrap configuration, if applicable.
*/
function getMarkupWrap(nodeName) {
- !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined;
+ !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0;
if (!markupWrap.hasOwnProperty(nodeName)) {
nodeName = '*';
}
@@ -26150,16 +25125,15 @@ function getMarkupWrap(nodeName) {
module.exports = getMarkupWrap;
}).call(this,require('_process'))
-},{"./ExecutionEnvironment":208,"./invariant":222,"_process":27}],219:[function(require,module,exports){
+},{"./ExecutionEnvironment":205,"./invariant":219,"_process":29}],216:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the 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
*/
@@ -26175,6 +25149,7 @@ module.exports = getMarkupWrap;
* @param {DOMWindow|DOMElement} scrollable
* @return {object} Map with `x` and `y` keys.
*/
+
function getUnboundedScrollPosition(scrollable) {
if (scrollable === window) {
return {
@@ -26189,21 +25164,20 @@ function getUnboundedScrollPosition(scrollable) {
}
module.exports = getUnboundedScrollPosition;
-},{}],220:[function(require,module,exports){
+},{}],217:[function(require,module,exports){
+'use strict';
+
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule hyphenate
* @typechecks
*/
-'use strict';
-
var _uppercasePattern = /([A-Z])/g;
/**
@@ -26223,16 +25197,15 @@ function hyphenate(string) {
}
module.exports = hyphenate;
-},{}],221:[function(require,module,exports){
+},{}],218:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the 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
*/
@@ -26263,17 +25236,16 @@ function hyphenateStyleName(string) {
}
module.exports = hyphenateStyleName;
-},{"./hyphenate":220}],222:[function(require,module,exports){
+},{"./hyphenate":217}],219:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule invariant
*/
'use strict';
@@ -26317,16 +25289,17 @@ function invariant(condition, format, a, b, c, d, e, f) {
module.exports = invariant;
}).call(this,require('_process'))
-},{"_process":27}],223:[function(require,module,exports){
+},{"_process":29}],220:[function(require,module,exports){
+'use strict';
+
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the 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
*/
@@ -26334,28 +25307,25 @@ module.exports = invariant;
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM node.
*/
-'use strict';
-
function isNode(object) {
return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
}
module.exports = isNode;
-},{}],224:[function(require,module,exports){
+},{}],221:[function(require,module,exports){
+'use strict';
+
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule isTextNode
* @typechecks
*/
-'use strict';
-
var isNode = require('./isNode');
/**
@@ -26367,57 +25337,16 @@ function isTextNode(object) {
}
module.exports = isTextNode;
-},{"./isNode":223}],225:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule joinClasses
- * @typechecks static-only
- */
-
-'use strict';
-
-/**
- * Combines multiple className strings into one.
- * http://jsperf.com/joinclasses-args-vs-array
- *
- * @param {...?string} className
- * @return {string}
- */
-function joinClasses(className /*, ... */) {
- if (!className) {
- className = '';
- }
- var nextClass;
- var argLength = arguments.length;
- if (argLength > 1) {
- for (var ii = 1; ii < argLength; ii++) {
- nextClass = arguments[ii];
- if (nextClass) {
- className = (className ? className + ' ' : '') + nextClass;
- }
- }
- }
- return className;
-}
-
-module.exports = joinClasses;
-},{}],226:[function(require,module,exports){
+},{"./isNode":220}],222:[function(require,module,exports){
(function (process){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the 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
*/
@@ -26446,7 +25375,7 @@ var invariant = require('./invariant');
var keyMirror = function (obj) {
var ret = {};
var key;
- !(obj instanceof Object && !Array.isArray(obj)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
+ !(obj instanceof Object && !Array.isArray(obj)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : void 0;
for (key in obj) {
if (!obj.hasOwnProperty(key)) {
continue;
@@ -26459,16 +25388,17 @@ var keyMirror = function (obj) {
module.exports = keyMirror;
}).call(this,require('_process'))
-},{"./invariant":222,"_process":27}],227:[function(require,module,exports){
+},{"./invariant":219,"_process":29}],223:[function(require,module,exports){
+"use strict";
+
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the 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
*/
/**
@@ -26481,8 +25411,6 @@ module.exports = keyMirror;
* 'xa12' in that case. Resolve keys you want to use once at startup time, then
* reuse those resolutions.
*/
-"use strict";
-
var keyOf = function (oneKeyObj) {
var key;
for (key in oneKeyObj) {
@@ -26495,16 +25423,15 @@ var keyOf = function (oneKeyObj) {
};
module.exports = keyOf;
-},{}],228:[function(require,module,exports){
+},{}],224:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the 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';
@@ -26547,16 +25474,15 @@ function mapObject(object, callback, context) {
}
module.exports = mapObject;
-},{}],229:[function(require,module,exports){
+},{}],225:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the 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
*/
@@ -26568,6 +25494,7 @@ module.exports = mapObject;
* @param {function} callback
* @return {function}
*/
+
function memoizeStringOnly(callback) {
var cache = {};
return function (string) {
@@ -26579,16 +25506,15 @@ function memoizeStringOnly(callback) {
}
module.exports = memoizeStringOnly;
-},{}],230:[function(require,module,exports){
+},{}],226:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the 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
*/
@@ -26603,21 +25529,20 @@ if (ExecutionEnvironment.canUseDOM) {
}
module.exports = performance || {};
-},{"./ExecutionEnvironment":208}],231:[function(require,module,exports){
+},{"./ExecutionEnvironment":205}],227:[function(require,module,exports){
+'use strict';
+
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule performanceNow
* @typechecks
*/
-'use strict';
-
var performance = require('./performance');
var performanceNow;
@@ -26638,31 +25563,48 @@ if (performance.now) {
}
module.exports = performanceNow;
-},{"./performance":230}],232:[function(require,module,exports){
+},{"./performance":226}],228:[function(require,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
+ * Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule shallowEqual
* @typechecks
*
*/
+/*eslint-disable no-self-compare */
+
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
+ */
+function is(x, y) {
+ // SameValue algorithm
+ if (x === y) {
+ // Steps 1-5, 7-10
+ // Steps 6.b-6.e: +0 != -0
+ return x !== 0 || 1 / x === 1 / y;
+ } else {
+ // Step 6.a: NaN == NaN
+ return x !== x && y !== y;
+ }
+}
+
+/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
* Returns true when the values of all keys are strictly equal.
*/
function shallowEqual(objA, objB) {
- if (objA === objB) {
+ if (is(objA, objB)) {
return true;
}
@@ -26678,9 +25620,8 @@ function shallowEqual(objA, objB) {
}
// Test for A's keys different from B.
- var bHasOwnProperty = hasOwnProperty.bind(objB);
for (var i = 0; i < keysA.length; i++) {
- if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
+ if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
@@ -26689,68 +25630,7 @@ function shallowEqual(objA, objB) {
}
module.exports = shallowEqual;
-},{}],233:[function(require,module,exports){
-(function (process){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule toArray
- * @typechecks
- */
-
-'use strict';
-
-var invariant = require('./invariant');
-
-/**
- * Convert array-like objects to arrays.
- *
- * This API assumes the caller knows the contents of the data type. For less
- * well defined inputs use createArrayFromMixed.
- *
- * @param {object|function|filelist} obj
- * @return {array}
- */
-function toArray(obj) {
- var length = obj.length;
-
- // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
- // old versions of Safari).
- !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
-
- !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
-
- !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
-
- // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
- // without method will throw during the slice call and skip straight to the
- // fallback.
- if (obj.hasOwnProperty) {
- try {
- return Array.prototype.slice.call(obj);
- } catch (e) {
- // IE < 9 does not support Array#slice on collections objects
- }
- }
-
- // Fall back to copying key by key. This assumes all keys have a value,
- // so will not preserve sparsely populated inputs.
- var ret = Array(length);
- for (var ii = 0; ii < length; ii++) {
- ret[ii] = obj[ii];
- }
- return ret;
-}
-
-module.exports = toArray;
-}).call(this,require('_process'))
-
-},{"./invariant":222,"_process":27}],234:[function(require,module,exports){
+},{}],229:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
@@ -26760,7 +25640,6 @@ module.exports = toArray;
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule warning
*/
'use strict';
@@ -26811,7 +25690,7 @@ if (process.env.NODE_ENV !== 'production') {
module.exports = warning;
}).call(this,require('_process'))
-},{"./emptyFunction":214,"_process":27}],235:[function(require,module,exports){
+},{"./emptyFunction":211,"_process":29}],230:[function(require,module,exports){
'use strict';
module.exports = function (str) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
@@ -26819,7 +25698,7 @@ module.exports = function (str) {
});
};
-},{}],236:[function(require,module,exports){
+},{}],231:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
@@ -26884,7 +25763,7 @@ module.exports = warning;
}).call(this,require('_process'))
-},{"_process":27}],"classnames":[function(require,module,exports){
+},{"_process":29}],"classnames":[function(require,module,exports){
/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
@@ -26948,7 +25827,7 @@ module.exports.Dispatcher = require('./lib/Dispatcher');
},{"./lib/Dispatcher":5}],"jquery":[function(require,module,exports){
/*!
- * jQuery JavaScript Library v2.2.1
+ * jQuery JavaScript Library v2.2.3
* http://jquery.com/
*
* Includes Sizzle.js
@@ -26958,7 +25837,7 @@ module.exports.Dispatcher = require('./lib/Dispatcher');
* Released under the MIT license
* http://jquery.org/license
*
- * Date: 2016-02-22T19:11Z
+ * Date: 2016-04-05T19:26Z
*/
(function( global, factory ) {
@@ -27014,7 +25893,7 @@ var support = {};
var
- version = "2.2.1",
+ version = "2.2.3",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
@@ -27225,6 +26104,7 @@ jQuery.extend( {
},
isPlainObject: function( obj ) {
+ var key;
// Not plain objects:
// - Any object or value whose internal [[Class]] property is not "[object Object]"
@@ -27234,14 +26114,18 @@ jQuery.extend( {
return false;
}
+ // Not own constructor property must be Object
if ( obj.constructor &&
- !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
+ !hasOwn.call( obj, "constructor" ) &&
+ !hasOwn.call( obj.constructor.prototype || {}, "isPrototypeOf" ) ) {
return false;
}
- // If the function hasn't returned already, we're confident that
- // |obj| is a plain object, created by {} or constructed with new Object
- return true;
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own
+ for ( key in obj ) {}
+
+ return key === undefined || hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
@@ -34274,6 +33158,12 @@ jQuery.extend( {
}
} );
+// Support: IE <=11 only
+// Accessing the selectedIndex property
+// forces the browser to respect setting selected
+// on the option
+// The getter ensures a default option is selected
+// when in an optgroup
if ( !support.optSelected ) {
jQuery.propHooks.selected = {
get: function( elem ) {
@@ -34282,6 +33172,16 @@ if ( !support.optSelected ) {
parent.parentNode.selectedIndex;
}
return null;
+ },
+ set: function( elem ) {
+ var parent = elem.parentNode;
+ if ( parent ) {
+ parent.selectedIndex;
+
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
}
};
}
@@ -34476,7 +33376,8 @@ jQuery.fn.extend( {
-var rreturn = /\r/g;
+var rreturn = /\r/g,
+ rspaces = /[\x20\t\r\n\f]+/g;
jQuery.fn.extend( {
val: function( value ) {
@@ -34552,9 +33453,15 @@ jQuery.extend( {
option: {
get: function( elem ) {
- // Support: IE<11
- // option.value not trimmed (#14858)
- return jQuery.trim( elem.value );
+ var val = jQuery.find.attr( elem, "value" );
+ return val != null ?
+ val :
+
+ // Support: IE10-11+
+ // option.text throws exceptions (#14686, #14858)
+ // Strip and collapse whitespace
+ // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
+ jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
}
},
select: {
@@ -34607,7 +33514,7 @@ jQuery.extend( {
while ( i-- ) {
option = options[ i ];
if ( option.selected =
- jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
+ jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
) {
optionSet = true;
}
@@ -36302,18 +35209,6 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
-// Support: Safari 8+
-// In Safari 8 documents created via document.implementation.createHTMLDocument
-// collapse sibling forms: the second one becomes a child of the first one.
-// Because of that, this security measure has to be disabled in Safari 8.
-// https://bugs.webkit.org/show_bug.cgi?id=137337
-support.createHTMLDocument = ( function() {
- var body = document.implementation.createHTMLDocument( "" ).body;
- body.innerHTML = "<form></form><form></form>";
- return body.childNodes.length === 2;
-} )();
-
-
// Argument "data" should be string of html
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
@@ -36326,12 +35221,7 @@ jQuery.parseHTML = function( data, context, keepScripts ) {
keepScripts = context;
context = false;
}
-
- // Stop scripts or inline event handlers from being executed immediately
- // by using document.implementation
- context = context || ( support.createHTMLDocument ?
- document.implementation.createHTMLDocument( "" ) :
- document );
+ context = context || document;
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
@@ -36413,7 +35303,7 @@ jQuery.fn.load = function( url, params, callback ) {
// If it fails, this function gets "jqXHR", "status", "error"
} ).always( callback && function( jqXHR, status ) {
self.each( function() {
- callback.apply( self, response || [ jqXHR.responseText, status, jqXHR ] );
+ callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
} );
} );
}
@@ -36783,12 +35673,12 @@ return jQuery;
(function (global){
/**
* @license
- * lodash 4.5.1 (Custom Build) <https://lodash.com/>
+ * lodash 4.11.2 (Custom Build) <https://lodash.com/>
* Build: `lodash -d -o ./foo/lodash.js`
- * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
+ * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
;(function() {
@@ -36796,7 +35686,19 @@ return jQuery;
var undefined;
/** Used as the semantic version number. */
- var VERSION = '4.5.1';
+ var VERSION = '4.11.2';
+
+ /** Used as the size to enable large array optimizations. */
+ var LARGE_ARRAY_SIZE = 200;
+
+ /** Used as the `TypeError` message for "Functions" methods. */
+ var FUNC_ERROR_TEXT = 'Expected a function';
+
+ /** Used to stand-in for `undefined` hash values. */
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
+
+ /** Used as the internal argument placeholder. */
+ var PLACEHOLDER = '__lodash_placeholder__';
/** Used to compose bitmasks for wrapper metadata. */
var BIND_FLAG = 1,
@@ -36822,20 +35724,11 @@ return jQuery;
var HOT_COUNT = 150,
HOT_SPAN = 16;
- /** Used as the size to enable large array optimizations. */
- var LARGE_ARRAY_SIZE = 200;
-
/** Used to indicate the type of lazy iteratees. */
var LAZY_FILTER_FLAG = 1,
LAZY_MAP_FLAG = 2,
LAZY_WHILE_FLAG = 3;
- /** Used as the `TypeError` message for "Functions" methods. */
- var FUNC_ERROR_TEXT = 'Expected a function';
-
- /** Used to stand-in for `undefined` hash values. */
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
-
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0,
MAX_SAFE_INTEGER = 9007199254740991,
@@ -36847,9 +35740,6 @@ return jQuery;
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
- /** Used as the internal argument placeholder. */
- var PLACEHOLDER = '__lodash_placeholder__';
-
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
@@ -36861,6 +35751,7 @@ return jQuery;
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
+ promiseTag = '[object Promise]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
@@ -36869,6 +35760,7 @@ return jQuery;
weakSetTag = '[object WeakSet]';
var arrayBufferTag = '[object ArrayBuffer]',
+ dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
@@ -36900,7 +35792,10 @@ return jQuery;
reIsPlainProp = /^\w*$/,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g;
- /** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */
+ /**
+ * Used to match `RegExp`
+ * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
+ */
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar.source);
@@ -36909,10 +35804,16 @@ return jQuery;
reTrimStart = /^\s+/,
reTrimEnd = /\s+$/;
+ /** Used to match non-compound words composed of alphanumeric characters. */
+ var reBasicWord = /[a-zA-Z0-9]+/g;
+
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
- /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */
+ /**
+ * Used to match
+ * [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components).
+ */
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
/** Used to match `RegExp` flags from their coerced string values. */
@@ -36927,7 +35828,7 @@ return jQuery;
/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;
- /** Used to detect host constructors (Safari > 5). */
+ /** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used to detect octal string values. */
@@ -36953,14 +35854,15 @@ return jQuery;
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
- rsQuoteRange = '\\u2018\\u2019\\u201c\\u201d',
+ rsPunctuationRange = '\\u2000-\\u206f',
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
rsVarRange = '\\ufe0e\\ufe0f',
- rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange;
+ rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
/** Used to compose unicode capture groups. */
- var rsAstral = '[' + rsAstralRange + ']',
+ var rsApos = "['\u2019]",
+ rsAstral = '[' + rsAstralRange + ']',
rsBreak = '[' + rsBreakRange + ']',
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
rsDigits = '\\d+',
@@ -36978,6 +35880,8 @@ return jQuery;
/** Used to compose unicode regexes. */
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
+ rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
+ rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
reOptMod = rsModifier + '?',
rsOptVar = '[' + rsVarRange + ']?',
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
@@ -36985,6 +35889,9 @@ return jQuery;
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
+ /** Used to match apostrophes. */
+ var reApos = RegExp(rsApos, 'g');
+
/**
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
@@ -36994,32 +35901,29 @@ return jQuery;
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
- /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
- var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
-
- /** Used to match non-compound words composed of alphanumeric characters. */
- var reBasicWord = /[a-zA-Z0-9]+/g;
-
/** Used to match complex or compound words. */
var reComplexWord = RegExp([
- rsUpper + '?' + rsLower + '+(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
- rsUpperMisc + '+(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
- rsUpper + '?' + rsLowerMisc + '+',
- rsUpper + '+',
+ rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
+ rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
+ rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
+ rsUpper + '+' + rsOptUpperContr,
rsDigits,
rsEmoji
].join('|'), 'g');
+ /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
+ var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
+
/** Used to detect strings that need a more robust regexp to match words. */
- var reHasComplexWord = /[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
+ var reHasComplexWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
/** Used to assign default `context` object properties. */
var contextProps = [
- 'Array', 'Buffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
+ 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
- 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
- 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_',
- 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
+ 'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError',
+ 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
+ '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
];
/** Used to make template sourceURLs easier to identify. */
@@ -37034,25 +35938,26 @@ return jQuery;
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
- typedArrayTags[dateTag] = typedArrayTags[errorTag] =
- typedArrayTags[funcTag] = typedArrayTags[mapTag] =
- typedArrayTags[numberTag] = typedArrayTags[objectTag] =
- typedArrayTags[regexpTag] = typedArrayTags[setTag] =
- typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
+ typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
+ typedArrayTags[errorTag] = typedArrayTags[funcTag] =
+ typedArrayTags[mapTag] = typedArrayTags[numberTag] =
+ typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
+ typedArrayTags[setTag] = typedArrayTags[stringTag] =
+ typedArrayTags[weakMapTag] = false;
/** Used to identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] =
- cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
- cloneableTags[dateTag] = cloneableTags[float32Tag] =
- cloneableTags[float64Tag] = cloneableTags[int8Tag] =
- cloneableTags[int16Tag] = cloneableTags[int32Tag] =
- cloneableTags[mapTag] = cloneableTags[numberTag] =
- cloneableTags[objectTag] = cloneableTags[regexpTag] =
- cloneableTags[setTag] = cloneableTags[stringTag] =
- cloneableTags[symbolTag] = cloneableTags[uint8Tag] =
- cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] =
- cloneableTags[uint32Tag] = true;
+ cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
+ cloneableTags[boolTag] = cloneableTags[dateTag] =
+ cloneableTags[float32Tag] = cloneableTags[float64Tag] =
+ cloneableTags[int8Tag] = cloneableTags[int16Tag] =
+ cloneableTags[int32Tag] = cloneableTags[mapTag] =
+ cloneableTags[numberTag] = cloneableTags[objectTag] =
+ cloneableTags[regexpTag] = cloneableTags[setTag] =
+ cloneableTags[stringTag] = cloneableTags[symbolTag] =
+ cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
+ cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] =
cloneableTags[weakMapTag] = false;
@@ -37165,6 +36070,7 @@ return jQuery;
* @returns {Object} Returns `map`.
*/
function addMapEntry(map, pair) {
+ // Don't return `Map#set` because it doesn't return the map instance in IE 11.
map.set(pair[0], pair[1]);
return map;
}
@@ -37189,7 +36095,7 @@ return jQuery;
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
- * @param {...*} args The arguments to invoke `func` with.
+ * @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
@@ -37296,7 +36202,8 @@ return jQuery;
* @private
* @param {Array} array The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`.
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`.
*/
function arrayEvery(array, predicate) {
var index = -1,
@@ -37322,13 +36229,13 @@ return jQuery;
function arrayFilter(array, predicate) {
var index = -1,
length = array.length,
- resIndex = -1,
+ resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
- result[++resIndex] = value;
+ result[resIndex++] = value;
}
}
return result;
@@ -37348,8 +36255,7 @@ return jQuery;
}
/**
- * A specialized version of `_.includesWith` for arrays without support for
- * specifying an index to search from.
+ * This function is like `arrayIncludes` except that it accepts a comparator.
*
* @private
* @param {Array} array The array to search.
@@ -37416,7 +36322,8 @@ return jQuery;
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
- * @param {boolean} [initAccum] Specify using the first element of `array` as the initial value.
+ * @param {boolean} [initAccum] Specify using the first element of `array` as
+ * the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduce(array, iteratee, accumulator, initAccum) {
@@ -37440,7 +36347,8 @@ return jQuery;
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
- * @param {boolean} [initAccum] Specify using the last element of `array` as the initial value.
+ * @param {boolean} [initAccum] Specify using the last element of `array` as
+ * the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
@@ -37461,7 +36369,8 @@ return jQuery;
* @private
* @param {Array} array The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
@@ -37476,35 +36385,6 @@ return jQuery;
}
/**
- * The base implementation of methods like `_.max` and `_.min` which accepts a
- * `comparator` to determine the extremum value.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} iteratee The iteratee invoked per iteration.
- * @param {Function} comparator The comparator used to compare values.
- * @returns {*} Returns the extremum value.
- */
- function baseExtremum(array, iteratee, comparator) {
- var index = -1,
- length = array.length;
-
- while (++index < length) {
- var value = array[index],
- current = iteratee(value);
-
- if (current != null && (computed === undefined
- ? current === current
- : comparator(current, computed)
- )) {
- var computed = current,
- result = value;
- }
- }
- return result;
- }
-
- /**
* The base implementation of methods like `_.find` and `_.findKey`, without
* support for iteratee shorthands, which iterates over `collection` using
* `eachFunc`.
@@ -37513,7 +36393,8 @@ return jQuery;
* @param {Array|Object} collection The collection to search.
* @param {Function} predicate The function invoked per iteration.
* @param {Function} eachFunc The function to iterate over `collection`.
- * @param {boolean} [retKey] Specify returning the key of the found element instead of the element itself.
+ * @param {boolean} [retKey] Specify returning the key of the found element
+ * instead of the element itself.
* @returns {*} Returns the found element or its key, else `undefined`.
*/
function baseFind(collection, predicate, eachFunc, retKey) {
@@ -37574,6 +36455,42 @@ return jQuery;
}
/**
+ * This function is like `baseIndexOf` except that it accepts a comparator.
+ *
+ * @private
+ * @param {Array} array The array to search.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @param {Function} comparator The comparator invoked per element.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function baseIndexOfWith(array, value, fromIndex, comparator) {
+ var index = fromIndex - 1,
+ length = array.length;
+
+ while (++index < length) {
+ if (comparator(array[index], value)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * The base implementation of `_.mean` and `_.meanBy` without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {number} Returns the mean.
+ */
+ function baseMean(array, iteratee) {
+ var length = array ? array.length : 0;
+ return length ? (baseSum(array, iteratee) / length) : NAN;
+ }
+
+ /**
* The base implementation of `_.reduce` and `_.reduceRight`, without support
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
*
@@ -37581,7 +36498,8 @@ return jQuery;
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} accumulator The initial value.
- * @param {boolean} initAccum Specify using the first or last element of `collection` as the initial value.
+ * @param {boolean} initAccum Specify using the first or last element of
+ * `collection` as the initial value.
* @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the accumulated value.
*/
@@ -37595,9 +36513,9 @@ return jQuery;
}
/**
- * The base implementation of `_.sortBy` which uses `comparer` to define
- * the sort order of `array` and replaces criteria objects with their
- * corresponding values.
+ * The base implementation of `_.sortBy` which uses `comparer` to define the
+ * sort order of `array` and replaces criteria objects with their corresponding
+ * values.
*
* @private
* @param {Array} array The array to sort.
@@ -37615,7 +36533,8 @@ return jQuery;
}
/**
- * The base implementation of `_.sum` without support for iteratee shorthands.
+ * The base implementation of `_.sum` and `_.sumBy` without support for
+ * iteratee shorthands.
*
* @private
* @param {Array} array The array to iterate over.
@@ -37744,79 +36663,6 @@ return jQuery;
}
/**
- * Compares values to sort them in ascending order.
- *
- * @private
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {number} Returns the sort order indicator for `value`.
- */
- function compareAscending(value, other) {
- if (value !== other) {
- var valIsNull = value === null,
- valIsUndef = value === undefined,
- valIsReflexive = value === value;
-
- var othIsNull = other === null,
- othIsUndef = other === undefined,
- othIsReflexive = other === other;
-
- if ((value > other && !othIsNull) || !valIsReflexive ||
- (valIsNull && !othIsUndef && othIsReflexive) ||
- (valIsUndef && othIsReflexive)) {
- return 1;
- }
- if ((value < other && !valIsNull) || !othIsReflexive ||
- (othIsNull && !valIsUndef && valIsReflexive) ||
- (othIsUndef && valIsReflexive)) {
- return -1;
- }
- }
- return 0;
- }
-
- /**
- * Used by `_.orderBy` to compare multiple properties of a value to another
- * and stable sort them.
- *
- * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
- * specify an order of "desc" for descending or "asc" for ascending sort order
- * of corresponding values.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {boolean[]|string[]} orders The order to sort by for each property.
- * @returns {number} Returns the sort order indicator for `object`.
- */
- function compareMultiple(object, other, orders) {
- var index = -1,
- objCriteria = object.criteria,
- othCriteria = other.criteria,
- length = objCriteria.length,
- ordersLength = orders.length;
-
- while (++index < length) {
- var result = compareAscending(objCriteria[index], othCriteria[index]);
- if (result) {
- if (index >= ordersLength) {
- return result;
- }
- var order = orders[index];
- return result * (order == 'desc' ? -1 : 1);
- }
- }
- // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
- // that causes it, under certain circumstances, to provide the same value for
- // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
- // for more details.
- //
- // This also ensures a stable sort in V8 and other engines.
- // See https://code.google.com/p/v8/issues/detail?id=90 for more details.
- return object.index - other.index;
- }
-
- /**
* Gets the number of `placeholder` occurrences in `array`.
*
* @private
@@ -37911,20 +36757,6 @@ return jQuery;
}
/**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
- function isIndex(value, length) {
- value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
- length = length == null ? MAX_SAFE_INTEGER : length;
- return value > -1 && value % 1 == 0 && value < length;
- }
-
- /**
* Converts `iterator` to an array.
*
* @private
@@ -37970,14 +36802,14 @@ return jQuery;
function replaceHolders(array, placeholder) {
var index = -1,
length = array.length,
- resIndex = -1,
+ resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value === placeholder || value === PLACEHOLDER) {
array[index] = PLACEHOLDER;
- result[++resIndex] = index;
+ result[resIndex++] = index;
}
}
return result;
@@ -38047,6 +36879,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 1.1.0
* @category Util
* @param {Object} [context=root] The context object.
* @returns {Function} Returns a new `lodash` function.
@@ -38089,7 +36922,8 @@ return jQuery;
/** Used for built-in method references. */
var arrayProto = context.Array.prototype,
- objectProto = context.Object.prototype;
+ objectProto = context.Object.prototype,
+ stringProto = context.String.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = context.Function.prototype.toString;
@@ -38104,7 +36938,8 @@ return jQuery;
var objectCtorString = funcToString.call(Object);
/**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
@@ -38125,7 +36960,6 @@ return jQuery;
Uint8Array = context.Uint8Array,
clearTimeout = context.clearTimeout,
enumerate = Reflect ? Reflect.enumerate : undefined,
- getPrototypeOf = Object.getPrototypeOf,
getOwnPropertySymbols = Object.getOwnPropertySymbols,
iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined,
objectCreate = Object.create,
@@ -38136,6 +36970,7 @@ return jQuery;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil,
nativeFloor = Math.floor,
+ nativeGetPrototype = Object.getPrototypeOf,
nativeIsFinite = context.isFinite,
nativeJoin = arrayProto.join,
nativeKeys = Object.keys,
@@ -38143,10 +36978,14 @@ return jQuery;
nativeMin = Math.min,
nativeParseInt = context.parseInt,
nativeRandom = Math.random,
- nativeReverse = arrayProto.reverse;
+ nativeReplace = stringProto.replace,
+ nativeReverse = arrayProto.reverse,
+ nativeSplit = stringProto.split;
/* Built-in method references that are verified to be native. */
- var Map = getNative(context, 'Map'),
+ var DataView = getNative(context, 'DataView'),
+ Map = getNative(context, 'Map'),
+ Promise = getNative(context, 'Promise'),
Set = getNative(context, 'Set'),
WeakMap = getNative(context, 'WeakMap'),
nativeCreate = getNative(Object, 'create');
@@ -38154,42 +36993,47 @@ return jQuery;
/** Used to store function metadata. */
var metaMap = WeakMap && new WeakMap;
+ /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */
+ var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
+
+ /** Used to lookup unminified function names. */
+ var realNames = {};
+
/** Used to detect maps, sets, and weakmaps. */
- var mapCtorString = Map ? funcToString.call(Map) : '',
- setCtorString = Set ? funcToString.call(Set) : '',
- weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : '';
+ var dataViewCtorString = toSource(DataView),
+ mapCtorString = toSource(Map),
+ promiseCtorString = toSource(Promise),
+ setCtorString = toSource(Set),
+ weakMapCtorString = toSource(WeakMap);
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
- symbolValueOf = Symbol ? symbolProto.valueOf : undefined,
- symbolToString = Symbol ? symbolProto.toString : undefined;
-
- /** Used to lookup unminified function names. */
- var realNames = {};
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
+ symbolToString = symbolProto ? symbolProto.toString : undefined;
/*------------------------------------------------------------------------*/
/**
* Creates a `lodash` object which wraps `value` to enable implicit method
- * chaining. Methods that operate on and return arrays, collections, and
- * functions can be chained together. Methods that retrieve a single value or
- * may return a primitive value will automatically end the chain sequence and
- * return the unwrapped value. Otherwise, the value must be unwrapped with
- * `_#value`.
+ * chain sequences. Methods that operate on and return arrays, collections,
+ * and functions can be chained together. Methods that retrieve a single value
+ * or may return a primitive value will automatically end the chain sequence
+ * and return the unwrapped value. Otherwise, the value must be unwrapped
+ * with `_#value`.
*
- * Explicit chaining, which must be unwrapped with `_#value` in all cases,
- * may be enabled using `_.chain`.
+ * Explicit chain sequences, which must be unwrapped with `_#value`, may be
+ * enabled using `_.chain`.
*
* The execution of chained methods is lazy, that is, it's deferred until
* `_#value` is implicitly or explicitly called.
*
- * Lazy evaluation allows several methods to support shortcut fusion. Shortcut
- * fusion is an optimization to merge iteratee calls; this avoids the creation
- * of intermediate arrays and can greatly reduce the number of iteratee executions.
- * Sections of a chain sequence qualify for shortcut fusion if the section is
- * applied to an array of at least two hundred elements and any iteratees
- * accept only one argument. The heuristic for whether a section qualifies
- * for shortcut fusion is subject to change.
+ * Lazy evaluation allows several methods to support shortcut fusion.
+ * Shortcut fusion is an optimization to merge iteratee calls; this avoids
+ * the creation of intermediate arrays and can greatly reduce the number of
+ * iteratee executions. Sections of a chain sequence qualify for shortcut
+ * fusion if the section is applied to an array of at least `200` elements
+ * and any iteratees accept only one argument. The heuristic for whether a
+ * section qualifies for shortcut fusion is subject to change.
*
* Chaining is supported in custom builds as long as the `_#value` method is
* directly or indirectly included in the build.
@@ -38211,49 +37055,52 @@ return jQuery;
* `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
* `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
* `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
- * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`,
- * `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`,
- * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flattenDepth`,
- * `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, `functionsIn`,
- * `groupBy`, `initial`, `intersection`, `intersectionBy`, `intersectionWith`,
- * `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, `keys`, `keysIn`,
- * `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, `memoize`,
- * `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, `nthArg`,
- * `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, `overEvery`,
- * `overSome`, `partial`, `partialRight`, `partition`, `pick`, `pickBy`, `plant`,
- * `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, `pullAt`, `push`,
- * `range`, `rangeRight`, `rearg`, `reject`, `remove`, `rest`, `reverse`,
- * `sampleSize`, `set`, `setWith`, `shuffle`, `slice`, `sort`, `sortBy`,
- * `splice`, `spread`, `tail`, `take`, `takeRight`, `takeRightWhile`,
- * `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, `toPairs`, `toPairsIn`,
- * `toPath`, `toPlainObject`, `transform`, `unary`, `union`, `unionBy`,
- * `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, `unshift`, `unzip`,
- * `unzipWith`, `values`, `valuesIn`, `without`, `wrap`, `xor`, `xorBy`,
- * `xorWith`, `zip`, `zipObject`, `zipObjectDeep`, and `zipWith`
+ * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
+ * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
+ * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
+ * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
+ * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
+ * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
+ * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
+ * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
+ * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
+ * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
+ * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
+ * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
+ * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
+ * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
+ * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
+ * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
+ * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
+ * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
+ * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
+ * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
+ * `zipObject`, `zipObjectDeep`, and `zipWith`
*
* The wrapper methods that are **not** chainable by default are:
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
- * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`,
- * `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
- * `findLastIndex`, `findLastKey`, `floor`, `forEach`, `forEachRight`, `forIn`,
- * `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, `hasIn`,
- * `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, `isArguments`,
- * `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`,
- * `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`,
- * `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`,
- * `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`,
+ * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `divide`, `each`,
+ * `eachRight`, `endsWith`, `eq`, `escape`, `escapeRegExp`, `every`, `find`,
+ * `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `first`,
+ * `floor`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`,
+ * `forOwnRight`, `get`, `gt`, `gte`, `has`, `hasIn`, `head`, `identity`,
+ * `includes`, `indexOf`, `inRange`, `invoke`, `isArguments`, `isArray`,
+ * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isBuffer`,
+ * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`,
+ * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, `isMatch`,
+ * `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`,
* `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`,
* `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`,
* `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`,
- * `lt`, `lte`, `max`, `maxBy`, `mean`, `min`, `minBy`, `noConflict`, `noop`,
- * `now`, `pad`, `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`,
- * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `sample`,
- * `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`,
- * `sortedLastIndex`, `sortedLastIndexBy`, `startCase`, `startsWith`, `subtract`,
- * `sum`, `sumBy`, `template`, `times`, `toLower`, `toInteger`, `toLength`,
- * `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, `trimEnd`,
- * `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, `upperFirst`,
- * `value`, and `words`
+ * `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`,
+ * `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, `padStart`, `parseInt`,
+ * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
+ * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
+ * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
+ * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toInteger`,
+ * `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, `toString`,
+ * `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`,
+ * `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words`
*
* @name _
* @constructor
@@ -38294,7 +37141,7 @@ return jQuery;
}
/**
- * The function whose prototype all chaining wrappers inherit from.
+ * The function whose prototype chain sequence wrappers inherit from.
*
* @private
*/
@@ -38307,7 +37154,7 @@ return jQuery;
*
* @private
* @param {*} value The value to wrap.
- * @param {boolean} [chainAll] Enable chaining for all wrapper methods.
+ * @param {boolean} [chainAll] Enable explicit method chain sequences.
*/
function LodashWrapper(value, chainAll) {
this.__wrapped__ = value;
@@ -38378,6 +37225,13 @@ return jQuery;
}
};
+ // Ensure wrappers are instances of `baseLodash`.
+ lodash.prototype = baseLodash.prototype;
+ lodash.prototype.constructor = lodash;
+
+ LodashWrapper.prototype = baseCreate(baseLodash.prototype);
+ LodashWrapper.prototype.constructor = LodashWrapper;
+
/*------------------------------------------------------------------------*/
/**
@@ -38494,10 +37348,14 @@ return jQuery;
return result;
}
+ // Ensure `LazyWrapper` is an instance of `baseLodash`.
+ LazyWrapper.prototype = baseCreate(baseLodash.prototype);
+ LazyWrapper.prototype.constructor = LazyWrapper;
+
/*------------------------------------------------------------------------*/
/**
- * Creates an hash object.
+ * Creates a hash object.
*
* @private
* @constructor
@@ -38557,6 +37415,9 @@ return jQuery;
hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
}
+ // Avoid inheriting from `Object.prototype` when possible.
+ Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto;
+
/*------------------------------------------------------------------------*/
/**
@@ -38651,7 +37512,7 @@ return jQuery;
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
- * @returns {Object} Returns the map cache object.
+ * @returns {Object} Returns the map cache instance.
*/
function mapSet(key, value) {
var data = this.__data__;
@@ -38665,6 +37526,13 @@ return jQuery;
return this;
}
+ // Add methods to `MapCache`.
+ MapCache.prototype.clear = mapClear;
+ MapCache.prototype['delete'] = mapDelete;
+ MapCache.prototype.get = mapGet;
+ MapCache.prototype.has = mapHas;
+ MapCache.prototype.set = mapSet;
+
/*------------------------------------------------------------------------*/
/**
@@ -38725,6 +37593,9 @@ return jQuery;
}
}
+ // Add methods to `SetCache`.
+ SetCache.prototype.push = cachePush;
+
/*------------------------------------------------------------------------*/
/**
@@ -38812,7 +37683,7 @@ return jQuery;
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
- * @returns {Object} Returns the stack cache object.
+ * @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__,
@@ -38833,13 +37704,20 @@ return jQuery;
return this;
}
+ // Add methods to `Stack`.
+ Stack.prototype.clear = stackClear;
+ Stack.prototype['delete'] = stackDelete;
+ Stack.prototype.get = stackGet;
+ Stack.prototype.has = stackHas;
+ Stack.prototype.set = stackSet;
+
/*------------------------------------------------------------------------*/
/**
* Removes `key` and its value from the associative array.
*
* @private
- * @param {Array} array The array to query.
+ * @param {Array} array The array to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
@@ -38883,8 +37761,7 @@ return jQuery;
}
/**
- * Gets the index at which the first occurrence of `key` is found in `array`
- * of key-value pairs.
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to search.
@@ -38939,7 +37816,8 @@ return jQuery;
}
/**
- * This function is like `assignValue` except that it doesn't assign `undefined` values.
+ * This function is like `assignValue` except that it doesn't assign
+ * `undefined` values.
*
* @private
* @param {Object} object The object to modify.
@@ -39023,39 +37901,6 @@ return jQuery;
}
/**
- * Casts `value` to an empty array if it's not an array like object.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {Array} Returns the array-like object.
- */
- function baseCastArrayLikeObject(value) {
- return isArrayLikeObject(value) ? value : [];
- }
-
- /**
- * Casts `value` to `identity` if it's not a function.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {Array} Returns the array-like object.
- */
- function baseCastFunction(value) {
- return typeof value == 'function' ? value : identity;
- }
-
- /**
- * Casts `value` to a path array if it's not one.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {Array} Returns the cast property path array.
- */
- function baseCastPath(value) {
- return isArray(value) ? value : stringToPath(value);
- }
-
- /**
* The base implementation of `_.clamp` which doesn't coerce arguments to numbers.
*
* @private
@@ -39083,13 +37928,14 @@ return jQuery;
* @private
* @param {*} value The value to clone.
* @param {boolean} [isDeep] Specify a deep clone.
+ * @param {boolean} [isFull] Specify a clone including symbols.
* @param {Function} [customizer] The function to customize cloning.
* @param {string} [key] The key of `value`.
* @param {Object} [object] The parent object of `value`.
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
* @returns {*} Returns the cloned value.
*/
- function baseClone(value, isDeep, customizer, key, object, stack) {
+ function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
var result;
if (customizer) {
result = object ? customizer(value, key, object, stack) : customizer(value);
@@ -39125,7 +37971,7 @@ return jQuery;
if (!cloneableTags[tag]) {
return object ? value : {};
}
- result = initCloneByTag(value, tag, isDeep);
+ result = initCloneByTag(value, tag, baseClone, isDeep);
}
}
// Check for circular references and return its corresponding clone.
@@ -39136,11 +37982,18 @@ return jQuery;
}
stack.set(value, result);
+ if (!isArr) {
+ var props = isFull ? getAllKeys(value) : keys(value);
+ }
// Recursively populate clone (susceptible to call stack limits).
- (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
- assignValue(result, key, baseClone(subValue, isDeep, customizer, key, value, stack));
+ arrayEach(props || value, function(subValue, key) {
+ if (props) {
+ key = subValue;
+ subValue = value[key];
+ }
+ assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
});
- return isArr ? result : copySymbols(value, result);
+ return result;
}
/**
@@ -39164,7 +38017,8 @@ return jQuery;
predicate = source[key],
value = object[key];
- if ((value === undefined && !(key in Object(object))) || !predicate(value)) {
+ if ((value === undefined &&
+ !(key in Object(object))) || !predicate(value)) {
return false;
}
}
@@ -39202,8 +38056,8 @@ return jQuery;
}
/**
- * The base implementation of methods like `_.difference` without support for
- * excluding multiple arrays or iteratee shorthands.
+ * The base implementation of methods like `_.difference` without support
+ * for excluding multiple arrays or iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
@@ -39240,6 +38094,7 @@ return jQuery;
var value = array[index],
computed = iteratee ? iteratee(value) : value;
+ value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
@@ -39282,7 +38137,8 @@ return jQuery;
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`
*/
function baseEvery(collection, predicate) {
var result = true;
@@ -39294,6 +38150,35 @@ return jQuery;
}
/**
+ * The base implementation of methods like `_.max` and `_.min` which accepts a
+ * `comparator` to determine the extremum value.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The iteratee invoked per iteration.
+ * @param {Function} comparator The comparator used to compare values.
+ * @returns {*} Returns the extremum value.
+ */
+ function baseExtremum(array, iteratee, comparator) {
+ var index = -1,
+ length = array.length;
+
+ while (++index < length) {
+ var value = array[index],
+ current = iteratee(value);
+
+ if (current != null && (computed === undefined
+ ? (current === current && !isSymbol(current))
+ : comparator(current, computed)
+ )) {
+ var computed = current,
+ result = value;
+ }
+ }
+ return result;
+ }
+
+ /**
* The base implementation of `_.fill` without an iteratee call guard.
*
* @private
@@ -39345,23 +38230,24 @@ return jQuery;
* @private
* @param {Array} array The array to flatten.
* @param {number} depth The maximum recursion depth.
- * @param {boolean} [isStrict] Restrict flattening to arrays-like objects.
+ * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
+ * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
* @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array.
*/
- function baseFlatten(array, depth, isStrict, result) {
- result || (result = []);
-
+ function baseFlatten(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
+ predicate || (predicate = isFlattenable);
+ result || (result = []);
+
while (++index < length) {
var value = array[index];
- if (depth > 0 && isArrayLikeObject(value) &&
- (isStrict || isArray(value) || isArguments(value))) {
+ if (depth > 0 && predicate(value)) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
- baseFlatten(value, depth - 1, isStrict, result);
+ baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value);
}
@@ -39373,10 +38259,9 @@ return jQuery;
}
/**
- * The base implementation of `baseForIn` and `baseForOwn` which iterates
- * over `object` properties returned by `keysFunc` invoking `iteratee` for
- * each property. Iteratee functions may exit iteration early by explicitly
- * returning `false`.
+ * The base implementation of `baseForOwn` which iterates over `object`
+ * properties returned by `keysFunc` and invokes `iteratee` for each property.
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
@@ -39399,18 +38284,6 @@ return jQuery;
var baseForRight = createBaseFor(true);
/**
- * The base implementation of `_.forIn` without support for iteratee shorthands.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Object} Returns `object`.
- */
- function baseForIn(object, iteratee) {
- return object == null ? object : baseFor(object, iteratee, keysIn);
- }
-
- /**
* The base implementation of `_.forOwn` without support for iteratee shorthands.
*
* @private
@@ -39458,18 +38331,49 @@ return jQuery;
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
- path = isKey(path, object) ? [path + ''] : baseCastPath(path);
+ path = isKey(path, object) ? [path] : castPath(path);
var index = 0,
length = path.length;
while (object != null && index < length) {
- object = object[path[index++]];
+ object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
/**
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
+ * symbols of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Function} keysFunc The function to get the keys of `object`.
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
+ * @returns {Array} Returns the array of property names and symbols.
+ */
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
+ var result = keysFunc(object);
+ return isArray(object)
+ ? result
+ : arrayPush(result, symbolsFunc(object));
+ }
+
+ /**
+ * The base implementation of `_.gt` which doesn't coerce arguments to numbers.
+ *
+ * @private
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if `value` is greater than `other`,
+ * else `false`.
+ */
+ function baseGt(value, other) {
+ return value > other;
+ }
+
+ /**
* The base implementation of `_.has` without support for deep paths.
*
* @private
@@ -39482,7 +38386,7 @@ return jQuery;
// that are composed entirely of index properties, return `false` for
// `hasOwnProperty` checks of them.
return hasOwnProperty.call(object, key) ||
- (typeof object == 'object' && key in object && getPrototypeOf(object) === null);
+ (typeof object == 'object' && key in object && getPrototype(object) === null);
}
/**
@@ -39522,9 +38426,11 @@ return jQuery;
*/
function baseIntersection(arrays, iteratee, comparator) {
var includes = comparator ? arrayIncludesWith : arrayIncludes,
+ length = arrays[0].length,
othLength = arrays.length,
othIndex = othLength,
caches = Array(othLength),
+ maxLength = Infinity,
result = [];
while (othIndex--) {
@@ -39532,26 +38438,27 @@ return jQuery;
if (othIndex && iteratee) {
array = arrayMap(array, baseUnary(iteratee));
}
- caches[othIndex] = !comparator && (iteratee || array.length >= 120)
+ maxLength = nativeMin(array.length, maxLength);
+ caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
? new SetCache(othIndex && array)
: undefined;
}
array = arrays[0];
var index = -1,
- length = array.length,
seen = caches[0];
outer:
- while (++index < length) {
+ while (++index < length && result.length < maxLength) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
+ value = (comparator || value !== 0) ? value : 0;
if (!(seen
? cacheHas(seen, computed)
: includes(result, computed, comparator)
)) {
- var othIndex = othLength;
+ othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
if (!(cache
@@ -39600,11 +38507,11 @@ return jQuery;
*/
function baseInvoke(object, path, args) {
if (!isKey(path, object)) {
- path = baseCastPath(path);
+ path = castPath(path);
object = parent(object, path);
path = last(path);
}
- var func = object == null ? object : object[path];
+ var func = object == null ? object : object[toKey(path)];
return func == null ? undefined : apply(func, object, args);
}
@@ -39643,7 +38550,8 @@ return jQuery;
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparisons.
- * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details.
+ * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
+ * for more details.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
@@ -39655,41 +38563,39 @@ return jQuery;
if (!objIsArr) {
objTag = getTag(object);
- if (objTag == argsTag) {
- objTag = objectTag;
- } else if (objTag != objectTag) {
- objIsArr = isTypedArray(object);
- }
+ objTag = objTag == argsTag ? objectTag : objTag;
}
if (!othIsArr) {
othTag = getTag(other);
- if (othTag == argsTag) {
- othTag = objectTag;
- } else if (othTag != objectTag) {
- othIsArr = isTypedArray(other);
- }
+ othTag = othTag == argsTag ? objectTag : othTag;
}
var objIsObj = objTag == objectTag && !isHostObject(object),
othIsObj = othTag == objectTag && !isHostObject(other),
isSameTag = objTag == othTag;
- if (isSameTag && !(objIsArr || objIsObj)) {
- return equalByTag(object, other, objTag, equalFunc, customizer, bitmask);
+ if (isSameTag && !objIsObj) {
+ stack || (stack = new Stack);
+ return (objIsArr || isTypedArray(object))
+ ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
+ : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
}
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
- if (!isPartial) {
+ if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
- return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack);
+ var objUnwrapped = objIsWrapped ? object.value() : object,
+ othUnwrapped = othIsWrapped ? other.value() : other;
+
+ stack || (stack = new Stack);
+ return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
- return (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, bitmask, stack);
+ return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
}
/**
@@ -39731,9 +38637,10 @@ return jQuery;
return false;
}
} else {
- var stack = new Stack,
- result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined;
-
+ var stack = new Stack;
+ if (customizer) {
+ var result = customizer(objValue, srcValue, key, object, source, stack);
+ }
if (!(result === undefined
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
: result
@@ -39753,14 +38660,15 @@ return jQuery;
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
- var type = typeof value;
- if (type == 'function') {
+ // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
+ // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
+ if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity;
}
- if (type == 'object') {
+ if (typeof value == 'object') {
return isArray(value)
? baseMatchesProperty(value[0], value[1])
: baseMatches(value);
@@ -39806,6 +38714,19 @@ return jQuery;
}
/**
+ * The base implementation of `_.lt` which doesn't coerce arguments to numbers.
+ *
+ * @private
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if `value` is less than `other`,
+ * else `false`.
+ */
+ function baseLt(value, other) {
+ return value < other;
+ }
+
+ /**
* The base implementation of `_.map` without support for iteratee shorthands.
*
* @private
@@ -39833,16 +38754,7 @@ return jQuery;
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
- var key = matchData[0][0],
- value = matchData[0][1];
-
- return function(object) {
- if (object == null) {
- return false;
- }
- return object[key] === value &&
- (value !== undefined || (key in Object(object)));
- };
+ return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || baseIsMatch(object, source, matchData);
@@ -39858,6 +38770,9 @@ return jQuery;
* @returns {Function} Returns the new function.
*/
function baseMatchesProperty(path, srcValue) {
+ if (isKey(path) && isStrictComparable(srcValue)) {
+ return matchesStrictComparable(toKey(path), srcValue);
+ }
return function(object) {
var objValue = get(object, path);
return (objValue === undefined && objValue === srcValue)
@@ -39874,16 +38789,16 @@ return jQuery;
* @param {Object} source The source object.
* @param {number} srcIndex The index of `source`.
* @param {Function} [customizer] The function to customize merged values.
- * @param {Object} [stack] Tracks traversed source values and their merged counterparts.
+ * @param {Object} [stack] Tracks traversed source values and their merged
+ * counterparts.
*/
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
- var props = (isArray(source) || isTypedArray(source))
- ? undefined
- : keysIn(source);
-
+ if (!(isArray(source) || isTypedArray(source))) {
+ var props = keysIn(source);
+ }
arrayEach(props || source, function(srcValue, key) {
if (props) {
key = srcValue;
@@ -39918,7 +38833,8 @@ return jQuery;
* @param {number} srcIndex The index of `source`.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize assigned values.
- * @param {Object} [stack] Tracks traversed source values and their merged counterparts.
+ * @param {Object} [stack] Tracks traversed source values and their merged
+ * counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = object[key],
@@ -39971,10 +38887,28 @@ return jQuery;
// Recursively merge objects and arrays (susceptible to call stack limits).
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
}
+ stack['delete'](srcValue);
assignMergeValue(object, key, newValue);
}
/**
+ * The base implementation of `_.nth` which doesn't coerce `n` to an integer.
+ *
+ * @private
+ * @param {Array} array The array to query.
+ * @param {number} n The index of the element to return.
+ * @returns {*} Returns the nth element of `array`.
+ */
+ function baseNth(array, n) {
+ var length = array.length;
+ if (!length) {
+ return;
+ }
+ n += n < 0 ? length : 0;
+ return isIndex(n, length) ? array[n] : undefined;
+ }
+
+ /**
* The base implementation of `_.orderBy` without param guards.
*
* @private
@@ -39984,12 +38918,8 @@ return jQuery;
* @returns {Array} Returns the new sorted array.
*/
function baseOrderBy(collection, iteratees, orders) {
- var index = -1,
- toIteratee = getIteratee();
-
- iteratees = arrayMap(iteratees.length ? iteratees : Array(1), function(iteratee) {
- return toIteratee(iteratee);
- });
+ var index = -1;
+ iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
var result = baseMap(collection, function(value, key, collection) {
var criteria = arrayMap(iteratees, function(iteratee) {
@@ -40005,11 +38935,11 @@ return jQuery;
/**
* The base implementation of `_.pick` without support for individual
- * property names.
+ * property identifiers.
*
* @private
* @param {Object} object The source object.
- * @param {string[]} props The property names to pick.
+ * @param {string[]} props The property identifiers to pick.
* @returns {Object} Returns the new object.
*/
function basePick(object, props) {
@@ -40031,12 +38961,19 @@ return jQuery;
* @returns {Object} Returns the new object.
*/
function basePickBy(object, predicate) {
- var result = {};
- baseForIn(object, function(value, key) {
+ var index = -1,
+ props = getAllKeysIn(object),
+ length = props.length,
+ result = {};
+
+ while (++index < length) {
+ var key = props[index],
+ value = object[key];
+
if (predicate(value, key)) {
result[key] = value;
}
- });
+ }
return result;
}
@@ -40067,18 +39004,6 @@ return jQuery;
}
/**
- * The base implementation of `_.pullAll`.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {Array} values The values to remove.
- * @returns {Array} Returns `array`.
- */
- function basePullAll(array, values) {
- return basePullAllBy(array, values);
- }
-
- /**
* The base implementation of `_.pullAllBy` without support for iteratee
* shorthands.
*
@@ -40086,22 +39011,24 @@ return jQuery;
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
* @param {Function} [iteratee] The iteratee invoked per element.
+ * @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns `array`.
*/
- function basePullAllBy(array, values, iteratee) {
- var index = -1,
+ function basePullAll(array, values, iteratee, comparator) {
+ var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
+ index = -1,
length = values.length,
seen = array;
if (iteratee) {
- seen = arrayMap(array, function(value) { return iteratee(value); });
+ seen = arrayMap(array, baseUnary(iteratee));
}
while (++index < length) {
var fromIndex = 0,
value = values[index],
computed = iteratee ? iteratee(value) : value;
- while ((fromIndex = baseIndexOf(seen, computed, fromIndex)) > -1) {
+ while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
if (seen !== array) {
splice.call(seen, fromIndex, 1);
}
@@ -40126,21 +39053,21 @@ return jQuery;
while (length--) {
var index = indexes[length];
- if (lastIndex == length || index != previous) {
+ if (length == lastIndex || index !== previous) {
var previous = index;
if (isIndex(index)) {
splice.call(array, index, 1);
}
else if (!isKey(index, array)) {
- var path = baseCastPath(index),
+ var path = castPath(index),
object = parent(array, path);
if (object != null) {
- delete object[last(path)];
+ delete object[toKey(last(path))];
}
}
else {
- delete array[index];
+ delete array[toKey(index)];
}
}
}
@@ -40184,6 +39111,34 @@ return jQuery;
}
/**
+ * The base implementation of `_.repeat` which doesn't coerce arguments.
+ *
+ * @private
+ * @param {string} string The string to repeat.
+ * @param {number} n The number of times to repeat the string.
+ * @returns {string} Returns the repeated string.
+ */
+ function baseRepeat(string, n) {
+ var result = '';
+ if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
+ return result;
+ }
+ // Leverage the exponentiation by squaring algorithm for a faster repeat.
+ // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
+ do {
+ if (n % 2) {
+ result += string;
+ }
+ n = nativeFloor(n / 2);
+ if (n) {
+ string += string;
+ }
+ } while (n);
+
+ return result;
+ }
+
+ /**
* The base implementation of `_.set`.
*
* @private
@@ -40194,7 +39149,7 @@ return jQuery;
* @returns {Object} Returns `object`.
*/
function baseSet(object, path, value, customizer) {
- path = isKey(path, object) ? [path + ''] : baseCastPath(path);
+ path = isKey(path, object) ? [path] : castPath(path);
var index = -1,
length = path.length,
@@ -40202,7 +39157,7 @@ return jQuery;
nested = object;
while (nested != null && ++index < length) {
- var key = path[index];
+ var key = toKey(path[index]);
if (isObject(nested)) {
var newValue = value;
if (index != lastIndex) {
@@ -40270,7 +39225,8 @@ return jQuery;
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
*/
function baseSome(collection, predicate) {
var result;
@@ -40303,7 +39259,8 @@ return jQuery;
var mid = (low + high) >>> 1,
computed = array[mid];
- if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {
+ if (computed !== null && !isSymbol(computed) &&
+ (retHighest ? (computed <= value) : (computed < value))) {
low = mid + 1;
} else {
high = mid;
@@ -40324,7 +39281,8 @@ return jQuery;
* @param {*} value The value to evaluate.
* @param {Function} iteratee The iteratee invoked per element.
* @param {boolean} [retHighest] Specify returning the highest qualified index.
- * @returns {number} Returns the index at which `value` should be inserted into `array`.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
*/
function baseSortedIndexBy(array, value, iteratee, retHighest) {
value = iteratee(value);
@@ -40333,21 +39291,26 @@ return jQuery;
high = array ? array.length : 0,
valIsNaN = value !== value,
valIsNull = value === null,
- valIsUndef = value === undefined;
+ valIsSymbol = isSymbol(value),
+ valIsUndefined = value === undefined;
while (low < high) {
var mid = nativeFloor((low + high) / 2),
computed = iteratee(array[mid]),
- isDef = computed !== undefined,
- isReflexive = computed === computed;
+ othIsDefined = computed !== undefined,
+ othIsNull = computed === null,
+ othIsReflexive = computed === computed,
+ othIsSymbol = isSymbol(computed);
if (valIsNaN) {
- var setLow = isReflexive || retHighest;
+ var setLow = retHighest || othIsReflexive;
+ } else if (valIsUndefined) {
+ setLow = othIsReflexive && (retHighest || othIsDefined);
} else if (valIsNull) {
- setLow = isReflexive && isDef && (retHighest || computed != null);
- } else if (valIsUndef) {
- setLow = isReflexive && (retHighest || isDef);
- } else if (computed == null) {
+ setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
+ } else if (valIsSymbol) {
+ setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
+ } else if (othIsNull || othIsSymbol) {
setLow = false;
} else {
setLow = retHighest ? (computed <= value) : (computed < value);
@@ -40362,47 +39325,71 @@ return jQuery;
}
/**
- * The base implementation of `_.sortedUniq`.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @returns {Array} Returns the new duplicate free array.
- */
- function baseSortedUniq(array) {
- return baseSortedUniqBy(array);
- }
-
- /**
- * The base implementation of `_.sortedUniqBy` without support for iteratee
- * shorthands.
+ * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
+ * support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @returns {Array} Returns the new duplicate free array.
*/
- function baseSortedUniqBy(array, iteratee) {
- var index = 0,
+ function baseSortedUniq(array, iteratee) {
+ var index = -1,
length = array.length,
- value = array[0],
- computed = iteratee ? iteratee(value) : value,
- seen = computed,
resIndex = 0,
- result = [value];
+ result = [];
while (++index < length) {
- value = array[index],
- computed = iteratee ? iteratee(value) : value;
+ var value = array[index],
+ computed = iteratee ? iteratee(value) : value;
- if (!eq(computed, seen)) {
- seen = computed;
- result[++resIndex] = value;
+ if (!index || !eq(computed, seen)) {
+ var seen = computed;
+ result[resIndex++] = value === 0 ? 0 : value;
}
}
return result;
}
/**
+ * The base implementation of `_.toNumber` which doesn't ensure correct
+ * conversions of binary, hexadecimal, or octal string values.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {number} Returns the number.
+ */
+ function baseToNumber(value) {
+ if (typeof value == 'number') {
+ return value;
+ }
+ if (isSymbol(value)) {
+ return NAN;
+ }
+ return +value;
+ }
+
+ /**
+ * The base implementation of `_.toString` which doesn't convert nullish
+ * values to empty strings.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {string} Returns the string.
+ */
+ function baseToString(value) {
+ // Exit early for strings to avoid a performance hit in some environments.
+ if (typeof value == 'string') {
+ return value;
+ }
+ if (isSymbol(value)) {
+ return symbolToString ? symbolToString.call(value) : '';
+ }
+ var result = (value + '');
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
+ }
+
+ /**
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
*
* @private
@@ -40440,6 +39427,7 @@ return jQuery;
var value = array[index],
computed = iteratee ? iteratee(value) : value;
+ value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
@@ -40471,10 +39459,25 @@ return jQuery;
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
- path = isKey(path, object) ? [path + ''] : baseCastPath(path);
+ path = isKey(path, object) ? [path] : castPath(path);
object = parent(object, path);
- var key = last(path);
- return (object != null && has(object, key)) ? delete object[key] : true;
+
+ var key = toKey(last(path));
+ return !(object != null && baseHas(object, key)) || delete object[key];
+ }
+
+ /**
+ * The base implementation of `_.update`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path of the property to update.
+ * @param {Function} updater The function to produce the updated value.
+ * @param {Function} [customizer] The function to customize path creation.
+ * @returns {Object} Returns `object`.
+ */
+ function baseUpdate(object, path, updater, customizer) {
+ return baseSet(object, path, updater(baseGet(object, path)), customizer);
}
/**
@@ -40549,7 +39552,7 @@ return jQuery;
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
*
* @private
- * @param {Array} props The property names.
+ * @param {Array} props The property identifiers.
* @param {Array} values The property values.
* @param {Function} assignFunc The function to assign values.
* @returns {Object} Returns the new object.
@@ -40561,12 +39564,61 @@ return jQuery;
result = {};
while (++index < length) {
- assignFunc(result, props[index], index < valsLength ? values[index] : undefined);
+ var value = index < valsLength ? values[index] : undefined;
+ assignFunc(result, props[index], value);
}
return result;
}
/**
+ * Casts `value` to an empty array if it's not an array like object.
+ *
+ * @private
+ * @param {*} value The value to inspect.
+ * @returns {Array|Object} Returns the cast array-like object.
+ */
+ function castArrayLikeObject(value) {
+ return isArrayLikeObject(value) ? value : [];
+ }
+
+ /**
+ * Casts `value` to `identity` if it's not a function.
+ *
+ * @private
+ * @param {*} value The value to inspect.
+ * @returns {Function} Returns cast function.
+ */
+ function castFunction(value) {
+ return typeof value == 'function' ? value : identity;
+ }
+
+ /**
+ * Casts `value` to a path array if it's not one.
+ *
+ * @private
+ * @param {*} value The value to inspect.
+ * @returns {Array} Returns the cast property path array.
+ */
+ function castPath(value) {
+ return isArray(value) ? value : stringToPath(value);
+ }
+
+ /**
+ * Casts `array` to a slice if it's needed.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {number} start The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the cast slice.
+ */
+ function castSlice(array, start, end) {
+ var length = array.length;
+ end = end === undefined ? length : end;
+ return (!start && end >= length) ? array : baseSlice(array, start, end);
+ }
+
+ /**
* Creates a clone of `buffer`.
*
* @private
@@ -40578,9 +39630,7 @@ return jQuery;
if (isDeep) {
return buffer.slice();
}
- var Ctor = buffer.constructor,
- result = new Ctor(buffer.length);
-
+ var result = new buffer.constructor(buffer.length);
buffer.copy(result);
return result;
}
@@ -40593,24 +39643,36 @@ return jQuery;
* @returns {ArrayBuffer} Returns the cloned array buffer.
*/
function cloneArrayBuffer(arrayBuffer) {
- var Ctor = arrayBuffer.constructor,
- result = new Ctor(arrayBuffer.byteLength),
- view = new Uint8Array(result);
-
- view.set(new Uint8Array(arrayBuffer));
+ var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
+ new Uint8Array(result).set(new Uint8Array(arrayBuffer));
return result;
}
/**
+ * Creates a clone of `dataView`.
+ *
+ * @private
+ * @param {Object} dataView The data view to clone.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Object} Returns the cloned data view.
+ */
+ function cloneDataView(dataView, isDeep) {
+ var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
+ return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
+ }
+
+ /**
* Creates a clone of `map`.
*
* @private
* @param {Object} map The map to clone.
+ * @param {Function} cloneFunc The function to clone values.
+ * @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned map.
*/
- function cloneMap(map) {
- var Ctor = map.constructor;
- return arrayReduce(mapToArray(map), addMapEntry, new Ctor);
+ function cloneMap(map, isDeep, cloneFunc) {
+ var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
+ return arrayReduce(array, addMapEntry, new map.constructor);
}
/**
@@ -40621,9 +39683,7 @@ return jQuery;
* @returns {Object} Returns the cloned regexp.
*/
function cloneRegExp(regexp) {
- var Ctor = regexp.constructor,
- result = new Ctor(regexp.source, reFlags.exec(regexp));
-
+ var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
result.lastIndex = regexp.lastIndex;
return result;
}
@@ -40633,11 +39693,13 @@ return jQuery;
*
* @private
* @param {Object} set The set to clone.
+ * @param {Function} cloneFunc The function to clone values.
+ * @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned set.
*/
- function cloneSet(set) {
- var Ctor = set.constructor;
- return arrayReduce(setToArray(set), addSetEntry, new Ctor);
+ function cloneSet(set, isDeep, cloneFunc) {
+ var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
+ return arrayReduce(array, addSetEntry, new set.constructor);
}
/**
@@ -40648,7 +39710,7 @@ return jQuery;
* @returns {Object} Returns the cloned symbol object.
*/
function cloneSymbol(symbol) {
- return Symbol ? Object(symbolValueOf.call(symbol)) : {};
+ return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
}
/**
@@ -40660,11 +39722,87 @@ return jQuery;
* @returns {Object} Returns the cloned typed array.
*/
function cloneTypedArray(typedArray, isDeep) {
- var arrayBuffer = typedArray.buffer,
- buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer,
- Ctor = typedArray.constructor;
+ var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
+ return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
+ }
- return new Ctor(buffer, typedArray.byteOffset, typedArray.length);
+ /**
+ * Compares values to sort them in ascending order.
+ *
+ * @private
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {number} Returns the sort order indicator for `value`.
+ */
+ function compareAscending(value, other) {
+ if (value !== other) {
+ var valIsDefined = value !== undefined,
+ valIsNull = value === null,
+ valIsReflexive = value === value,
+ valIsSymbol = isSymbol(value);
+
+ var othIsDefined = other !== undefined,
+ othIsNull = other === null,
+ othIsReflexive = other === other,
+ othIsSymbol = isSymbol(other);
+
+ if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
+ (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
+ (valIsNull && othIsDefined && othIsReflexive) ||
+ (!valIsDefined && othIsReflexive) ||
+ !valIsReflexive) {
+ return 1;
+ }
+ if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
+ (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
+ (othIsNull && valIsDefined && valIsReflexive) ||
+ (!othIsDefined && valIsReflexive) ||
+ !othIsReflexive) {
+ return -1;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Used by `_.orderBy` to compare multiple properties of a value to another
+ * and stable sort them.
+ *
+ * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
+ * specify an order of "desc" for descending or "asc" for ascending sort order
+ * of corresponding values.
+ *
+ * @private
+ * @param {Object} object The object to compare.
+ * @param {Object} other The other object to compare.
+ * @param {boolean[]|string[]} orders The order to sort by for each property.
+ * @returns {number} Returns the sort order indicator for `object`.
+ */
+ function compareMultiple(object, other, orders) {
+ var index = -1,
+ objCriteria = object.criteria,
+ othCriteria = other.criteria,
+ length = objCriteria.length,
+ ordersLength = orders.length;
+
+ while (++index < length) {
+ var result = compareAscending(objCriteria[index], othCriteria[index]);
+ if (result) {
+ if (index >= ordersLength) {
+ return result;
+ }
+ var order = orders[index];
+ return result * (order == 'desc' ? -1 : 1);
+ }
+ }
+ // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
+ // that causes it, under certain circumstances, to provide the same value for
+ // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
+ // for more details.
+ //
+ // This also ensures a stable sort in V8 and other engines.
+ // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
+ return object.index - other.index;
}
/**
@@ -40763,26 +39901,12 @@ return jQuery;
*
* @private
* @param {Object} source The object to copy properties from.
- * @param {Array} props The property names to copy.
- * @param {Object} [object={}] The object to copy properties to.
- * @returns {Object} Returns `object`.
- */
- function copyObject(source, props, object) {
- return copyObjectWith(source, props, object);
- }
-
- /**
- * This function is like `copyObject` except that it accepts a function to
- * customize copied values.
- *
- * @private
- * @param {Object} source The object to copy properties from.
- * @param {Array} props The property names to copy.
+ * @param {Array} props The property identifiers to copy.
* @param {Object} [object={}] The object to copy properties to.
* @param {Function} [customizer] The function to customize copied values.
* @returns {Object} Returns `object`.
*/
- function copyObjectWith(source, props, object, customizer) {
+ function copyObject(source, props, object, customizer) {
object || (object = {});
var index = -1,
@@ -40892,7 +40016,7 @@ return jQuery;
}
/**
- * Creates a base function for methods like `_.forIn`.
+ * Creates a base function for methods like `_.forIn` and `_.forOwn`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
@@ -40921,7 +40045,8 @@ return jQuery;
*
* @private
* @param {Function} func The function to wrap.
- * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
+ * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
+ * for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @returns {Function} Returns the new wrapped function.
*/
@@ -40951,8 +40076,13 @@ return jQuery;
? stringToArray(string)
: undefined;
- var chr = strSymbols ? strSymbols[0] : string.charAt(0),
- trailing = strSymbols ? strSymbols.slice(1).join('') : string.slice(1);
+ var chr = strSymbols
+ ? strSymbols[0]
+ : string.charAt(0);
+
+ var trailing = strSymbols
+ ? castSlice(strSymbols, 1).join('')
+ : string.slice(1);
return chr[methodName]() + trailing;
};
@@ -40967,7 +40097,7 @@ return jQuery;
*/
function createCompounder(callback) {
return function(string) {
- return arrayReduce(words(deburr(string)), callback, '');
+ return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
};
}
@@ -40981,8 +40111,8 @@ return jQuery;
*/
function createCtorWrapper(Ctor) {
return function() {
- // Use a `switch` statement to work with class constructors.
- // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
+ // Use a `switch` statement to work with class constructors. See
+ // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
// for more details.
var args = arguments;
switch (args.length) {
@@ -41009,7 +40139,8 @@ return jQuery;
*
* @private
* @param {Function} func The function to wrap.
- * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
+ * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
+ * for more details.
* @param {number} arity The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
@@ -41081,7 +40212,9 @@ return jQuery;
) {
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
} else {
- wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);
+ wrapper = (func.length == 1 && isLaziable(func))
+ ? wrapper[funcName]()
+ : wrapper.thru(func);
}
}
return function() {
@@ -41109,11 +40242,14 @@ return jQuery;
*
* @private
* @param {Function|string} func The function or method name to wrap.
- * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
+ * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
+ * for more details.
* @param {*} [thisArg] The `this` binding of `func`.
- * @param {Array} [partials] The arguments to prepend to those provided to the new function.
+ * @param {Array} [partials] The arguments to prepend to those provided to
+ * the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
- * @param {Array} [partialsRight] The arguments to append to those provided to the new function.
+ * @param {Array} [partialsRight] The arguments to append to those provided
+ * to the new function.
* @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
@@ -41189,6 +40325,39 @@ return jQuery;
}
/**
+ * Creates a function that performs a mathematical operation on two values.
+ *
+ * @private
+ * @param {Function} operator The function to perform the operation.
+ * @returns {Function} Returns the new mathematical operation function.
+ */
+ function createMathOperation(operator) {
+ return function(value, other) {
+ var result;
+ if (value === undefined && other === undefined) {
+ return 0;
+ }
+ if (value !== undefined) {
+ result = value;
+ }
+ if (other !== undefined) {
+ if (result === undefined) {
+ return other;
+ }
+ if (typeof value == 'string' || typeof other == 'string') {
+ value = baseToString(value);
+ other = baseToString(other);
+ } else {
+ value = baseToNumber(value);
+ other = baseToNumber(other);
+ }
+ result = operator(value, other);
+ }
+ return result;
+ };
+ }
+
+ /**
* Creates a function like `_.over`.
*
* @private
@@ -41197,7 +40366,10 @@ return jQuery;
*/
function createOver(arrayFunc) {
return rest(function(iteratees) {
- iteratees = arrayMap(baseFlatten(iteratees, 1), getIteratee());
+ iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
+ ? arrayMap(iteratees[0], baseUnary(getIteratee()))
+ : arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseUnary(getIteratee()));
+
return rest(function(args) {
var thisArg = this;
return arrayFunc(iteratees, function(iteratee) {
@@ -41212,37 +40384,34 @@ return jQuery;
* is truncated if the number of characters exceeds `length`.
*
* @private
- * @param {string} string The string to create padding for.
- * @param {number} [length=0] The padding length.
+ * @param {number} length The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padding for `string`.
*/
- function createPadding(string, length, chars) {
- length = toInteger(length);
+ function createPadding(length, chars) {
+ chars = chars === undefined ? ' ' : baseToString(chars);
- var strLength = stringSize(string);
- if (!length || strLength >= length) {
- return '';
+ var charsLength = chars.length;
+ if (charsLength < 2) {
+ return charsLength ? baseRepeat(chars, length) : chars;
}
- var padLength = length - strLength;
- chars = chars === undefined ? ' ' : (chars + '');
-
- var result = repeat(chars, nativeCeil(padLength / stringSize(chars)));
+ var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
return reHasComplexSymbol.test(chars)
- ? stringToArray(result).slice(0, padLength).join('')
- : result.slice(0, padLength);
+ ? castSlice(stringToArray(result), 0, length).join('')
+ : result.slice(0, length);
}
/**
- * Creates a function that wraps `func` to invoke it with the optional `this`
- * binding of `thisArg` and the `partials` prepended to those provided to
- * the wrapper.
+ * Creates a function that wraps `func` to invoke it with the `this` binding
+ * of `thisArg` and `partials` prepended to the arguments it receives.
*
* @private
* @param {Function} func The function to wrap.
- * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
+ * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
+ * for more details.
* @param {*} thisArg The `this` binding of `func`.
- * @param {Array} partials The arguments to prepend to those provided to the new function.
+ * @param {Array} partials The arguments to prepend to those provided to
+ * the new function.
* @returns {Function} Returns the new wrapped function.
*/
function createPartialWrapper(func, bitmask, thisArg, partials) {
@@ -41295,15 +40464,34 @@ return jQuery;
}
/**
+ * Creates a function that performs a relational operation on two values.
+ *
+ * @private
+ * @param {Function} operator The function to perform the operation.
+ * @returns {Function} Returns the new relational operation function.
+ */
+ function createRelationalOperation(operator) {
+ return function(value, other) {
+ if (!(typeof value == 'string' && typeof other == 'string')) {
+ value = toNumber(value);
+ other = toNumber(other);
+ }
+ return operator(value, other);
+ };
+ }
+
+ /**
* Creates a function that wraps `func` to continue currying.
*
* @private
* @param {Function} func The function to wrap.
- * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
+ * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
+ * for more details.
* @param {Function} wrapFunc The function to create the `func` wrapper.
* @param {*} placeholder The placeholder value.
* @param {*} [thisArg] The `this` binding of `func`.
- * @param {Array} [partials] The arguments to prepend to those provided to the new function.
+ * @param {Array} [partials] The arguments to prepend to those provided to
+ * the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
@@ -41312,7 +40500,6 @@ return jQuery;
*/
function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
var isCurry = bitmask & CURRY_FLAG,
- newArgPos = argPos ? copyArray(argPos) : undefined,
newHolders = isCurry ? holders : undefined,
newHoldersRight = isCurry ? undefined : holders,
newPartials = isCurry ? partials : undefined,
@@ -41326,7 +40513,7 @@ return jQuery;
}
var newData = [
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
- newHoldersRight, newArgPos, ary, arity
+ newHoldersRight, argPos, ary, arity
];
var result = wrapFunc.apply(undefined, newData);
@@ -41369,7 +40556,7 @@ return jQuery;
* @param {Array} values The values to add to the set.
* @returns {Object} Returns the new set.
*/
- var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) {
+ var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
return new Set(values);
};
@@ -41461,9 +40648,10 @@ return jQuery;
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} [customizer] The function to customize comparisons.
- * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details.
- * @param {Object} [stack] Tracks traversed `array` and `other` objects.
+ * @param {Function} customizer The function to customize comparisons.
+ * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
+ * for more details.
+ * @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
@@ -41504,12 +40692,16 @@ return jQuery;
// Recursively compare arrays (susceptible to call stack limits).
if (isUnordered) {
if (!arraySome(other, function(othValue) {
- return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack);
+ return arrValue === othValue ||
+ equalFunc(arrValue, othValue, customizer, bitmask, stack);
})) {
result = false;
break;
}
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
+ } else if (!(
+ arrValue === othValue ||
+ equalFunc(arrValue, othValue, customizer, bitmask, stack)
+ )) {
result = false;
break;
}
@@ -41530,12 +40722,22 @@ return jQuery;
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} [customizer] The function to customize comparisons.
- * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details.
+ * @param {Function} customizer The function to customize comparisons.
+ * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
+ * for more details.
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
- function equalByTag(object, other, tag, equalFunc, customizer, bitmask) {
+ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
switch (tag) {
+ case dataViewTag:
+ if ((object.byteLength != other.byteLength) ||
+ (object.byteOffset != other.byteOffset)) {
+ return false;
+ }
+ object = object.buffer;
+ other = other.buffer;
+
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
@@ -41545,8 +40747,9 @@ return jQuery;
case boolTag:
case dateTag:
- // Coerce dates and booleans to numbers, dates to milliseconds and booleans
- // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
+ // Coerce dates and booleans to numbers, dates to milliseconds and
+ // booleans to `1` or `0` treating invalid dates coerced to `NaN` as
+ // not equal.
return +object == +other;
case errorTag:
@@ -41558,8 +40761,9 @@ return jQuery;
case regexpTag:
case stringTag:
- // Coerce regexes to strings and treat strings primitives and string
- // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
+ // Coerce regexes to strings and treat strings, primitives and objects,
+ // as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring
+ // for more details.
return object == (other + '');
case mapTag:
@@ -41569,12 +40773,24 @@ return jQuery;
var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
convert || (convert = setToArray);
+ if (object.size != other.size && !isPartial) {
+ return false;
+ }
+ // Assume cyclic values are equal.
+ var stacked = stack.get(object);
+ if (stacked) {
+ return stacked == other;
+ }
+ bitmask |= UNORDERED_COMPARE_FLAG;
+ stack.set(object, other);
+
// Recursively compare objects (susceptible to call stack limits).
- return (isPartial || object.size == other.size) &&
- equalFunc(convert(object), convert(other), customizer, bitmask | UNORDERED_COMPARE_FLAG);
+ return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
case symbolTag:
- return !!Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other));
+ if (symbolValueOf) {
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
+ }
}
return false;
}
@@ -41587,9 +40803,10 @@ return jQuery;
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} [customizer] The function to customize comparisons.
- * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details.
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
+ * @param {Function} customizer The function to customize comparisons.
+ * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
+ * for more details.
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
@@ -41655,6 +40872,29 @@ return jQuery;
}
/**
+ * Creates an array of own enumerable property names and symbols of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names and symbols.
+ */
+ function getAllKeys(object) {
+ return baseGetAllKeys(object, keys, getSymbols);
+ }
+
+ /**
+ * Creates an array of own and inherited enumerable property names and
+ * symbols of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names and symbols.
+ */
+ function getAllKeysIn(object) {
+ return baseGetAllKeys(object, keysIn, getSymbolsIn);
+ }
+
+ /**
* Gets metadata for `func`.
*
* @private
@@ -41688,10 +40928,10 @@ return jQuery;
}
/**
- * Gets the appropriate "iteratee" function. If the `_.iteratee` method is
- * customized this function returns the custom method, otherwise it returns
- * `baseIteratee`. If arguments are provided the chosen function is invoked
- * with them and its result is returned.
+ * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
+ * this function returns the custom method, otherwise it returns `baseIteratee`.
+ * If arguments are provided, the chosen function is invoked with them and
+ * its result is returned.
*
* @private
* @param {*} [value] The value to convert to an iteratee.
@@ -41707,8 +40947,9 @@ return jQuery;
/**
* Gets the "length" property value of `object`.
*
- * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
- * that affects Safari on at least iOS 8.1-8.3 ARM64.
+ * **Note:** This function is used to avoid a
+ * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects
+ * Safari on at least iOS 8.1-8.3 ARM64.
*
* @private
* @param {Object} object The object to query.
@@ -41742,7 +40983,7 @@ return jQuery;
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
- var value = object == null ? undefined : object[key];
+ var value = object[key];
return isNative(value) ? value : undefined;
}
@@ -41759,14 +41000,51 @@ return jQuery;
}
/**
- * Creates an array of the own symbol properties of `object`.
+ * Gets the `[[Prototype]]` of `value`.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {null|Object} Returns the `[[Prototype]]`.
+ */
+ function getPrototype(value) {
+ return nativeGetPrototype(Object(value));
+ }
+
+ /**
+ * Creates an array of the own enumerable symbol properties of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
- var getSymbols = getOwnPropertySymbols || function() {
- return [];
+ function getSymbols(object) {
+ // Coerce `object` to an object to avoid non-object errors in V8.
+ // See https://bugs.chromium.org/p/v8/issues/detail?id=3443 for more details.
+ return getOwnPropertySymbols(Object(object));
+ }
+
+ // Fallback for IE < 11.
+ if (!getOwnPropertySymbols) {
+ getSymbols = function() {
+ return [];
+ };
+ }
+
+ /**
+ * Creates an array of the own and inherited enumerable symbol properties
+ * of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of symbols.
+ */
+ var getSymbolsIn = !getOwnPropertySymbols ? getSymbols : function(object) {
+ var result = [];
+ while (object) {
+ arrayPush(result, getSymbols(object));
+ object = getPrototype(object);
+ }
+ return result;
};
/**
@@ -41780,18 +41058,23 @@ return jQuery;
return objectToString.call(value);
}
- // Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps.
- if ((Map && getTag(new Map) != mapTag) ||
+ // Fallback for data views, maps, sets, and weak maps in IE 11,
+ // for data views in Edge, and promises in Node.js.
+ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
+ (Map && getTag(new Map) != mapTag) ||
+ (Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = objectToString.call(value),
- Ctor = result == objectTag ? value.constructor : null,
- ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : '';
+ Ctor = result == objectTag ? value.constructor : undefined,
+ ctorString = Ctor ? toSource(Ctor) : undefined;
if (ctorString) {
switch (ctorString) {
+ case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
+ case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
@@ -41838,23 +41121,25 @@ return jQuery;
* @returns {boolean} Returns `true` if `path` exists, else `false`.
*/
function hasPath(object, path, hasFunc) {
- if (object == null) {
- return false;
- }
- var result = hasFunc(object, path);
- if (!result && !isKey(path)) {
- path = baseCastPath(path);
- object = parent(object, path);
- if (object != null) {
- path = last(path);
- result = hasFunc(object, path);
+ path = isKey(path, object) ? [path] : castPath(path);
+
+ var result,
+ index = -1,
+ length = path.length;
+
+ while (++index < length) {
+ var key = toKey(path[index]);
+ if (!(result = object != null && hasFunc(object, key))) {
+ break;
}
+ object = object[key];
}
- var length = object ? object.length : undefined;
- return result || (
- !!length && isLength(length) && isIndex(path, length) &&
- (isArray(object) || isString(object) || isArguments(object))
- );
+ if (result) {
+ return result;
+ }
+ var length = object ? object.length : 0;
+ return !!length && isLength(length) && isIndex(key, length) &&
+ (isArray(object) || isString(object) || isArguments(object));
}
/**
@@ -41884,8 +41169,8 @@ return jQuery;
* @returns {Object} Returns the initialized clone.
*/
function initCloneObject(object) {
- return (isFunction(object.constructor) && !isPrototype(object))
- ? baseCreate(getPrototypeOf(object))
+ return (typeof object.constructor == 'function' && !isPrototype(object))
+ ? baseCreate(getPrototype(object))
: {};
}
@@ -41898,10 +41183,11 @@ return jQuery;
* @private
* @param {Object} object The object to clone.
* @param {string} tag The `toStringTag` of the object to clone.
+ * @param {Function} cloneFunc The function to clone values.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the initialized clone.
*/
- function initCloneByTag(object, tag, isDeep) {
+ function initCloneByTag(object, tag, cloneFunc, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
@@ -41911,13 +41197,16 @@ return jQuery;
case dateTag:
return new Ctor(+object);
+ case dataViewTag:
+ return cloneDataView(object, isDeep);
+
case float32Tag: case float64Tag:
case int8Tag: case int16Tag: case int32Tag:
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
return cloneTypedArray(object, isDeep);
case mapTag:
- return cloneMap(object);
+ return cloneMap(object, isDeep, cloneFunc);
case numberTag:
case stringTag:
@@ -41927,7 +41216,7 @@ return jQuery;
return cloneRegExp(object);
case setTag:
- return cloneSet(object);
+ return cloneSet(object, isDeep, cloneFunc);
case symbolTag:
return cloneSymbol(object);
@@ -41952,13 +41241,52 @@ return jQuery;
}
/**
+ * Checks if `value` is a flattenable `arguments` object or array.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
+ */
+ function isFlattenable(value) {
+ return isArrayLikeObject(value) && (isArray(value) || isArguments(value));
+ }
+
+ /**
+ * Checks if `value` is a flattenable array and not a `_.matchesProperty`
+ * iteratee shorthand.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
+ */
+ function isFlattenableIteratee(value) {
+ return isArray(value) && !(value.length == 2 && !isFunction(value[0]));
+ }
+
+ /**
+ * Checks if `value` is a valid array-like index.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+ */
+ function isIndex(value, length) {
+ length = length == null ? MAX_SAFE_INTEGER : length;
+ return !!length &&
+ (typeof value == 'number' || reIsUint.test(value)) &&
+ (value > -1 && value % 1 == 0 && value < length);
+ }
+
+ /**
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
+ * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
+ * else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
@@ -41966,8 +41294,9 @@ return jQuery;
}
var type = typeof index;
if (type == 'number'
- ? (isArrayLike(object) && isIndex(index, object.length))
- : (type == 'string' && index in object)) {
+ ? (isArrayLike(object) && isIndex(index, object.length))
+ : (type == 'string' && index in object)
+ ) {
return eq(object[index], value);
}
return false;
@@ -41982,12 +41311,16 @@ return jQuery;
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
- if (typeof value == 'number') {
+ if (isArray(value)) {
+ return false;
+ }
+ var type = typeof value;
+ if (type == 'number' || type == 'symbol' || type == 'boolean' ||
+ value == null || isSymbol(value)) {
return true;
}
- return !isArray(value) &&
- (reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
- (object != null && value in Object(object)));
+ return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
+ (object != null && value in Object(object));
}
/**
@@ -41999,8 +41332,9 @@ return jQuery;
*/
function isKeyable(value) {
var type = typeof value;
- return type == 'number' || type == 'boolean' ||
- (type == 'string' && value != '__proto__') || value == null;
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
+ ? (value !== '__proto__')
+ : (value === null);
}
/**
@@ -42008,7 +41342,8 @@ return jQuery;
*
* @private
* @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.
+ * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
+ * else `false`.
*/
function isLaziable(func) {
var funcName = getFuncName(func),
@@ -42033,7 +41368,7 @@ return jQuery;
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
- proto = (isFunction(Ctor) && Ctor.prototype) || objectProto;
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
@@ -42051,14 +41386,34 @@ return jQuery;
}
/**
+ * A specialized version of `matchesProperty` for source values suitable
+ * for strict equality comparisons, i.e. `===`.
+ *
+ * @private
+ * @param {string} key The key of the property to get.
+ * @param {*} srcValue The value to match.
+ * @returns {Function} Returns the new function.
+ */
+ function matchesStrictComparable(key, srcValue) {
+ return function(object) {
+ if (object == null) {
+ return false;
+ }
+ return object[key] === srcValue &&
+ (srcValue !== undefined || (key in Object(object)));
+ };
+ }
+
+ /**
* Merges the function metadata of `source` into `data`.
*
* Merging metadata reduces the number of wrappers used to invoke a function.
* This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
- * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`
- * modify function arguments, making the order in which they are executed important,
- * preventing the merging of metadata. However, we make an exception for a safe
- * combined case where curried functions have `_.ary` and or `_.rearg` applied.
+ * may be applied regardless of execution order. Methods like `_.ary` and
+ * `_.rearg` modify function arguments, making the order in which they are
+ * executed important, preventing the merging of metadata. However, we make
+ * an exception for a safe combined case where curried functions have `_.ary`
+ * and or `_.rearg` applied.
*
* @private
* @param {Array} data The destination metadata.
@@ -42090,20 +41445,20 @@ return jQuery;
var value = source[3];
if (value) {
var partials = data[3];
- data[3] = partials ? composeArgs(partials, value, source[4]) : copyArray(value);
- data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : copyArray(source[4]);
+ data[3] = partials ? composeArgs(partials, value, source[4]) : value;
+ data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
}
// Compose partial right arguments.
value = source[5];
if (value) {
partials = data[5];
- data[5] = partials ? composeArgsRight(partials, value, source[6]) : copyArray(value);
- data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : copyArray(source[6]);
+ data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
+ data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
}
// Use source `argPos` if available.
value = source[7];
if (value) {
- data[7] = copyArray(value);
+ data[7] = value;
}
// Use source `ary` if it's smaller.
if (srcBitmask & ARY_FLAG) {
@@ -42129,13 +41484,13 @@ return jQuery;
* @param {string} key The key of the property to merge.
* @param {Object} object The parent object of `objValue`.
* @param {Object} source The parent object of `srcValue`.
- * @param {Object} [stack] Tracks traversed source values and their merged counterparts.
+ * @param {Object} [stack] Tracks traversed source values and their merged
+ * counterparts.
* @returns {*} Returns the value to assign.
*/
function mergeDefaults(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) {
- stack.set(srcValue, objValue);
- baseMerge(objValue, srcValue, undefined, mergeDefaults, stack);
+ baseMerge(objValue, srcValue, undefined, mergeDefaults, stack.set(srcValue, objValue));
}
return objValue;
}
@@ -42149,7 +41504,7 @@ return jQuery;
* @returns {*} Returns the parent value.
*/
function parent(object, path) {
- return path.length == 1 ? object : get(object, baseSlice(path, 0, -1));
+ return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
}
/**
@@ -42178,8 +41533,9 @@ return jQuery;
* Sets metadata for `func`.
*
* **Note:** If this function becomes hot, i.e. is invoked a lot in a short
- * period of time, it will trip its breaker and transition to an identity function
- * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070)
+ * period of time, it will trip its breaker and transition to an identity
+ * function to avoid garbage collection pauses in V8. See
+ * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
* for more details.
*
* @private
@@ -42214,12 +41570,46 @@ return jQuery;
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
- function stringToPath(string) {
+ var stringToPath = memoize(function(string) {
var result = [];
toString(string).replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
+ });
+
+ /**
+ * Converts `value` to a string key if it's not a string or symbol.
+ *
+ * @private
+ * @param {*} value The value to inspect.
+ * @returns {string|symbol} Returns the key.
+ */
+ function toKey(value) {
+ if (typeof value == 'string' || isSymbol(value)) {
+ return value;
+ }
+ var result = (value + '');
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
+ }
+
+ /**
+ * Converts `func` to its source code.
+ *
+ * @private
+ * @param {Function} func The function to process.
+ * @returns {string} Returns the source code.
+ */
+ function toSource(func) {
+ if (func != null) {
+ try {
+ return funcToString.call(func);
+ } catch (e) {}
+ try {
+ return (func + '');
+ } catch (e) {}
+ }
+ return '';
}
/**
@@ -42249,9 +41639,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to process.
- * @param {number} [size=0] The length of each chunk.
+ * @param {number} [size=1] The length of each chunk
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the new array containing chunks.
* @example
*
@@ -42261,19 +41653,22 @@ return jQuery;
* _.chunk(['a', 'b', 'c', 'd'], 3);
* // => [['a', 'b', 'c'], ['d']]
*/
- function chunk(array, size) {
- size = nativeMax(toInteger(size), 0);
-
+ function chunk(array, size, guard) {
+ if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
+ size = 1;
+ } else {
+ size = nativeMax(toInteger(size), 0);
+ }
var length = array ? array.length : 0;
if (!length || size < 1) {
return [];
}
var index = 0,
- resIndex = -1,
+ resIndex = 0,
result = Array(nativeCeil(length / size));
while (index < length) {
- result[++resIndex] = baseSlice(array, index, (index += size));
+ result[resIndex++] = baseSlice(array, index, (index += size));
}
return result;
}
@@ -42284,6 +41679,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to compact.
* @returns {Array} Returns the new array of filtered values.
@@ -42295,13 +41691,13 @@ return jQuery;
function compact(array) {
var index = -1,
length = array ? array.length : 0,
- resIndex = -1,
+ resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value) {
- result[++resIndex] = value;
+ result[resIndex++] = value;
}
}
return result;
@@ -42313,6 +41709,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to concatenate.
* @param {...*} [values] The values to concatenate.
@@ -42328,25 +41725,34 @@ return jQuery;
* console.log(array);
* // => [1]
*/
- var concat = rest(function(array, values) {
- if (!isArray(array)) {
- array = array == null ? [] : [Object(array)];
+ function concat() {
+ var length = arguments.length,
+ array = castArray(arguments[0]);
+
+ if (length < 2) {
+ return length ? copyArray(array) : [];
}
- values = baseFlatten(values, 1);
- return arrayConcat(array, values);
- });
+ var args = Array(length - 1);
+ while (length--) {
+ args[length - 1] = arguments[length];
+ }
+ return arrayConcat(array, baseFlatten(args, 1));
+ }
/**
- * Creates an array of unique `array` values not included in the other
- * given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
- * for equality comparisons.
+ * Creates an array of unique `array` values not included in the other given
+ * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * for equality comparisons. The order of result values is determined by the
+ * order they occur in the first array.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
+ * @see _.without, _.xor
* @example
*
* _.difference([3, 2, 1], [4, 2]);
@@ -42354,21 +41760,24 @@ return jQuery;
*/
var difference = rest(function(array, values) {
return isArrayLikeObject(array)
- ? baseDifference(array, baseFlatten(values, 1, true))
+ ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
: [];
});
/**
* This method is like `_.difference` except that it accepts `iteratee` which
* is invoked for each element of `array` and `values` to generate the criterion
- * by which uniqueness is computed. The iteratee is invoked with one argument: (value).
+ * by which they're compared. Result values are chosen from the first array.
+ * The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Array} Returns the new array of filtered values.
* @example
*
@@ -42385,17 +41794,19 @@ return jQuery;
iteratee = undefined;
}
return isArrayLikeObject(array)
- ? baseDifference(array, baseFlatten(values, 1, true), getIteratee(iteratee))
+ ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee))
: [];
});
/**
* This method is like `_.difference` except that it accepts `comparator`
- * which is invoked to compare elements of `array` to `values`. The comparator
- * is invoked with two arguments: (arrVal, othVal).
+ * which is invoked to compare elements of `array` to `values`. Result values
+ * are chosen from the first array. The comparator is invoked with two arguments:
+ * (arrVal, othVal).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
@@ -42414,7 +41825,7 @@ return jQuery;
comparator = undefined;
}
return isArrayLikeObject(array)
- ? baseDifference(array, baseFlatten(values, 1, true), undefined, comparator)
+ ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
: [];
});
@@ -42423,10 +41834,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.5.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to drop.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
@@ -42456,10 +41868,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to drop.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
@@ -42492,9 +41905,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
@@ -42532,9 +41947,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
@@ -42573,6 +41990,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.2.0
* @category Array
* @param {Array} array The array to fill.
* @param {*} value The value to fill `array` with.
@@ -42611,9 +42029,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 1.1.0
* @category Array
* @param {Array} array The array to search.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
@@ -42650,9 +42070,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Array
* @param {Array} array The array to search.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
@@ -42688,6 +42110,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
@@ -42706,6 +42129,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
@@ -42724,6 +42148,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.4.0
* @category Array
* @param {Array} array The array to flatten.
* @param {number} [depth=1] The maximum recursion depth.
@@ -42753,6 +42178,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} pairs The key-value pairs.
* @returns {Object} Returns the new object.
@@ -42778,6 +42204,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @alias first
* @category Array
* @param {Array} array The array to query.
@@ -42791,17 +42218,18 @@ return jQuery;
* // => undefined
*/
function head(array) {
- return array ? array[0] : undefined;
+ return (array && array.length) ? array[0] : undefined;
}
/**
* Gets the index at which the first occurrence of `value` is found in `array`
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
- * for equality comparisons. If `fromIndex` is negative, it's used as the offset
- * from the end of `array`.
+ * for equality comparisons. If `fromIndex` is negative, it's used as the
+ * offset from the end of `array`.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to search.
* @param {*} value The value to search for.
@@ -42833,6 +42261,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @returns {Array} Returns the slice of `array`.
@@ -42848,20 +42277,22 @@ return jQuery;
/**
* Creates an array of unique values that are included in all given arrays
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
- * for equality comparisons.
+ * for equality comparisons. The order of result values is determined by the
+ * order they occur in the first array.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @returns {Array} Returns the new array of shared values.
+ * @returns {Array} Returns the new array of intersecting values.
* @example
*
* _.intersection([2, 1], [4, 2], [1, 2]);
* // => [2]
*/
var intersection = rest(function(arrays) {
- var mapped = arrayMap(arrays, baseCastArrayLikeObject);
+ var mapped = arrayMap(arrays, castArrayLikeObject);
return (mapped.length && mapped[0] === arrays[0])
? baseIntersection(mapped)
: [];
@@ -42870,14 +42301,17 @@ return jQuery;
/**
* This method is like `_.intersection` except that it accepts `iteratee`
* which is invoked for each element of each `arrays` to generate the criterion
- * by which uniqueness is computed. The iteratee is invoked with one argument: (value).
+ * by which they're compared. Result values are chosen from the first array.
+ * The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {Array} Returns the new array of shared values.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
+ * @returns {Array} Returns the new array of intersecting values.
* @example
*
* _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor);
@@ -42889,7 +42323,7 @@ return jQuery;
*/
var intersectionBy = rest(function(arrays) {
var iteratee = last(arrays),
- mapped = arrayMap(arrays, baseCastArrayLikeObject);
+ mapped = arrayMap(arrays, castArrayLikeObject);
if (iteratee === last(mapped)) {
iteratee = undefined;
@@ -42903,15 +42337,17 @@ return jQuery;
/**
* This method is like `_.intersection` except that it accepts `comparator`
- * which is invoked to compare elements of `arrays`. The comparator is invoked
- * with two arguments: (arrVal, othVal).
+ * which is invoked to compare elements of `arrays`. Result values are chosen
+ * from the first array. The comparator is invoked with two arguments:
+ * (arrVal, othVal).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns the new array of shared values.
+ * @returns {Array} Returns the new array of intersecting values.
* @example
*
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
@@ -42922,7 +42358,7 @@ return jQuery;
*/
var intersectionWith = rest(function(arrays) {
var comparator = last(arrays),
- mapped = arrayMap(arrays, baseCastArrayLikeObject);
+ mapped = arrayMap(arrays, castArrayLikeObject);
if (comparator === last(mapped)) {
comparator = undefined;
@@ -42939,6 +42375,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to convert.
* @param {string} [separator=','] The element separator.
@@ -42957,6 +42394,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the last element of `array`.
@@ -42976,6 +42414,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to search.
* @param {*} value The value to search for.
@@ -42998,7 +42437,11 @@ return jQuery;
var index = length;
if (fromIndex !== undefined) {
index = toInteger(fromIndex);
- index = (index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1)) + 1;
+ index = (
+ index < 0
+ ? nativeMax(length + index, 0)
+ : nativeMin(index, length - 1)
+ ) + 1;
}
if (value !== value) {
return indexOfNaN(array, index, true);
@@ -43012,6 +42455,31 @@ return jQuery;
}
/**
+ * Gets the nth element of `array`. If `n` is negative, the nth element
+ * from the end is returned.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.11.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {number} [n=0] The index of the element to return.
+ * @returns {*} Returns the nth element of `array`.
+ * @example
+ *
+ * var array = ['a', 'b', 'c', 'd'];
+ *
+ * _.nth(array, 1);
+ * // => 'b'
+ *
+ * _.nth(array, -2);
+ * // => 'c';
+ */
+ function nth(array, n) {
+ return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
+ }
+
+ /**
* Removes all given values from `array` using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons.
@@ -43021,6 +42489,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {...*} [values] The values to remove.
@@ -43042,6 +42511,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
@@ -43063,16 +42533,18 @@ return jQuery;
/**
* This method is like `_.pullAll` except that it accepts `iteratee` which is
* invoked for each element of `array` and `values` to generate the criterion
- * by which uniqueness is computed. The iteratee is invoked with one argument: (value).
+ * by which they're compared. The iteratee is invoked with one argument: (value).
*
* **Note:** Unlike `_.differenceBy`, this method mutates `array`.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Array} Returns `array`.
* @example
*
@@ -43084,7 +42556,36 @@ return jQuery;
*/
function pullAllBy(array, values, iteratee) {
return (array && array.length && values && values.length)
- ? basePullAllBy(array, values, getIteratee(iteratee))
+ ? basePullAll(array, values, getIteratee(iteratee))
+ : array;
+ }
+
+ /**
+ * This method is like `_.pullAll` except that it accepts `comparator` which
+ * is invoked to compare elements of `array` to `values`. The comparator is
+ * invoked with two arguments: (arrVal, othVal).
+ *
+ * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.6.0
+ * @category Array
+ * @param {Array} array The array to modify.
+ * @param {Array} values The values to remove.
+ * @param {Function} [comparator] The comparator invoked per element.
+ * @returns {Array} Returns `array`.
+ * @example
+ *
+ * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
+ *
+ * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
+ * console.log(array);
+ * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
+ */
+ function pullAllWith(array, values, comparator) {
+ return (array && array.length && values && values.length)
+ ? basePullAll(array, values, undefined, comparator)
: array;
}
@@ -43096,10 +42597,10 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to modify.
- * @param {...(number|number[])} [indexes] The indexes of elements to remove,
- * specified individually or in arrays.
+ * @param {...(number|number[])} [indexes] The indexes of elements to remove.
* @returns {Array} Returns the new array of removed elements.
* @example
*
@@ -43113,10 +42614,15 @@ return jQuery;
* // => [10, 20]
*/
var pullAt = rest(function(array, indexes) {
- indexes = arrayMap(baseFlatten(indexes, 1), String);
+ indexes = baseFlatten(indexes, 1);
+
+ var length = array ? array.length : 0,
+ result = baseAt(array, indexes);
+
+ basePullAt(array, arrayMap(indexes, function(index) {
+ return isIndex(index, length) ? +index : index;
+ }).sort(compareAscending));
- var result = baseAt(array, indexes);
- basePullAt(array, indexes.sort(compareAscending));
return result;
});
@@ -43130,9 +42636,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Array
* @param {Array} array The array to modify.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the new array of removed elements.
* @example
*
@@ -43177,7 +42685,9 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
+ * @param {Array} array The array to modify.
* @returns {Array} Returns `array`.
* @example
*
@@ -43196,11 +42706,13 @@ return jQuery;
/**
* Creates a slice of `array` from `start` up to, but not including, `end`.
*
- * **Note:** This method is used instead of [`Array#slice`](https://mdn.io/Array/slice)
- * to ensure dense arrays are returned.
+ * **Note:** This method is used instead of
+ * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
+ * returned.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
@@ -43224,15 +42736,17 @@ return jQuery;
}
/**
- * Uses a binary search to determine the lowest index at which `value` should
- * be inserted into `array` in order to maintain its sort order.
+ * Uses a binary search to determine the lowest index at which `value`
+ * should be inserted into `array` in order to maintain its sort order.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @returns {number} Returns the index at which `value` should be inserted into `array`.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
* @example
*
* _.sortedIndex([30, 50], 40);
@@ -43252,11 +42766,14 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {number} Returns the index at which `value` should be inserted into `array`.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
* @example
*
* var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };
@@ -43278,6 +42795,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to search.
* @param {*} value The value to search for.
@@ -43305,10 +42823,12 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @returns {number} Returns the index at which `value` should be inserted into `array`.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
* @example
*
* _.sortedLastIndex([4, 5], 4);
@@ -43325,11 +42845,14 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {number} Returns the index at which `value` should be inserted into `array`.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
* @example
*
* // The `_.property` iteratee shorthand.
@@ -43346,6 +42869,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to search.
* @param {*} value The value to search for.
@@ -43372,6 +42896,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @returns {Array} Returns the new duplicate free array.
@@ -43392,6 +42917,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
@@ -43403,7 +42929,7 @@ return jQuery;
*/
function sortedUniqBy(array, iteratee) {
return (array && array.length)
- ? baseSortedUniqBy(array, getIteratee(iteratee))
+ ? baseSortedUniq(array, getIteratee(iteratee))
: [];
}
@@ -43412,6 +42938,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to query.
* @returns {Array} Returns the slice of `array`.
@@ -43429,10 +42956,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to take.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
@@ -43461,10 +42989,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to take.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
@@ -43492,14 +43021,16 @@ return jQuery;
/**
* Creates a slice of `array` with elements taken from the end. Elements are
- * taken until `predicate` returns falsey. The predicate is invoked with three
- * arguments: (value, index, array).
+ * taken until `predicate` returns falsey. The predicate is invoked with
+ * three arguments: (value, index, array).
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
@@ -43537,9 +43068,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
@@ -43577,6 +43110,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of combined values.
@@ -43586,19 +43120,22 @@ return jQuery;
* // => [2, 1, 4]
*/
var union = rest(function(arrays) {
- return baseUniq(baseFlatten(arrays, 1, true));
+ return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
/**
* This method is like `_.union` except that it accepts `iteratee` which is
- * invoked for each element of each `arrays` to generate the criterion by which
- * uniqueness is computed. The iteratee is invoked with one argument: (value).
+ * invoked for each element of each `arrays` to generate the criterion by
+ * which uniqueness is computed. The iteratee is invoked with one argument:
+ * (value).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Array} Returns the new array of combined values.
* @example
*
@@ -43614,7 +43151,7 @@ return jQuery;
if (isArrayLikeObject(iteratee)) {
iteratee = undefined;
}
- return baseUniq(baseFlatten(arrays, 1, true), getIteratee(iteratee));
+ return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee));
});
/**
@@ -43624,6 +43161,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [comparator] The comparator invoked per element.
@@ -43641,17 +43179,18 @@ return jQuery;
if (isArrayLikeObject(comparator)) {
comparator = undefined;
}
- return baseUniq(baseFlatten(arrays, 1, true), undefined, comparator);
+ return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
});
/**
* Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
- * for equality comparisons, in which only the first occurrence of each element
- * is kept.
+ * for equality comparisons, in which only the first occurrence of each
+ * element is kept.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @returns {Array} Returns the new duplicate free array.
@@ -43673,9 +43212,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Array} Returns the new duplicate free array.
* @example
*
@@ -43699,6 +43240,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [comparator] The comparator invoked per element.
@@ -43723,6 +43265,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 1.2.0
* @category Array
* @param {Array} array The array of grouped elements to process.
* @returns {Array} Returns the new array of regrouped elements.
@@ -43757,9 +43300,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.8.0
* @category Array
* @param {Array} array The array of grouped elements to process.
- * @param {Function} [iteratee=_.identity] The function to combine regrouped values.
+ * @param {Function} [iteratee=_.identity] The function to combine
+ * regrouped values.
* @returns {Array} Returns the new array of regrouped elements.
* @example
*
@@ -43789,10 +43334,12 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to filter.
* @param {...*} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
+ * @see _.difference, _.xor
* @example
*
* _.without([1, 2, 1, 3], 1, 2);
@@ -43805,14 +43352,18 @@ return jQuery;
});
/**
- * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
- * of the given arrays.
+ * Creates an array of unique values that is the
+ * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
+ * of the given arrays. The order of result values is determined by the order
+ * they occur in the arrays.
*
* @static
* @memberOf _
+ * @since 2.4.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of values.
+ * @see _.difference, _.without
* @example
*
* _.xor([2, 1], [4, 2]);
@@ -43824,14 +43375,17 @@ return jQuery;
/**
* This method is like `_.xor` except that it accepts `iteratee` which is
- * invoked for each element of each `arrays` to generate the criterion by which
- * uniqueness is computed. The iteratee is invoked with one argument: (value).
+ * invoked for each element of each `arrays` to generate the criterion by
+ * which by which they're compared. The iteratee is invoked with one argument:
+ * (value).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Array} Returns the new array of values.
* @example
*
@@ -43857,6 +43411,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [comparator] The comparator invoked per element.
@@ -43878,12 +43433,13 @@ return jQuery;
});
/**
- * Creates an array of grouped elements, the first of which contains the first
- * elements of the given arrays, the second of which contains the second elements
- * of the given arrays, and so on.
+ * Creates an array of grouped elements, the first of which contains the
+ * first elements of the given arrays, the second of which contains the
+ * second elements of the given arrays, and so on.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to process.
* @returns {Array} Returns the new array of grouped elements.
@@ -43896,12 +43452,13 @@ return jQuery;
/**
* This method is like `_.fromPairs` except that it accepts two arrays,
- * one of property names and one of corresponding values.
+ * one of property identifiers and one of corresponding values.
*
* @static
* @memberOf _
+ * @since 0.4.0
* @category Array
- * @param {Array} [props=[]] The property names.
+ * @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
@@ -43918,8 +43475,9 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.1.0
* @category Array
- * @param {Array} [props=[]] The property names.
+ * @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
@@ -43938,6 +43496,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.8.0
* @category Array
* @param {...Array} [arrays] The arrays to process.
* @param {Function} [iteratee=_.identity] The function to combine grouped values.
@@ -43960,11 +43519,13 @@ return jQuery;
/*------------------------------------------------------------------------*/
/**
- * Creates a `lodash` object that wraps `value` with explicit method chaining enabled.
- * The result of such method chaining must be unwrapped with `_#value`.
+ * Creates a `lodash` wrapper instance that wraps `value` with explicit method
+ * chain sequences enabled. The result of such sequences must be unwrapped
+ * with `_#value`.
*
* @static
* @memberOf _
+ * @since 1.3.0
* @category Seq
* @param {*} value The value to wrap.
* @returns {Object} Returns the new `lodash` wrapper instance.
@@ -43995,10 +43556,11 @@ return jQuery;
/**
* This method invokes `interceptor` and returns `value`. The interceptor
* is invoked with one argument; (value). The purpose of this method is to
- * "tap into" a method chain in order to modify intermediate results.
+ * "tap into" a method chain sequence in order to modify intermediate results.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Seq
* @param {*} value The value to provide to `interceptor`.
* @param {Function} interceptor The function to invoke.
@@ -44022,10 +43584,11 @@ return jQuery;
/**
* This method is like `_.tap` except that it returns the result of `interceptor`.
* The purpose of this method is to "pass thru" values replacing intermediate
- * results in a method chain.
+ * results in a method chain sequence.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Seq
* @param {*} value The value to provide to `interceptor`.
* @param {Function} interceptor The function to invoke.
@@ -44050,9 +43613,9 @@ return jQuery;
*
* @name at
* @memberOf _
+ * @since 1.0.0
* @category Seq
- * @param {...(string|string[])} [paths] The property paths of elements to pick,
- * specified individually or in arrays.
+ * @param {...(string|string[])} [paths] The property paths of elements to pick.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
@@ -44090,10 +43653,11 @@ return jQuery;
});
/**
- * Enables explicit method chaining on the wrapper object.
+ * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
*
* @name chain
* @memberOf _
+ * @since 0.1.0
* @category Seq
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
@@ -44120,10 +43684,11 @@ return jQuery;
}
/**
- * Executes the chained sequence and returns the wrapped result.
+ * Executes the chain sequence and returns the wrapped result.
*
* @name commit
* @memberOf _
+ * @since 3.2.0
* @category Seq
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
@@ -44149,32 +43714,12 @@ return jQuery;
}
/**
- * This method is the wrapper version of `_.flatMap`.
- *
- * @name flatMap
- * @memberOf _
- * @category Seq
- * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Object} Returns the new `lodash` wrapper instance.
- * @example
- *
- * function duplicate(n) {
- * return [n, n];
- * }
- *
- * _([1, 2]).flatMap(duplicate).value();
- * // => [1, 1, 2, 2]
- */
- function wrapperFlatMap(iteratee) {
- return this.map(iteratee).flatten();
- }
-
- /**
* Gets the next value on a wrapped object following the
* [iterator protocol](https://mdn.io/iteration_protocols#iterator).
*
* @name next
* @memberOf _
+ * @since 4.0.0
* @category Seq
* @returns {Object} Returns the next iterator value.
* @example
@@ -44205,6 +43750,7 @@ return jQuery;
*
* @name Symbol.iterator
* @memberOf _
+ * @since 4.0.0
* @category Seq
* @returns {Object} Returns the wrapper object.
* @example
@@ -44222,10 +43768,11 @@ return jQuery;
}
/**
- * Creates a clone of the chained sequence planting `value` as the wrapped value.
+ * Creates a clone of the chain sequence planting `value` as the wrapped value.
*
* @name plant
* @memberOf _
+ * @since 3.2.0
* @category Seq
* @param {*} value The value to plant.
* @returns {Object} Returns the new `lodash` wrapper instance.
@@ -44271,6 +43818,7 @@ return jQuery;
*
* @name reverse
* @memberOf _
+ * @since 0.1.0
* @category Seq
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
@@ -44302,10 +43850,11 @@ return jQuery;
}
/**
- * Executes the chained sequence to extract the unwrapped value.
+ * Executes the chain sequence to resolve the unwrapped value.
*
* @name value
* @memberOf _
+ * @since 0.1.0
* @alias toJSON, valueOf
* @category Seq
* @returns {*} Returns the resolved unwrapped value.
@@ -44322,15 +43871,17 @@ return jQuery;
/**
* Creates an object composed of keys generated from the results of running
- * each element of `collection` through `iteratee`. The corresponding value
- * of each key is the number of times the key was returned by `iteratee`.
- * The iteratee is invoked with one argument: (value).
+ * each element of `collection` thru `iteratee`. The corresponding value of
+ * each key is the number of times the key was returned by `iteratee`. The
+ * iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
+ * @since 0.5.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
@@ -44351,19 +43902,22 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
- * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`.
* @example
*
* _.every([true, 1, null, 'yes'], Boolean);
* // => false
*
* var users = [
- * { 'user': 'barney', 'active': false },
- * { 'user': 'fred', 'active': false }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* // The `_.matches` iteratee shorthand.
@@ -44388,15 +43942,18 @@ return jQuery;
/**
* Iterates over elements of `collection`, returning an array of all elements
- * `predicate` returns truthy for. The predicate is invoked with three arguments:
- * (value, index|key, collection).
+ * `predicate` returns truthy for. The predicate is invoked with three
+ * arguments: (value, index|key, collection).
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
+ * @see _.reject
* @example
*
* var users = [
@@ -44426,14 +43983,16 @@ return jQuery;
/**
* Iterates over elements of `collection`, returning the first element
- * `predicate` returns truthy for. The predicate is invoked with three arguments:
- * (value, index|key, collection).
+ * `predicate` returns truthy for. The predicate is invoked with three
+ * arguments: (value, index|key, collection).
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to search.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
@@ -44473,9 +44032,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Collection
* @param {Array|Object} collection The collection to search.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
@@ -44494,15 +44055,17 @@ return jQuery;
}
/**
- * Creates an array of flattened values by running each element in `collection`
- * through `iteratee` and concating its result to the other mapped values.
- * The iteratee is invoked with three arguments: (value, index|key, collection).
+ * Creates a flattened array of values by running each element in `collection`
+ * thru `iteratee` and flattening the mapped results. The iteratee is invoked
+ * with three arguments: (value, index|key, collection).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the new flattened array.
* @example
*
@@ -44518,37 +44081,91 @@ return jQuery;
}
/**
- * Iterates over elements of `collection` invoking `iteratee` for each element.
+ * This method is like `_.flatMap` except that it recursively flattens the
+ * mapped results.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.7.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The function invoked per iteration.
+ * @returns {Array} Returns the new flattened array.
+ * @example
+ *
+ * function duplicate(n) {
+ * return [[[n, n]]];
+ * }
+ *
+ * _.flatMapDeep([1, 2], duplicate);
+ * // => [1, 1, 2, 2]
+ */
+ function flatMapDeep(collection, iteratee) {
+ return baseFlatten(map(collection, iteratee), INFINITY);
+ }
+
+ /**
+ * This method is like `_.flatMap` except that it recursively flattens the
+ * mapped results up to `depth` times.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.7.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The function invoked per iteration.
+ * @param {number} [depth=1] The maximum recursion depth.
+ * @returns {Array} Returns the new flattened array.
+ * @example
+ *
+ * function duplicate(n) {
+ * return [[[n, n]]];
+ * }
+ *
+ * _.flatMapDepth([1, 2], duplicate, 2);
+ * // => [[1, 1], [2, 2]]
+ */
+ function flatMapDepth(collection, iteratee, depth) {
+ depth = depth === undefined ? 1 : toInteger(depth);
+ return baseFlatten(map(collection, iteratee), depth);
+ }
+
+ /**
+ * Iterates over elements of `collection` and invokes `iteratee` for each element.
* The iteratee is invoked with three arguments: (value, index|key, collection).
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
- * **Note:** As with other "Collections" methods, objects with a "length" property
- * are iterated like arrays. To avoid this behavior use `_.forIn` or `_.forOwn`
- * for object iteration.
+ * **Note:** As with other "Collections" methods, objects with a "length"
+ * property are iterated like arrays. To avoid this behavior use `_.forIn`
+ * or `_.forOwn` for object iteration.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @alias each
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
+ * @see _.forEachRight
* @example
*
* _([1, 2]).forEach(function(value) {
* console.log(value);
* });
- * // => logs `1` then `2`
+ * // => Logs `1` then `2`.
*
* _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
* console.log(key);
* });
- * // => logs 'a' then 'b' (iteration order is not guaranteed)
+ * // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forEach(collection, iteratee) {
return (typeof iteratee == 'function' && isArray(collection))
? arrayEach(collection, iteratee)
- : baseEach(collection, baseCastFunction(iteratee));
+ : baseEach(collection, getIteratee(iteratee));
}
/**
@@ -44557,35 +44174,40 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.0.0
* @alias eachRight
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
+ * @see _.forEach
* @example
*
* _.forEachRight([1, 2], function(value) {
* console.log(value);
* });
- * // => logs `2` then `1`
+ * // => Logs `2` then `1`.
*/
function forEachRight(collection, iteratee) {
return (typeof iteratee == 'function' && isArray(collection))
? arrayEachRight(collection, iteratee)
- : baseEachRight(collection, baseCastFunction(iteratee));
+ : baseEachRight(collection, getIteratee(iteratee));
}
/**
* Creates an object composed of keys generated from the results of running
- * each element of `collection` through `iteratee`. The corresponding value
- * of each key is an array of elements responsible for generating the key.
- * The iteratee is invoked with one argument: (value).
+ * each element of `collection` thru `iteratee`. The order of grouped values
+ * is determined by the order they occur in `collection`. The corresponding
+ * value of each key is an array of elements responsible for generating the
+ * key. The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
@@ -44605,18 +44227,20 @@ return jQuery;
});
/**
- * Checks if `value` is in `collection`. If `collection` is a string it's checked
- * for a substring of `value`, otherwise [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * Checks if `value` is in `collection`. If `collection` is a string, it's
+ * checked for a substring of `value`, otherwise
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* is used for equality comparisons. If `fromIndex` is negative, it's used as
* the offset from the end of `collection`.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object|string} collection The collection to search.
* @param {*} value The value to search for.
* @param {number} [fromIndex=0] The index to search from.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
* @returns {boolean} Returns `true` if `value` is found, else `false`.
* @example
*
@@ -44648,11 +44272,12 @@ return jQuery;
/**
* Invokes the method at `path` of each element in `collection`, returning
* an array of the results of each invoked method. Any additional arguments
- * are provided to each invoked method. If `methodName` is a function it's
- * invoked for, and `this` bound to, each element in `collection`.
+ * are provided to each invoked method. If `methodName` is a function, it's
+ * invoked for and `this` bound to, each element in `collection`.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Array|Function|string} path The path of the method to invoke or
@@ -44682,15 +44307,17 @@ return jQuery;
/**
* Creates an object composed of keys generated from the results of running
- * each element of `collection` through `iteratee`. The corresponding value
- * of each key is the last element responsible for generating the key. The
+ * each element of `collection` thru `iteratee`. The corresponding value of
+ * each key is the last element responsible for generating the key. The
* iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
@@ -44712,7 +44339,7 @@ return jQuery;
});
/**
- * Creates an array of values by running each element in `collection` through
+ * Creates an array of values by running each element in `collection` thru
* `iteratee`. The iteratee is invoked with three arguments:
* (value, index|key, collection).
*
@@ -44720,16 +44347,18 @@ return jQuery;
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
*
* The guarded methods are:
- * `ary`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`,
- * `invert`, `parseInt`, `random`, `range`, `rangeRight`, `slice`, `some`,
- * `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimEnd`, `trimStart`,
- * and `words`
+ * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
+ * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
+ * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
+ * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
* @example
*
@@ -44765,24 +44394,26 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] The iteratees to sort by.
+ * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
+ * The iteratees to sort by.
* @param {string[]} [orders] The sort orders of `iteratees`.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
* @returns {Array} Returns the new sorted array.
* @example
*
* var users = [
* { 'user': 'fred', 'age': 48 },
* { 'user': 'barney', 'age': 34 },
- * { 'user': 'fred', 'age': 42 },
+ * { 'user': 'fred', 'age': 40 },
* { 'user': 'barney', 'age': 36 }
* ];
*
* // Sort by `user` in ascending order and by `age` in descending order.
* _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
- * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
+ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*/
function orderBy(collection, iteratees, orders, guard) {
if (collection == null) {
@@ -44806,9 +44437,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the array of grouped elements.
* @example
*
@@ -44839,9 +44472,9 @@ return jQuery;
/**
* Reduces `collection` to a value which is the accumulated result of running
- * each element in `collection` through `iteratee`, where each successive
+ * each element in `collection` thru `iteratee`, where each successive
* invocation is supplied the return value of the previous. If `accumulator`
- * is not given the first element of `collection` is used as the initial
+ * is not given, the first element of `collection` is used as the initial
* value. The iteratee is invoked with four arguments:
* (accumulator, value, index|key, collection).
*
@@ -44854,11 +44487,13 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @returns {*} Returns the accumulated value.
+ * @see _.reduceRight
* @example
*
* _.reduce([1, 2], function(sum, n) {
@@ -44885,11 +44520,13 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @returns {*} Returns the accumulated value.
+ * @see _.reduce
* @example
*
* var array = [[0, 1], [2, 3], [4, 5]];
@@ -44912,10 +44549,13 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
+ * @see _.filter
* @example
*
* var users = [
@@ -44951,6 +44591,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Collection
* @param {Array|Object} collection The collection to sample.
* @returns {*} Returns the random element.
@@ -44972,9 +44613,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to sample.
- * @param {number} [n=0] The number of elements to sample.
+ * @param {number} [n=1] The number of elements to sample.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the random elements.
* @example
*
@@ -44984,13 +44627,17 @@ return jQuery;
* _.sampleSize([1, 2, 3], 4);
* // => [2, 3, 1]
*/
- function sampleSize(collection, n) {
+ function sampleSize(collection, n, guard) {
var index = -1,
result = toArray(collection),
length = result.length,
lastIndex = length - 1;
- n = baseClamp(toInteger(n), 0, length);
+ if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
+ n = 1;
+ } else {
+ n = baseClamp(toInteger(n), 0, length);
+ }
while (++index < n) {
var rand = baseRandom(index, lastIndex),
value = result[rand];
@@ -45008,6 +44655,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to shuffle.
* @returns {Array} Returns the new shuffled array.
@@ -45022,10 +44670,11 @@ return jQuery;
/**
* Gets the size of `collection` by returning its length for array-like
- * values or the number of own enumerable properties for objects.
+ * values or the number of own enumerable string keyed properties for objects.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to inspect.
* @returns {number} Returns the collection size.
@@ -45048,6 +44697,12 @@ return jQuery;
var result = collection.length;
return (result && isString(collection)) ? stringSize(collection) : result;
}
+ if (isObjectLike(collection)) {
+ var tag = getTag(collection);
+ if (tag == mapTag || tag == setTag) {
+ return collection.size;
+ }
+ }
return keys(collection).length;
}
@@ -45058,11 +44713,14 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
- * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
* @example
*
* _.some([null, 0, 'yes', false], Boolean);
@@ -45095,36 +44753,37 @@ return jQuery;
/**
* Creates an array of elements, sorted in ascending order by the results of
- * running each element in a collection through each iteratee. This method
+ * running each element in a collection thru each iteratee. This method
* performs a stable sort, that is, it preserves the original sort order of
* equal elements. The iteratees are invoked with one argument: (value).
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {...(Function|Function[]|Object|Object[]|string|string[])} [iteratees=[_.identity]]
- * The iteratees to sort by, specified individually or in arrays.
+ * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
+ * [iteratees=[_.identity]] The iteratees to sort by.
* @returns {Array} Returns the new sorted array.
* @example
*
* var users = [
* { 'user': 'fred', 'age': 48 },
* { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 42 },
+ * { 'user': 'fred', 'age': 40 },
* { 'user': 'barney', 'age': 34 }
* ];
*
* _.sortBy(users, function(o) { return o.user; });
- * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
+ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*
* _.sortBy(users, ['user', 'age']);
- * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
+ * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
*
* _.sortBy(users, 'user', function(o) {
* return Math.floor(o.age / 10);
* });
- * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
+ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*/
var sortBy = rest(function(collection, iteratees) {
if (collection == null) {
@@ -45134,9 +44793,13 @@ return jQuery;
if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
iteratees = [];
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
- iteratees.length = 1;
+ iteratees = [iteratees[0]];
}
- return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
+ iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
+ ? iteratees[0]
+ : baseFlatten(iteratees, 1, isFlattenableIteratee);
+
+ return baseOrderBy(collection, iteratees, []);
});
/*------------------------------------------------------------------------*/
@@ -45147,6 +44810,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.4.0
* @type {Function}
* @category Date
* @returns {number} Returns the timestamp.
@@ -45155,7 +44819,7 @@ return jQuery;
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
- * // => logs the number of milliseconds it took for the deferred function to be invoked
+ * // => Logs the number of milliseconds it took for the deferred function to be invoked.
*/
var now = Date.now;
@@ -45167,6 +44831,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {number} n The number of calls before `func` is invoked.
* @param {Function} func The function to restrict.
@@ -45182,7 +44847,7 @@ return jQuery;
* _.forEach(saves, function(type) {
* asyncSave({ 'type': type, 'complete': done });
* });
- * // => logs 'done saving!' after the two async saves have completed
+ * // => Logs 'done saving!' after the two async saves have completed.
*/
function after(n, func) {
if (typeof func != 'function') {
@@ -45197,15 +44862,16 @@ return jQuery;
}
/**
- * Creates a function that accepts up to `n` arguments, ignoring any
- * additional arguments.
+ * Creates a function that invokes `func`, with up to `n` arguments,
+ * ignoring any additional arguments.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Function
* @param {Function} func The function to cap arguments for.
* @param {number} [n=func.length] The arity cap.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the new function.
* @example
*
@@ -45225,6 +44891,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Function
* @param {number} n The number of calls at which `func` is no longer invoked.
* @param {Function} func The function to restrict.
@@ -45253,8 +44920,7 @@ return jQuery;
/**
* Creates a function that invokes `func` with the `this` binding of `thisArg`
- * and prepends any additional `_.bind` arguments to those provided to the
- * bound function.
+ * and `partials` prepended to the arguments it receives.
*
* The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
* may be used as a placeholder for partially applied arguments.
@@ -45264,6 +44930,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to bind.
* @param {*} thisArg The `this` binding of `func`.
@@ -45296,12 +44963,12 @@ return jQuery;
});
/**
- * Creates a function that invokes the method at `object[key]` and prepends
- * any additional `_.bindKey` arguments to those provided to the bound function.
+ * Creates a function that invokes the method at `object[key]` with `partials`
+ * prepended to the arguments it receives.
*
* This method differs from `_.bind` by allowing bound functions to reference
- * methods that may be redefined or don't yet exist.
- * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
+ * methods that may be redefined or don't yet exist. See
+ * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
* for more details.
*
* The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
@@ -45309,6 +44976,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.10.0
* @category Function
* @param {Object} object The object to invoke the method on.
* @param {string} key The key of the method.
@@ -45362,10 +45030,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Function
* @param {Function} func The function to curry.
* @param {number} [arity=func.length] The arity of `func`.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the new curried function.
* @example
*
@@ -45406,10 +45075,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Function
* @param {Function} func The function to curry.
* @param {number} [arity=func.length] The arity of `func`.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the new curried function.
* @example
*
@@ -45453,21 +45123,22 @@ return jQuery;
* on the trailing edge of the timeout only if the debounced function is
* invoked more than once during the `wait` timeout.
*
- * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.debounce` and `_.throttle`.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to debounce.
* @param {number} [wait=0] The number of milliseconds to delay.
- * @param {Object} [options] The options object.
- * @param {boolean} [options.leading=false] Specify invoking on the leading
- * edge of the timeout.
- * @param {number} [options.maxWait] The maximum time `func` is allowed to be
- * delayed before it's invoked.
- * @param {boolean} [options.trailing=true] Specify invoking on the trailing
- * edge of the timeout.
+ * @param {Object} [options={}] The options object.
+ * @param {boolean} [options.leading=false]
+ * Specify invoking on the leading edge of the timeout.
+ * @param {number} [options.maxWait]
+ * The maximum time `func` is allowed to be delayed before it's invoked.
+ * @param {boolean} [options.trailing=true]
+ * Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new debounced function.
* @example
*
@@ -45489,16 +45160,15 @@ return jQuery;
* jQuery(window).on('popstate', debounced.cancel);
*/
function debounce(func, wait, options) {
- var args,
- maxTimeoutId,
+ var lastArgs,
+ lastThis,
+ maxWait,
result,
- stamp,
- thisArg,
- timeoutId,
- trailingCall,
- lastCalled = 0,
+ timerId,
+ lastCallTime = 0,
+ lastInvokeTime = 0,
leading = false,
- maxWait = false,
+ maxing = false,
trailing = true;
if (typeof func != 'function') {
@@ -45507,96 +45177,104 @@ return jQuery;
wait = toNumber(wait) || 0;
if (isObject(options)) {
leading = !!options.leading;
- maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait);
+ maxing = 'maxWait' in options;
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
- function cancel() {
- if (timeoutId) {
- clearTimeout(timeoutId);
- }
- if (maxTimeoutId) {
- clearTimeout(maxTimeoutId);
- }
- lastCalled = 0;
- args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined;
+ function invokeFunc(time) {
+ var args = lastArgs,
+ thisArg = lastThis;
+
+ lastArgs = lastThis = undefined;
+ lastInvokeTime = time;
+ result = func.apply(thisArg, args);
+ return result;
}
- function complete(isCalled, id) {
- if (id) {
- clearTimeout(id);
- }
- maxTimeoutId = timeoutId = trailingCall = undefined;
- if (isCalled) {
- lastCalled = now();
- result = func.apply(thisArg, args);
- if (!timeoutId && !maxTimeoutId) {
- args = thisArg = undefined;
- }
- }
+ function leadingEdge(time) {
+ // Reset any `maxWait` timer.
+ lastInvokeTime = time;
+ // Start the timer for the trailing edge.
+ timerId = setTimeout(timerExpired, wait);
+ // Invoke the leading edge.
+ return leading ? invokeFunc(time) : result;
}
- function delayed() {
- var remaining = wait - (now() - stamp);
- if (remaining <= 0 || remaining > wait) {
- complete(trailingCall, maxTimeoutId);
- } else {
- timeoutId = setTimeout(delayed, remaining);
+ function remainingWait(time) {
+ var timeSinceLastCall = time - lastCallTime,
+ timeSinceLastInvoke = time - lastInvokeTime,
+ result = wait - timeSinceLastCall;
+
+ return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
+ }
+
+ function shouldInvoke(time) {
+ var timeSinceLastCall = time - lastCallTime,
+ timeSinceLastInvoke = time - lastInvokeTime;
+
+ // Either this is the first call, activity has stopped and we're at the
+ // trailing edge, the system time has gone backwards and we're treating
+ // it as the trailing edge, or we've hit the `maxWait` limit.
+ return (!lastCallTime || (timeSinceLastCall >= wait) ||
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
+ }
+
+ function timerExpired() {
+ var time = now();
+ if (shouldInvoke(time)) {
+ return trailingEdge(time);
}
+ // Restart the timer.
+ timerId = setTimeout(timerExpired, remainingWait(time));
}
- function flush() {
- if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) {
- result = func.apply(thisArg, args);
+ function trailingEdge(time) {
+ clearTimeout(timerId);
+ timerId = undefined;
+
+ // Only invoke if we have `lastArgs` which means `func` has been
+ // debounced at least once.
+ if (trailing && lastArgs) {
+ return invokeFunc(time);
}
- cancel();
+ lastArgs = lastThis = undefined;
return result;
}
- function maxDelayed() {
- complete(trailing, timeoutId);
+ function cancel() {
+ if (timerId !== undefined) {
+ clearTimeout(timerId);
+ }
+ lastCallTime = lastInvokeTime = 0;
+ lastArgs = lastThis = timerId = undefined;
}
- function debounced() {
- args = arguments;
- stamp = now();
- thisArg = this;
- trailingCall = trailing && (timeoutId || !leading);
+ function flush() {
+ return timerId === undefined ? result : trailingEdge(now());
+ }
- if (maxWait === false) {
- var leadingCall = leading && !timeoutId;
- } else {
- if (!lastCalled && !maxTimeoutId && !leading) {
- lastCalled = stamp;
- }
- var remaining = maxWait - (stamp - lastCalled);
+ function debounced() {
+ var time = now(),
+ isInvoking = shouldInvoke(time);
- var isCalled = (remaining <= 0 || remaining > maxWait) &&
- (leading || maxTimeoutId);
+ lastArgs = arguments;
+ lastThis = this;
+ lastCallTime = time;
- if (isCalled) {
- if (maxTimeoutId) {
- maxTimeoutId = clearTimeout(maxTimeoutId);
- }
- lastCalled = stamp;
- result = func.apply(thisArg, args);
+ if (isInvoking) {
+ if (timerId === undefined) {
+ return leadingEdge(lastCallTime);
}
- else if (!maxTimeoutId) {
- maxTimeoutId = setTimeout(maxDelayed, remaining);
+ if (maxing) {
+ // Handle invocations in a tight loop.
+ clearTimeout(timerId);
+ timerId = setTimeout(timerExpired, wait);
+ return invokeFunc(lastCallTime);
}
}
- if (isCalled && timeoutId) {
- timeoutId = clearTimeout(timeoutId);
- }
- else if (!timeoutId && wait !== maxWait) {
- timeoutId = setTimeout(delayed, wait);
- }
- if (leadingCall) {
- isCalled = true;
- result = func.apply(thisArg, args);
- }
- if (isCalled && !timeoutId && !maxTimeoutId) {
- args = thisArg = undefined;
+ if (timerId === undefined) {
+ timerId = setTimeout(timerExpired, wait);
}
return result;
}
@@ -45611,6 +45289,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to defer.
* @param {...*} [args] The arguments to invoke `func` with.
@@ -45620,7 +45299,7 @@ return jQuery;
* _.defer(function(text) {
* console.log(text);
* }, 'deferred');
- * // => logs 'deferred' after one or more milliseconds
+ * // => Logs 'deferred' after one or more milliseconds.
*/
var defer = rest(function(func, args) {
return baseDelay(func, 1, args);
@@ -45632,6 +45311,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation.
@@ -45642,7 +45322,7 @@ return jQuery;
* _.delay(function(text) {
* console.log(text);
* }, 1000, 'later');
- * // => logs 'later' after one second
+ * // => Logs 'later' after one second.
*/
var delay = rest(function(func, wait, args) {
return baseDelay(func, toNumber(wait) || 0, args);
@@ -45653,6 +45333,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Function
* @param {Function} func The function to flip arguments for.
* @returns {Function} Returns the new function.
@@ -45671,18 +45352,20 @@ return jQuery;
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
- * provided it determines the cache key for storing the result based on the
+ * provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
- * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
+ * constructor with one whose instances implement the
+ * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
* method interface of `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
@@ -45727,10 +45410,13 @@ return jQuery;
memoized.cache = cache.set(key, result);
return result;
};
- memoized.cache = new memoize.Cache;
+ memoized.cache = new (memoize.Cache || MapCache);
return memoized;
}
+ // Assign cache to `_.memoize`.
+ memoize.Cache = MapCache;
+
/**
* Creates a function that negates the result of the predicate `func`. The
* `func` predicate is invoked with the `this` binding and arguments of the
@@ -45738,6 +45424,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Function
* @param {Function} predicate The predicate to negate.
* @returns {Function} Returns the new function.
@@ -45766,6 +45453,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new restricted function.
@@ -45785,11 +45473,12 @@ return jQuery;
* corresponding `transforms`.
*
* @static
+ * @since 4.0.0
* @memberOf _
* @category Function
* @param {Function} func The function to wrap.
- * @param {...(Function|Function[])} [transforms] The functions to transform
- * arguments, specified individually or in arrays.
+ * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
+ * [transforms[_.identity]] The functions to transform.
* @returns {Function} Returns the new function.
* @example
*
@@ -45812,7 +45501,9 @@ return jQuery;
* // => [100, 10]
*/
var overArgs = rest(function(func, transforms) {
- transforms = arrayMap(baseFlatten(transforms, 1), getIteratee());
+ transforms = (transforms.length == 1 && isArray(transforms[0]))
+ ? arrayMap(transforms[0], baseUnary(getIteratee()))
+ : arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseUnary(getIteratee()));
var funcsLength = transforms.length;
return rest(function(args) {
@@ -45827,9 +45518,9 @@ return jQuery;
});
/**
- * Creates a function that invokes `func` with `partial` arguments prepended
- * to those provided to the new function. This method is like `_.bind` except
- * it does **not** alter the `this` binding.
+ * Creates a function that invokes `func` with `partials` prepended to the
+ * arguments it receives. This method is like `_.bind` except it does **not**
+ * alter the `this` binding.
*
* The `_.partial.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments.
@@ -45839,6 +45530,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.2.0
* @category Function
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [partials] The arguments to be partially applied.
@@ -45865,7 +45557,7 @@ return jQuery;
/**
* This method is like `_.partial` except that partially applied arguments
- * are appended to those provided to the new function.
+ * are appended to the arguments it receives.
*
* The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments.
@@ -45875,6 +45567,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 1.0.0
* @category Function
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [partials] The arguments to be partially applied.
@@ -45901,16 +45594,16 @@ return jQuery;
/**
* Creates a function that invokes `func` with arguments arranged according
- * to the specified indexes where the argument value at the first index is
+ * to the specified `indexes` where the argument value at the first index is
* provided as the first argument, the argument value at the second index is
* provided as the second argument, and so on.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Function
* @param {Function} func The function to rearrange arguments for.
- * @param {...(number|number[])} indexes The arranged argument indexes,
- * specified individually or in arrays.
+ * @param {...(number|number[])} indexes The arranged argument indexes.
* @returns {Function} Returns the new function.
* @example
*
@@ -45927,12 +45620,15 @@ return jQuery;
/**
* Creates a function that invokes `func` with the `this` binding of the
- * created function and arguments from `start` and beyond provided as an array.
+ * created function and arguments from `start` and beyond provided as
+ * an array.
*
- * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).
+ * **Note:** This method is based on the
+ * [rest parameter](https://mdn.io/rest_parameters).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Function
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
@@ -45977,13 +45673,16 @@ return jQuery;
}
/**
- * Creates a function that invokes `func` with the `this` binding of the created
- * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3).
+ * Creates a function that invokes `func` with the `this` binding of the
+ * create function and an array of arguments much like
+ * [`Function#apply`](http://www.ecma-international.org/ecma-262/6.0/#sec-function.prototype.apply).
*
- * **Note:** This method is based on the [spread operator](https://mdn.io/spread_operator).
+ * **Note:** This method is based on the
+ * [spread operator](https://mdn.io/spread_operator).
*
* @static
* @memberOf _
+ * @since 3.2.0
* @category Function
* @param {Function} func The function to spread arguments over.
* @param {number} [start=0] The start position of the spread.
@@ -46014,7 +45713,7 @@ return jQuery;
start = start === undefined ? 0 : nativeMax(toInteger(start), 0);
return rest(function(args) {
var array = args[start],
- otherArgs = args.slice(0, start);
+ otherArgs = castSlice(args, 0, start);
if (array) {
arrayPush(otherArgs, array);
@@ -46033,23 +45732,24 @@ return jQuery;
* throttled function. Subsequent calls to the throttled function return the
* result of the last `func` invocation.
*
- * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
- * on the trailing edge of the timeout only if the throttled function is
- * invoked more than once during the `wait` timeout.
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
+ * invoked on the trailing edge of the timeout only if the throttled function
+ * is invoked more than once during the `wait` timeout.
*
- * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.throttle` and `_.debounce`.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to throttle.
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
- * @param {Object} [options] The options object.
- * @param {boolean} [options.leading=true] Specify invoking on the leading
- * edge of the timeout.
- * @param {boolean} [options.trailing=true] Specify invoking on the trailing
- * edge of the timeout.
+ * @param {Object} [options={}] The options object.
+ * @param {boolean} [options.leading=true]
+ * Specify invoking on the leading edge of the timeout.
+ * @param {boolean} [options.trailing=true]
+ * Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new throttled function.
* @example
*
@@ -46087,6 +45787,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Function
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new function.
@@ -46107,6 +45808,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {*} value The value to wrap.
* @param {Function} [wrapper=identity] The wrapper function.
@@ -46132,6 +45834,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.4.0
* @category Lang
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast array.
@@ -46180,9 +45883,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to clone.
* @returns {*} Returns the cloned value.
+ * @see _.cloneDeep
* @example
*
* var objects = [{ 'a': 1 }, { 'b': 2 }];
@@ -46192,21 +45897,23 @@ return jQuery;
* // => true
*/
function clone(value) {
- return baseClone(value);
+ return baseClone(value, false, true);
}
/**
* This method is like `_.clone` except that it accepts `customizer` which
- * is invoked to produce the cloned value. If `customizer` returns `undefined`
+ * is invoked to produce the cloned value. If `customizer` returns `undefined`,
* cloning is handled by the method instead. The `customizer` is invoked with
* up to four arguments; (value [, index|key, object, stack]).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to clone.
* @param {Function} [customizer] The function to customize cloning.
* @returns {*} Returns the cloned value.
+ * @see _.cloneDeepWith
* @example
*
* function customizer(value) {
@@ -46225,7 +45932,7 @@ return jQuery;
* // => 0
*/
function cloneWith(value, customizer) {
- return baseClone(value, false, customizer);
+ return baseClone(value, false, true, customizer);
}
/**
@@ -46233,9 +45940,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 1.0.0
* @category Lang
* @param {*} value The value to recursively clone.
* @returns {*} Returns the deep cloned value.
+ * @see _.clone
* @example
*
* var objects = [{ 'a': 1 }, { 'b': 2 }];
@@ -46245,7 +45954,7 @@ return jQuery;
* // => false
*/
function cloneDeep(value) {
- return baseClone(value, true);
+ return baseClone(value, true, true);
}
/**
@@ -46253,10 +45962,12 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to recursively clone.
* @param {Function} [customizer] The function to customize cloning.
* @returns {*} Returns the deep cloned value.
+ * @see _.cloneWith
* @example
*
* function customizer(value) {
@@ -46275,15 +45986,17 @@ return jQuery;
* // => 20
*/
function cloneDeepWith(value, customizer) {
- return baseClone(value, true, customizer);
+ return baseClone(value, true, true, customizer);
}
/**
- * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * Performs a
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
@@ -46317,10 +46030,13 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`.
+ * @returns {boolean} Returns `true` if `value` is greater than `other`,
+ * else `false`.
+ * @see _.lt
* @example
*
* _.gt(3, 1);
@@ -46332,19 +46048,20 @@ return jQuery;
* _.gt(1, 3);
* // => false
*/
- function gt(value, other) {
- return value > other;
- }
+ var gt = createRelationalOperation(baseGt);
/**
* Checks if `value` is greater than or equal to `other`.
*
* @static
* @memberOf _
+ * @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`.
+ * @returns {boolean} Returns `true` if `value` is greater than or equal to
+ * `other`, else `false`.
+ * @see _.lte
* @example
*
* _.gte(3, 1);
@@ -46356,18 +46073,20 @@ return jQuery;
* _.gte(1, 3);
* // => false
*/
- function gte(value, other) {
+ var gte = createRelationalOperation(function(value, other) {
return value >= other;
- }
+ });
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
@@ -46387,10 +46106,12 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @type {Function}
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isArray([1, 2, 3]);
@@ -46412,9 +46133,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.3.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isArrayBuffer(new ArrayBuffer(2));
@@ -46434,6 +46157,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
@@ -46452,8 +46176,7 @@ return jQuery;
* // => false
*/
function isArrayLike(value) {
- return value != null &&
- !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));
+ return value != null && isLength(getLength(value)) && !isFunction(value);
}
/**
@@ -46462,9 +46185,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is an array-like object,
+ * else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
@@ -46488,9 +46213,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isBoolean(false);
@@ -46509,6 +46236,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
@@ -46529,9 +46257,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isDate(new Date);
@@ -46549,9 +46279,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a DOM element,
+ * else `false`.
* @example
*
* _.isElement(document.body);
@@ -46565,14 +46297,20 @@ return jQuery;
}
/**
- * Checks if `value` is empty. A value is considered empty unless it's an
- * `arguments` object, array, string, or jQuery-like collection with a length
- * greater than `0` or an object with own enumerable properties.
+ * Checks if `value` is an empty object, collection, map, or set.
+ *
+ * Objects are considered empty if they have no own enumerable string keyed
+ * properties.
+ *
+ * Array-like values such as `arguments` objects, arrays, buffers, strings, or
+ * jQuery-like collections are considered empty if they have a `length` of `0`.
+ * Similarly, maps and sets are considered empty if they have a `size` of `0`.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
- * @param {Array|Object|string} value The value to inspect.
+ * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
* @example
*
@@ -46593,16 +46331,22 @@ return jQuery;
*/
function isEmpty(value) {
if (isArrayLike(value) &&
- (isArray(value) || isString(value) ||
- isFunction(value.splice) || isArguments(value))) {
+ (isArray(value) || isString(value) || isFunction(value.splice) ||
+ isArguments(value) || isBuffer(value))) {
return !value.length;
}
+ if (isObjectLike(value)) {
+ var tag = getTag(value);
+ if (tag == mapTag || tag == setTag) {
+ return !value.size;
+ }
+ }
for (var key in value) {
if (hasOwnProperty.call(value, key)) {
return false;
}
}
- return true;
+ return !(nonEnumShadows && keys(value).length);
}
/**
@@ -46617,10 +46361,12 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+ * @returns {boolean} Returns `true` if the values are equivalent,
+ * else `false`.
* @example
*
* var object = { 'user': 'fred' };
@@ -46638,17 +46384,19 @@ return jQuery;
/**
* This method is like `_.isEqual` except that it accepts `customizer` which
- * is invoked to compare values. If `customizer` returns `undefined` comparisons
+ * is invoked to compare values. If `customizer` returns `undefined`, comparisons
* are handled by the method instead. The `customizer` is invoked with up to
* six arguments: (objValue, othValue [, index|key, object, other, stack]).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+ * @returns {boolean} Returns `true` if the values are equivalent,
+ * else `false`.
* @example
*
* function isGreeting(value) {
@@ -46679,9 +46427,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is an error object,
+ * else `false`.
* @example
*
* _.isError(new Error);
@@ -46701,13 +46451,16 @@ return jQuery;
/**
* Checks if `value` is a finite primitive number.
*
- * **Note:** This method is based on [`Number.isFinite`](https://mdn.io/Number/isFinite).
+ * **Note:** This method is based on
+ * [`Number.isFinite`](https://mdn.io/Number/isFinite).
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a finite number,
+ * else `false`.
* @example
*
* _.isFinite(3);
@@ -46731,9 +46484,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isFunction(_);
@@ -46744,8 +46499,8 @@ return jQuery;
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8 which returns 'object' for typed array constructors, and
- // PhantomJS 1.9 which returns 'function' for `NodeList` instances.
+ // in Safari 8 which returns 'object' for typed array and weak map constructors,
+ // and PhantomJS 1.9 which returns 'function' for `NodeList` instances.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
@@ -46753,10 +46508,12 @@ return jQuery;
/**
* Checks if `value` is an integer.
*
- * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger).
+ * **Note:** This method is based on
+ * [`Number.isInteger`](https://mdn.io/Number/isInteger).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an integer, else `false`.
@@ -46781,13 +46538,16 @@ return jQuery;
/**
* Checks if `value` is a valid array-like length.
*
- * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
+ * **Note:** This function is loosely based on
+ * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a valid length,
+ * else `false`.
* @example
*
* _.isLength(3);
@@ -46808,11 +46568,13 @@ return jQuery;
}
/**
- * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
- * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+ * Checks if `value` is the
+ * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
@@ -46841,6 +46603,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
@@ -46867,9 +46630,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.3.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isMap(new Map);
@@ -46891,6 +46656,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Lang
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
@@ -46911,12 +46677,13 @@ return jQuery;
/**
* This method is like `_.isMatch` except that it accepts `customizer` which
- * is invoked to compare values. If `customizer` returns `undefined` comparisons
+ * is invoked to compare values. If `customizer` returns `undefined`, comparisons
* are handled by the method instead. The `customizer` is invoked with five
* arguments: (objValue, srcValue, index|key, object, source).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
@@ -46948,11 +46715,14 @@ return jQuery;
/**
* Checks if `value` is `NaN`.
*
- * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4)
- * which returns `true` for `undefined` and other non-numeric values.
+ * **Note:** This method is based on
+ * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
+ * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
+ * `undefined` and other non-number values.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
@@ -46972,7 +46742,8 @@ return jQuery;
*/
function isNaN(value) {
// An `NaN` primitive is the only value that is not equal to itself.
- // Perform the `toStringTag` check first to avoid errors with some ActiveX objects in IE.
+ // Perform the `toStringTag` check first to avoid errors with some
+ // ActiveX objects in IE.
return isNumber(value) && value != +value;
}
@@ -46981,9 +46752,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a native function,
+ * else `false`.
* @example
*
* _.isNative(Array.prototype.push);
@@ -46993,14 +46766,11 @@ return jQuery;
* // => false
*/
function isNative(value) {
- if (value == null) {
+ if (!isObject(value)) {
return false;
}
- if (isFunction(value)) {
- return reIsNative.test(funcToString.call(value));
- }
- return isObjectLike(value) &&
- (isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
+ var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
+ return pattern.test(toSource(value));
}
/**
@@ -47008,6 +46778,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `null`, else `false`.
@@ -47028,6 +46799,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is nullish, else `false`.
@@ -47049,14 +46821,16 @@ return jQuery;
/**
* Checks if `value` is classified as a `Number` primitive or object.
*
- * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
- * as numbers, use the `_.isFinite` method.
+ * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
+ * classified as numbers, use the `_.isFinite` method.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isNumber(3);
@@ -47082,9 +46856,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.8.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a plain object,
+ * else `false`.
* @example
*
* function Foo() {
@@ -47108,11 +46884,11 @@ return jQuery;
objectToString.call(value) != objectTag || isHostObject(value)) {
return false;
}
- var proto = getPrototypeOf(value);
+ var proto = getPrototype(value);
if (proto === null) {
return true;
}
- var Ctor = proto.constructor;
+ var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return (typeof Ctor == 'function' &&
Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
}
@@ -47122,9 +46898,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isRegExp(/abc/);
@@ -47141,13 +46919,16 @@ return jQuery;
* Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
* double precision number which isn't the result of a rounded unsafe integer.
*
- * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
+ * **Note:** This method is based on
+ * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a safe integer,
+ * else `false`.
* @example
*
* _.isSafeInteger(3);
@@ -47171,9 +46952,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.3.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isSet(new Set);
@@ -47190,10 +46973,12 @@ return jQuery;
* Checks if `value` is classified as a `String` primitive or object.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isString('abc');
@@ -47212,9 +46997,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
@@ -47233,9 +47020,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
@@ -47253,6 +47042,7 @@ return jQuery;
* Checks if `value` is `undefined`.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to check.
@@ -47274,9 +47064,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.3.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isWeakMap(new WeakMap);
@@ -47294,9 +47086,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.3.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isWeakSet(new WeakSet);
@@ -47314,10 +47108,13 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`.
+ * @returns {boolean} Returns `true` if `value` is less than `other`,
+ * else `false`.
+ * @see _.gt
* @example
*
* _.lt(1, 3);
@@ -47329,19 +47126,20 @@ return jQuery;
* _.lt(3, 1);
* // => false
*/
- function lt(value, other) {
- return value < other;
- }
+ var lt = createRelationalOperation(baseLt);
/**
* Checks if `value` is less than or equal to `other`.
*
* @static
* @memberOf _
+ * @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`.
+ * @returns {boolean} Returns `true` if `value` is less than or equal to
+ * `other`, else `false`.
+ * @see _.gte
* @example
*
* _.lte(1, 3);
@@ -47353,14 +47151,15 @@ return jQuery;
* _.lte(3, 1);
* // => false
*/
- function lte(value, other) {
+ var lte = createRelationalOperation(function(value, other) {
return value <= other;
- }
+ });
/**
* Converts `value` to an array.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to convert.
@@ -47398,10 +47197,12 @@ return jQuery;
/**
* Converts `value` to an integer.
*
- * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
+ * **Note:** This function is loosely based on
+ * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
@@ -47436,10 +47237,12 @@ return jQuery;
* Converts `value` to an integer suitable for use as the length of an
* array-like object.
*
- * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
+ * **Note:** This method is based on
+ * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
@@ -47466,6 +47269,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
@@ -47484,6 +47288,12 @@ return jQuery;
* // => 3
*/
function toNumber(value) {
+ if (typeof value == 'number') {
+ return value;
+ }
+ if (isSymbol(value)) {
+ return NAN;
+ }
if (isObject(value)) {
var other = isFunction(value.valueOf) ? value.valueOf() : value;
value = isObject(other) ? (other + '') : other;
@@ -47499,11 +47309,12 @@ return jQuery;
}
/**
- * Converts `value` to a plain object flattening inherited enumerable
- * properties of `value` to own properties of the plain object.
+ * Converts `value` to a plain object flattening inherited enumerable string
+ * keyed properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
@@ -47531,6 +47342,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
@@ -47553,11 +47365,12 @@ return jQuery;
}
/**
- * Converts `value` to a string if it's not one. An empty string is returned
- * for `null` and `undefined` values. The sign of `-0` is preserved.
+ * Converts `value` to a string. An empty string is returned for `null`
+ * and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {string} Returns the string.
@@ -47573,36 +47386,27 @@ return jQuery;
* // => '1,2,3'
*/
function toString(value) {
- // Exit early for strings to avoid a performance hit in some environments.
- if (typeof value == 'string') {
- return value;
- }
- if (value == null) {
- return '';
- }
- if (isSymbol(value)) {
- return Symbol ? symbolToString.call(value) : '';
- }
- var result = (value + '');
- return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
+ return value == null ? '' : baseToString(value);
}
/*------------------------------------------------------------------------*/
/**
- * Assigns own enumerable properties of source objects to the destination
- * object. Source objects are applied from left to right. Subsequent sources
- * overwrite property assignments of previous sources.
+ * Assigns own enumerable string keyed properties of source objects to the
+ * destination object. Source objects are applied from left to right.
+ * Subsequent sources overwrite property assignments of previous sources.
*
* **Note:** This method mutates `object` and is loosely based on
* [`Object.assign`](https://mdn.io/Object/assign).
*
* @static
* @memberOf _
+ * @since 0.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
+ * @see _.assignIn
* @example
*
* function Foo() {
@@ -47620,7 +47424,15 @@ return jQuery;
* // => { 'a': 1, 'c': 3, 'e': 5 }
*/
var assign = createAssigner(function(object, source) {
- copyObject(source, keys(source), object);
+ if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
+ copyObject(source, keys(source), object);
+ return;
+ }
+ for (var key in source) {
+ if (hasOwnProperty.call(source, key)) {
+ assignValue(object, key, source[key]);
+ }
+ }
});
/**
@@ -47631,11 +47443,13 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @alias extend
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
+ * @see _.assign
* @example
*
* function Foo() {
@@ -47653,25 +47467,33 @@ return jQuery;
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }
*/
var assignIn = createAssigner(function(object, source) {
- copyObject(source, keysIn(source), object);
+ if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
+ copyObject(source, keysIn(source), object);
+ return;
+ }
+ for (var key in source) {
+ assignValue(object, key, source[key]);
+ }
});
/**
- * This method is like `_.assignIn` except that it accepts `customizer` which
- * is invoked to produce the assigned values. If `customizer` returns `undefined`
- * assignment is handled by the method instead. The `customizer` is invoked
- * with five arguments: (objValue, srcValue, key, object, source).
+ * This method is like `_.assignIn` except that it accepts `customizer`
+ * which is invoked to produce the assigned values. If `customizer` returns
+ * `undefined`, assignment is handled by the method instead. The `customizer`
+ * is invoked with five arguments: (objValue, srcValue, key, object, source).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @alias extendWith
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} [customizer] The function to customize assigned values.
* @returns {Object} Returns `object`.
+ * @see _.assignWith
* @example
*
* function customizer(objValue, srcValue) {
@@ -47684,24 +47506,26 @@ return jQuery;
* // => { 'a': 1, 'b': 2 }
*/
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
- copyObjectWith(source, keysIn(source), object, customizer);
+ copyObject(source, keysIn(source), object, customizer);
});
/**
- * This method is like `_.assign` except that it accepts `customizer` which
- * is invoked to produce the assigned values. If `customizer` returns `undefined`
- * assignment is handled by the method instead. The `customizer` is invoked
- * with five arguments: (objValue, srcValue, key, object, source).
+ * This method is like `_.assign` except that it accepts `customizer`
+ * which is invoked to produce the assigned values. If `customizer` returns
+ * `undefined`, assignment is handled by the method instead. The `customizer`
+ * is invoked with five arguments: (objValue, srcValue, key, object, source).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} [customizer] The function to customize assigned values.
* @returns {Object} Returns `object`.
+ * @see _.assignInWith
* @example
*
* function customizer(objValue, srcValue) {
@@ -47714,7 +47538,7 @@ return jQuery;
* // => { 'a': 1, 'b': 2 }
*/
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
- copyObjectWith(source, keys(source), object, customizer);
+ copyObject(source, keys(source), object, customizer);
});
/**
@@ -47722,10 +47546,10 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 1.0.0
* @category Object
* @param {Object} object The object to iterate over.
- * @param {...(string|string[])} [paths] The property paths of elements to pick,
- * specified individually or in arrays.
+ * @param {...(string|string[])} [paths] The property paths of elements to pick.
* @returns {Array} Returns the new array of picked elements.
* @example
*
@@ -47742,11 +47566,13 @@ return jQuery;
});
/**
- * Creates an object that inherits from the `prototype` object. If a `properties`
- * object is given its own enumerable properties are assigned to the created object.
+ * Creates an object that inherits from the `prototype` object. If a
+ * `properties` object is given, its own enumerable string keyed properties
+ * are assigned to the created object.
*
* @static
* @memberOf _
+ * @since 2.3.0
* @category Object
* @param {Object} prototype The object to inherit from.
* @param {Object} [properties] The properties to assign to the object.
@@ -47779,19 +47605,21 @@ return jQuery;
}
/**
- * Assigns own and inherited enumerable properties of source objects to the
- * destination object for all destination properties that resolve to `undefined`.
- * Source objects are applied from left to right. Once a property is set,
- * additional values of the same property are ignored.
+ * Assigns own and inherited enumerable string keyed properties of source
+ * objects to the destination object for all destination properties that
+ * resolve to `undefined`. Source objects are applied from left to right.
+ * Once a property is set, additional values of the same property are ignored.
*
* **Note:** This method mutates `object`.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
+ * @see _.defaultsDeep
* @example
*
* _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
@@ -47810,10 +47638,12 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
+ * @see _.defaults
* @example
*
* _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });
@@ -47831,10 +47661,13 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 1.1.0
* @category Object
* @param {Object} object The object to search.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
- * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
+ * @returns {string|undefined} Returns the key of the matched element,
+ * else `undefined`.
* @example
*
* var users = {
@@ -47868,10 +47701,13 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Object
* @param {Object} object The object to search.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
- * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
+ * @returns {string|undefined} Returns the key of the matched element,
+ * else `undefined`.
* @example
*
* var users = {
@@ -47900,17 +47736,19 @@ return jQuery;
}
/**
- * Iterates over own and inherited enumerable properties of an object invoking
- * `iteratee` for each property. The iteratee is invoked with three arguments:
- * (value, key, object). Iteratee functions may exit iteration early by explicitly
- * returning `false`.
+ * Iterates over own and inherited enumerable string keyed properties of an
+ * object and invokes `iteratee` for each property. The iteratee is invoked
+ * with three arguments: (value, key, object). Iteratee functions may exit
+ * iteration early by explicitly returning `false`.
*
* @static
* @memberOf _
+ * @since 0.3.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns `object`.
+ * @see _.forInRight
* @example
*
* function Foo() {
@@ -47923,12 +47761,12 @@ return jQuery;
* _.forIn(new Foo, function(value, key) {
* console.log(key);
* });
- * // => logs 'a', 'b', then 'c' (iteration order is not guaranteed)
+ * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
*/
function forIn(object, iteratee) {
return object == null
? object
- : baseFor(object, baseCastFunction(iteratee), keysIn);
+ : baseFor(object, getIteratee(iteratee), keysIn);
}
/**
@@ -47937,10 +47775,12 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns `object`.
+ * @see _.forIn
* @example
*
* function Foo() {
@@ -47953,26 +47793,28 @@ return jQuery;
* _.forInRight(new Foo, function(value, key) {
* console.log(key);
* });
- * // => logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'
+ * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
*/
function forInRight(object, iteratee) {
return object == null
? object
- : baseForRight(object, baseCastFunction(iteratee), keysIn);
+ : baseForRight(object, getIteratee(iteratee), keysIn);
}
/**
- * Iterates over own enumerable properties of an object invoking `iteratee`
- * for each property. The iteratee is invoked with three arguments:
- * (value, key, object). Iteratee functions may exit iteration early by
- * explicitly returning `false`.
+ * Iterates over own enumerable string keyed properties of an object and
+ * invokes `iteratee` for each property. The iteratee is invoked with three
+ * arguments: (value, key, object). Iteratee functions may exit iteration
+ * early by explicitly returning `false`.
*
* @static
* @memberOf _
+ * @since 0.3.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns `object`.
+ * @see _.forOwnRight
* @example
*
* function Foo() {
@@ -47985,10 +47827,10 @@ return jQuery;
* _.forOwn(new Foo, function(value, key) {
* console.log(key);
* });
- * // => logs 'a' then 'b' (iteration order is not guaranteed)
+ * // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forOwn(object, iteratee) {
- return object && baseForOwn(object, baseCastFunction(iteratee));
+ return object && baseForOwn(object, getIteratee(iteratee));
}
/**
@@ -47997,10 +47839,12 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns `object`.
+ * @see _.forOwn
* @example
*
* function Foo() {
@@ -48013,10 +47857,10 @@ return jQuery;
* _.forOwnRight(new Foo, function(value, key) {
* console.log(key);
* });
- * // => logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'
+ * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
*/
function forOwnRight(object, iteratee) {
- return object && baseForOwnRight(object, baseCastFunction(iteratee));
+ return object && baseForOwnRight(object, getIteratee(iteratee));
}
/**
@@ -48024,10 +47868,12 @@ return jQuery;
* of `object`.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to inspect.
* @returns {Array} Returns the new array of property names.
+ * @see _.functionsIn
* @example
*
* function Foo() {
@@ -48050,9 +47896,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The object to inspect.
* @returns {Array} Returns the new array of property names.
+ * @see _.functions
* @example
*
* function Foo() {
@@ -48071,14 +47919,15 @@ return jQuery;
/**
* Gets the value at `path` of `object`. If the resolved value is
- * `undefined` the `defaultValue` is used in its place.
+ * `undefined`, the `defaultValue` is used in its place.
*
* @static
* @memberOf _
+ * @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
- * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
+ * @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
@@ -48102,6 +47951,7 @@ return jQuery;
* Checks if `path` is a direct property of `object`.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
@@ -48109,23 +47959,23 @@ return jQuery;
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
- * var object = { 'a': { 'b': { 'c': 3 } } };
- * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });
+ * var object = { 'a': { 'b': 2 } };
+ * var other = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.has(object, 'a');
* // => true
*
- * _.has(object, 'a.b.c');
+ * _.has(object, 'a.b');
* // => true
*
- * _.has(object, ['a', 'b', 'c']);
+ * _.has(object, ['a', 'b']);
* // => true
*
* _.has(other, 'a');
* // => false
*/
function has(object, path) {
- return hasPath(object, path, baseHas);
+ return object != null && hasPath(object, path, baseHas);
}
/**
@@ -48133,37 +47983,39 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
- * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });
+ * var object = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.hasIn(object, 'a');
* // => true
*
- * _.hasIn(object, 'a.b.c');
+ * _.hasIn(object, 'a.b');
* // => true
*
- * _.hasIn(object, ['a', 'b', 'c']);
+ * _.hasIn(object, ['a', 'b']);
* // => true
*
* _.hasIn(object, 'b');
* // => false
*/
function hasIn(object, path) {
- return hasPath(object, path, baseHasIn);
+ return object != null && hasPath(object, path, baseHasIn);
}
/**
* Creates an object composed of the inverted keys and values of `object`.
- * If `object` contains duplicate values, subsequent values overwrite property
- * assignments of previous values.
+ * If `object` contains duplicate values, subsequent values overwrite
+ * property assignments of previous values.
*
* @static
* @memberOf _
+ * @since 0.7.0
* @category Object
* @param {Object} object The object to invert.
* @returns {Object} Returns the new inverted object.
@@ -48180,16 +48032,18 @@ return jQuery;
/**
* This method is like `_.invert` except that the inverted object is generated
- * from the results of running each element of `object` through `iteratee`.
- * The corresponding inverted value of each inverted key is an array of keys
+ * from the results of running each element of `object` thru `iteratee`. The
+ * corresponding inverted value of each inverted key is an array of keys
* responsible for generating the inverted value. The iteratee is invoked
* with one argument: (value).
*
* @static
* @memberOf _
+ * @since 4.1.0
* @category Object
* @param {Object} object The object to invert.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Object} Returns the new inverted object.
* @example
*
@@ -48216,6 +48070,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the method to invoke.
@@ -48238,6 +48093,7 @@ return jQuery;
* for more details.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
@@ -48284,6 +48140,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
@@ -48322,15 +48179,18 @@ return jQuery;
/**
* The opposite of `_.mapValues`; this method creates an object with the
* same values as `object` and keys generated by running each own enumerable
- * property of `object` through `iteratee`. The iteratee is invoked with
- * three arguments: (value, key, object).
+ * string keyed property of `object` thru `iteratee`. The iteratee is invoked
+ * with three arguments: (value, key, object).
*
* @static
* @memberOf _
+ * @since 3.8.0
* @category Object
* @param {Object} object The object to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
+ * @see _.mapValues
* @example
*
* _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
@@ -48349,16 +48209,20 @@ return jQuery;
}
/**
- * Creates an object with the same keys as `object` and values generated by
- * running each own enumerable property of `object` through `iteratee`. The
- * iteratee is invoked with three arguments: (value, key, object).
+ * Creates an object with the same keys as `object` and values generated
+ * by running each own enumerable string keyed property of `object` thru
+ * `iteratee`. The iteratee is invoked with three arguments:
+ * (value, key, object).
*
* @static
* @memberOf _
+ * @since 2.4.0
* @category Object
* @param {Object} object The object to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
+ * @see _.mapKeys
* @example
*
* var users = {
@@ -48384,10 +48248,11 @@ return jQuery;
}
/**
- * Recursively merges own and inherited enumerable properties of source objects
- * into the destination object. Source properties that resolve to `undefined`
- * are skipped if a destination value exists. Array and plain object properties
- * are merged recursively. Other objects and value types are overridden by
+ * This method is like `_.assign` except that it recursively merges own and
+ * inherited enumerable string keyed properties of source objects into the
+ * destination object. Source properties that resolve to `undefined` are
+ * skipped if a destination value exists. Array and plain object properties
+ * are merged recursively.Other objects and value types are overridden by
* assignment. Source objects are applied from left to right. Subsequent
* sources overwrite property assignments of previous sources.
*
@@ -48395,6 +48260,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 0.5.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
@@ -48419,7 +48285,7 @@ return jQuery;
/**
* This method is like `_.merge` except that it accepts `customizer` which
* is invoked to produce the merged values of the destination and source
- * properties. If `customizer` returns `undefined` merging is handled by the
+ * properties. If `customizer` returns `undefined`, merging is handled by the
* method instead. The `customizer` is invoked with seven arguments:
* (objValue, srcValue, key, object, source, stack).
*
@@ -48427,6 +48293,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
@@ -48459,14 +48326,15 @@ return jQuery;
/**
* The opposite of `_.pick`; this method creates an object composed of the
- * own and inherited enumerable properties of `object` that are not omitted.
+ * own and inherited enumerable string keyed properties of `object` that are
+ * not omitted.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
- * @param {...(string|string[])} [props] The property names to omit, specified
- * individually or in arrays.
+ * @param {...(string|string[])} [props] The property identifiers to omit.
* @returns {Object} Returns the new object.
* @example
*
@@ -48479,21 +48347,23 @@ return jQuery;
if (object == null) {
return {};
}
- props = arrayMap(baseFlatten(props, 1), String);
- return basePick(object, baseDifference(keysIn(object), props));
+ props = arrayMap(baseFlatten(props, 1), toKey);
+ return basePick(object, baseDifference(getAllKeysIn(object), props));
});
/**
* The opposite of `_.pickBy`; this method creates an object composed of
- * the own and inherited enumerable properties of `object` that `predicate`
- * doesn't return truthy for. The predicate is invoked with two arguments:
- * (value, key).
+ * the own and inherited enumerable string keyed properties of `object` that
+ * `predicate` doesn't return truthy for. The predicate is invoked with two
+ * arguments: (value, key).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The source object.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per property.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
@@ -48513,11 +48383,11 @@ return jQuery;
* Creates an object composed of the picked `object` properties.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
- * @param {...(string|string[])} [props] The property names to pick, specified
- * individually or in arrays.
+ * @param {...(string|string[])} [props] The property identifiers to pick.
* @returns {Object} Returns the new object.
* @example
*
@@ -48527,7 +48397,7 @@ return jQuery;
* // => { 'a': 1, 'c': 3 }
*/
var pick = rest(function(object, props) {
- return object == null ? {} : basePick(object, baseFlatten(props, 1));
+ return object == null ? {} : basePick(object, arrayMap(baseFlatten(props, 1), toKey));
});
/**
@@ -48536,9 +48406,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The source object.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per property.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
@@ -48552,16 +48424,17 @@ return jQuery;
}
/**
- * This method is like `_.get` except that if the resolved value is a function
- * it's invoked with the `this` binding of its parent object and its result
- * is returned.
+ * This method is like `_.get` except that if the resolved value is a
+ * function it's invoked with the `this` binding of its parent object and
+ * its result is returned.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to resolve.
- * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
+ * @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
@@ -48580,21 +48453,29 @@ return jQuery;
* // => 'default'
*/
function result(object, path, defaultValue) {
- if (!isKey(path, object)) {
- path = baseCastPath(path);
- var result = get(object, path);
- object = parent(object, path);
- } else {
- result = object == null ? undefined : object[path];
+ path = isKey(path, object) ? [path] : castPath(path);
+
+ var index = -1,
+ length = path.length;
+
+ // Ensure the loop is entered when path is empty.
+ if (!length) {
+ object = undefined;
+ length = 1;
}
- if (result === undefined) {
- result = defaultValue;
+ while (++index < length) {
+ var value = object == null ? undefined : object[toKey(path[index])];
+ if (value === undefined) {
+ index = length;
+ value = defaultValue;
+ }
+ object = isFunction(value) ? value.call(object) : value;
}
- return isFunction(result) ? result.call(object) : result;
+ return object;
}
/**
- * Sets the value at `path` of `object`. If a portion of `path` doesn't exist
+ * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
* it's created. Arrays are created for missing index properties while objects
* are created for all other missing properties. Use `_.setWith` to customize
* `path` creation.
@@ -48603,6 +48484,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.7.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
@@ -48616,7 +48498,7 @@ return jQuery;
* console.log(object.a[0].b.c);
* // => 4
*
- * _.set(object, 'x[0].y.z', 5);
+ * _.set(object, ['x', '0', 'y', 'z'], 5);
* console.log(object.x[0].y.z);
* // => 5
*/
@@ -48634,6 +48516,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
@@ -48642,8 +48525,10 @@ return jQuery;
* @returns {Object} Returns `object`.
* @example
*
- * _.setWith({ '0': { 'length': 2 } }, '[0][1][2]', 3, Object);
- * // => { '0': { '1': { '2': 3 }, 'length': 2 } }
+ * var object = {};
+ *
+ * _.setWith(object, '[0][1]', 'a', Object);
+ * // => { '0': { '1': 'a' } }
*/
function setWith(object, path, value, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined;
@@ -48651,11 +48536,13 @@ return jQuery;
}
/**
- * Creates an array of own enumerable key-value pairs for `object` which
- * can be consumed by `_.fromPairs`.
+ * Creates an array of own enumerable string keyed-value pairs for `object`
+ * which can be consumed by `_.fromPairs`.
*
* @static
* @memberOf _
+ * @since 4.0.0
+ * @alias entries
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the new array of key-value pairs.
@@ -48676,11 +48563,13 @@ return jQuery;
}
/**
- * Creates an array of own and inherited enumerable key-value pairs for
- * `object` which can be consumed by `_.fromPairs`.
+ * Creates an array of own and inherited enumerable string keyed-value pairs
+ * for `object` which can be consumed by `_.fromPairs`.
*
* @static
* @memberOf _
+ * @since 4.0.0
+ * @alias entriesIn
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the new array of key-value pairs.
@@ -48702,14 +48591,15 @@ return jQuery;
/**
* An alternative to `_.reduce`; this method transforms `object` to a new
- * `accumulator` object which is the result of running each of its own enumerable
- * properties through `iteratee`, with each invocation potentially mutating
- * the `accumulator` object. The iteratee is invoked with four arguments:
- * (accumulator, value, key, object). Iteratee functions may exit iteration
- * early by explicitly returning `false`.
+ * `accumulator` object which is the result of running each of its own
+ * enumerable string keyed properties thru `iteratee`, with each invocation
+ * potentially mutating the `accumulator` object. The iteratee is invoked
+ * with four arguments: (accumulator, value, key, object). Iteratee functions
+ * may exit iteration early by explicitly returning `false`.
*
* @static
* @memberOf _
+ * @since 1.3.0
* @category Object
* @param {Array|Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
@@ -48738,7 +48628,7 @@ return jQuery;
if (isArr) {
accumulator = isArray(object) ? new Ctor : [];
} else {
- accumulator = isFunction(Ctor) ? baseCreate(getPrototypeOf(object)) : {};
+ accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
}
} else {
accumulator = {};
@@ -48757,6 +48647,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to unset.
@@ -48770,7 +48661,7 @@ return jQuery;
* console.log(object);
* // => { 'a': [{ 'b': {} }] };
*
- * _.unset(object, 'a[0].b.c');
+ * _.unset(object, ['a', '0', 'b', 'c']);
* // => true
*
* console.log(object);
@@ -48781,11 +48672,72 @@ return jQuery;
}
/**
- * Creates an array of the own enumerable property values of `object`.
+ * This method is like `_.set` except that accepts `updater` to produce the
+ * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
+ * is invoked with one argument: (value).
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.6.0
+ * @category Object
+ * @param {Object} object The object to modify.
+ * @param {Array|string} path The path of the property to set.
+ * @param {Function} updater The function to produce the updated value.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
+ *
+ * _.update(object, 'a[0].b.c', function(n) { return n * n; });
+ * console.log(object.a[0].b.c);
+ * // => 9
+ *
+ * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
+ * console.log(object.x[0].y.z);
+ * // => 0
+ */
+ function update(object, path, updater) {
+ return object == null ? object : baseUpdate(object, path, castFunction(updater));
+ }
+
+ /**
+ * This method is like `_.update` except that it accepts `customizer` which is
+ * invoked to produce the objects of `path`. If `customizer` returns `undefined`
+ * path creation is handled by the method instead. The `customizer` is invoked
+ * with three arguments: (nsValue, key, nsObject).
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.6.0
+ * @category Object
+ * @param {Object} object The object to modify.
+ * @param {Array|string} path The path of the property to set.
+ * @param {Function} updater The function to produce the updated value.
+ * @param {Function} [customizer] The function to customize assigned values.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * var object = {};
+ *
+ * _.updateWith(object, '[0][1]', _.constant('a'), Object);
+ * // => { '0': { '1': 'a' } }
+ */
+ function updateWith(object, path, updater, customizer) {
+ customizer = typeof customizer == 'function' ? customizer : undefined;
+ return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
+ }
+
+ /**
+ * Creates an array of the own enumerable string keyed property values of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
@@ -48810,12 +48762,14 @@ return jQuery;
}
/**
- * Creates an array of the own and inherited enumerable property values of `object`.
+ * Creates an array of the own and inherited enumerable string keyed property
+ * values of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property values.
@@ -48842,6 +48796,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Number
* @param {number} number The number to clamp.
* @param {number} [lower] The lower bound.
@@ -48872,18 +48827,20 @@ return jQuery;
}
/**
- * Checks if `n` is between `start` and up to but not including, `end`. If
- * `end` is not specified it's set to `start` with `start` then set to `0`.
+ * Checks if `n` is between `start` and up to, but not including, `end`. If
+ * `end` is not specified, it's set to `start` with `start` then set to `0`.
* If `start` is greater than `end` the params are swapped to support
* negative ranges.
*
* @static
* @memberOf _
+ * @since 3.3.0
* @category Number
* @param {number} number The number to check.
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
+ * @see _.range, _.rangeRight
* @example
*
* _.inRange(3, 2, 4);
@@ -48922,14 +48879,15 @@ return jQuery;
/**
* Produces a random number between the inclusive `lower` and `upper` bounds.
* If only one argument is provided a number between `0` and the given number
- * is returned. If `floating` is `true`, or either `lower` or `upper` are floats,
- * a floating-point number is returned instead of an integer.
+ * is returned. If `floating` is `true`, or either `lower` or `upper` are
+ * floats, a floating-point number is returned instead of an integer.
*
* **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results.
*
* @static
* @memberOf _
+ * @since 0.7.0
* @category Number
* @param {number} [lower=0] The lower bound.
* @param {number} [upper=1] The upper bound.
@@ -48995,6 +48953,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the camel cased string.
@@ -49003,10 +48962,10 @@ return jQuery;
* _.camelCase('Foo Bar');
* // => 'fooBar'
*
- * _.camelCase('--foo-bar');
+ * _.camelCase('--foo-bar--');
* // => 'fooBar'
*
- * _.camelCase('__foo_bar__');
+ * _.camelCase('__FOO_BAR__');
* // => 'fooBar'
*/
var camelCase = createCompounder(function(result, word, index) {
@@ -49020,6 +48979,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to capitalize.
* @returns {string} Returns the capitalized string.
@@ -49033,11 +48993,14 @@ return jQuery;
}
/**
- * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
- * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
+ * Deburrs `string` by converting
+ * [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
+ * to basic latin letters and removing
+ * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to deburr.
* @returns {string} Returns the deburred string.
@@ -49056,11 +49019,13 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to search.
* @param {string} [target] The string to search for.
* @param {number} [position=string.length] The position to search from.
- * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`.
+ * @returns {boolean} Returns `true` if `string` ends with `target`,
+ * else `false`.
* @example
*
* _.endsWith('abc', 'c');
@@ -49074,7 +49039,7 @@ return jQuery;
*/
function endsWith(string, target, position) {
string = toString(string);
- target = typeof target == 'string' ? target : (target + '');
+ target = baseToString(target);
var length = string.length;
position = position === undefined
@@ -49094,20 +49059,22 @@ return jQuery;
*
* Though the ">" character is escaped for symmetry, characters like
* ">" and "/" don't need escaping in HTML and have no special meaning
- * unless they're part of a tag or unquoted attribute value.
- * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
+ * unless they're part of a tag or unquoted attribute value. See
+ * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
* (under "semi-related fun fact") for more details.
*
* Backticks are escaped because in IE < 9, they can break out of
* attribute values or HTML comments. See [#59](https://html5sec.org/#59),
* [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
- * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)
- * for more details.
+ * [#133](https://html5sec.org/#133) of the
+ * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details.
*
- * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)
- * to reduce XSS vectors.
+ * When working with HTML you should always
+ * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
+ * XSS vectors.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category String
* @param {string} [string=''] The string to escape.
@@ -49130,6 +49097,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to escape.
* @returns {string} Returns the escaped string.
@@ -49146,10 +49114,12 @@ return jQuery;
}
/**
- * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
+ * Converts `string` to
+ * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the kebab cased string.
@@ -49161,7 +49131,7 @@ return jQuery;
* _.kebabCase('fooBar');
* // => 'foo-bar'
*
- * _.kebabCase('__foo_bar__');
+ * _.kebabCase('__FOO_BAR__');
* // => 'foo-bar'
*/
var kebabCase = createCompounder(function(result, word, index) {
@@ -49173,12 +49143,13 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the lower cased string.
* @example
*
- * _.lowerCase('--Foo-Bar');
+ * _.lowerCase('--Foo-Bar--');
* // => 'foo bar'
*
* _.lowerCase('fooBar');
@@ -49196,6 +49167,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the converted string.
@@ -49210,29 +49182,12 @@ return jQuery;
var lowerFirst = createCaseFirst('toLowerCase');
/**
- * Converts the first character of `string` to upper case.
- *
- * @static
- * @memberOf _
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the converted string.
- * @example
- *
- * _.upperFirst('fred');
- * // => 'Fred'
- *
- * _.upperFirst('FRED');
- * // => 'FRED'
- */
- var upperFirst = createCaseFirst('toUpperCase');
-
- /**
* Pads `string` on the left and right sides if it's shorter than `length`.
* Padding characters are truncated if they can't be evenly divided by `length`.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
@@ -49253,15 +49208,16 @@ return jQuery;
string = toString(string);
length = toInteger(length);
- var strLength = stringSize(string);
+ var strLength = length ? stringSize(string) : 0;
if (!length || strLength >= length) {
return string;
}
- var mid = (length - strLength) / 2,
- leftLength = nativeFloor(mid),
- rightLength = nativeCeil(mid);
-
- return createPadding('', leftLength, chars) + string + createPadding('', rightLength, chars);
+ var mid = (length - strLength) / 2;
+ return (
+ createPadding(nativeFloor(mid), chars) +
+ string +
+ createPadding(nativeCeil(mid), chars)
+ );
}
/**
@@ -49270,6 +49226,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
@@ -49288,7 +49245,12 @@ return jQuery;
*/
function padEnd(string, length, chars) {
string = toString(string);
- return string + createPadding(string, length, chars);
+ length = toInteger(length);
+
+ var strLength = length ? stringSize(string) : 0;
+ return (length && strLength < length)
+ ? (string + createPadding(length - strLength, chars))
+ : string;
}
/**
@@ -49297,6 +49259,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
@@ -49315,23 +49278,29 @@ return jQuery;
*/
function padStart(string, length, chars) {
string = toString(string);
- return createPadding(string, length, chars) + string;
+ length = toInteger(length);
+
+ var strLength = length ? stringSize(string) : 0;
+ return (length && strLength < length)
+ ? (createPadding(length - strLength, chars) + string)
+ : string;
}
/**
* Converts `string` to an integer of the specified radix. If `radix` is
- * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
- * in which case a `radix` of `16` is used.
+ * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
+ * hexadecimal, in which case a `radix` of `16` is used.
*
- * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#x15.1.2.2)
- * of `parseInt`.
+ * **Note:** This method aligns with the
+ * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
*
* @static
* @memberOf _
+ * @since 1.1.0
* @category String
* @param {string} string The string to convert.
* @param {number} [radix=10] The radix to interpret `value` by.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {number} Returns the converted integer.
* @example
*
@@ -49343,7 +49312,7 @@ return jQuery;
*/
function parseInt(string, radix, guard) {
// Chrome fails to trim leading <BOM> whitespace characters.
- // See https://code.google.com/p/v8/issues/detail?id=3109 for more details.
+ // See https://bugs.chromium.org/p/v8/issues/detail?id=3109 for more details.
if (guard || radix == null) {
radix = 0;
} else if (radix) {
@@ -49358,9 +49327,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to repeat.
- * @param {number} [n=0] The number of times to repeat the string.
+ * @param {number} [n=1] The number of times to repeat the string.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the repeated string.
* @example
*
@@ -49373,34 +49344,24 @@ return jQuery;
* _.repeat('abc', 0);
* // => ''
*/
- function repeat(string, n) {
- string = toString(string);
- n = toInteger(n);
-
- var result = '';
- if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
- return result;
+ function repeat(string, n, guard) {
+ if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
+ n = 1;
+ } else {
+ n = toInteger(n);
}
- // Leverage the exponentiation by squaring algorithm for a faster repeat.
- // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
- do {
- if (n % 2) {
- result += string;
- }
- n = nativeFloor(n / 2);
- string += string;
- } while (n);
-
- return result;
+ return baseRepeat(toString(string), n);
}
/**
* Replaces matches for `pattern` in `string` with `replacement`.
*
- * **Note:** This method is based on [`String#replace`](https://mdn.io/String/replace).
+ * **Note:** This method is based on
+ * [`String#replace`](https://mdn.io/String/replace).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to modify.
* @param {RegExp|string} pattern The pattern to replace.
@@ -49415,14 +49376,16 @@ return jQuery;
var args = arguments,
string = toString(args[0]);
- return args.length < 3 ? string : string.replace(args[1], args[2]);
+ return args.length < 3 ? string : nativeReplace.call(string, args[1], args[2]);
}
/**
- * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case).
+ * Converts `string` to
+ * [snake case](https://en.wikipedia.org/wiki/Snake_case).
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the snake cased string.
@@ -49434,7 +49397,7 @@ return jQuery;
* _.snakeCase('fooBar');
* // => 'foo_bar'
*
- * _.snakeCase('--foo-bar');
+ * _.snakeCase('--FOO-BAR--');
* // => 'foo_bar'
*/
var snakeCase = createCompounder(function(result, word, index) {
@@ -49444,10 +49407,12 @@ return jQuery;
/**
* Splits `string` by `separator`.
*
- * **Note:** This method is based on [`String#split`](https://mdn.io/String/split).
+ * **Note:** This method is based on
+ * [`String#split`](https://mdn.io/String/split).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to split.
* @param {RegExp|string} separator The separator pattern to split by.
@@ -49459,30 +49424,49 @@ return jQuery;
* // => ['a', 'b']
*/
function split(string, separator, limit) {
- return toString(string).split(separator, limit);
+ if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
+ separator = limit = undefined;
+ }
+ limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
+ if (!limit) {
+ return [];
+ }
+ string = toString(string);
+ if (string && (
+ typeof separator == 'string' ||
+ (separator != null && !isRegExp(separator))
+ )) {
+ separator = baseToString(separator);
+ if (separator == '' && reHasComplexSymbol.test(string)) {
+ return castSlice(stringToArray(string), 0, limit);
+ }
+ }
+ return nativeSplit.call(string, separator, limit);
}
/**
- * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
+ * Converts `string` to
+ * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
*
* @static
* @memberOf _
+ * @since 3.1.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the start cased string.
* @example
*
- * _.startCase('--foo-bar');
+ * _.startCase('--foo-bar--');
* // => 'Foo Bar'
*
* _.startCase('fooBar');
* // => 'Foo Bar'
*
- * _.startCase('__foo_bar__');
- * // => 'Foo Bar'
+ * _.startCase('__FOO_BAR__');
+ * // => 'FOO BAR'
*/
var startCase = createCompounder(function(result, word, index) {
- return result + (index ? ' ' : '') + capitalize(word);
+ return result + (index ? ' ' : '') + upperFirst(word);
});
/**
@@ -49490,11 +49474,13 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to search.
* @param {string} [target] The string to search for.
* @param {number} [position=0] The position to search from.
- * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`.
+ * @returns {boolean} Returns `true` if `string` starts with `target`,
+ * else `false`.
* @example
*
* _.startsWith('abc', 'a');
@@ -49509,7 +49495,7 @@ return jQuery;
function startsWith(string, target, position) {
string = toString(string);
position = baseClamp(toInteger(position), 0, string.length);
- return string.lastIndexOf(target, position) == position;
+ return string.lastIndexOf(baseToString(target), position) == position;
}
/**
@@ -49517,7 +49503,7 @@ return jQuery;
* in "interpolate" delimiters, HTML-escape interpolated data properties in
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
* properties may be accessed as free variables in the template. If a setting
- * object is given it takes precedence over `_.templateSettings` values.
+ * object is given, it takes precedence over `_.templateSettings` values.
*
* **Note:** In the development build `_.template` utilizes
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
@@ -49530,17 +49516,24 @@ return jQuery;
* [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category String
* @param {string} [string=''] The template string.
- * @param {Object} [options] The options object.
- * @param {RegExp} [options.escape] The HTML "escape" delimiter.
- * @param {RegExp} [options.evaluate] The "evaluate" delimiter.
- * @param {Object} [options.imports] An object to import into the template as free variables.
- * @param {RegExp} [options.interpolate] The "interpolate" delimiter.
- * @param {string} [options.sourceURL] The sourceURL of the template's compiled source.
- * @param {string} [options.variable] The data object variable name.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param {Object} [options={}] The options object.
+ * @param {RegExp} [options.escape=_.templateSettings.escape]
+ * The HTML "escape" delimiter.
+ * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
+ * The "evaluate" delimiter.
+ * @param {Object} [options.imports=_.templateSettings.imports]
+ * An object to import into the template as free variables.
+ * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
+ * The "interpolate" delimiter.
+ * @param {string} [options.sourceURL='lodash.templateSources[n]']
+ * The sourceURL of the compiled template.
+ * @param {string} [options.variable='obj']
+ * The data object variable name.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the compiled template function.
* @example
*
@@ -49589,7 +49582,7 @@ return jQuery;
* // Use the `sourceURL` option to specify a custom sourceURL for the template.
* var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
* compiled(data);
- * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
+ * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
*
* // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
@@ -49609,7 +49602,8 @@ return jQuery;
* ');
*/
function template(string, options, guard) {
- // Based on John Resig's `tmpl` implementation (http://ejohn.org/blog/javascript-micro-templating/)
+ // Based on John Resig's `tmpl` implementation
+ // (http://ejohn.org/blog/javascript-micro-templating/)
// and Laura Doktorova's doT.js (https://github.com/olado/doT).
var settings = lodash.templateSettings;
@@ -49716,17 +49710,19 @@ return jQuery;
}
/**
- * Converts `string`, as a whole, to lower case.
+ * Converts `string`, as a whole, to lower case just like
+ * [String#toLowerCase](https://mdn.io/toLowerCase).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the lower cased string.
* @example
*
- * _.toLower('--Foo-Bar');
- * // => '--foo-bar'
+ * _.toLower('--Foo-Bar--');
+ * // => '--foo-bar--'
*
* _.toLower('fooBar');
* // => 'foobar'
@@ -49739,17 +49735,19 @@ return jQuery;
}
/**
- * Converts `string`, as a whole, to upper case.
+ * Converts `string`, as a whole, to upper case just like
+ * [String#toUpperCase](https://mdn.io/toUpperCase).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the upper cased string.
* @example
*
- * _.toUpper('--foo-bar');
- * // => '--FOO-BAR'
+ * _.toUpper('--foo-bar--');
+ * // => '--FOO-BAR--'
*
* _.toUpper('fooBar');
* // => 'FOOBAR'
@@ -49766,10 +49764,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
@@ -49784,22 +49783,18 @@ return jQuery;
*/
function trim(string, chars, guard) {
string = toString(string);
- if (!string) {
- return string;
- }
- if (guard || chars === undefined) {
+ if (string && (guard || chars === undefined)) {
return string.replace(reTrim, '');
}
- chars = (chars + '');
- if (!chars) {
+ if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),
- chrSymbols = stringToArray(chars);
+ chrSymbols = stringToArray(chars),
+ start = charsStartIndex(strSymbols, chrSymbols),
+ end = charsEndIndex(strSymbols, chrSymbols) + 1;
- return strSymbols
- .slice(charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1)
- .join('');
+ return castSlice(strSymbols, start, end).join('');
}
/**
@@ -49807,10 +49802,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
@@ -49822,20 +49818,16 @@ return jQuery;
*/
function trimEnd(string, chars, guard) {
string = toString(string);
- if (!string) {
- return string;
- }
- if (guard || chars === undefined) {
+ if (string && (guard || chars === undefined)) {
return string.replace(reTrimEnd, '');
}
- chars = (chars + '');
- if (!chars) {
+ if (!string || !(chars = baseToString(chars))) {
return string;
}
- var strSymbols = stringToArray(string);
- return strSymbols
- .slice(0, charsEndIndex(strSymbols, stringToArray(chars)) + 1)
- .join('');
+ var strSymbols = stringToArray(string),
+ end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
+
+ return castSlice(strSymbols, 0, end).join('');
}
/**
@@ -49843,10 +49835,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
@@ -49858,20 +49851,16 @@ return jQuery;
*/
function trimStart(string, chars, guard) {
string = toString(string);
- if (!string) {
- return string;
- }
- if (guard || chars === undefined) {
+ if (string && (guard || chars === undefined)) {
return string.replace(reTrimStart, '');
}
- chars = (chars + '');
- if (!chars) {
+ if (!string || !(chars = baseToString(chars))) {
return string;
}
- var strSymbols = stringToArray(string);
- return strSymbols
- .slice(charsStartIndex(strSymbols, stringToArray(chars)))
- .join('');
+ var strSymbols = stringToArray(string),
+ start = charsStartIndex(strSymbols, stringToArray(chars));
+
+ return castSlice(strSymbols, start).join('');
}
/**
@@ -49881,9 +49870,10 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to truncate.
- * @param {Object} [options=({})] The options object.
+ * @param {Object} [options={}] The options object.
* @param {number} [options.length=30] The maximum string length.
* @param {string} [options.omission='...'] The string to indicate text is omitted.
* @param {RegExp|string} [options.separator] The separator pattern to truncate to.
@@ -49917,7 +49907,7 @@ return jQuery;
if (isObject(options)) {
var separator = 'separator' in options ? options.separator : separator;
length = 'length' in options ? toInteger(options.length) : length;
- omission = 'omission' in options ? toString(options.omission) : omission;
+ omission = 'omission' in options ? baseToString(options.omission) : omission;
}
string = toString(string);
@@ -49934,7 +49924,7 @@ return jQuery;
return omission;
}
var result = strSymbols
- ? strSymbols.slice(0, end).join('')
+ ? castSlice(strSymbols, 0, end).join('')
: string.slice(0, end);
if (separator === undefined) {
@@ -49957,7 +49947,7 @@ return jQuery;
}
result = result.slice(0, newEnd === undefined ? end : newEnd);
}
- } else if (string.indexOf(separator, end) != end) {
+ } else if (string.indexOf(baseToString(separator), end) != end) {
var index = result.lastIndexOf(separator);
if (index > -1) {
result = result.slice(0, index);
@@ -49968,14 +49958,15 @@ return jQuery;
/**
* The inverse of `_.escape`; this method converts the HTML entities
- * `&amp;`, `&lt;`, `&gt;`, `&quot;`, `&#39;`, and `&#96;` in `string` to their
- * corresponding characters.
+ * `&amp;`, `&lt;`, `&gt;`, `&quot;`, `&#39;`, and `&#96;` in `string` to
+ * their corresponding characters.
*
- * **Note:** No other HTML entities are unescaped. To unescape additional HTML
- * entities use a third-party library like [_he_](https://mths.be/he).
+ * **Note:** No other HTML entities are unescaped. To unescape additional
+ * HTML entities use a third-party library like [_he_](https://mths.be/he).
*
* @static
* @memberOf _
+ * @since 0.6.0
* @category String
* @param {string} [string=''] The string to unescape.
* @returns {string} Returns the unescaped string.
@@ -49996,6 +49987,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the upper cased string.
@@ -50015,14 +50007,34 @@ return jQuery;
});
/**
+ * Converts the first character of `string` to upper case.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the converted string.
+ * @example
+ *
+ * _.upperFirst('fred');
+ * // => 'Fred'
+ *
+ * _.upperFirst('FRED');
+ * // => 'FRED'
+ */
+ var upperFirst = createCaseFirst('toUpperCase');
+
+ /**
* Splits `string` into an array of its words.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to inspect.
* @param {RegExp|string} [pattern] The pattern to match words.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the words of `string`.
* @example
*
@@ -50050,8 +50062,10 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Util
* @param {Function} func The function to attempt.
+ * @param {...*} [args] The arguments to invoke `func` with.
* @returns {*} Returns the `func` result or error object.
* @example
*
@@ -50079,11 +50093,11 @@ return jQuery;
* **Note:** This method doesn't set the "length" property of bound functions.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {Object} object The object to bind and assign the bound methods to.
- * @param {...(string|string[])} methodNames The object method names to bind,
- * specified individually or in arrays.
+ * @param {...(string|string[])} methodNames The object method names to bind.
* @returns {Object} Returns `object`.
* @example
*
@@ -50096,23 +50110,25 @@ return jQuery;
*
* _.bindAll(view, 'onClick');
* jQuery(element).on('click', view.onClick);
- * // => logs 'clicked docs' when clicked
+ * // => Logs 'clicked docs' when clicked.
*/
var bindAll = rest(function(object, methodNames) {
arrayEach(baseFlatten(methodNames, 1), function(key) {
+ key = toKey(key);
object[key] = bind(object[key], object);
});
return object;
});
/**
- * Creates a function that iterates over `pairs` invoking the corresponding
+ * Creates a function that iterates over `pairs` and invokes the corresponding
* function of the first predicate to return truthy. The predicate-function
* pairs are invoked with the `this` binding and arguments of the created
* function.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {Array} pairs The predicate-function pairs.
* @returns {Function} Returns the new function.
@@ -50162,6 +50178,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {Object} source The object of property predicates to conform to.
* @returns {Function} Returns the new function.
@@ -50184,6 +50201,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.4.0
* @category Util
* @param {*} value The value to return from the new function.
* @returns {Function} Returns the new function.
@@ -50208,9 +50226,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Util
* @param {...(Function|Function[])} [funcs] Functions to invoke.
* @returns {Function} Returns the new function.
+ * @see _.flowRight
* @example
*
* function square(n) {
@@ -50228,10 +50248,12 @@ return jQuery;
* invokes the given functions from right to left.
*
* @static
+ * @since 3.0.0
* @memberOf _
* @category Util
* @param {...(Function|Function[])} [funcs] Functions to invoke.
* @returns {Function} Returns the new function.
+ * @see _.flow
* @example
*
* function square(n) {
@@ -50248,6 +50270,7 @@ return jQuery;
* This method returns the first argument given to it.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {*} value Any value.
@@ -50265,12 +50288,13 @@ return jQuery;
/**
* Creates a function that invokes `func` with the arguments of the created
- * function. If `func` is a property name the created callback returns the
- * property value for a given element. If `func` is an object the created
- * callback returns `true` for elements that contain the equivalent object
- * properties, otherwise it returns `false`.
+ * function. If `func` is a property name, the created function returns the
+ * property value for a given element. If `func` is an array or object, the
+ * created function returns `true` for elements that contain the equivalent
+ * source properties, otherwise it returns `false`.
*
* @static
+ * @since 4.0.0
* @memberOf _
* @category Util
* @param {*} [func=_.identity] The value to convert to a callback.
@@ -50278,20 +50302,31 @@ return jQuery;
* @example
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40 }
+ * { 'user': 'barney', 'age': 36, 'active': true },
+ * { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
+ * // The `_.matches` iteratee shorthand.
+ * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
+ * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.filter(users, _.iteratee(['user', 'fred']));
+ * // => [{ 'user': 'fred', 'age': 40 }]
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.map(users, _.iteratee('user'));
+ * // => ['barney', 'fred']
+ *
* // Create custom iteratee shorthands.
- * _.iteratee = _.wrap(_.iteratee, function(callback, func) {
- * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func);
- * return !p ? callback(func) : function(object) {
- * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]);
+ * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
+ * return !_.isRegExp(func) ? iteratee(func) : function(string) {
+ * return func.test(string);
* };
* });
*
- * _.filter(users, 'age > 36');
- * // => [{ 'user': 'fred', 'age': 40 }]
+ * _.filter(['abc', 'def'], /ef/);
+ * // => ['def']
*/
function iteratee(func) {
return baseIteratee(typeof func == 'function' ? func : baseClone(func, true));
@@ -50307,6 +50342,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Util
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new function.
@@ -50333,6 +50369,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.2.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @param {*} srcValue The value to match.
@@ -50357,6 +50394,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.7.0
* @category Util
* @param {Array|string} path The path of the method to invoke.
* @param {...*} [args] The arguments to invoke the method with.
@@ -50364,15 +50402,15 @@ return jQuery;
* @example
*
* var objects = [
- * { 'a': { 'b': { 'c': _.constant(2) } } },
- * { 'a': { 'b': { 'c': _.constant(1) } } }
+ * { 'a': { 'b': _.constant(2) } },
+ * { 'a': { 'b': _.constant(1) } }
* ];
*
- * _.map(objects, _.method('a.b.c'));
+ * _.map(objects, _.method('a.b'));
* // => [2, 1]
*
- * _.invokeMap(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');
- * // => [1, 2]
+ * _.map(objects, _.method(['a', 'b']));
+ * // => [2, 1]
*/
var method = rest(function(path, args) {
return function(object) {
@@ -50387,6 +50425,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.7.0
* @category Util
* @param {Object} object The object to query.
* @param {...*} [args] The arguments to invoke the method with.
@@ -50409,21 +50448,21 @@ return jQuery;
});
/**
- * Adds all own enumerable function properties of a source object to the
- * destination object. If `object` is a function then methods are added to
- * its prototype as well.
+ * Adds all own enumerable string keyed function properties of a source
+ * object to the destination object. If `object` is a function, then methods
+ * are added to its prototype as well.
*
* **Note:** Use `_.runInContext` to create a pristine `lodash` function to
* avoid conflicts caused by modifying the original.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {Function|Object} [object=lodash] The destination object.
* @param {Object} source The object of functions to add.
- * @param {Object} [options] The options object.
- * @param {boolean} [options.chain=true] Specify whether the functions added
- * are chainable.
+ * @param {Object} [options={}] The options object.
+ * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
* @returns {Function|Object} Returns `object`.
* @example
*
@@ -50455,7 +50494,7 @@ return jQuery;
object = this;
methodNames = baseFunctions(source, keys(source));
}
- var chain = (isObject(options) && 'chain' in options) ? options.chain : true,
+ var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
isFunc = isFunction(object);
arrayEach(methodNames, function(methodName) {
@@ -50485,6 +50524,7 @@ return jQuery;
* the `lodash` function.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @returns {Function} Returns the `lodash` function.
@@ -50505,6 +50545,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.3.0
* @category Util
* @example
*
@@ -50518,35 +50559,42 @@ return jQuery;
}
/**
- * Creates a function that returns its nth argument.
+ * Creates a function that returns its nth argument. If `n` is negative,
+ * the nth argument from the end is returned.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {number} [n=0] The index of the argument to return.
* @returns {Function} Returns the new function.
* @example
*
* var func = _.nthArg(1);
- *
- * func('a', 'b', 'c');
+ * func('a', 'b', 'c', 'd');
* // => 'b'
+ *
+ * var func = _.nthArg(-2);
+ * func('a', 'b', 'c', 'd');
+ * // => 'c'
*/
function nthArg(n) {
n = toInteger(n);
- return function() {
- return arguments[n];
- };
+ return rest(function(args) {
+ return baseNth(args, n);
+ });
}
/**
- * Creates a function that invokes `iteratees` with the arguments provided
- * to the created function and returns their results.
+ * Creates a function that invokes `iteratees` with the arguments it receives
+ * and returns their results.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
- * @param {...(Function|Function[])} iteratees The iteratees to invoke.
+ * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
+ * [iteratees=[_.identity]] The iteratees to invoke.
* @returns {Function} Returns the new function.
* @example
*
@@ -50559,12 +50607,14 @@ return jQuery;
/**
* Creates a function that checks if **all** of the `predicates` return
- * truthy when invoked with the arguments provided to the created function.
+ * truthy when invoked with the arguments it receives.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
- * @param {...(Function|Function[])} predicates The predicates to check.
+ * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
+ * [predicates=[_.identity]] The predicates to check.
* @returns {Function} Returns the new function.
* @example
*
@@ -50583,12 +50633,14 @@ return jQuery;
/**
* Creates a function that checks if **any** of the `predicates` return
- * truthy when invoked with the arguments provided to the created function.
+ * truthy when invoked with the arguments it receives.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
- * @param {...(Function|Function[])} predicates The predicates to check.
+ * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
+ * [predicates=[_.identity]] The predicates to check.
* @returns {Function} Returns the new function.
* @example
*
@@ -50610,24 +50662,25 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 2.4.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new function.
* @example
*
* var objects = [
- * { 'a': { 'b': { 'c': 2 } } },
- * { 'a': { 'b': { 'c': 1 } } }
+ * { 'a': { 'b': 2 } },
+ * { 'a': { 'b': 1 } }
* ];
*
- * _.map(objects, _.property('a.b.c'));
+ * _.map(objects, _.property('a.b'));
* // => [2, 1]
*
- * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
+ * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
* // => [1, 2]
*/
function property(path) {
- return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
+ return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
}
/**
@@ -50636,6 +50689,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Util
* @param {Object} object The object to query.
* @returns {Function} Returns the new function.
@@ -50659,19 +50713,21 @@ return jQuery;
/**
* Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
- * `start` is specified without an `end` or `step`. If `end` is not specified
+ * `start` is specified without an `end` or `step`. If `end` is not specified,
* it's set to `start` with `start` then set to `0`.
*
* **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
* @returns {Array} Returns the new array of numbers.
+ * @see _.inRange, _.rangeRight
* @example
*
* _.range(4);
@@ -50703,11 +50759,13 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
* @returns {Array} Returns the new array of numbers.
+ * @see _.inRange, _.range
* @example
*
* _.rangeRight(4);
@@ -50738,6 +50796,7 @@ return jQuery;
* each invocation. The iteratee is invoked with one argument; (index).
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {number} n The number of times to invoke `iteratee`.
@@ -50759,7 +50818,7 @@ return jQuery;
var index = MAX_ARRAY_LENGTH,
length = nativeMin(n, MAX_ARRAY_LENGTH);
- iteratee = baseCastFunction(iteratee);
+ iteratee = getIteratee(iteratee);
n -= MAX_ARRAY_LENGTH;
var result = baseTimes(length, iteratee);
@@ -50774,6 +50833,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {*} value The value to convert.
* @returns {Array} Returns the new property path array.
@@ -50795,13 +50855,17 @@ return jQuery;
* // => false
*/
function toPath(value) {
- return isArray(value) ? arrayMap(value, String) : stringToPath(value);
+ if (isArray(value)) {
+ return arrayMap(value, toKey);
+ }
+ return isSymbol(value) ? [value] : copyArray(stringToPath(value));
}
/**
- * Generates a unique ID. If `prefix` is given the ID is appended to it.
+ * Generates a unique ID. If `prefix` is given, the ID is appended to it.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {string} [prefix=''] The value to prefix the ID with.
@@ -50826,6 +50890,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 3.4.0
* @category Math
* @param {number} augend The first number in an addition.
* @param {number} addend The second number in an addition.
@@ -50835,25 +50900,16 @@ return jQuery;
* _.add(6, 4);
* // => 10
*/
- function add(augend, addend) {
- var result;
- if (augend === undefined && addend === undefined) {
- return 0;
- }
- if (augend !== undefined) {
- result = augend;
- }
- if (addend !== undefined) {
- result = result === undefined ? addend : (result + addend);
- }
- return result;
- }
+ var add = createMathOperation(function(augend, addend) {
+ return augend + addend;
+ });
/**
* Computes `number` rounded up to `precision`.
*
* @static
* @memberOf _
+ * @since 3.10.0
* @category Math
* @param {number} number The number to round up.
* @param {number} [precision=0] The precision to round up to.
@@ -50872,10 +50928,30 @@ return jQuery;
var ceil = createRound('ceil');
/**
+ * Divide two numbers.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.7.0
+ * @category Math
+ * @param {number} dividend The first number in a division.
+ * @param {number} divisor The second number in a division.
+ * @returns {number} Returns the quotient.
+ * @example
+ *
+ * _.divide(6, 4);
+ * // => 1.5
+ */
+ var divide = createMathOperation(function(dividend, divisor) {
+ return dividend / divisor;
+ });
+
+ /**
* Computes `number` rounded down to `precision`.
*
* @static
* @memberOf _
+ * @since 3.10.0
* @category Math
* @param {number} number The number to round down.
* @param {number} [precision=0] The precision to round down to.
@@ -50894,10 +50970,11 @@ return jQuery;
var floor = createRound('floor');
/**
- * Computes the maximum value of `array`. If `array` is empty or falsey
+ * Computes the maximum value of `array`. If `array` is empty or falsey,
* `undefined` is returned.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Math
* @param {Array} array The array to iterate over.
@@ -50912,7 +50989,7 @@ return jQuery;
*/
function max(array) {
return (array && array.length)
- ? baseExtremum(array, identity, gt)
+ ? baseExtremum(array, identity, baseGt)
: undefined;
}
@@ -50923,9 +51000,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {*} Returns the maximum value.
* @example
*
@@ -50940,7 +51019,7 @@ return jQuery;
*/
function maxBy(array, iteratee) {
return (array && array.length)
- ? baseExtremum(array, getIteratee(iteratee), gt)
+ ? baseExtremum(array, getIteratee(iteratee), baseGt)
: undefined;
}
@@ -50949,6 +51028,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
* @returns {number} Returns the mean.
@@ -50958,14 +51038,43 @@ return jQuery;
* // => 5
*/
function mean(array) {
- return sum(array) / (array ? array.length : 0);
+ return baseMean(array, identity);
+ }
+
+ /**
+ * This method is like `_.mean` except that it accepts `iteratee` which is
+ * invoked for each element in `array` to generate the value to be averaged.
+ * The iteratee is invoked with one argument: (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.7.0
+ * @category Math
+ * @param {Array} array The array to iterate over.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
+ * @returns {number} Returns the mean.
+ * @example
+ *
+ * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
+ *
+ * _.meanBy(objects, function(o) { return o.n; });
+ * // => 5
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.meanBy(objects, 'n');
+ * // => 5
+ */
+ function meanBy(array, iteratee) {
+ return baseMean(array, getIteratee(iteratee));
}
/**
- * Computes the minimum value of `array`. If `array` is empty or falsey
+ * Computes the minimum value of `array`. If `array` is empty or falsey,
* `undefined` is returned.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Math
* @param {Array} array The array to iterate over.
@@ -50980,7 +51089,7 @@ return jQuery;
*/
function min(array) {
return (array && array.length)
- ? baseExtremum(array, identity, lt)
+ ? baseExtremum(array, identity, baseLt)
: undefined;
}
@@ -50991,9 +51100,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {*} Returns the minimum value.
* @example
*
@@ -51008,15 +51119,35 @@ return jQuery;
*/
function minBy(array, iteratee) {
return (array && array.length)
- ? baseExtremum(array, getIteratee(iteratee), lt)
+ ? baseExtremum(array, getIteratee(iteratee), baseLt)
: undefined;
}
/**
+ * Multiply two numbers.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.7.0
+ * @category Math
+ * @param {number} multiplier The first number in a multiplication.
+ * @param {number} multiplicand The second number in a multiplication.
+ * @returns {number} Returns the product.
+ * @example
+ *
+ * _.multiply(6, 4);
+ * // => 24
+ */
+ var multiply = createMathOperation(function(multiplier, multiplicand) {
+ return multiplier * multiplicand;
+ });
+
+ /**
* Computes `number` rounded to `precision`.
*
* @static
* @memberOf _
+ * @since 3.10.0
* @category Math
* @param {number} number The number to round.
* @param {number} [precision=0] The precision to round to.
@@ -51039,6 +51170,7 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Math
* @param {number} minuend The first number in a subtraction.
* @param {number} subtrahend The second number in a subtraction.
@@ -51048,25 +51180,16 @@ return jQuery;
* _.subtract(6, 4);
* // => 2
*/
- function subtract(minuend, subtrahend) {
- var result;
- if (minuend === undefined && subtrahend === undefined) {
- return 0;
- }
- if (minuend !== undefined) {
- result = minuend;
- }
- if (subtrahend !== undefined) {
- result = result === undefined ? subtrahend : (result - subtrahend);
- }
- return result;
- }
+ var subtract = createMathOperation(function(minuend, subtrahend) {
+ return minuend - subtrahend;
+ });
/**
* Computes the sum of the values in `array`.
*
* @static
* @memberOf _
+ * @since 3.4.0
* @category Math
* @param {Array} array The array to iterate over.
* @returns {number} Returns the sum.
@@ -51088,9 +51211,11 @@ return jQuery;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {number} Returns the sum.
* @example
*
@@ -51111,39 +51236,7 @@ return jQuery;
/*------------------------------------------------------------------------*/
- // Ensure wrappers are instances of `baseLodash`.
- lodash.prototype = baseLodash.prototype;
-
- LodashWrapper.prototype = baseCreate(baseLodash.prototype);
- LodashWrapper.prototype.constructor = LodashWrapper;
-
- LazyWrapper.prototype = baseCreate(baseLodash.prototype);
- LazyWrapper.prototype.constructor = LazyWrapper;
-
- // Avoid inheriting from `Object.prototype` when possible.
- Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto;
-
- // Add functions to the `MapCache`.
- MapCache.prototype.clear = mapClear;
- MapCache.prototype['delete'] = mapDelete;
- MapCache.prototype.get = mapGet;
- MapCache.prototype.has = mapHas;
- MapCache.prototype.set = mapSet;
-
- // Add functions to the `SetCache`.
- SetCache.prototype.push = cachePush;
-
- // Add functions to the `Stack` cache.
- Stack.prototype.clear = stackClear;
- Stack.prototype['delete'] = stackDelete;
- Stack.prototype.get = stackGet;
- Stack.prototype.has = stackHas;
- Stack.prototype.set = stackSet;
-
- // Assign cache to `_.memoize`.
- memoize.Cache = MapCache;
-
- // Add functions that return wrapped values when chaining.
+ // Add methods that return wrapped values in chain sequences.
lodash.after = after;
lodash.ary = ary;
lodash.assign = assign;
@@ -51182,6 +51275,8 @@ return jQuery;
lodash.fill = fill;
lodash.filter = filter;
lodash.flatMap = flatMap;
+ lodash.flatMapDeep = flatMapDeep;
+ lodash.flatMapDepth = flatMapDepth;
lodash.flatten = flatten;
lodash.flattenDeep = flattenDeep;
lodash.flattenDepth = flattenDepth;
@@ -51234,6 +51329,7 @@ return jQuery;
lodash.pull = pull;
lodash.pullAll = pullAll;
lodash.pullAllBy = pullAllBy;
+ lodash.pullAllWith = pullAllWith;
lodash.pullAt = pullAt;
lodash.range = range;
lodash.rangeRight = rangeRight;
@@ -51276,6 +51372,8 @@ return jQuery;
lodash.unset = unset;
lodash.unzip = unzip;
lodash.unzipWith = unzipWith;
+ lodash.update = update;
+ lodash.updateWith = updateWith;
lodash.values = values;
lodash.valuesIn = valuesIn;
lodash.without = without;
@@ -51290,15 +51388,17 @@ return jQuery;
lodash.zipWith = zipWith;
// Add aliases.
+ lodash.entries = toPairs;
+ lodash.entriesIn = toPairsIn;
lodash.extend = assignIn;
lodash.extendWith = assignInWith;
- // Add functions to `lodash.prototype`.
+ // Add methods to `lodash.prototype`.
mixin(lodash, lodash);
/*------------------------------------------------------------------------*/
- // Add functions that return unwrapped values when chaining.
+ // Add methods that return unwrapped values in chain sequences.
lodash.add = add;
lodash.attempt = attempt;
lodash.camelCase = camelCase;
@@ -51310,6 +51410,7 @@ return jQuery;
lodash.cloneDeepWith = cloneDeepWith;
lodash.cloneWith = cloneWith;
lodash.deburr = deburr;
+ lodash.divide = divide;
lodash.endsWith = endsWith;
lodash.eq = eq;
lodash.escape = escape;
@@ -51387,8 +51488,11 @@ return jQuery;
lodash.max = max;
lodash.maxBy = maxBy;
lodash.mean = mean;
+ lodash.meanBy = meanBy;
lodash.min = min;
lodash.minBy = minBy;
+ lodash.multiply = multiply;
+ lodash.nth = nth;
lodash.noConflict = noConflict;
lodash.noop = noop;
lodash.now = now;
@@ -51628,7 +51732,7 @@ return jQuery;
};
});
- // Add `Array` and `String` methods to `lodash.prototype`.
+ // Add `Array` methods to `lodash.prototype`.
arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
var func = arrayProto[methodName],
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
@@ -51637,15 +51741,16 @@ return jQuery;
lodash.prototype[methodName] = function() {
var args = arguments;
if (retUnwrapped && !this.__chain__) {
- return func.apply(this.value(), args);
+ var value = this.value();
+ return func.apply(isArray(value) ? value : [], args);
}
return this[chainName](function(value) {
- return func.apply(value, args);
+ return func.apply(isArray(value) ? value : [], args);
});
};
});
- // Map minified function names to their real names.
+ // Map minified method names to their real names.
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName];
if (lodashFunc) {
@@ -51661,16 +51766,15 @@ return jQuery;
'func': undefined
}];
- // Add functions to the lazy wrapper.
+ // Add methods to `LazyWrapper`.
LazyWrapper.prototype.clone = lazyClone;
LazyWrapper.prototype.reverse = lazyReverse;
LazyWrapper.prototype.value = lazyValue;
- // Add chaining functions to the `lodash` wrapper.
+ // Add chain sequence methods to the `lodash` wrapper.
lodash.prototype.at = wrapperAt;
lodash.prototype.chain = wrapperChain;
lodash.prototype.commit = wrapperCommit;
- lodash.prototype.flatMap = wrapperFlatMap;
lodash.prototype.next = wrapperNext;
lodash.prototype.plant = wrapperPlant;
lodash.prototype.reverse = wrapperReverse;
@@ -51687,9 +51791,11 @@ return jQuery;
// Export lodash.
var _ = runInContext();
- // Expose lodash on the free variable `window` or `self` when available. This
- // prevents errors in cases where lodash is loaded by a script tag in the presence
- // of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch for more details.
+ // Expose Lodash on the free variable `window` or `self` when available so it's
+ // globally accessible, even when bundled with Browserify, Webpack, etc. This
+ // also prevents errors in cases where Lodash is loaded by a script tag in the
+ // presence of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch
+ // for more details. Use `_.noConflict` to remove Lodash from the global object.
(freeWindow || freeSelf || {})._ = _;
// Some AMD build optimizers like r.js check for condition patterns like the following:
@@ -51722,164 +51828,169 @@ return jQuery;
module.exports = require('react/lib/ReactDOM');
-},{"react/lib/ReactDOM":100}],"react-router":[function(require,module,exports){
-/* components */
+},{"react/lib/ReactDOM":102}],"react-router":[function(require,module,exports){
'use strict';
exports.__esModule = true;
+exports.createMemoryHistory = exports.hashHistory = exports.browserHistory = exports.applyRouterMiddleware = exports.formatPattern = exports.useRouterHistory = exports.match = exports.routerShape = exports.locationShape = exports.PropTypes = exports.RoutingContext = exports.RouterContext = exports.createRoutes = exports.useRoutes = exports.RouteContext = exports.Lifecycle = exports.History = exports.Route = exports.Redirect = exports.IndexRoute = exports.IndexRedirect = exports.withRouter = exports.IndexLink = exports.Link = exports.Router = undefined;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+var _RouteUtils = require('./RouteUtils');
+
+Object.defineProperty(exports, 'createRoutes', {
+ enumerable: true,
+ get: function get() {
+ return _RouteUtils.createRoutes;
+ }
+});
+
+var _PropTypes2 = require('./PropTypes');
+
+Object.defineProperty(exports, 'locationShape', {
+ enumerable: true,
+ get: function get() {
+ return _PropTypes2.locationShape;
+ }
+});
+Object.defineProperty(exports, 'routerShape', {
+ enumerable: true,
+ get: function get() {
+ return _PropTypes2.routerShape;
+ }
+});
+
+var _PatternUtils = require('./PatternUtils');
+
+Object.defineProperty(exports, 'formatPattern', {
+ enumerable: true,
+ get: function get() {
+ return _PatternUtils.formatPattern;
+ }
+});
var _Router2 = require('./Router');
var _Router3 = _interopRequireDefault(_Router2);
-exports.Router = _Router3['default'];
-
var _Link2 = require('./Link');
var _Link3 = _interopRequireDefault(_Link2);
-exports.Link = _Link3['default'];
-
var _IndexLink2 = require('./IndexLink');
var _IndexLink3 = _interopRequireDefault(_IndexLink2);
-exports.IndexLink = _IndexLink3['default'];
+var _withRouter2 = require('./withRouter');
-/* components (configuration) */
+var _withRouter3 = _interopRequireDefault(_withRouter2);
var _IndexRedirect2 = require('./IndexRedirect');
var _IndexRedirect3 = _interopRequireDefault(_IndexRedirect2);
-exports.IndexRedirect = _IndexRedirect3['default'];
-
var _IndexRoute2 = require('./IndexRoute');
var _IndexRoute3 = _interopRequireDefault(_IndexRoute2);
-exports.IndexRoute = _IndexRoute3['default'];
-
var _Redirect2 = require('./Redirect');
var _Redirect3 = _interopRequireDefault(_Redirect2);
-exports.Redirect = _Redirect3['default'];
-
var _Route2 = require('./Route');
var _Route3 = _interopRequireDefault(_Route2);
-exports.Route = _Route3['default'];
-
-/* mixins */
-
var _History2 = require('./History');
var _History3 = _interopRequireDefault(_History2);
-exports.History = _History3['default'];
-
var _Lifecycle2 = require('./Lifecycle');
var _Lifecycle3 = _interopRequireDefault(_Lifecycle2);
-exports.Lifecycle = _Lifecycle3['default'];
-
var _RouteContext2 = require('./RouteContext');
var _RouteContext3 = _interopRequireDefault(_RouteContext2);
-exports.RouteContext = _RouteContext3['default'];
-
-/* utils */
-
var _useRoutes2 = require('./useRoutes');
var _useRoutes3 = _interopRequireDefault(_useRoutes2);
-exports.useRoutes = _useRoutes3['default'];
-
-var _RouteUtils = require('./RouteUtils');
-
-exports.createRoutes = _RouteUtils.createRoutes;
-
var _RouterContext2 = require('./RouterContext');
var _RouterContext3 = _interopRequireDefault(_RouterContext2);
-exports.RouterContext = _RouterContext3['default'];
-
var _RoutingContext2 = require('./RoutingContext');
var _RoutingContext3 = _interopRequireDefault(_RoutingContext2);
-exports.RoutingContext = _RoutingContext3['default'];
-
-var _PropTypes2 = require('./PropTypes');
-
var _PropTypes3 = _interopRequireDefault(_PropTypes2);
-exports.PropTypes = _PropTypes3['default'];
-
var _match2 = require('./match');
var _match3 = _interopRequireDefault(_match2);
-exports.match = _match3['default'];
-
var _useRouterHistory2 = require('./useRouterHistory');
var _useRouterHistory3 = _interopRequireDefault(_useRouterHistory2);
-exports.useRouterHistory = _useRouterHistory3['default'];
-
-var _PatternUtils = require('./PatternUtils');
-
-exports.formatPattern = _PatternUtils.formatPattern;
+var _applyRouterMiddleware2 = require('./applyRouterMiddleware');
-/* histories */
+var _applyRouterMiddleware3 = _interopRequireDefault(_applyRouterMiddleware2);
var _browserHistory2 = require('./browserHistory');
var _browserHistory3 = _interopRequireDefault(_browserHistory2);
-exports.browserHistory = _browserHistory3['default'];
-
var _hashHistory2 = require('./hashHistory');
var _hashHistory3 = _interopRequireDefault(_hashHistory2);
-exports.hashHistory = _hashHistory3['default'];
-
var _createMemoryHistory2 = require('./createMemoryHistory');
var _createMemoryHistory3 = _interopRequireDefault(_createMemoryHistory2);
-exports.createMemoryHistory = _createMemoryHistory3['default'];
-},{"./History":30,"./IndexLink":31,"./IndexRedirect":32,"./IndexRoute":33,"./Lifecycle":34,"./Link":35,"./PatternUtils":36,"./PropTypes":37,"./Redirect":38,"./Route":39,"./RouteContext":40,"./RouteUtils":41,"./Router":42,"./RouterContext":43,"./RoutingContext":45,"./browserHistory":47,"./createMemoryHistory":49,"./hashHistory":55,"./match":57,"./useRouterHistory":60,"./useRoutes":61}],"react/addons":[function(require,module,exports){
-'use strict';
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-var warning = require('fbjs/lib/warning');
-warning(
- false,
- // Require examples in this string must be split to prevent React's
- // build tools from mistaking them for real requires.
- // Otherwise the build tools will attempt to build a 'react-addons-{addon}' module.
- 'require' + "('react/addons') is deprecated. " +
- 'Access using require' + "('react-addons-{addon}') instead."
-);
+exports.Router = _Router3.default; /* components */
+
+exports.Link = _Link3.default;
+exports.IndexLink = _IndexLink3.default;
+exports.withRouter = _withRouter3.default;
-module.exports = require('./lib/ReactWithAddons');
+/* components (configuration) */
+
+exports.IndexRedirect = _IndexRedirect3.default;
+exports.IndexRoute = _IndexRoute3.default;
+exports.Redirect = _Redirect3.default;
+exports.Route = _Route3.default;
+
+/* mixins */
+
+exports.History = _History3.default;
+exports.Lifecycle = _Lifecycle3.default;
+exports.RouteContext = _RouteContext3.default;
+
+/* utils */
+
+exports.useRoutes = _useRoutes3.default;
+exports.RouterContext = _RouterContext3.default;
+exports.RoutingContext = _RoutingContext3.default;
+exports.PropTypes = _PropTypes3.default;
+exports.match = _match3.default;
+exports.useRouterHistory = _useRouterHistory3.default;
+exports.applyRouterMiddleware = _applyRouterMiddleware3.default;
+
+/* histories */
-},{"./lib/ReactWithAddons":158,"fbjs/lib/warning":234}],"react":[function(require,module,exports){
+exports.browserHistory = _browserHistory3.default;
+exports.hashHistory = _hashHistory3.default;
+exports.createMemoryHistory = _createMemoryHistory3.default;
+},{"./History":32,"./IndexLink":33,"./IndexRedirect":34,"./IndexRoute":35,"./Lifecycle":37,"./Link":38,"./PatternUtils":39,"./PropTypes":40,"./Redirect":41,"./Route":42,"./RouteContext":43,"./RouteUtils":44,"./Router":45,"./RouterContext":46,"./RoutingContext":48,"./applyRouterMiddleware":50,"./browserHistory":51,"./createMemoryHistory":53,"./hashHistory":59,"./match":61,"./useRouterHistory":64,"./useRoutes":65,"./withRouter":66}],"react":[function(require,module,exports){
'use strict';
module.exports = require('./lib/React');
-},{"./lib/React":86}],"shallowequal":[function(require,module,exports){
+},{"./lib/React":92}],"shallowequal":[function(require,module,exports){
'use strict';
var fetchKeys = require('lodash.keys');
@@ -51928,7 +52039,7 @@ module.exports = function shallowEqual(objA, objB, compare, compareContext) {
return true;
};
-},{"lodash.keys":26}]},{},[])
+},{"lodash.keys":27}]},{},[])
//# sourceMappingURL=vendor.js.map
diff --git a/web/conf.js b/web/conf.js
index 5867ce45..7fe75da4 100644
--- a/web/conf.js
+++ b/web/conf.js
@@ -10,7 +10,6 @@ var conf = {
],
// Package these as well as the dependencies
vendor_includes: [
- "react/addons"
],
app: 'src/js/app.js',
eslint: ["src/js/**/*.js", "!src/js/filt/filt.js"]
diff --git a/web/package.json b/web/package.json
index fb3da81b..2eaac445 100644
--- a/web/package.json
+++ b/web/package.json
@@ -17,25 +17,24 @@
},
"dependencies": {
"bootstrap": "^3.3.6",
- "classnames": "^2.2.3",
+ "classnames": "^2.2.5",
"flux": "^2.1.1",
- "jquery": "^2.2.1",
- "lodash": "^4.5.1",
- "react": "^0.14.7",
- "react-dom": "^0.14.7",
- "react-router": "^2.0.0",
+ "jquery": "^2.2.3",
+ "lodash": "^4.11.2",
+ "react": "^15.0.2",
+ "react-dom": "^15.0.2",
+ "react-router": "^2.4.0",
"shallowequal": "^0.2.2"
},
"devDependencies": {
- "babel-core": "^6.5.2",
- "babel-eslint": "^5.0.0",
- "babel-jest": "^6.0.1",
+ "babel-core": "^6.7.7",
+ "babel-jest": "^12.0.2",
"babel-plugin-transform-class-properties": "^6.6.0",
- "babel-preset-es2015": "^6.5.0",
+ "babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
- "babelify": "^7.2.0",
+ "babelify": "^7.3.0",
"browserify": "^13.0.0",
- "eslint": "^2.2.0",
+ "eslint": "^2.9.0",
"gulp": "^3.9.1",
"gulp-clean-css": "^2.0.6",
"gulp-eslint": "^2.0.0",
@@ -48,7 +47,6 @@
"gulp-sourcemaps": "^1.6.0",
"gulp-util": "^3.0.7",
"jest": "^0.1.40",
- "lodash": "^4.5.1",
"uglifyify": "^3.0.1",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",