react-router 4.4.0-beta.6 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/cjs/react-router.js +111 -167
- package/cjs/react-router.min.js +1 -1
- package/esm/react-router.js +112 -166
- package/package.json +19 -21
- package/umd/react-router.js +394 -431
- package/umd/react-router.min.js +1 -1
package/umd/react-router.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(factory((global.ReactRouter = {}),global.React));
|
|
5
5
|
}(this, (function (exports,React) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
var React__default = 'default' in React ? React['default'] : React;
|
|
8
8
|
|
|
9
9
|
function _inheritsLoose(subClass, superClass) {
|
|
10
10
|
subClass.prototype = Object.create(superClass.prototype);
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
subClass.__proto__ = superClass;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
15
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
16
16
|
|
|
17
17
|
function unwrapExports (x) {
|
|
18
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x
|
|
18
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function createCommonjsModule(fn, module) {
|
|
@@ -920,17 +920,17 @@
|
|
|
920
920
|
}
|
|
921
921
|
|
|
922
922
|
function parsePath(path) {
|
|
923
|
-
var pathname = path ||
|
|
924
|
-
var search =
|
|
925
|
-
var hash =
|
|
926
|
-
var hashIndex = pathname.indexOf(
|
|
923
|
+
var pathname = path || '/';
|
|
924
|
+
var search = '';
|
|
925
|
+
var hash = '';
|
|
926
|
+
var hashIndex = pathname.indexOf('#');
|
|
927
927
|
|
|
928
928
|
if (hashIndex !== -1) {
|
|
929
929
|
hash = pathname.substr(hashIndex);
|
|
930
930
|
pathname = pathname.substr(0, hashIndex);
|
|
931
931
|
}
|
|
932
932
|
|
|
933
|
-
var searchIndex = pathname.indexOf(
|
|
933
|
+
var searchIndex = pathname.indexOf('?');
|
|
934
934
|
|
|
935
935
|
if (searchIndex !== -1) {
|
|
936
936
|
search = pathname.substr(searchIndex);
|
|
@@ -939,42 +939,42 @@
|
|
|
939
939
|
|
|
940
940
|
return {
|
|
941
941
|
pathname: pathname,
|
|
942
|
-
search: search ===
|
|
943
|
-
hash: hash ===
|
|
942
|
+
search: search === '?' ? '' : search,
|
|
943
|
+
hash: hash === '#' ? '' : hash
|
|
944
944
|
};
|
|
945
945
|
}
|
|
946
946
|
function createPath(location) {
|
|
947
947
|
var pathname = location.pathname,
|
|
948
948
|
search = location.search,
|
|
949
949
|
hash = location.hash;
|
|
950
|
-
var path = pathname ||
|
|
951
|
-
if (search && search !==
|
|
952
|
-
if (hash && hash !==
|
|
950
|
+
var path = pathname || '/';
|
|
951
|
+
if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
|
|
952
|
+
if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
|
|
953
953
|
return path;
|
|
954
954
|
}
|
|
955
955
|
|
|
956
956
|
function createLocation(path, state, key, currentLocation) {
|
|
957
957
|
var location;
|
|
958
958
|
|
|
959
|
-
if (typeof path ===
|
|
959
|
+
if (typeof path === 'string') {
|
|
960
960
|
// Two-arg form: push(path, state)
|
|
961
961
|
location = parsePath(path);
|
|
962
962
|
location.state = state;
|
|
963
963
|
} else {
|
|
964
964
|
// One-arg form: push(location)
|
|
965
965
|
location = _extends({}, path);
|
|
966
|
-
if (location.pathname === undefined) location.pathname =
|
|
966
|
+
if (location.pathname === undefined) location.pathname = '';
|
|
967
967
|
|
|
968
968
|
if (location.search) {
|
|
969
|
-
if (location.search.charAt(0) !==
|
|
969
|
+
if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
|
|
970
970
|
} else {
|
|
971
|
-
location.search =
|
|
971
|
+
location.search = '';
|
|
972
972
|
}
|
|
973
973
|
|
|
974
974
|
if (location.hash) {
|
|
975
|
-
if (location.hash.charAt(0) !==
|
|
975
|
+
if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
|
|
976
976
|
} else {
|
|
977
|
-
location.hash =
|
|
977
|
+
location.hash = '';
|
|
978
978
|
}
|
|
979
979
|
|
|
980
980
|
if (state !== undefined && location.state === undefined) location.state = state;
|
|
@@ -984,7 +984,7 @@
|
|
|
984
984
|
location.pathname = decodeURI(location.pathname);
|
|
985
985
|
} catch (e) {
|
|
986
986
|
if (e instanceof URIError) {
|
|
987
|
-
throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' +
|
|
987
|
+
throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
|
|
988
988
|
} else {
|
|
989
989
|
throw e;
|
|
990
990
|
}
|
|
@@ -996,13 +996,13 @@
|
|
|
996
996
|
// Resolve incomplete/relative pathname relative to current location.
|
|
997
997
|
if (!location.pathname) {
|
|
998
998
|
location.pathname = currentLocation.pathname;
|
|
999
|
-
} else if (location.pathname.charAt(0) !==
|
|
999
|
+
} else if (location.pathname.charAt(0) !== '/') {
|
|
1000
1000
|
location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
|
|
1001
1001
|
}
|
|
1002
1002
|
} else {
|
|
1003
1003
|
// When there is no prior location and pathname is empty, set it to /
|
|
1004
1004
|
if (!location.pathname) {
|
|
1005
|
-
location.pathname =
|
|
1005
|
+
location.pathname = '/';
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
1008
|
|
|
@@ -1016,7 +1016,7 @@
|
|
|
1016
1016
|
var prompt = null;
|
|
1017
1017
|
|
|
1018
1018
|
function setPrompt(nextPrompt) {
|
|
1019
|
-
warning(prompt == null,
|
|
1019
|
+
warning(prompt == null, 'A history supports only one prompt at a time');
|
|
1020
1020
|
prompt = nextPrompt;
|
|
1021
1021
|
return function () {
|
|
1022
1022
|
if (prompt === nextPrompt) prompt = null;
|
|
@@ -1028,13 +1028,13 @@
|
|
|
1028
1028
|
// the previous one, we may end up in a weird state. Figure out the
|
|
1029
1029
|
// best way to handle this.
|
|
1030
1030
|
if (prompt != null) {
|
|
1031
|
-
var result = typeof prompt ===
|
|
1031
|
+
var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
|
|
1032
1032
|
|
|
1033
|
-
if (typeof result ===
|
|
1034
|
-
if (typeof getUserConfirmation ===
|
|
1033
|
+
if (typeof result === 'string') {
|
|
1034
|
+
if (typeof getUserConfirmation === 'function') {
|
|
1035
1035
|
getUserConfirmation(result, callback);
|
|
1036
1036
|
} else {
|
|
1037
|
-
warning(false,
|
|
1037
|
+
warning(false, 'A history needs a getUserConfirmation function in order to use a prompt message');
|
|
1038
1038
|
callback(true);
|
|
1039
1039
|
}
|
|
1040
1040
|
} else {
|
|
@@ -1082,7 +1082,7 @@
|
|
|
1082
1082
|
};
|
|
1083
1083
|
}
|
|
1084
1084
|
|
|
1085
|
-
var canUseDOM = !!(typeof window !==
|
|
1085
|
+
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
1086
1086
|
|
|
1087
1087
|
function clamp(n, lowerBound, upperBound) {
|
|
1088
1088
|
return Math.min(Math.max(n, lowerBound), upperBound);
|
|
@@ -1100,7 +1100,7 @@
|
|
|
1100
1100
|
var _props = props,
|
|
1101
1101
|
getUserConfirmation = _props.getUserConfirmation,
|
|
1102
1102
|
_props$initialEntries = _props.initialEntries,
|
|
1103
|
-
initialEntries = _props$initialEntries === void 0 ? [
|
|
1103
|
+
initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries,
|
|
1104
1104
|
_props$initialIndex = _props.initialIndex,
|
|
1105
1105
|
initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex,
|
|
1106
1106
|
_props$keyLength = _props.keyLength,
|
|
@@ -1120,14 +1120,14 @@
|
|
|
1120
1120
|
|
|
1121
1121
|
var index = clamp(initialIndex, 0, initialEntries.length - 1);
|
|
1122
1122
|
var entries = initialEntries.map(function (entry) {
|
|
1123
|
-
return typeof entry ===
|
|
1123
|
+
return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey());
|
|
1124
1124
|
}); // Public interface
|
|
1125
1125
|
|
|
1126
1126
|
var createHref = createPath;
|
|
1127
1127
|
|
|
1128
1128
|
function push(path, state) {
|
|
1129
|
-
warning(!(typeof path ===
|
|
1130
|
-
var action =
|
|
1129
|
+
warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored');
|
|
1130
|
+
var action = 'PUSH';
|
|
1131
1131
|
var location = createLocation(path, state, createKey(), history.location);
|
|
1132
1132
|
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
1133
1133
|
if (!ok) return;
|
|
@@ -1151,8 +1151,8 @@
|
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
1153
|
function replace(path, state) {
|
|
1154
|
-
warning(!(typeof path ===
|
|
1155
|
-
var action =
|
|
1154
|
+
warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored');
|
|
1155
|
+
var action = 'REPLACE';
|
|
1156
1156
|
var location = createLocation(path, state, createKey(), history.location);
|
|
1157
1157
|
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
1158
1158
|
if (!ok) return;
|
|
@@ -1166,7 +1166,7 @@
|
|
|
1166
1166
|
|
|
1167
1167
|
function go(n) {
|
|
1168
1168
|
var nextIndex = clamp(history.index + n, 0, history.entries.length - 1);
|
|
1169
|
-
var action =
|
|
1169
|
+
var action = 'POP';
|
|
1170
1170
|
var location = history.entries[nextIndex];
|
|
1171
1171
|
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
1172
1172
|
if (ok) {
|
|
@@ -1210,7 +1210,7 @@
|
|
|
1210
1210
|
|
|
1211
1211
|
var history = {
|
|
1212
1212
|
length: entries.length,
|
|
1213
|
-
action:
|
|
1213
|
+
action: 'POP',
|
|
1214
1214
|
location: entries[index],
|
|
1215
1215
|
index: index,
|
|
1216
1216
|
entries: entries,
|
|
@@ -1233,124 +1233,56 @@
|
|
|
1233
1233
|
return commonjsGlobal[key] = (commonjsGlobal[key] || 0) + 1;
|
|
1234
1234
|
};
|
|
1235
1235
|
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
* LICENSE file in the root directory of this source tree.
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1243
|
-
*/
|
|
1244
|
-
|
|
1245
|
-
function makeEmptyFunction(arg) {
|
|
1246
|
-
return function () {
|
|
1247
|
-
return arg;
|
|
1248
|
-
};
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
/**
|
|
1252
|
-
* This function accepts and discards inputs; it has no side effects. This is
|
|
1253
|
-
* primarily useful idiomatically for overridable function endpoints which
|
|
1254
|
-
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
|
1255
|
-
*/
|
|
1256
|
-
var emptyFunction$1 = function emptyFunction() {};
|
|
1257
|
-
|
|
1258
|
-
emptyFunction$1.thatReturns = makeEmptyFunction;
|
|
1259
|
-
emptyFunction$1.thatReturnsFalse = makeEmptyFunction(false);
|
|
1260
|
-
emptyFunction$1.thatReturnsTrue = makeEmptyFunction(true);
|
|
1261
|
-
emptyFunction$1.thatReturnsNull = makeEmptyFunction(null);
|
|
1262
|
-
emptyFunction$1.thatReturnsThis = function () {
|
|
1263
|
-
return this;
|
|
1264
|
-
};
|
|
1265
|
-
emptyFunction$1.thatReturnsArgument = function (arg) {
|
|
1266
|
-
return arg;
|
|
1267
|
-
};
|
|
1268
|
-
|
|
1269
|
-
var emptyFunction_1 = emptyFunction$1;
|
|
1270
|
-
|
|
1271
|
-
/**
|
|
1272
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
1273
|
-
* This can be used to log issues in development environments in critical
|
|
1274
|
-
* paths. Removing the logging code for production environments will keep the
|
|
1275
|
-
* same logic and follow the same code paths.
|
|
1276
|
-
*/
|
|
1277
|
-
|
|
1278
|
-
var warning$1 = emptyFunction_1;
|
|
1279
|
-
|
|
1280
|
-
{
|
|
1281
|
-
var printWarning$2 = function printWarning(format) {
|
|
1282
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1283
|
-
args[_key - 1] = arguments[_key];
|
|
1236
|
+
function warning$1(condition, message) {
|
|
1237
|
+
{
|
|
1238
|
+
if (condition) {
|
|
1239
|
+
return;
|
|
1284
1240
|
}
|
|
1285
1241
|
|
|
1286
|
-
var
|
|
1287
|
-
|
|
1288
|
-
return args[argIndex++];
|
|
1289
|
-
});
|
|
1242
|
+
var text = "Warning: " + message;
|
|
1243
|
+
|
|
1290
1244
|
if (typeof console !== 'undefined') {
|
|
1291
|
-
console.
|
|
1245
|
+
console.warn(text);
|
|
1292
1246
|
}
|
|
1247
|
+
|
|
1293
1248
|
try {
|
|
1294
|
-
|
|
1295
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
1296
|
-
// to find the callsite that caused this warning to fire.
|
|
1297
|
-
throw new Error(message);
|
|
1249
|
+
throw Error(text);
|
|
1298
1250
|
} catch (x) {}
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
warning$1 = function warning(condition, format) {
|
|
1302
|
-
if (format === undefined) {
|
|
1303
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
if (format.indexOf('Failed Composite propType: ') === 0) {
|
|
1307
|
-
return; // Ignore CompositeComponent proptype check.
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
if (!condition) {
|
|
1311
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
1312
|
-
args[_key2 - 2] = arguments[_key2];
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
printWarning$2.apply(undefined, [format].concat(args));
|
|
1316
|
-
}
|
|
1317
|
-
};
|
|
1251
|
+
}
|
|
1318
1252
|
}
|
|
1319
1253
|
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
var _propTypes2 = _interopRequireDefault(propTypes);
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
var _gud2 = _interopRequireDefault(gud);
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
var _warning2 = _interopRequireDefault(warning_1);
|
|
1341
|
-
|
|
1342
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1254
|
+
function _defineProperty(obj, key, value) {
|
|
1255
|
+
if (key in obj) {
|
|
1256
|
+
Object.defineProperty(obj, key, {
|
|
1257
|
+
value: value,
|
|
1258
|
+
enumerable: true,
|
|
1259
|
+
configurable: true,
|
|
1260
|
+
writable: true
|
|
1261
|
+
});
|
|
1262
|
+
} else {
|
|
1263
|
+
obj[key] = value;
|
|
1264
|
+
}
|
|
1343
1265
|
|
|
1344
|
-
|
|
1266
|
+
return obj;
|
|
1267
|
+
}
|
|
1345
1268
|
|
|
1346
|
-
function
|
|
1269
|
+
function _inheritsLoose$1(subClass, superClass) {
|
|
1270
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
1271
|
+
subClass.prototype.constructor = subClass;
|
|
1272
|
+
subClass.__proto__ = superClass;
|
|
1273
|
+
}
|
|
1347
1274
|
|
|
1348
|
-
function
|
|
1275
|
+
function _assertThisInitialized(self) {
|
|
1276
|
+
if (self === void 0) {
|
|
1277
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1278
|
+
}
|
|
1349
1279
|
|
|
1350
|
-
|
|
1280
|
+
return self;
|
|
1281
|
+
}
|
|
1351
1282
|
|
|
1352
|
-
// Inlined Object.is polyfill.
|
|
1283
|
+
var MAX_SIGNED_31_BIT_INT = 1073741823; // Inlined Object.is polyfill.
|
|
1353
1284
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
1285
|
+
|
|
1354
1286
|
function objectIs(x, y) {
|
|
1355
1287
|
if (x === y) {
|
|
1356
1288
|
return x !== 0 || 1 / x === 1 / y;
|
|
@@ -1387,43 +1319,50 @@
|
|
|
1387
1319
|
}
|
|
1388
1320
|
|
|
1389
1321
|
function createReactContext(defaultValue, calculateChangedBits) {
|
|
1390
|
-
var
|
|
1322
|
+
var _defineProperty2, _defineProperty3;
|
|
1391
1323
|
|
|
1392
|
-
var contextProp = '__create-react-context-' + (
|
|
1324
|
+
var contextProp = '__create-react-context-' + gud() + '__';
|
|
1393
1325
|
|
|
1394
|
-
var Provider =
|
|
1395
|
-
|
|
1326
|
+
var Provider =
|
|
1327
|
+
/*#__PURE__*/
|
|
1328
|
+
function (_Component) {
|
|
1329
|
+
_inheritsLoose$1(Provider, _Component);
|
|
1396
1330
|
|
|
1397
1331
|
function Provider() {
|
|
1398
|
-
var
|
|
1399
|
-
|
|
1400
|
-
_classCallCheck(this, Provider);
|
|
1332
|
+
var _this;
|
|
1401
1333
|
|
|
1402
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
1334
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1403
1335
|
args[_key] = arguments[_key];
|
|
1404
1336
|
}
|
|
1405
1337
|
|
|
1406
|
-
|
|
1338
|
+
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
1339
|
+
|
|
1340
|
+
_defineProperty(_assertThisInitialized(_this), "emitter", createEventEmitter(_this.props.value));
|
|
1341
|
+
|
|
1342
|
+
return _this;
|
|
1407
1343
|
}
|
|
1408
1344
|
|
|
1409
|
-
Provider.prototype
|
|
1345
|
+
var _proto = Provider.prototype;
|
|
1346
|
+
|
|
1347
|
+
_proto.getChildContext = function getChildContext() {
|
|
1410
1348
|
var _ref;
|
|
1411
1349
|
|
|
1412
1350
|
return _ref = {}, _ref[contextProp] = this.emitter, _ref;
|
|
1413
1351
|
};
|
|
1414
1352
|
|
|
1415
|
-
|
|
1353
|
+
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
1416
1354
|
if (this.props.value !== nextProps.value) {
|
|
1417
1355
|
var oldValue = this.props.value;
|
|
1418
1356
|
var newValue = nextProps.value;
|
|
1419
|
-
var changedBits
|
|
1357
|
+
var changedBits;
|
|
1420
1358
|
|
|
1421
1359
|
if (objectIs(oldValue, newValue)) {
|
|
1422
1360
|
changedBits = 0; // No change
|
|
1423
1361
|
} else {
|
|
1424
1362
|
changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
|
|
1363
|
+
|
|
1425
1364
|
{
|
|
1426
|
-
(
|
|
1365
|
+
warning$1((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: ' + changedBits);
|
|
1427
1366
|
}
|
|
1428
1367
|
|
|
1429
1368
|
changedBits |= 0;
|
|
@@ -1435,61 +1374,73 @@
|
|
|
1435
1374
|
}
|
|
1436
1375
|
};
|
|
1437
1376
|
|
|
1438
|
-
|
|
1377
|
+
_proto.render = function render() {
|
|
1439
1378
|
return this.props.children;
|
|
1440
1379
|
};
|
|
1441
1380
|
|
|
1442
1381
|
return Provider;
|
|
1443
1382
|
}(React.Component);
|
|
1444
1383
|
|
|
1445
|
-
Provider
|
|
1384
|
+
_defineProperty(Provider, "childContextTypes", (_defineProperty2 = {}, _defineProperty2[contextProp] = propTypes.object.isRequired, _defineProperty2));
|
|
1446
1385
|
|
|
1447
|
-
var Consumer =
|
|
1448
|
-
|
|
1386
|
+
var Consumer =
|
|
1387
|
+
/*#__PURE__*/
|
|
1388
|
+
function (_Component2) {
|
|
1389
|
+
_inheritsLoose$1(Consumer, _Component2);
|
|
1449
1390
|
|
|
1450
1391
|
function Consumer() {
|
|
1451
|
-
var
|
|
1392
|
+
var _this2;
|
|
1452
1393
|
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1394
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1456
1395
|
args[_key2] = arguments[_key2];
|
|
1457
1396
|
}
|
|
1458
1397
|
|
|
1459
|
-
|
|
1398
|
+
_this2 = _Component2.call.apply(_Component2, [this].concat(args)) || this;
|
|
1399
|
+
|
|
1400
|
+
_defineProperty(_assertThisInitialized(_this2), "observedBits", void 0);
|
|
1401
|
+
|
|
1402
|
+
_defineProperty(_assertThisInitialized(_this2), "state", {
|
|
1460
1403
|
value: _this2.getValue()
|
|
1461
|
-
}
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1406
|
+
_defineProperty(_assertThisInitialized(_this2), "onUpdate", function (newValue, changedBits) {
|
|
1462
1407
|
var observedBits = _this2.observedBits | 0;
|
|
1408
|
+
|
|
1463
1409
|
if ((observedBits & changedBits) !== 0) {
|
|
1464
|
-
_this2.setState({
|
|
1410
|
+
_this2.setState({
|
|
1411
|
+
value: _this2.getValue()
|
|
1412
|
+
});
|
|
1465
1413
|
}
|
|
1466
|
-
}
|
|
1414
|
+
});
|
|
1415
|
+
|
|
1416
|
+
return _this2;
|
|
1467
1417
|
}
|
|
1468
1418
|
|
|
1469
|
-
Consumer.prototype
|
|
1470
|
-
var observedBits = nextProps.observedBits;
|
|
1419
|
+
var _proto2 = Consumer.prototype;
|
|
1471
1420
|
|
|
1421
|
+
_proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
1422
|
+
var observedBits = nextProps.observedBits;
|
|
1472
1423
|
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT // Subscribe to all changes by default
|
|
1473
1424
|
: observedBits;
|
|
1474
1425
|
};
|
|
1475
1426
|
|
|
1476
|
-
|
|
1427
|
+
_proto2.componentDidMount = function componentDidMount() {
|
|
1477
1428
|
if (this.context[contextProp]) {
|
|
1478
1429
|
this.context[contextProp].on(this.onUpdate);
|
|
1479
1430
|
}
|
|
1480
|
-
var observedBits = this.props.observedBits;
|
|
1481
1431
|
|
|
1432
|
+
var observedBits = this.props.observedBits;
|
|
1482
1433
|
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT // Subscribe to all changes by default
|
|
1483
1434
|
: observedBits;
|
|
1484
1435
|
};
|
|
1485
1436
|
|
|
1486
|
-
|
|
1437
|
+
_proto2.componentWillUnmount = function componentWillUnmount() {
|
|
1487
1438
|
if (this.context[contextProp]) {
|
|
1488
1439
|
this.context[contextProp].off(this.onUpdate);
|
|
1489
1440
|
}
|
|
1490
1441
|
};
|
|
1491
1442
|
|
|
1492
|
-
|
|
1443
|
+
_proto2.getValue = function getValue() {
|
|
1493
1444
|
if (this.context[contextProp]) {
|
|
1494
1445
|
return this.context[contextProp].get();
|
|
1495
1446
|
} else {
|
|
@@ -1497,15 +1448,14 @@
|
|
|
1497
1448
|
}
|
|
1498
1449
|
};
|
|
1499
1450
|
|
|
1500
|
-
|
|
1451
|
+
_proto2.render = function render() {
|
|
1501
1452
|
return onlyChild(this.props.children)(this.state.value);
|
|
1502
1453
|
};
|
|
1503
1454
|
|
|
1504
1455
|
return Consumer;
|
|
1505
1456
|
}(React.Component);
|
|
1506
1457
|
|
|
1507
|
-
Consumer
|
|
1508
|
-
|
|
1458
|
+
_defineProperty(Consumer, "contextTypes", (_defineProperty3 = {}, _defineProperty3[contextProp] = propTypes.object, _defineProperty3));
|
|
1509
1459
|
|
|
1510
1460
|
return {
|
|
1511
1461
|
Provider: Provider,
|
|
@@ -1513,72 +1463,24 @@
|
|
|
1513
1463
|
};
|
|
1514
1464
|
}
|
|
1515
1465
|
|
|
1516
|
-
|
|
1517
|
-
module.exports = exports['default'];
|
|
1518
|
-
});
|
|
1519
|
-
|
|
1520
|
-
unwrapExports(implementation);
|
|
1521
|
-
|
|
1522
|
-
var lib = createCommonjsModule(function (module, exports) {
|
|
1523
|
-
|
|
1524
|
-
exports.__esModule = true;
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
var _react2 = _interopRequireDefault(React);
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
var _implementation2 = _interopRequireDefault(implementation);
|
|
1533
|
-
|
|
1534
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1535
|
-
|
|
1536
|
-
exports.default = _react2.default.createContext || _implementation2.default;
|
|
1537
|
-
module.exports = exports['default'];
|
|
1538
|
-
});
|
|
1539
|
-
|
|
1540
|
-
var createContext = unwrapExports(lib);
|
|
1466
|
+
var index = React__default.createContext || createReactContext;
|
|
1541
1467
|
|
|
1542
1468
|
// TODO: Replace with React.createContext once we can assume React 16+
|
|
1543
|
-
var context = createContext();
|
|
1544
|
-
context.Provider.displayName = "Router.Provider";
|
|
1545
|
-
context.Consumer.displayName = "Router.Consumer";
|
|
1546
|
-
|
|
1547
|
-
var warnAboutGettingProperty = function warnAboutGettingProperty() {};
|
|
1548
1469
|
|
|
1549
|
-
{
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
get: function get() {
|
|
1555
|
-
if (!didIssueWarning) {
|
|
1556
|
-
warning(false, message);
|
|
1557
|
-
didIssueWarning = true;
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
return value;
|
|
1561
|
-
},
|
|
1562
|
-
configurable: true
|
|
1563
|
-
});
|
|
1564
|
-
};
|
|
1565
|
-
}
|
|
1470
|
+
var createNamedContext = function createNamedContext(name) {
|
|
1471
|
+
var context = index();
|
|
1472
|
+
context.displayName = name;
|
|
1473
|
+
return context;
|
|
1474
|
+
};
|
|
1566
1475
|
|
|
1567
|
-
var
|
|
1476
|
+
var context =
|
|
1477
|
+
/*#__PURE__*/
|
|
1478
|
+
createNamedContext("Router");
|
|
1568
1479
|
|
|
1569
|
-
function getContext(props, state) {
|
|
1570
|
-
return {
|
|
1571
|
-
history: props.history,
|
|
1572
|
-
location: state.location,
|
|
1573
|
-
match: Router.computeRootMatch(state.location.pathname),
|
|
1574
|
-
staticContext: props.staticContext
|
|
1575
|
-
};
|
|
1576
|
-
}
|
|
1577
1480
|
/**
|
|
1578
1481
|
* The public API for putting history on context.
|
|
1579
1482
|
*/
|
|
1580
1483
|
|
|
1581
|
-
|
|
1582
1484
|
var Router =
|
|
1583
1485
|
/*#__PURE__*/
|
|
1584
1486
|
function (_React$Component) {
|
|
@@ -1640,39 +1542,19 @@
|
|
|
1640
1542
|
};
|
|
1641
1543
|
|
|
1642
1544
|
_proto.render = function render() {
|
|
1643
|
-
|
|
1644
|
-
return React.createElement(context.Provider, {
|
|
1545
|
+
return React__default.createElement(context.Provider, {
|
|
1645
1546
|
children: this.props.children || null,
|
|
1646
|
-
value:
|
|
1547
|
+
value: {
|
|
1548
|
+
history: this.props.history,
|
|
1549
|
+
location: this.state.location,
|
|
1550
|
+
match: Router.computeRootMatch(this.state.location.pathname),
|
|
1551
|
+
staticContext: this.props.staticContext
|
|
1552
|
+
}
|
|
1647
1553
|
});
|
|
1648
1554
|
};
|
|
1649
1555
|
|
|
1650
1556
|
return Router;
|
|
1651
|
-
}(
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
if (!React.createContext) {
|
|
1655
|
-
Router.childContextTypes = {
|
|
1656
|
-
router: propTypes.object.isRequired
|
|
1657
|
-
};
|
|
1658
|
-
|
|
1659
|
-
Router.prototype.getChildContext = function () {
|
|
1660
|
-
var context$$1 = getContext(this.props, this.state);
|
|
1661
|
-
|
|
1662
|
-
{
|
|
1663
|
-
var contextWithoutWarnings = _extends({}, context$$1);
|
|
1664
|
-
|
|
1665
|
-
Object.keys(context$$1).forEach(function (key) {
|
|
1666
|
-
warnAboutGettingProperty$1(context$$1, key, "You should not be using this.context.router." + key + " directly. It is private API " + "for internal use only and is subject to change at any time. Instead, use " + "a <Route> or withRouter() to access the current location, match, etc.");
|
|
1667
|
-
});
|
|
1668
|
-
context$$1._withoutWarnings = contextWithoutWarnings;
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
return {
|
|
1672
|
-
router: context$$1
|
|
1673
|
-
};
|
|
1674
|
-
};
|
|
1675
|
-
}
|
|
1557
|
+
}(React__default.Component);
|
|
1676
1558
|
|
|
1677
1559
|
{
|
|
1678
1560
|
Router.propTypes = {
|
|
@@ -1710,14 +1592,14 @@
|
|
|
1710
1592
|
var _proto = MemoryRouter.prototype;
|
|
1711
1593
|
|
|
1712
1594
|
_proto.render = function render() {
|
|
1713
|
-
return
|
|
1595
|
+
return React__default.createElement(Router, {
|
|
1714
1596
|
history: this.history,
|
|
1715
1597
|
children: this.props.children
|
|
1716
1598
|
});
|
|
1717
1599
|
};
|
|
1718
1600
|
|
|
1719
1601
|
return MemoryRouter;
|
|
1720
|
-
}(
|
|
1602
|
+
}(React__default.Component);
|
|
1721
1603
|
|
|
1722
1604
|
{
|
|
1723
1605
|
MemoryRouter.propTypes = {
|
|
@@ -1761,19 +1643,21 @@
|
|
|
1761
1643
|
};
|
|
1762
1644
|
|
|
1763
1645
|
return Lifecycle;
|
|
1764
|
-
}(
|
|
1646
|
+
}(React__default.Component);
|
|
1765
1647
|
|
|
1766
1648
|
/**
|
|
1767
1649
|
* The public API for prompting the user before navigating away from a screen.
|
|
1768
1650
|
*/
|
|
1769
1651
|
|
|
1770
|
-
function Prompt(
|
|
1771
|
-
|
|
1652
|
+
function Prompt(_ref) {
|
|
1653
|
+
var message = _ref.message,
|
|
1654
|
+
_ref$when = _ref.when,
|
|
1655
|
+
when = _ref$when === void 0 ? true : _ref$when;
|
|
1656
|
+
return React__default.createElement(context.Consumer, null, function (context$$1) {
|
|
1772
1657
|
!context$$1 ? invariant(false, "You should not use <Prompt> outside a <Router>") : void 0;
|
|
1773
|
-
if (!
|
|
1658
|
+
if (!when || context$$1.staticContext) return null;
|
|
1774
1659
|
var method = context$$1.history.block;
|
|
1775
|
-
|
|
1776
|
-
return React.createElement(Lifecycle, {
|
|
1660
|
+
return React__default.createElement(Lifecycle, {
|
|
1777
1661
|
onMount: function onMount(self) {
|
|
1778
1662
|
self.release = method(message);
|
|
1779
1663
|
},
|
|
@@ -1785,15 +1669,12 @@
|
|
|
1785
1669
|
},
|
|
1786
1670
|
onUnmount: function onUnmount(self) {
|
|
1787
1671
|
self.release();
|
|
1788
|
-
}
|
|
1672
|
+
},
|
|
1673
|
+
message: message
|
|
1789
1674
|
});
|
|
1790
1675
|
});
|
|
1791
1676
|
}
|
|
1792
1677
|
|
|
1793
|
-
Prompt.defaultProps = {
|
|
1794
|
-
when: true
|
|
1795
|
-
};
|
|
1796
|
-
|
|
1797
1678
|
{
|
|
1798
1679
|
var messageType = propTypes.oneOfType([propTypes.func, propTypes.string]);
|
|
1799
1680
|
Prompt.propTypes = {
|
|
@@ -2273,27 +2154,37 @@
|
|
|
2273
2154
|
* The public API for navigating programmatically with a component.
|
|
2274
2155
|
*/
|
|
2275
2156
|
|
|
2276
|
-
function Redirect(
|
|
2277
|
-
|
|
2157
|
+
function Redirect(_ref) {
|
|
2158
|
+
var computedMatch = _ref.computedMatch,
|
|
2159
|
+
to = _ref.to,
|
|
2160
|
+
_ref$push = _ref.push,
|
|
2161
|
+
push = _ref$push === void 0 ? false : _ref$push;
|
|
2162
|
+
return React__default.createElement(context.Consumer, null, function (context$$1) {
|
|
2278
2163
|
!context$$1 ? invariant(false, "You should not use <Redirect> outside a <Router>") : void 0;
|
|
2279
|
-
var
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2164
|
+
var history = context$$1.history,
|
|
2165
|
+
staticContext = context$$1.staticContext;
|
|
2166
|
+
var method = push ? history.push : history.replace;
|
|
2167
|
+
var location = createLocation(computedMatch ? typeof to === "string" ? generatePath(to, computedMatch.params) : _extends({}, to, {
|
|
2168
|
+
pathname: generatePath(to.pathname, computedMatch.params)
|
|
2169
|
+
}) : to); // When rendering in a static context,
|
|
2283
2170
|
// set the new location immediately.
|
|
2284
2171
|
|
|
2285
|
-
if (
|
|
2286
|
-
method(
|
|
2172
|
+
if (staticContext) {
|
|
2173
|
+
method(location);
|
|
2287
2174
|
return null;
|
|
2288
2175
|
}
|
|
2289
2176
|
|
|
2290
|
-
return
|
|
2177
|
+
return React__default.createElement(Lifecycle, {
|
|
2291
2178
|
onMount: function onMount() {
|
|
2292
|
-
method(
|
|
2179
|
+
method(location);
|
|
2293
2180
|
},
|
|
2294
2181
|
onUpdate: function onUpdate(self, prevProps) {
|
|
2295
|
-
|
|
2296
|
-
|
|
2182
|
+
var prevLocation = createLocation(prevProps.to);
|
|
2183
|
+
|
|
2184
|
+
if (!locationsAreEqual(prevLocation, _extends({}, location, {
|
|
2185
|
+
key: prevLocation.key
|
|
2186
|
+
}))) {
|
|
2187
|
+
method(location);
|
|
2297
2188
|
}
|
|
2298
2189
|
},
|
|
2299
2190
|
to: to
|
|
@@ -2301,10 +2192,6 @@
|
|
|
2301
2192
|
});
|
|
2302
2193
|
}
|
|
2303
2194
|
|
|
2304
|
-
Redirect.defaultProps = {
|
|
2305
|
-
push: false
|
|
2306
|
-
};
|
|
2307
|
-
|
|
2308
2195
|
{
|
|
2309
2196
|
Redirect.propTypes = {
|
|
2310
2197
|
push: propTypes.bool,
|
|
@@ -2315,33 +2202,35 @@
|
|
|
2315
2202
|
|
|
2316
2203
|
var reactIs_production_min = createCommonjsModule(function (module, exports) {
|
|
2317
2204
|
Object.defineProperty(exports,"__esModule",{value:!0});
|
|
2318
|
-
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.
|
|
2319
|
-
function
|
|
2320
|
-
exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===l||a===g||a===f||a===n||"object"===typeof a&&null!==a&&(
|
|
2321
|
-
exports.isForwardRef=function(a){return
|
|
2205
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.concurrent_mode"):60111,m=b?Symbol.for("react.forward_ref"):60112,n=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.memo"):60115,r=b?Symbol.for("react.lazy"):
|
|
2206
|
+
60116;function t(a){if("object"===typeof a&&null!==a){var p=a.$$typeof;switch(p){case c:switch(a=a.type,a){case l:case e:case g:case f:return a;default:switch(a=a&&a.$$typeof,a){case k:case m:case h:return a;default:return p}}case d:return p}}}function u(a){return t(a)===l}exports.typeOf=t;exports.AsyncMode=l;exports.ConcurrentMode=l;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=m;exports.Fragment=e;exports.Profiler=g;exports.Portal=d;
|
|
2207
|
+
exports.StrictMode=f;exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===l||a===g||a===f||a===n||"object"===typeof a&&null!==a&&(a.$$typeof===r||a.$$typeof===q||a.$$typeof===h||a.$$typeof===k||a.$$typeof===m)};exports.isAsyncMode=function(a){return u(a)};exports.isConcurrentMode=u;exports.isContextConsumer=function(a){return t(a)===k};exports.isContextProvider=function(a){return t(a)===h};
|
|
2208
|
+
exports.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return t(a)===m};exports.isFragment=function(a){return t(a)===e};exports.isProfiler=function(a){return t(a)===g};exports.isPortal=function(a){return t(a)===d};exports.isStrictMode=function(a){return t(a)===f};
|
|
2322
2209
|
});
|
|
2323
2210
|
|
|
2324
2211
|
unwrapExports(reactIs_production_min);
|
|
2325
2212
|
var reactIs_production_min_1 = reactIs_production_min.typeOf;
|
|
2326
2213
|
var reactIs_production_min_2 = reactIs_production_min.AsyncMode;
|
|
2327
|
-
var reactIs_production_min_3 = reactIs_production_min.
|
|
2328
|
-
var reactIs_production_min_4 = reactIs_production_min.
|
|
2329
|
-
var reactIs_production_min_5 = reactIs_production_min.
|
|
2330
|
-
var reactIs_production_min_6 = reactIs_production_min.
|
|
2331
|
-
var reactIs_production_min_7 = reactIs_production_min.
|
|
2332
|
-
var reactIs_production_min_8 = reactIs_production_min.
|
|
2333
|
-
var reactIs_production_min_9 = reactIs_production_min.
|
|
2334
|
-
var reactIs_production_min_10 = reactIs_production_min.
|
|
2335
|
-
var reactIs_production_min_11 = reactIs_production_min.
|
|
2336
|
-
var reactIs_production_min_12 = reactIs_production_min.
|
|
2337
|
-
var reactIs_production_min_13 = reactIs_production_min.
|
|
2338
|
-
var reactIs_production_min_14 = reactIs_production_min.
|
|
2339
|
-
var reactIs_production_min_15 = reactIs_production_min.
|
|
2340
|
-
var reactIs_production_min_16 = reactIs_production_min.
|
|
2341
|
-
var reactIs_production_min_17 = reactIs_production_min.
|
|
2342
|
-
var reactIs_production_min_18 = reactIs_production_min.
|
|
2343
|
-
var reactIs_production_min_19 = reactIs_production_min.
|
|
2344
|
-
var reactIs_production_min_20 = reactIs_production_min.
|
|
2214
|
+
var reactIs_production_min_3 = reactIs_production_min.ConcurrentMode;
|
|
2215
|
+
var reactIs_production_min_4 = reactIs_production_min.ContextConsumer;
|
|
2216
|
+
var reactIs_production_min_5 = reactIs_production_min.ContextProvider;
|
|
2217
|
+
var reactIs_production_min_6 = reactIs_production_min.Element;
|
|
2218
|
+
var reactIs_production_min_7 = reactIs_production_min.ForwardRef;
|
|
2219
|
+
var reactIs_production_min_8 = reactIs_production_min.Fragment;
|
|
2220
|
+
var reactIs_production_min_9 = reactIs_production_min.Profiler;
|
|
2221
|
+
var reactIs_production_min_10 = reactIs_production_min.Portal;
|
|
2222
|
+
var reactIs_production_min_11 = reactIs_production_min.StrictMode;
|
|
2223
|
+
var reactIs_production_min_12 = reactIs_production_min.isValidElementType;
|
|
2224
|
+
var reactIs_production_min_13 = reactIs_production_min.isAsyncMode;
|
|
2225
|
+
var reactIs_production_min_14 = reactIs_production_min.isConcurrentMode;
|
|
2226
|
+
var reactIs_production_min_15 = reactIs_production_min.isContextConsumer;
|
|
2227
|
+
var reactIs_production_min_16 = reactIs_production_min.isContextProvider;
|
|
2228
|
+
var reactIs_production_min_17 = reactIs_production_min.isElement;
|
|
2229
|
+
var reactIs_production_min_18 = reactIs_production_min.isForwardRef;
|
|
2230
|
+
var reactIs_production_min_19 = reactIs_production_min.isFragment;
|
|
2231
|
+
var reactIs_production_min_20 = reactIs_production_min.isProfiler;
|
|
2232
|
+
var reactIs_production_min_21 = reactIs_production_min.isPortal;
|
|
2233
|
+
var reactIs_production_min_22 = reactIs_production_min.isStrictMode;
|
|
2345
2234
|
|
|
2346
2235
|
var reactIs_development = createCommonjsModule(function (module, exports) {
|
|
2347
2236
|
|
|
@@ -2363,16 +2252,71 @@
|
|
|
2363
2252
|
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
2364
2253
|
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
2365
2254
|
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
2366
|
-
var
|
|
2255
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
2367
2256
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
2368
|
-
var
|
|
2257
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
2258
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
2259
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
2369
2260
|
|
|
2370
2261
|
function isValidElementType(type) {
|
|
2371
2262
|
return typeof type === 'string' || typeof type === 'function' ||
|
|
2372
2263
|
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
2373
|
-
type === REACT_FRAGMENT_TYPE || type ===
|
|
2264
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
|
|
2374
2265
|
}
|
|
2375
2266
|
|
|
2267
|
+
/**
|
|
2268
|
+
* Forked from fbjs/warning:
|
|
2269
|
+
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
2270
|
+
*
|
|
2271
|
+
* Only change is we use console.warn instead of console.error,
|
|
2272
|
+
* and do nothing when 'console' is not supported.
|
|
2273
|
+
* This really simplifies the code.
|
|
2274
|
+
* ---
|
|
2275
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
2276
|
+
* This can be used to log issues in development environments in critical
|
|
2277
|
+
* paths. Removing the logging code for production environments will keep the
|
|
2278
|
+
* same logic and follow the same code paths.
|
|
2279
|
+
*/
|
|
2280
|
+
|
|
2281
|
+
var lowPriorityWarning = function () {};
|
|
2282
|
+
|
|
2283
|
+
{
|
|
2284
|
+
var printWarning = function (format) {
|
|
2285
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
2286
|
+
args[_key - 1] = arguments[_key];
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
var argIndex = 0;
|
|
2290
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
2291
|
+
return args[argIndex++];
|
|
2292
|
+
});
|
|
2293
|
+
if (typeof console !== 'undefined') {
|
|
2294
|
+
console.warn(message);
|
|
2295
|
+
}
|
|
2296
|
+
try {
|
|
2297
|
+
// --- Welcome to debugging React ---
|
|
2298
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
2299
|
+
// to find the callsite that caused this warning to fire.
|
|
2300
|
+
throw new Error(message);
|
|
2301
|
+
} catch (x) {}
|
|
2302
|
+
};
|
|
2303
|
+
|
|
2304
|
+
lowPriorityWarning = function (condition, format) {
|
|
2305
|
+
if (format === undefined) {
|
|
2306
|
+
throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
2307
|
+
}
|
|
2308
|
+
if (!condition) {
|
|
2309
|
+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
2310
|
+
args[_key2 - 2] = arguments[_key2];
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
printWarning.apply(undefined, [format].concat(args));
|
|
2314
|
+
}
|
|
2315
|
+
};
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
var lowPriorityWarning$1 = lowPriorityWarning;
|
|
2319
|
+
|
|
2376
2320
|
function typeOf(object) {
|
|
2377
2321
|
if (typeof object === 'object' && object !== null) {
|
|
2378
2322
|
var $$typeof = object.$$typeof;
|
|
@@ -2382,7 +2326,7 @@
|
|
|
2382
2326
|
var type = object.type;
|
|
2383
2327
|
|
|
2384
2328
|
switch (type) {
|
|
2385
|
-
case
|
|
2329
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
2386
2330
|
case REACT_FRAGMENT_TYPE:
|
|
2387
2331
|
case REACT_PROFILER_TYPE:
|
|
2388
2332
|
case REACT_STRICT_MODE_TYPE:
|
|
@@ -2407,7 +2351,9 @@
|
|
|
2407
2351
|
return undefined;
|
|
2408
2352
|
}
|
|
2409
2353
|
|
|
2410
|
-
|
|
2354
|
+
// AsyncMode alias is deprecated along with isAsyncMode
|
|
2355
|
+
var AsyncMode = REACT_CONCURRENT_MODE_TYPE;
|
|
2356
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
2411
2357
|
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
2412
2358
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
2413
2359
|
var Element = REACT_ELEMENT_TYPE;
|
|
@@ -2417,8 +2363,20 @@
|
|
|
2417
2363
|
var Portal = REACT_PORTAL_TYPE;
|
|
2418
2364
|
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2419
2365
|
|
|
2366
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
2367
|
+
|
|
2368
|
+
// AsyncMode should be deprecated
|
|
2420
2369
|
function isAsyncMode(object) {
|
|
2421
|
-
|
|
2370
|
+
{
|
|
2371
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
2372
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
2373
|
+
lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
return isConcurrentMode(object);
|
|
2377
|
+
}
|
|
2378
|
+
function isConcurrentMode(object) {
|
|
2379
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
2422
2380
|
}
|
|
2423
2381
|
function isContextConsumer(object) {
|
|
2424
2382
|
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
@@ -2447,6 +2405,7 @@
|
|
|
2447
2405
|
|
|
2448
2406
|
exports.typeOf = typeOf;
|
|
2449
2407
|
exports.AsyncMode = AsyncMode;
|
|
2408
|
+
exports.ConcurrentMode = ConcurrentMode;
|
|
2450
2409
|
exports.ContextConsumer = ContextConsumer;
|
|
2451
2410
|
exports.ContextProvider = ContextProvider;
|
|
2452
2411
|
exports.Element = Element;
|
|
@@ -2457,6 +2416,7 @@
|
|
|
2457
2416
|
exports.StrictMode = StrictMode;
|
|
2458
2417
|
exports.isValidElementType = isValidElementType;
|
|
2459
2418
|
exports.isAsyncMode = isAsyncMode;
|
|
2419
|
+
exports.isConcurrentMode = isConcurrentMode;
|
|
2460
2420
|
exports.isContextConsumer = isContextConsumer;
|
|
2461
2421
|
exports.isContextProvider = isContextProvider;
|
|
2462
2422
|
exports.isElement = isElement;
|
|
@@ -2472,24 +2432,26 @@
|
|
|
2472
2432
|
unwrapExports(reactIs_development);
|
|
2473
2433
|
var reactIs_development_1 = reactIs_development.typeOf;
|
|
2474
2434
|
var reactIs_development_2 = reactIs_development.AsyncMode;
|
|
2475
|
-
var reactIs_development_3 = reactIs_development.
|
|
2476
|
-
var reactIs_development_4 = reactIs_development.
|
|
2477
|
-
var reactIs_development_5 = reactIs_development.
|
|
2478
|
-
var reactIs_development_6 = reactIs_development.
|
|
2479
|
-
var reactIs_development_7 = reactIs_development.
|
|
2480
|
-
var reactIs_development_8 = reactIs_development.
|
|
2481
|
-
var reactIs_development_9 = reactIs_development.
|
|
2482
|
-
var reactIs_development_10 = reactIs_development.
|
|
2483
|
-
var reactIs_development_11 = reactIs_development.
|
|
2484
|
-
var reactIs_development_12 = reactIs_development.
|
|
2485
|
-
var reactIs_development_13 = reactIs_development.
|
|
2486
|
-
var reactIs_development_14 = reactIs_development.
|
|
2487
|
-
var reactIs_development_15 = reactIs_development.
|
|
2488
|
-
var reactIs_development_16 = reactIs_development.
|
|
2489
|
-
var reactIs_development_17 = reactIs_development.
|
|
2490
|
-
var reactIs_development_18 = reactIs_development.
|
|
2491
|
-
var reactIs_development_19 = reactIs_development.
|
|
2492
|
-
var reactIs_development_20 = reactIs_development.
|
|
2435
|
+
var reactIs_development_3 = reactIs_development.ConcurrentMode;
|
|
2436
|
+
var reactIs_development_4 = reactIs_development.ContextConsumer;
|
|
2437
|
+
var reactIs_development_5 = reactIs_development.ContextProvider;
|
|
2438
|
+
var reactIs_development_6 = reactIs_development.Element;
|
|
2439
|
+
var reactIs_development_7 = reactIs_development.ForwardRef;
|
|
2440
|
+
var reactIs_development_8 = reactIs_development.Fragment;
|
|
2441
|
+
var reactIs_development_9 = reactIs_development.Profiler;
|
|
2442
|
+
var reactIs_development_10 = reactIs_development.Portal;
|
|
2443
|
+
var reactIs_development_11 = reactIs_development.StrictMode;
|
|
2444
|
+
var reactIs_development_12 = reactIs_development.isValidElementType;
|
|
2445
|
+
var reactIs_development_13 = reactIs_development.isAsyncMode;
|
|
2446
|
+
var reactIs_development_14 = reactIs_development.isConcurrentMode;
|
|
2447
|
+
var reactIs_development_15 = reactIs_development.isContextConsumer;
|
|
2448
|
+
var reactIs_development_16 = reactIs_development.isContextProvider;
|
|
2449
|
+
var reactIs_development_17 = reactIs_development.isElement;
|
|
2450
|
+
var reactIs_development_18 = reactIs_development.isForwardRef;
|
|
2451
|
+
var reactIs_development_19 = reactIs_development.isFragment;
|
|
2452
|
+
var reactIs_development_20 = reactIs_development.isProfiler;
|
|
2453
|
+
var reactIs_development_21 = reactIs_development.isPortal;
|
|
2454
|
+
var reactIs_development_22 = reactIs_development.isStrictMode;
|
|
2493
2455
|
|
|
2494
2456
|
var reactIs = createCommonjsModule(function (module) {
|
|
2495
2457
|
|
|
@@ -2544,6 +2506,7 @@
|
|
|
2544
2506
|
sensitive = _options$sensitive === void 0 ? false : _options$sensitive;
|
|
2545
2507
|
var paths = [].concat(path);
|
|
2546
2508
|
return paths.reduce(function (matched, path) {
|
|
2509
|
+
if (!path) return null;
|
|
2547
2510
|
if (matched) return matched;
|
|
2548
2511
|
|
|
2549
2512
|
var _compilePath = compilePath$1(path, {
|
|
@@ -2576,17 +2539,7 @@
|
|
|
2576
2539
|
}
|
|
2577
2540
|
|
|
2578
2541
|
function isEmptyChildren(children) {
|
|
2579
|
-
return
|
|
2580
|
-
}
|
|
2581
|
-
|
|
2582
|
-
function getContext$1(props, context$$1) {
|
|
2583
|
-
var location = props.location || context$$1.location;
|
|
2584
|
-
var match = props.computedMatch ? props.computedMatch // <Switch> already computed the match for us
|
|
2585
|
-
: props.path ? matchPath(location.pathname, props) : context$$1.match;
|
|
2586
|
-
return _extends({}, context$$1, {
|
|
2587
|
-
location: location,
|
|
2588
|
-
match: match
|
|
2589
|
-
});
|
|
2542
|
+
return React__default.Children.count(children) === 0;
|
|
2590
2543
|
}
|
|
2591
2544
|
/**
|
|
2592
2545
|
* The public API for matching a single path and rendering.
|
|
@@ -2607,9 +2560,17 @@
|
|
|
2607
2560
|
_proto.render = function render() {
|
|
2608
2561
|
var _this = this;
|
|
2609
2562
|
|
|
2610
|
-
return
|
|
2563
|
+
return React__default.createElement(context.Consumer, null, function (context$$1) {
|
|
2611
2564
|
!context$$1 ? invariant(false, "You should not use <Route> outside a <Router>") : void 0;
|
|
2612
|
-
var
|
|
2565
|
+
var location = _this.props.location || context$$1.location;
|
|
2566
|
+
var match = _this.props.computedMatch ? _this.props.computedMatch // <Switch> already computed the match for us
|
|
2567
|
+
: _this.props.path ? matchPath(location.pathname, _this.props) : context$$1.match;
|
|
2568
|
+
|
|
2569
|
+
var props = _extends({}, context$$1, {
|
|
2570
|
+
location: location,
|
|
2571
|
+
match: match
|
|
2572
|
+
});
|
|
2573
|
+
|
|
2613
2574
|
var _this$props = _this.props,
|
|
2614
2575
|
children = _this$props.children,
|
|
2615
2576
|
component = _this$props.component,
|
|
@@ -2633,48 +2594,14 @@
|
|
|
2633
2594
|
}
|
|
2634
2595
|
}
|
|
2635
2596
|
|
|
2636
|
-
return
|
|
2597
|
+
return React__default.createElement(context.Provider, {
|
|
2637
2598
|
value: props
|
|
2638
|
-
}, children && !isEmptyChildren(children) ? children : props.match ? component ?
|
|
2599
|
+
}, children && !isEmptyChildren(children) ? children : props.match ? component ? React__default.createElement(component, props) : render ? render(props) : null : null);
|
|
2639
2600
|
});
|
|
2640
2601
|
};
|
|
2641
2602
|
|
|
2642
2603
|
return Route;
|
|
2643
|
-
}(
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
if (!React.createContext) {
|
|
2647
|
-
Route.contextTypes = {
|
|
2648
|
-
router: propTypes.object.isRequired
|
|
2649
|
-
};
|
|
2650
|
-
Route.childContextTypes = {
|
|
2651
|
-
router: propTypes.object.isRequired
|
|
2652
|
-
};
|
|
2653
|
-
|
|
2654
|
-
Route.prototype.getChildContext = function () {
|
|
2655
|
-
!this.context.router ? invariant(false, "You should not use <Route> outside a <Router>") : void 0;
|
|
2656
|
-
var parentContext = this.context.router;
|
|
2657
|
-
|
|
2658
|
-
{
|
|
2659
|
-
parentContext = parentContext._withoutWarnings;
|
|
2660
|
-
}
|
|
2661
|
-
|
|
2662
|
-
var context$$1 = getContext$1(this.props, parentContext);
|
|
2663
|
-
|
|
2664
|
-
{
|
|
2665
|
-
var contextWithoutWarnings = _extends({}, context$$1);
|
|
2666
|
-
|
|
2667
|
-
Object.keys(context$$1).forEach(function (key) {
|
|
2668
|
-
warnAboutGettingProperty$1(context$$1, key, "You should not be using this.context.router." + key + " directly. It is private API " + "for internal use only and is subject to change at any time. Instead, use " + "a <Route> or withRouter() to access the current location, match, etc.");
|
|
2669
|
-
});
|
|
2670
|
-
context$$1._withoutWarnings = contextWithoutWarnings;
|
|
2671
|
-
}
|
|
2672
|
-
|
|
2673
|
-
return {
|
|
2674
|
-
router: context$$1
|
|
2675
|
-
};
|
|
2676
|
-
};
|
|
2677
|
-
}
|
|
2604
|
+
}(React__default.Component);
|
|
2678
2605
|
|
|
2679
2606
|
{
|
|
2680
2607
|
Route.propTypes = {
|
|
@@ -2772,26 +2699,12 @@
|
|
|
2772
2699
|
|
|
2773
2700
|
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
2774
2701
|
|
|
2775
|
-
_this.createHref = function (path) {
|
|
2776
|
-
return addLeadingSlash$1(_this.props.basename + createURL(path));
|
|
2777
|
-
};
|
|
2778
|
-
|
|
2779
2702
|
_this.handlePush = function (location) {
|
|
2780
|
-
|
|
2781
|
-
basename = _this$props.basename,
|
|
2782
|
-
context = _this$props.context;
|
|
2783
|
-
context.action = "PUSH";
|
|
2784
|
-
context.location = addBasename(basename, createLocation(location));
|
|
2785
|
-
context.url = createURL(context.location);
|
|
2703
|
+
return _this.navigateTo(location, "PUSH");
|
|
2786
2704
|
};
|
|
2787
2705
|
|
|
2788
2706
|
_this.handleReplace = function (location) {
|
|
2789
|
-
|
|
2790
|
-
basename = _this$props2.basename,
|
|
2791
|
-
context = _this$props2.context;
|
|
2792
|
-
context.action = "REPLACE";
|
|
2793
|
-
context.location = addBasename(basename, createLocation(location));
|
|
2794
|
-
context.url = createURL(context.location);
|
|
2707
|
+
return _this.navigateTo(location, "REPLACE");
|
|
2795
2708
|
};
|
|
2796
2709
|
|
|
2797
2710
|
_this.handleListen = function () {
|
|
@@ -2807,15 +2720,31 @@
|
|
|
2807
2720
|
|
|
2808
2721
|
var _proto = StaticRouter.prototype;
|
|
2809
2722
|
|
|
2723
|
+
_proto.navigateTo = function navigateTo(location, action) {
|
|
2724
|
+
var _this$props = this.props,
|
|
2725
|
+
_this$props$basename = _this$props.basename,
|
|
2726
|
+
basename = _this$props$basename === void 0 ? "" : _this$props$basename,
|
|
2727
|
+
_this$props$context = _this$props.context,
|
|
2728
|
+
context = _this$props$context === void 0 ? {} : _this$props$context;
|
|
2729
|
+
context.action = action;
|
|
2730
|
+
context.location = addBasename(basename, createLocation(location));
|
|
2731
|
+
context.url = createURL(context.location);
|
|
2732
|
+
};
|
|
2733
|
+
|
|
2810
2734
|
_proto.render = function render() {
|
|
2811
|
-
var _this$
|
|
2812
|
-
basename = _this$
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2735
|
+
var _this$props2 = this.props,
|
|
2736
|
+
_this$props2$basename = _this$props2.basename,
|
|
2737
|
+
basename = _this$props2$basename === void 0 ? "" : _this$props2$basename,
|
|
2738
|
+
_this$props2$context = _this$props2.context,
|
|
2739
|
+
context = _this$props2$context === void 0 ? {} : _this$props2$context,
|
|
2740
|
+
_this$props2$location = _this$props2.location,
|
|
2741
|
+
location = _this$props2$location === void 0 ? "/" : _this$props2$location,
|
|
2742
|
+
rest = _objectWithoutPropertiesLoose(_this$props2, ["basename", "context", "location"]);
|
|
2816
2743
|
|
|
2817
2744
|
var history = {
|
|
2818
|
-
createHref:
|
|
2745
|
+
createHref: function createHref(path) {
|
|
2746
|
+
return addLeadingSlash$1(basename + createURL(path));
|
|
2747
|
+
},
|
|
2819
2748
|
action: "POP",
|
|
2820
2749
|
location: stripBasename$1(basename, createLocation(location)),
|
|
2821
2750
|
push: this.handlePush,
|
|
@@ -2826,19 +2755,14 @@
|
|
|
2826
2755
|
listen: this.handleListen,
|
|
2827
2756
|
block: this.handleBlock
|
|
2828
2757
|
};
|
|
2829
|
-
return
|
|
2758
|
+
return React__default.createElement(Router, _extends({}, rest, {
|
|
2830
2759
|
history: history,
|
|
2831
|
-
staticContext:
|
|
2760
|
+
staticContext: context
|
|
2832
2761
|
}));
|
|
2833
2762
|
};
|
|
2834
2763
|
|
|
2835
2764
|
return StaticRouter;
|
|
2836
|
-
}(
|
|
2837
|
-
|
|
2838
|
-
StaticRouter.defaultProps = {
|
|
2839
|
-
basename: "",
|
|
2840
|
-
location: "/"
|
|
2841
|
-
};
|
|
2765
|
+
}(React__default.Component);
|
|
2842
2766
|
|
|
2843
2767
|
{
|
|
2844
2768
|
StaticRouter.propTypes = {
|
|
@@ -2870,7 +2794,7 @@
|
|
|
2870
2794
|
_proto.render = function render() {
|
|
2871
2795
|
var _this = this;
|
|
2872
2796
|
|
|
2873
|
-
return
|
|
2797
|
+
return React__default.createElement(context.Consumer, null, function (context$$1) {
|
|
2874
2798
|
!context$$1 ? invariant(false, "You should not use <Switch> outside a <Router>") : void 0;
|
|
2875
2799
|
var location = _this.props.location || context$$1.location;
|
|
2876
2800
|
var element, match; // We use React.Children.forEach instead of React.Children.toArray().find()
|
|
@@ -2878,8 +2802,8 @@
|
|
|
2878
2802
|
// to trigger an unmount/remount for two <Route>s that render the same
|
|
2879
2803
|
// component at different URLs.
|
|
2880
2804
|
|
|
2881
|
-
|
|
2882
|
-
if (match == null &&
|
|
2805
|
+
React__default.Children.forEach(_this.props.children, function (child) {
|
|
2806
|
+
if (match == null && React__default.isValidElement(child)) {
|
|
2883
2807
|
element = child;
|
|
2884
2808
|
var path = child.props.path || child.props.from;
|
|
2885
2809
|
match = path ? matchPath(location.pathname, _extends({}, child.props, {
|
|
@@ -2887,7 +2811,7 @@
|
|
|
2887
2811
|
})) : context$$1.match;
|
|
2888
2812
|
}
|
|
2889
2813
|
});
|
|
2890
|
-
return match ?
|
|
2814
|
+
return match ? React__default.cloneElement(element, {
|
|
2891
2815
|
location: location,
|
|
2892
2816
|
computedMatch: match
|
|
2893
2817
|
}) : null;
|
|
@@ -2895,7 +2819,7 @@
|
|
|
2895
2819
|
};
|
|
2896
2820
|
|
|
2897
2821
|
return Switch;
|
|
2898
|
-
}(
|
|
2822
|
+
}(React__default.Component);
|
|
2899
2823
|
|
|
2900
2824
|
{
|
|
2901
2825
|
Switch.propTypes = {
|
|
@@ -2913,8 +2837,11 @@
|
|
|
2913
2837
|
* Copyright 2015, Yahoo! Inc.
|
|
2914
2838
|
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
|
2915
2839
|
*/
|
|
2840
|
+
|
|
2841
|
+
|
|
2916
2842
|
var REACT_STATICS = {
|
|
2917
2843
|
childContextTypes: true,
|
|
2844
|
+
contextType: true,
|
|
2918
2845
|
contextTypes: true,
|
|
2919
2846
|
defaultProps: true,
|
|
2920
2847
|
displayName: true,
|
|
@@ -2935,15 +2862,24 @@
|
|
|
2935
2862
|
arity: true
|
|
2936
2863
|
};
|
|
2937
2864
|
|
|
2865
|
+
var FORWARD_REF_STATICS = {
|
|
2866
|
+
'$$typeof': true,
|
|
2867
|
+
render: true
|
|
2868
|
+
};
|
|
2869
|
+
|
|
2870
|
+
var TYPE_STATICS = {};
|
|
2871
|
+
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
2872
|
+
|
|
2938
2873
|
var defineProperty = Object.defineProperty;
|
|
2939
2874
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
2940
2875
|
var getOwnPropertySymbols$1 = Object.getOwnPropertySymbols;
|
|
2941
2876
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
2942
2877
|
var getPrototypeOf = Object.getPrototypeOf;
|
|
2943
|
-
var objectPrototype =
|
|
2878
|
+
var objectPrototype = Object.prototype;
|
|
2944
2879
|
|
|
2945
2880
|
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
2946
|
-
if (typeof sourceComponent !== 'string') {
|
|
2881
|
+
if (typeof sourceComponent !== 'string') {
|
|
2882
|
+
// don't hoist over string (html) components
|
|
2947
2883
|
|
|
2948
2884
|
if (objectPrototype) {
|
|
2949
2885
|
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
@@ -2958,11 +2894,15 @@
|
|
|
2958
2894
|
keys = keys.concat(getOwnPropertySymbols$1(sourceComponent));
|
|
2959
2895
|
}
|
|
2960
2896
|
|
|
2897
|
+
var targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS;
|
|
2898
|
+
var sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS;
|
|
2899
|
+
|
|
2961
2900
|
for (var i = 0; i < keys.length; ++i) {
|
|
2962
2901
|
var key = keys[i];
|
|
2963
|
-
if (!
|
|
2902
|
+
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
|
2964
2903
|
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
2965
|
-
try {
|
|
2904
|
+
try {
|
|
2905
|
+
// Avoid failures from read-only properties
|
|
2966
2906
|
defineProperty(targetComponent, key, descriptor);
|
|
2967
2907
|
} catch (e) {}
|
|
2968
2908
|
}
|
|
@@ -2981,31 +2921,54 @@
|
|
|
2981
2921
|
*/
|
|
2982
2922
|
|
|
2983
2923
|
function withRouter(Component) {
|
|
2924
|
+
var displayName = "withRouter(" + (Component.displayName || Component.name) + ")";
|
|
2925
|
+
|
|
2984
2926
|
var C = function C(props) {
|
|
2985
2927
|
var wrappedComponentRef = props.wrappedComponentRef,
|
|
2986
2928
|
remainingProps = _objectWithoutPropertiesLoose(props, ["wrappedComponentRef"]);
|
|
2987
2929
|
|
|
2988
|
-
return
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
}
|
|
2930
|
+
return React__default.createElement(context.Consumer, null, function (context$$1) {
|
|
2931
|
+
!context$$1 ? invariant(false, "You should not use <" + displayName + " /> outside a <Router>") : void 0;
|
|
2932
|
+
return React__default.createElement(Component, _extends({}, remainingProps, context$$1, {
|
|
2933
|
+
ref: wrappedComponentRef
|
|
2934
|
+
}));
|
|
2994
2935
|
});
|
|
2995
2936
|
};
|
|
2996
2937
|
|
|
2997
|
-
C.displayName =
|
|
2938
|
+
C.displayName = displayName;
|
|
2998
2939
|
C.WrappedComponent = Component;
|
|
2999
2940
|
|
|
3000
2941
|
{
|
|
3001
2942
|
C.propTypes = {
|
|
3002
|
-
wrappedComponentRef: propTypes.func
|
|
2943
|
+
wrappedComponentRef: propTypes.oneOfType([propTypes.string, propTypes.func, propTypes.object])
|
|
3003
2944
|
};
|
|
3004
2945
|
}
|
|
3005
2946
|
|
|
3006
2947
|
return hoistNonReactStatics_cjs(C, Component);
|
|
3007
2948
|
}
|
|
3008
2949
|
|
|
2950
|
+
{
|
|
2951
|
+
if (typeof window !== "undefined") {
|
|
2952
|
+
var global$1 = window;
|
|
2953
|
+
var key$1 = "__react_router_build__";
|
|
2954
|
+
var buildNames = {
|
|
2955
|
+
cjs: "CommonJS",
|
|
2956
|
+
esm: "ES modules",
|
|
2957
|
+
umd: "UMD"
|
|
2958
|
+
};
|
|
2959
|
+
|
|
2960
|
+
if (global$1[key$1] && global$1[key$1] !== "umd") {
|
|
2961
|
+
var initialBuildName = buildNames[global$1[key$1]];
|
|
2962
|
+
var secondaryBuildName = buildNames["umd"]; // TODO: Add link to article that explains in detail how to avoid
|
|
2963
|
+
// loading 2 different builds.
|
|
2964
|
+
|
|
2965
|
+
throw new Error("You are loading the " + secondaryBuildName + " build of React Router " + ("on a page that is already running the " + initialBuildName + " ") + "build, so things won't work right.");
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2968
|
+
global$1[key$1] = "umd";
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
|
|
3009
2972
|
exports.MemoryRouter = MemoryRouter;
|
|
3010
2973
|
exports.Prompt = Prompt;
|
|
3011
2974
|
exports.Redirect = Redirect;
|