Add files
This commit is contained in:
commit
bb80829159
18195 changed files with 2122994 additions and 0 deletions
38
509bba0_unpacked_with_node_modules/~/history/lib/Actions.js
generated
Executable file
38
509bba0_unpacked_with_node_modules/~/history/lib/Actions.js
generated
Executable file
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* Indicates that navigation was caused by a call to history.push.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
var PUSH = 'PUSH';
|
||||
|
||||
exports.PUSH = PUSH;
|
||||
/**
|
||||
* Indicates that navigation was caused by a call to history.replace.
|
||||
*/
|
||||
var REPLACE = 'REPLACE';
|
||||
|
||||
exports.REPLACE = REPLACE;
|
||||
/**
|
||||
* Indicates that navigation was caused by some other action such
|
||||
* as using a browser's back/forward buttons and/or manually manipulating
|
||||
* the URL in a browser's location bar. This is the default.
|
||||
*
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate
|
||||
* for more information.
|
||||
*/
|
||||
var POP = 'POP';
|
||||
|
||||
exports.POP = POP;
|
||||
exports['default'] = {
|
||||
PUSH: PUSH,
|
||||
REPLACE: REPLACE,
|
||||
POP: POP
|
||||
};
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/Actions.js
|
||||
// module id = 203
|
||||
// module chunks = 4
|
65
509bba0_unpacked_with_node_modules/~/history/lib/AsyncUtils.js
generated
Executable file
65
509bba0_unpacked_with_node_modules/~/history/lib/AsyncUtils.js
generated
Executable file
|
@ -0,0 +1,65 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
var _slice = Array.prototype.slice;
|
||||
exports.loopAsync = loopAsync;
|
||||
|
||||
function loopAsync(turns, work, callback) {
|
||||
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;
|
||||
}
|
||||
|
||||
hasNext = true;
|
||||
if (sync) {
|
||||
// Iterate instead of recursing if possible.
|
||||
return;
|
||||
}
|
||||
|
||||
sync = true;
|
||||
|
||||
while (!isDone && currentTurn < turns && hasNext) {
|
||||
hasNext = false;
|
||||
work.call(this, currentTurn++, next, done);
|
||||
}
|
||||
|
||||
sync = false;
|
||||
|
||||
if (isDone) {
|
||||
// This means the loop finished synchronously.
|
||||
callback.apply(this, doneArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentTurn >= turns && hasNext) {
|
||||
isDone = true;
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/AsyncUtils.js
|
||||
// module id = 2542
|
||||
// module chunks = 4
|
80
509bba0_unpacked_with_node_modules/~/history/lib/DOMStateStorage.js
generated
Executable file
80
509bba0_unpacked_with_node_modules/~/history/lib/DOMStateStorage.js
generated
Executable file
|
@ -0,0 +1,80 @@
|
|||
/*eslint-disable no-empty */
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.saveState = saveState;
|
||||
exports.readState = readState;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
var _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
var KeyPrefix = '@@History/';
|
||||
var QuotaExceededErrors = ['QuotaExceededError', 'QUOTA_EXCEEDED_ERR'];
|
||||
|
||||
var SecurityError = 'SecurityError';
|
||||
|
||||
function createKey(key) {
|
||||
return KeyPrefix + key;
|
||||
}
|
||||
|
||||
function saveState(key, state) {
|
||||
try {
|
||||
if (state == null) {
|
||||
window.sessionStorage.removeItem(createKey(key));
|
||||
} else {
|
||||
window.sessionStorage.setItem(createKey(key), JSON.stringify(state));
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.name === SecurityError) {
|
||||
// Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
|
||||
// attempt to access window.sessionStorage.
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] Unable to save state; sessionStorage is not available due to security settings') : undefined;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (QuotaExceededErrors.indexOf(error.name) >= 0 && window.sessionStorage.length === 0) {
|
||||
// Safari "private mode" throws QuotaExceededError.
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] Unable to save state; sessionStorage is not available in Safari private mode') : undefined;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function readState(key) {
|
||||
var json = undefined;
|
||||
try {
|
||||
json = window.sessionStorage.getItem(createKey(key));
|
||||
} catch (error) {
|
||||
if (error.name === SecurityError) {
|
||||
// Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
|
||||
// attempt to access window.sessionStorage.
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] Unable to read state; sessionStorage is not available due to security settings') : undefined;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (json) {
|
||||
try {
|
||||
return JSON.parse(json);
|
||||
} catch (error) {
|
||||
// Ignore invalid JSON.
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/DOMStateStorage.js
|
||||
// module id = 613
|
||||
// module chunks = 4
|
82
509bba0_unpacked_with_node_modules/~/history/lib/DOMUtils.js
generated
Executable file
82
509bba0_unpacked_with_node_modules/~/history/lib/DOMUtils.js
generated
Executable file
|
@ -0,0 +1,82 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.addEventListener = addEventListener;
|
||||
exports.removeEventListener = removeEventListener;
|
||||
exports.getHashPath = getHashPath;
|
||||
exports.replaceHashPath = replaceHashPath;
|
||||
exports.getWindowPath = getWindowPath;
|
||||
exports.go = go;
|
||||
exports.getUserConfirmation = getUserConfirmation;
|
||||
exports.supportsHistory = supportsHistory;
|
||||
exports.supportsGoWithoutReloadUsingHash = supportsGoWithoutReloadUsingHash;
|
||||
|
||||
function addEventListener(node, event, listener) {
|
||||
if (node.addEventListener) {
|
||||
node.addEventListener(event, listener, false);
|
||||
} else {
|
||||
node.attachEvent('on' + event, listener);
|
||||
}
|
||||
}
|
||||
|
||||
function removeEventListener(node, event, listener) {
|
||||
if (node.removeEventListener) {
|
||||
node.removeEventListener(event, listener, false);
|
||||
} else {
|
||||
node.detachEvent('on' + event, listener);
|
||||
}
|
||||
}
|
||||
|
||||
function getHashPath() {
|
||||
// We can't use window.location.hash here because it's not
|
||||
// consistent across browsers - Firefox will pre-decode it!
|
||||
return window.location.href.split('#')[1] || '';
|
||||
}
|
||||
|
||||
function replaceHashPath(path) {
|
||||
window.location.replace(window.location.pathname + window.location.search + '#' + path);
|
||||
}
|
||||
|
||||
function getWindowPath() {
|
||||
return window.location.pathname + window.location.search + window.location.hash;
|
||||
}
|
||||
|
||||
function go(n) {
|
||||
if (n) window.history.go(n);
|
||||
}
|
||||
|
||||
function getUserConfirmation(message, callback) {
|
||||
callback(window.confirm(message));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
|
||||
*
|
||||
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
|
||||
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
|
||||
* changed to avoid false negatives for Windows Phones: https://github.com/rackt/react-router/issues/586
|
||||
*/
|
||||
|
||||
function supportsHistory() {
|
||||
var ua = navigator.userAgent;
|
||||
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) {
|
||||
return false;
|
||||
}
|
||||
return window.history && 'pushState' in window.history;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if using go(n) with hash history causes a full page reload.
|
||||
*/
|
||||
|
||||
function supportsGoWithoutReloadUsingHash() {
|
||||
var ua = navigator.userAgent;
|
||||
return ua.indexOf('Firefox') === -1;
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/DOMUtils.js
|
||||
// module id = 614
|
||||
// module chunks = 4
|
12
509bba0_unpacked_with_node_modules/~/history/lib/ExecutionEnvironment.js
generated
Executable file
12
509bba0_unpacked_with_node_modules/~/history/lib/ExecutionEnvironment.js
generated
Executable file
|
@ -0,0 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
||||
exports.canUseDOM = canUseDOM;
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/ExecutionEnvironment.js
|
||||
// module id = 422
|
||||
// module chunks = 4
|
54
509bba0_unpacked_with_node_modules/~/history/lib/PathUtils.js
generated
Executable file
54
509bba0_unpacked_with_node_modules/~/history/lib/PathUtils.js
generated
Executable file
|
@ -0,0 +1,54 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.extractPath = extractPath;
|
||||
exports.parsePath = parsePath;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
var _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
function extractPath(string) {
|
||||
var match = string.match(/^https?:\/\/[^\/]*/);
|
||||
|
||||
if (match == null) return string;
|
||||
|
||||
return string.substring(match[0].length);
|
||||
}
|
||||
|
||||
function parsePath(path) {
|
||||
var pathname = extractPath(path);
|
||||
var search = '';
|
||||
var hash = '';
|
||||
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](path === pathname, 'A path must be pathname + search + hash only, not a fully qualified URL like "%s"', path) : undefined;
|
||||
|
||||
var hashIndex = pathname.indexOf('#');
|
||||
if (hashIndex !== -1) {
|
||||
hash = pathname.substring(hashIndex);
|
||||
pathname = pathname.substring(0, hashIndex);
|
||||
}
|
||||
|
||||
var searchIndex = pathname.indexOf('?');
|
||||
if (searchIndex !== -1) {
|
||||
search = pathname.substring(searchIndex);
|
||||
pathname = pathname.substring(0, searchIndex);
|
||||
}
|
||||
|
||||
if (pathname === '') pathname = '/';
|
||||
|
||||
return {
|
||||
pathname: pathname,
|
||||
search: search,
|
||||
hash: hash
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/PathUtils.js
|
||||
// module id = 248
|
||||
// module chunks = 4
|
187
509bba0_unpacked_with_node_modules/~/history/lib/createBrowserHistory.js
generated
Executable file
187
509bba0_unpacked_with_node_modules/~/history/lib/createBrowserHistory.js
generated
Executable file
|
@ -0,0 +1,187 @@
|
|||
'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 _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _Actions = require('./Actions');
|
||||
|
||||
var _PathUtils = require('./PathUtils');
|
||||
|
||||
var _ExecutionEnvironment = require('./ExecutionEnvironment');
|
||||
|
||||
var _DOMUtils = require('./DOMUtils');
|
||||
|
||||
var _DOMStateStorage = require('./DOMStateStorage');
|
||||
|
||||
var _createDOMHistory = require('./createDOMHistory');
|
||||
|
||||
var _createDOMHistory2 = _interopRequireDefault(_createDOMHistory);
|
||||
|
||||
/**
|
||||
* Creates and returns a history object that uses HTML5's history API
|
||||
* (pushState, replaceState, and the popstate event) to manage history.
|
||||
* This is the recommended method of managing history in browsers because
|
||||
* it provides the cleanest URLs.
|
||||
*
|
||||
* Note: In browsers that do not support the HTML5 history API full
|
||||
* page reloads will be used to preserve URLs.
|
||||
*/
|
||||
function createBrowserHistory() {
|
||||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
||||
|
||||
!_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Browser history needs a DOM') : _invariant2['default'](false) : undefined;
|
||||
|
||||
var forceRefresh = options.forceRefresh;
|
||||
|
||||
var isSupported = _DOMUtils.supportsHistory();
|
||||
var useRefresh = !isSupported || forceRefresh;
|
||||
|
||||
function getCurrentLocation(historyState) {
|
||||
try {
|
||||
historyState = historyState || window.history.state || {};
|
||||
} catch (e) {
|
||||
historyState = {};
|
||||
}
|
||||
|
||||
var path = _DOMUtils.getWindowPath();
|
||||
var _historyState = historyState;
|
||||
var key = _historyState.key;
|
||||
|
||||
var state = undefined;
|
||||
if (key) {
|
||||
state = _DOMStateStorage.readState(key);
|
||||
} else {
|
||||
state = null;
|
||||
key = history.createKey();
|
||||
|
||||
if (isSupported) window.history.replaceState(_extends({}, historyState, { key: key }), null);
|
||||
}
|
||||
|
||||
var location = _PathUtils.parsePath(path);
|
||||
|
||||
return history.createLocation(_extends({}, location, { state: state }), undefined, key);
|
||||
}
|
||||
|
||||
function startPopStateListener(_ref) {
|
||||
var transitionTo = _ref.transitionTo;
|
||||
|
||||
function popStateListener(event) {
|
||||
if (event.state === undefined) return; // Ignore extraneous popstate events in WebKit.
|
||||
|
||||
transitionTo(getCurrentLocation(event.state));
|
||||
}
|
||||
|
||||
_DOMUtils.addEventListener(window, 'popstate', popStateListener);
|
||||
|
||||
return function () {
|
||||
_DOMUtils.removeEventListener(window, 'popstate', popStateListener);
|
||||
};
|
||||
}
|
||||
|
||||
function finishTransition(location) {
|
||||
var basename = location.basename;
|
||||
var pathname = location.pathname;
|
||||
var search = location.search;
|
||||
var hash = location.hash;
|
||||
var state = location.state;
|
||||
var action = location.action;
|
||||
var key = location.key;
|
||||
|
||||
if (action === _Actions.POP) return; // Nothing to do.
|
||||
|
||||
_DOMStateStorage.saveState(key, state);
|
||||
|
||||
var path = (basename || '') + pathname + search + hash;
|
||||
var historyState = {
|
||||
key: key
|
||||
};
|
||||
|
||||
if (action === _Actions.PUSH) {
|
||||
if (useRefresh) {
|
||||
window.location.href = path;
|
||||
return false; // Prevent location update.
|
||||
} else {
|
||||
window.history.pushState(historyState, null, path);
|
||||
}
|
||||
} else {
|
||||
// REPLACE
|
||||
if (useRefresh) {
|
||||
window.location.replace(path);
|
||||
return false; // Prevent location update.
|
||||
} else {
|
||||
window.history.replaceState(historyState, null, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var history = _createDOMHistory2['default'](_extends({}, options, {
|
||||
getCurrentLocation: getCurrentLocation,
|
||||
finishTransition: finishTransition,
|
||||
saveState: _DOMStateStorage.saveState
|
||||
}));
|
||||
|
||||
var listenerCount = 0,
|
||||
stopPopStateListener = undefined;
|
||||
|
||||
function listenBefore(listener) {
|
||||
if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
|
||||
|
||||
var unlisten = history.listenBefore(listener);
|
||||
|
||||
return function () {
|
||||
unlisten();
|
||||
|
||||
if (--listenerCount === 0) stopPopStateListener();
|
||||
};
|
||||
}
|
||||
|
||||
function listen(listener) {
|
||||
if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
|
||||
|
||||
var unlisten = history.listen(listener);
|
||||
|
||||
return function () {
|
||||
unlisten();
|
||||
|
||||
if (--listenerCount === 0) stopPopStateListener();
|
||||
};
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function registerTransitionHook(hook) {
|
||||
if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
|
||||
|
||||
history.registerTransitionHook(hook);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function unregisterTransitionHook(hook) {
|
||||
history.unregisterTransitionHook(hook);
|
||||
|
||||
if (--listenerCount === 0) stopPopStateListener();
|
||||
}
|
||||
|
||||
return _extends({}, history, {
|
||||
listenBefore: listenBefore,
|
||||
listen: listen,
|
||||
registerTransitionHook: registerTransitionHook,
|
||||
unregisterTransitionHook: unregisterTransitionHook
|
||||
});
|
||||
}
|
||||
|
||||
exports['default'] = createBrowserHistory;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/createBrowserHistory.js
|
||||
// module id = 2543
|
||||
// module chunks = 4
|
47
509bba0_unpacked_with_node_modules/~/history/lib/createDOMHistory.js
generated
Executable file
47
509bba0_unpacked_with_node_modules/~/history/lib/createDOMHistory.js
generated
Executable file
|
@ -0,0 +1,47 @@
|
|||
'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 _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _ExecutionEnvironment = require('./ExecutionEnvironment');
|
||||
|
||||
var _DOMUtils = require('./DOMUtils');
|
||||
|
||||
var _createHistory = require('./createHistory');
|
||||
|
||||
var _createHistory2 = _interopRequireDefault(_createHistory);
|
||||
|
||||
function createDOMHistory(options) {
|
||||
var history = _createHistory2['default'](_extends({
|
||||
getUserConfirmation: _DOMUtils.getUserConfirmation
|
||||
}, options, {
|
||||
go: _DOMUtils.go
|
||||
}));
|
||||
|
||||
function listen(listener) {
|
||||
!_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'DOM history needs a DOM') : _invariant2['default'](false) : undefined;
|
||||
|
||||
return history.listen(listener);
|
||||
}
|
||||
|
||||
return _extends({}, history, {
|
||||
listen: listen
|
||||
});
|
||||
}
|
||||
|
||||
exports['default'] = createDOMHistory;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/createDOMHistory.js
|
||||
// module id = 962
|
||||
// module chunks = 4
|
253
509bba0_unpacked_with_node_modules/~/history/lib/createHashHistory.js
generated
Executable file
253
509bba0_unpacked_with_node_modules/~/history/lib/createHashHistory.js
generated
Executable file
|
@ -0,0 +1,253 @@
|
|||
'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 _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _Actions = require('./Actions');
|
||||
|
||||
var _PathUtils = require('./PathUtils');
|
||||
|
||||
var _ExecutionEnvironment = require('./ExecutionEnvironment');
|
||||
|
||||
var _DOMUtils = require('./DOMUtils');
|
||||
|
||||
var _DOMStateStorage = require('./DOMStateStorage');
|
||||
|
||||
var _createDOMHistory = require('./createDOMHistory');
|
||||
|
||||
var _createDOMHistory2 = _interopRequireDefault(_createDOMHistory);
|
||||
|
||||
function isAbsolutePath(path) {
|
||||
return typeof path === 'string' && path.charAt(0) === '/';
|
||||
}
|
||||
|
||||
function ensureSlash() {
|
||||
var path = _DOMUtils.getHashPath();
|
||||
|
||||
if (isAbsolutePath(path)) return true;
|
||||
|
||||
_DOMUtils.replaceHashPath('/' + path);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function addQueryStringValueToPath(path, key, value) {
|
||||
return path + (path.indexOf('?') === -1 ? '?' : '&') + (key + '=' + value);
|
||||
}
|
||||
|
||||
function stripQueryStringValueFromPath(path, key) {
|
||||
return path.replace(new RegExp('[?&]?' + key + '=[a-zA-Z0-9]+'), '');
|
||||
}
|
||||
|
||||
function getQueryStringValueFromPath(path, key) {
|
||||
var match = path.match(new RegExp('\\?.*?\\b' + key + '=(.+?)\\b'));
|
||||
return match && match[1];
|
||||
}
|
||||
|
||||
var DefaultQueryKey = '_k';
|
||||
|
||||
function createHashHistory() {
|
||||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
||||
|
||||
!_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Hash history needs a DOM') : _invariant2['default'](false) : undefined;
|
||||
|
||||
var queryKey = options.queryKey;
|
||||
|
||||
if (queryKey === undefined || !!queryKey) queryKey = typeof queryKey === 'string' ? queryKey : DefaultQueryKey;
|
||||
|
||||
function getCurrentLocation() {
|
||||
var path = _DOMUtils.getHashPath();
|
||||
|
||||
var key = undefined,
|
||||
state = undefined;
|
||||
if (queryKey) {
|
||||
key = getQueryStringValueFromPath(path, queryKey);
|
||||
path = stripQueryStringValueFromPath(path, queryKey);
|
||||
|
||||
if (key) {
|
||||
state = _DOMStateStorage.readState(key);
|
||||
} else {
|
||||
state = null;
|
||||
key = history.createKey();
|
||||
_DOMUtils.replaceHashPath(addQueryStringValueToPath(path, queryKey, key));
|
||||
}
|
||||
} else {
|
||||
key = state = null;
|
||||
}
|
||||
|
||||
var location = _PathUtils.parsePath(path);
|
||||
|
||||
return history.createLocation(_extends({}, location, { state: state }), undefined, key);
|
||||
}
|
||||
|
||||
function startHashChangeListener(_ref) {
|
||||
var transitionTo = _ref.transitionTo;
|
||||
|
||||
function hashChangeListener() {
|
||||
if (!ensureSlash()) return; // Always make sure hashes are preceeded with a /.
|
||||
|
||||
transitionTo(getCurrentLocation());
|
||||
}
|
||||
|
||||
ensureSlash();
|
||||
_DOMUtils.addEventListener(window, 'hashchange', hashChangeListener);
|
||||
|
||||
return function () {
|
||||
_DOMUtils.removeEventListener(window, 'hashchange', hashChangeListener);
|
||||
};
|
||||
}
|
||||
|
||||
function finishTransition(location) {
|
||||
var basename = location.basename;
|
||||
var pathname = location.pathname;
|
||||
var search = location.search;
|
||||
var state = location.state;
|
||||
var action = location.action;
|
||||
var key = location.key;
|
||||
|
||||
if (action === _Actions.POP) return; // Nothing to do.
|
||||
|
||||
var path = (basename || '') + pathname + search;
|
||||
|
||||
if (queryKey) {
|
||||
path = addQueryStringValueToPath(path, queryKey, key);
|
||||
_DOMStateStorage.saveState(key, state);
|
||||
} else {
|
||||
// Drop key and state.
|
||||
location.key = location.state = null;
|
||||
}
|
||||
|
||||
var currentHash = _DOMUtils.getHashPath();
|
||||
|
||||
if (action === _Actions.PUSH) {
|
||||
if (currentHash !== path) {
|
||||
window.location.hash = path;
|
||||
} else {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'You cannot PUSH the same path using hash history') : undefined;
|
||||
}
|
||||
} else if (currentHash !== path) {
|
||||
// REPLACE
|
||||
_DOMUtils.replaceHashPath(path);
|
||||
}
|
||||
}
|
||||
|
||||
var history = _createDOMHistory2['default'](_extends({}, options, {
|
||||
getCurrentLocation: getCurrentLocation,
|
||||
finishTransition: finishTransition,
|
||||
saveState: _DOMStateStorage.saveState
|
||||
}));
|
||||
|
||||
var listenerCount = 0,
|
||||
stopHashChangeListener = undefined;
|
||||
|
||||
function listenBefore(listener) {
|
||||
if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
|
||||
|
||||
var unlisten = history.listenBefore(listener);
|
||||
|
||||
return function () {
|
||||
unlisten();
|
||||
|
||||
if (--listenerCount === 0) stopHashChangeListener();
|
||||
};
|
||||
}
|
||||
|
||||
function listen(listener) {
|
||||
if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
|
||||
|
||||
var unlisten = history.listen(listener);
|
||||
|
||||
return function () {
|
||||
unlisten();
|
||||
|
||||
if (--listenerCount === 0) stopHashChangeListener();
|
||||
};
|
||||
}
|
||||
|
||||
function push(location) {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
|
||||
|
||||
history.push(location);
|
||||
}
|
||||
|
||||
function replace(location) {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
|
||||
|
||||
history.replace(location);
|
||||
}
|
||||
|
||||
var goIsSupportedWithoutReload = _DOMUtils.supportsGoWithoutReloadUsingHash();
|
||||
|
||||
function go(n) {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](goIsSupportedWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : undefined;
|
||||
|
||||
history.go(n);
|
||||
}
|
||||
|
||||
function createHref(path) {
|
||||
return '#' + history.createHref(path);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function registerTransitionHook(hook) {
|
||||
if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
|
||||
|
||||
history.registerTransitionHook(hook);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function unregisterTransitionHook(hook) {
|
||||
history.unregisterTransitionHook(hook);
|
||||
|
||||
if (--listenerCount === 0) stopHashChangeListener();
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function pushState(state, path) {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
|
||||
|
||||
history.pushState(state, path);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function replaceState(state, path) {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
|
||||
|
||||
history.replaceState(state, path);
|
||||
}
|
||||
|
||||
return _extends({}, history, {
|
||||
listenBefore: listenBefore,
|
||||
listen: listen,
|
||||
push: push,
|
||||
replace: replace,
|
||||
go: go,
|
||||
createHref: createHref,
|
||||
|
||||
registerTransitionHook: registerTransitionHook, // deprecated - warning is in createHistory
|
||||
unregisterTransitionHook: unregisterTransitionHook, // deprecated - warning is in createHistory
|
||||
pushState: pushState, // deprecated - warning is in createHistory
|
||||
replaceState: replaceState // deprecated - warning is in createHistory
|
||||
});
|
||||
}
|
||||
|
||||
exports['default'] = createHashHistory;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/createHashHistory.js
|
||||
// module id = 963
|
||||
// module chunks = 4
|
295
509bba0_unpacked_with_node_modules/~/history/lib/createHistory.js
generated
Executable file
295
509bba0_unpacked_with_node_modules/~/history/lib/createHistory.js
generated
Executable file
|
@ -0,0 +1,295 @@
|
|||
'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 _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
var _deepEqual = require('deep-equal');
|
||||
|
||||
var _deepEqual2 = _interopRequireDefault(_deepEqual);
|
||||
|
||||
var _PathUtils = require('./PathUtils');
|
||||
|
||||
var _AsyncUtils = require('./AsyncUtils');
|
||||
|
||||
var _Actions = require('./Actions');
|
||||
|
||||
var _createLocation2 = require('./createLocation');
|
||||
|
||||
var _createLocation3 = _interopRequireDefault(_createLocation2);
|
||||
|
||||
var _runTransitionHook = require('./runTransitionHook');
|
||||
|
||||
var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
|
||||
|
||||
var _deprecate = require('./deprecate');
|
||||
|
||||
var _deprecate2 = _interopRequireDefault(_deprecate);
|
||||
|
||||
function createRandomKey(length) {
|
||||
return Math.random().toString(36).substr(2, length);
|
||||
}
|
||||
|
||||
function locationsAreEqual(a, b) {
|
||||
return a.pathname === b.pathname && a.search === b.search &&
|
||||
//a.action === b.action && // Different action !== location change.
|
||||
a.key === b.key && _deepEqual2['default'](a.state, b.state);
|
||||
}
|
||||
|
||||
var DefaultKeyLength = 6;
|
||||
|
||||
function createHistory() {
|
||||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
||||
var getCurrentLocation = options.getCurrentLocation;
|
||||
var finishTransition = options.finishTransition;
|
||||
var saveState = options.saveState;
|
||||
var go = options.go;
|
||||
var getUserConfirmation = options.getUserConfirmation;
|
||||
var keyLength = options.keyLength;
|
||||
|
||||
if (typeof keyLength !== 'number') keyLength = DefaultKeyLength;
|
||||
|
||||
var transitionHooks = [];
|
||||
|
||||
function listenBefore(hook) {
|
||||
transitionHooks.push(hook);
|
||||
|
||||
return function () {
|
||||
transitionHooks = transitionHooks.filter(function (item) {
|
||||
return item !== hook;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
var allKeys = [];
|
||||
var changeListeners = [];
|
||||
var location = undefined;
|
||||
|
||||
function getCurrent() {
|
||||
if (pendingLocation && pendingLocation.action === _Actions.POP) {
|
||||
return allKeys.indexOf(pendingLocation.key);
|
||||
} else if (location) {
|
||||
return allKeys.indexOf(location.key);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
function updateLocation(newLocation) {
|
||||
var current = getCurrent();
|
||||
|
||||
location = newLocation;
|
||||
|
||||
if (location.action === _Actions.PUSH) {
|
||||
allKeys = [].concat(allKeys.slice(0, current + 1), [location.key]);
|
||||
} else if (location.action === _Actions.REPLACE) {
|
||||
allKeys[current] = location.key;
|
||||
}
|
||||
|
||||
changeListeners.forEach(function (listener) {
|
||||
listener(location);
|
||||
});
|
||||
}
|
||||
|
||||
function listen(listener) {
|
||||
changeListeners.push(listener);
|
||||
|
||||
if (location) {
|
||||
listener(location);
|
||||
} else {
|
||||
var _location = getCurrentLocation();
|
||||
allKeys = [_location.key];
|
||||
updateLocation(_location);
|
||||
}
|
||||
|
||||
return function () {
|
||||
changeListeners = changeListeners.filter(function (item) {
|
||||
return item !== listener;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function confirmTransitionTo(location, callback) {
|
||||
_AsyncUtils.loopAsync(transitionHooks.length, function (index, next, done) {
|
||||
_runTransitionHook2['default'](transitionHooks[index], location, function (result) {
|
||||
if (result != null) {
|
||||
done(result);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
}, function (message) {
|
||||
if (getUserConfirmation && typeof message === 'string') {
|
||||
getUserConfirmation(message, function (ok) {
|
||||
callback(ok !== false);
|
||||
});
|
||||
} else {
|
||||
callback(message !== false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var pendingLocation = undefined;
|
||||
|
||||
function transitionTo(nextLocation) {
|
||||
if (location && locationsAreEqual(location, nextLocation)) return; // Nothing to do.
|
||||
|
||||
pendingLocation = nextLocation;
|
||||
|
||||
confirmTransitionTo(nextLocation, function (ok) {
|
||||
if (pendingLocation !== nextLocation) return; // Transition was interrupted.
|
||||
|
||||
if (ok) {
|
||||
// treat PUSH to current path like REPLACE to be consistent with browsers
|
||||
if (nextLocation.action === _Actions.PUSH) {
|
||||
var prevPath = createPath(location);
|
||||
var nextPath = createPath(nextLocation);
|
||||
|
||||
if (nextPath === prevPath && _deepEqual2['default'](location.state, nextLocation.state)) nextLocation.action = _Actions.REPLACE;
|
||||
}
|
||||
|
||||
if (finishTransition(nextLocation) !== false) updateLocation(nextLocation);
|
||||
} else if (location && nextLocation.action === _Actions.POP) {
|
||||
var prevIndex = allKeys.indexOf(location.key);
|
||||
var nextIndex = allKeys.indexOf(nextLocation.key);
|
||||
|
||||
if (prevIndex !== -1 && nextIndex !== -1) go(prevIndex - nextIndex); // Restore the URL.
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function push(location) {
|
||||
transitionTo(createLocation(location, _Actions.PUSH, createKey()));
|
||||
}
|
||||
|
||||
function replace(location) {
|
||||
transitionTo(createLocation(location, _Actions.REPLACE, createKey()));
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
go(-1);
|
||||
}
|
||||
|
||||
function goForward() {
|
||||
go(1);
|
||||
}
|
||||
|
||||
function createKey() {
|
||||
return createRandomKey(keyLength);
|
||||
}
|
||||
|
||||
function createPath(location) {
|
||||
if (location == null || typeof location === 'string') return location;
|
||||
|
||||
var pathname = location.pathname;
|
||||
var search = location.search;
|
||||
var hash = location.hash;
|
||||
|
||||
var result = pathname;
|
||||
|
||||
if (search) result += search;
|
||||
|
||||
if (hash) result += hash;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function createHref(location) {
|
||||
return createPath(location);
|
||||
}
|
||||
|
||||
function createLocation(location, action) {
|
||||
var key = arguments.length <= 2 || arguments[2] === undefined ? createKey() : arguments[2];
|
||||
|
||||
if (typeof action === 'object') {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'The state (2nd) argument to history.createLocation is deprecated; use a ' + 'location descriptor instead') : undefined;
|
||||
|
||||
if (typeof location === 'string') location = _PathUtils.parsePath(location);
|
||||
|
||||
location = _extends({}, location, { state: action });
|
||||
|
||||
action = key;
|
||||
key = arguments[3] || createKey();
|
||||
}
|
||||
|
||||
return _createLocation3['default'](location, action, key);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function setState(state) {
|
||||
if (location) {
|
||||
updateLocationState(location, state);
|
||||
updateLocation(location);
|
||||
} else {
|
||||
updateLocationState(getCurrentLocation(), state);
|
||||
}
|
||||
}
|
||||
|
||||
function updateLocationState(location, state) {
|
||||
location.state = _extends({}, location.state, state);
|
||||
saveState(location.key, location.state);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function registerTransitionHook(hook) {
|
||||
if (transitionHooks.indexOf(hook) === -1) transitionHooks.push(hook);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function unregisterTransitionHook(hook) {
|
||||
transitionHooks = transitionHooks.filter(function (item) {
|
||||
return item !== hook;
|
||||
});
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function pushState(state, path) {
|
||||
if (typeof path === 'string') path = _PathUtils.parsePath(path);
|
||||
|
||||
push(_extends({ state: state }, path));
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function replaceState(state, path) {
|
||||
if (typeof path === 'string') path = _PathUtils.parsePath(path);
|
||||
|
||||
replace(_extends({ state: state }, path));
|
||||
}
|
||||
|
||||
return {
|
||||
listenBefore: listenBefore,
|
||||
listen: listen,
|
||||
transitionTo: transitionTo,
|
||||
push: push,
|
||||
replace: replace,
|
||||
go: go,
|
||||
goBack: goBack,
|
||||
goForward: goForward,
|
||||
createKey: createKey,
|
||||
createPath: createPath,
|
||||
createHref: createHref,
|
||||
createLocation: createLocation,
|
||||
|
||||
setState: _deprecate2['default'](setState, 'setState is deprecated; use location.key to save state instead'),
|
||||
registerTransitionHook: _deprecate2['default'](registerTransitionHook, 'registerTransitionHook is deprecated; use listenBefore instead'),
|
||||
unregisterTransitionHook: _deprecate2['default'](unregisterTransitionHook, 'unregisterTransitionHook is deprecated; use the callback returned from listenBefore instead'),
|
||||
pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
|
||||
replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
|
||||
};
|
||||
}
|
||||
|
||||
exports['default'] = createHistory;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/createHistory.js
|
||||
// module id = 964
|
||||
// module chunks = 4
|
58
509bba0_unpacked_with_node_modules/~/history/lib/createLocation.js
generated
Executable file
58
509bba0_unpacked_with_node_modules/~/history/lib/createLocation.js
generated
Executable file
|
@ -0,0 +1,58 @@
|
|||
'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 _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
var _Actions = require('./Actions');
|
||||
|
||||
var _PathUtils = require('./PathUtils');
|
||||
|
||||
function createLocation() {
|
||||
var location = arguments.length <= 0 || arguments[0] === undefined ? '/' : arguments[0];
|
||||
var action = arguments.length <= 1 || arguments[1] === undefined ? _Actions.POP : arguments[1];
|
||||
var key = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
|
||||
|
||||
var _fourthArg = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3];
|
||||
|
||||
if (typeof location === 'string') location = _PathUtils.parsePath(location);
|
||||
|
||||
if (typeof action === 'object') {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'The state (2nd) argument to createLocation is deprecated; use a ' + 'location descriptor instead') : undefined;
|
||||
|
||||
location = _extends({}, location, { state: action });
|
||||
|
||||
action = key || _Actions.POP;
|
||||
key = _fourthArg;
|
||||
}
|
||||
|
||||
var pathname = location.pathname || '/';
|
||||
var search = location.search || '';
|
||||
var hash = location.hash || '';
|
||||
var state = location.state || null;
|
||||
|
||||
return {
|
||||
pathname: pathname,
|
||||
search: search,
|
||||
hash: hash,
|
||||
state: state,
|
||||
action: action,
|
||||
key: key
|
||||
};
|
||||
}
|
||||
|
||||
exports['default'] = createLocation;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/createLocation.js
|
||||
// module id = 2544
|
||||
// module chunks = 4
|
161
509bba0_unpacked_with_node_modules/~/history/lib/createMemoryHistory.js
generated
Executable file
161
509bba0_unpacked_with_node_modules/~/history/lib/createMemoryHistory.js
generated
Executable file
|
@ -0,0 +1,161 @@
|
|||
'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 _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _PathUtils = require('./PathUtils');
|
||||
|
||||
var _Actions = require('./Actions');
|
||||
|
||||
var _createHistory = require('./createHistory');
|
||||
|
||||
var _createHistory2 = _interopRequireDefault(_createHistory);
|
||||
|
||||
function createStateStorage(entries) {
|
||||
return entries.filter(function (entry) {
|
||||
return entry.state;
|
||||
}).reduce(function (memo, entry) {
|
||||
memo[entry.key] = entry.state;
|
||||
return memo;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function createMemoryHistory() {
|
||||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
||||
|
||||
if (Array.isArray(options)) {
|
||||
options = { entries: options };
|
||||
} else if (typeof options === 'string') {
|
||||
options = { entries: [options] };
|
||||
}
|
||||
|
||||
var history = _createHistory2['default'](_extends({}, options, {
|
||||
getCurrentLocation: getCurrentLocation,
|
||||
finishTransition: finishTransition,
|
||||
saveState: saveState,
|
||||
go: go
|
||||
}));
|
||||
|
||||
var _options = options;
|
||||
var entries = _options.entries;
|
||||
var current = _options.current;
|
||||
|
||||
if (typeof entries === 'string') {
|
||||
entries = [entries];
|
||||
} else if (!Array.isArray(entries)) {
|
||||
entries = ['/'];
|
||||
}
|
||||
|
||||
entries = entries.map(function (entry) {
|
||||
var key = history.createKey();
|
||||
|
||||
if (typeof entry === 'string') return { pathname: entry, key: key };
|
||||
|
||||
if (typeof entry === 'object' && entry) return _extends({}, entry, { key: key });
|
||||
|
||||
!false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Unable to create history entry from %s', entry) : _invariant2['default'](false) : undefined;
|
||||
});
|
||||
|
||||
if (current == null) {
|
||||
current = entries.length - 1;
|
||||
} else {
|
||||
!(current >= 0 && current < entries.length) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Current index must be >= 0 and < %s, was %s', entries.length, current) : _invariant2['default'](false) : undefined;
|
||||
}
|
||||
|
||||
var storage = createStateStorage(entries);
|
||||
|
||||
function saveState(key, state) {
|
||||
storage[key] = state;
|
||||
}
|
||||
|
||||
function readState(key) {
|
||||
return storage[key];
|
||||
}
|
||||
|
||||
function getCurrentLocation() {
|
||||
var entry = entries[current];
|
||||
var basename = entry.basename;
|
||||
var pathname = entry.pathname;
|
||||
var search = entry.search;
|
||||
|
||||
var path = (basename || '') + pathname + (search || '');
|
||||
|
||||
var key = undefined,
|
||||
state = undefined;
|
||||
if (entry.key) {
|
||||
key = entry.key;
|
||||
state = readState(key);
|
||||
} else {
|
||||
key = history.createKey();
|
||||
state = null;
|
||||
entry.key = key;
|
||||
}
|
||||
|
||||
var location = _PathUtils.parsePath(path);
|
||||
|
||||
return history.createLocation(_extends({}, location, { state: state }), undefined, key);
|
||||
}
|
||||
|
||||
function canGo(n) {
|
||||
var index = current + n;
|
||||
return index >= 0 && index < entries.length;
|
||||
}
|
||||
|
||||
function go(n) {
|
||||
if (n) {
|
||||
if (!canGo(n)) {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'Cannot go(%s) there is not enough history', n) : undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
current += n;
|
||||
|
||||
var currentLocation = getCurrentLocation();
|
||||
|
||||
// change action to POP
|
||||
history.transitionTo(_extends({}, currentLocation, { action: _Actions.POP }));
|
||||
}
|
||||
}
|
||||
|
||||
function finishTransition(location) {
|
||||
switch (location.action) {
|
||||
case _Actions.PUSH:
|
||||
current += 1;
|
||||
|
||||
// if we are not on the top of stack
|
||||
// remove rest and push new
|
||||
if (current < entries.length) entries.splice(current);
|
||||
|
||||
entries.push(location);
|
||||
saveState(location.key, location.state);
|
||||
break;
|
||||
case _Actions.REPLACE:
|
||||
entries[current] = location;
|
||||
saveState(location.key, location.state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return history;
|
||||
}
|
||||
|
||||
exports['default'] = createMemoryHistory;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/createMemoryHistory.js
|
||||
// module id = 2545
|
||||
// module chunks = 4
|
26
509bba0_unpacked_with_node_modules/~/history/lib/deprecate.js
generated
Executable file
26
509bba0_unpacked_with_node_modules/~/history/lib/deprecate.js
generated
Executable file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
var _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
function deprecate(fn, message) {
|
||||
return function () {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] ' + message) : undefined;
|
||||
return fn.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
exports['default'] = deprecate;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/deprecate.js
|
||||
// module id = 615
|
||||
// module chunks = 4
|
31
509bba0_unpacked_with_node_modules/~/history/lib/runTransitionHook.js
generated
Executable file
31
509bba0_unpacked_with_node_modules/~/history/lib/runTransitionHook.js
generated
Executable file
|
@ -0,0 +1,31 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
var _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
function runTransitionHook(hook, location, callback) {
|
||||
var result = hook(location, callback);
|
||||
|
||||
if (hook.length < 2) {
|
||||
// Assume the hook runs synchronously and automatically
|
||||
// call the callback with the return value.
|
||||
callback(result);
|
||||
} else {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](result === undefined, 'You should not "return" in a transition hook with a callback argument; call the callback instead') : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
exports['default'] = runTransitionHook;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/runTransitionHook.js
|
||||
// module id = 616
|
||||
// module chunks = 4
|
165
509bba0_unpacked_with_node_modules/~/history/lib/useBasename.js
generated
Executable file
165
509bba0_unpacked_with_node_modules/~/history/lib/useBasename.js
generated
Executable file
|
@ -0,0 +1,165 @@
|
|||
'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 _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
var _ExecutionEnvironment = require('./ExecutionEnvironment');
|
||||
|
||||
var _PathUtils = require('./PathUtils');
|
||||
|
||||
var _runTransitionHook = require('./runTransitionHook');
|
||||
|
||||
var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
|
||||
|
||||
var _deprecate = require('./deprecate');
|
||||
|
||||
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 checkedBaseHref = false;
|
||||
|
||||
function checkBaseHref() {
|
||||
if (checkedBaseHref) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 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');
|
||||
|
||||
if (baseHref != null) {
|
||||
basename = baseHref;
|
||||
|
||||
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);
|
||||
location.basename = basename;
|
||||
|
||||
if (location.pathname === '') location.pathname = '/';
|
||||
} else {
|
||||
location.basename = '';
|
||||
}
|
||||
}
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
function prependBasename(location) {
|
||||
checkBaseHref();
|
||||
|
||||
if (!basename) return location;
|
||||
|
||||
if (typeof location === 'string') location = _PathUtils.parsePath(location);
|
||||
|
||||
var pname = location.pathname;
|
||||
var normalizedBasename = basename.slice(-1) === '/' ? basename : basename + '/';
|
||||
var normalizedPathname = pname.charAt(0) === '/' ? pname.slice(1) : pname;
|
||||
var pathname = normalizedBasename + normalizedPathname;
|
||||
|
||||
return _extends({}, location, {
|
||||
pathname: pathname
|
||||
});
|
||||
}
|
||||
|
||||
// Override all read methods with basename-aware versions.
|
||||
function listenBefore(hook) {
|
||||
return history.listenBefore(function (location, callback) {
|
||||
_runTransitionHook2['default'](hook, addBasename(location), callback);
|
||||
});
|
||||
}
|
||||
|
||||
function listen(listener) {
|
||||
return history.listen(function (location) {
|
||||
listener(addBasename(location));
|
||||
});
|
||||
}
|
||||
|
||||
// Override all write methods with basename-aware versions.
|
||||
function push(location) {
|
||||
history.push(prependBasename(location));
|
||||
}
|
||||
|
||||
function replace(location) {
|
||||
history.replace(prependBasename(location));
|
||||
}
|
||||
|
||||
function createPath(location) {
|
||||
return history.createPath(prependBasename(location));
|
||||
}
|
||||
|
||||
function createHref(location) {
|
||||
return history.createHref(prependBasename(location));
|
||||
}
|
||||
|
||||
function createLocation(location) {
|
||||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
return addBasename(history.createLocation.apply(history, [prependBasename(location)].concat(args)));
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function pushState(state, path) {
|
||||
if (typeof path === 'string') path = _PathUtils.parsePath(path);
|
||||
|
||||
push(_extends({ state: state }, path));
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function replaceState(state, path) {
|
||||
if (typeof path === 'string') path = _PathUtils.parsePath(path);
|
||||
|
||||
replace(_extends({ state: state }, path));
|
||||
}
|
||||
|
||||
return _extends({}, history, {
|
||||
listenBefore: listenBefore,
|
||||
listen: listen,
|
||||
push: push,
|
||||
replace: replace,
|
||||
createPath: createPath,
|
||||
createHref: createHref,
|
||||
createLocation: createLocation,
|
||||
|
||||
pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
|
||||
replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
exports['default'] = useBasename;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/useBasename.js
|
||||
// module id = 965
|
||||
// module chunks = 4
|
183
509bba0_unpacked_with_node_modules/~/history/lib/useQueries.js
generated
Executable file
183
509bba0_unpacked_with_node_modules/~/history/lib/useQueries.js
generated
Executable file
|
@ -0,0 +1,183 @@
|
|||
'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 _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
var _queryString = require('query-string');
|
||||
|
||||
var _runTransitionHook = require('./runTransitionHook');
|
||||
|
||||
var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
|
||||
|
||||
var _PathUtils = require('./PathUtils');
|
||||
|
||||
var _deprecate = require('./deprecate');
|
||||
|
||||
var _deprecate2 = _interopRequireDefault(_deprecate);
|
||||
|
||||
var SEARCH_BASE_KEY = '$searchBase';
|
||||
|
||||
function defaultStringifyQuery(query) {
|
||||
return _queryString.stringify(query).replace(/%20/g, '+');
|
||||
}
|
||||
|
||||
var defaultParseQueryString = _queryString.parse;
|
||||
|
||||
function isNestedObject(object) {
|
||||
for (var p in object) {
|
||||
if (Object.prototype.hasOwnProperty.call(object, p) && typeof object[p] === 'object' && !Array.isArray(object[p]) && object[p] !== null) return true;
|
||||
}return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new createHistory function that may be used to create
|
||||
* history objects that know how to handle URL queries.
|
||||
*/
|
||||
function useQueries(createHistory) {
|
||||
return function () {
|
||||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
||||
|
||||
var history = createHistory(options);
|
||||
|
||||
var stringifyQuery = options.stringifyQuery;
|
||||
var parseQueryString = options.parseQueryString;
|
||||
|
||||
if (typeof stringifyQuery !== 'function') stringifyQuery = defaultStringifyQuery;
|
||||
|
||||
if (typeof parseQueryString !== 'function') parseQueryString = defaultParseQueryString;
|
||||
|
||||
function addQuery(location) {
|
||||
if (location.query == null) {
|
||||
var search = location.search;
|
||||
|
||||
location.query = parseQueryString(search.substring(1));
|
||||
location[SEARCH_BASE_KEY] = { search: search, searchBase: '' };
|
||||
}
|
||||
|
||||
// TODO: Instead of all the book-keeping here, this should just strip the
|
||||
// stringified query from the search.
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
function appendQuery(location, query) {
|
||||
var _extends2;
|
||||
|
||||
var searchBaseSpec = location[SEARCH_BASE_KEY];
|
||||
var queryString = query ? stringifyQuery(query) : '';
|
||||
if (!searchBaseSpec && !queryString) {
|
||||
return location;
|
||||
}
|
||||
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](stringifyQuery !== defaultStringifyQuery || !isNestedObject(query), 'useQueries does not stringify nested query objects by default; ' + 'use a custom stringifyQuery function') : undefined;
|
||||
|
||||
if (typeof location === 'string') location = _PathUtils.parsePath(location);
|
||||
|
||||
var searchBase = undefined;
|
||||
if (searchBaseSpec && location.search === searchBaseSpec.search) {
|
||||
searchBase = searchBaseSpec.searchBase;
|
||||
} else {
|
||||
searchBase = location.search || '';
|
||||
}
|
||||
|
||||
var search = searchBase;
|
||||
if (queryString) {
|
||||
search += (search ? '&' : '?') + queryString;
|
||||
}
|
||||
|
||||
return _extends({}, location, (_extends2 = {
|
||||
search: search
|
||||
}, _extends2[SEARCH_BASE_KEY] = { search: search, searchBase: searchBase }, _extends2));
|
||||
}
|
||||
|
||||
// Override all read methods with query-aware versions.
|
||||
function listenBefore(hook) {
|
||||
return history.listenBefore(function (location, callback) {
|
||||
_runTransitionHook2['default'](hook, addQuery(location), callback);
|
||||
});
|
||||
}
|
||||
|
||||
function listen(listener) {
|
||||
return history.listen(function (location) {
|
||||
listener(addQuery(location));
|
||||
});
|
||||
}
|
||||
|
||||
// Override all write methods with query-aware versions.
|
||||
function push(location) {
|
||||
history.push(appendQuery(location, location.query));
|
||||
}
|
||||
|
||||
function replace(location) {
|
||||
history.replace(appendQuery(location, location.query));
|
||||
}
|
||||
|
||||
function createPath(location, query) {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](!query, 'the query argument to createPath is deprecated; use a location descriptor instead') : undefined;
|
||||
|
||||
return history.createPath(appendQuery(location, query || location.query));
|
||||
}
|
||||
|
||||
function createHref(location, query) {
|
||||
process.env.NODE_ENV !== 'production' ? _warning2['default'](!query, 'the query argument to createHref is deprecated; use a location descriptor instead') : undefined;
|
||||
|
||||
return history.createHref(appendQuery(location, query || location.query));
|
||||
}
|
||||
|
||||
function createLocation(location) {
|
||||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
var fullLocation = history.createLocation.apply(history, [appendQuery(location, location.query)].concat(args));
|
||||
if (location.query) {
|
||||
fullLocation.query = location.query;
|
||||
}
|
||||
return addQuery(fullLocation);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function pushState(state, path, query) {
|
||||
if (typeof path === 'string') path = _PathUtils.parsePath(path);
|
||||
|
||||
push(_extends({ state: state }, path, { query: query }));
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function replaceState(state, path, query) {
|
||||
if (typeof path === 'string') path = _PathUtils.parsePath(path);
|
||||
|
||||
replace(_extends({ state: state }, path, { query: query }));
|
||||
}
|
||||
|
||||
return _extends({}, history, {
|
||||
listenBefore: listenBefore,
|
||||
listen: listen,
|
||||
push: push,
|
||||
replace: replace,
|
||||
createPath: createPath,
|
||||
createHref: createHref,
|
||||
createLocation: createLocation,
|
||||
|
||||
pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
|
||||
replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
exports['default'] = useQueries;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/lib/useQueries.js
|
||||
// module id = 423
|
||||
// module chunks = 4
|
68
509bba0_unpacked_with_node_modules/~/history/~/warning/browser.js
generated
Executable file
68
509bba0_unpacked_with_node_modules/~/history/~/warning/browser.js
generated
Executable file
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Similar to invariant but only logs a warning if the condition is not met.
|
||||
* This can be used to log issues in development environments in critical
|
||||
* paths. Removing the logging code for production environments will keep the
|
||||
* same logic and follow the same code paths.
|
||||
*/
|
||||
|
||||
var warning = function() {};
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
warning = function(condition, format, args) {
|
||||
var len = arguments.length;
|
||||
args = new Array(len > 2 ? len - 2 : 0);
|
||||
for (var key = 2; key < len; key++) {
|
||||
args[key - 2] = arguments[key];
|
||||
}
|
||||
if (format === undefined) {
|
||||
throw new Error(
|
||||
'`warning(condition, format, ...args)` requires a warning ' +
|
||||
'message argument'
|
||||
);
|
||||
}
|
||||
|
||||
if (format.length < 10 || (/^[s\W]*$/).test(format)) {
|
||||
throw new Error(
|
||||
'The warning format should be able to uniquely identify this ' +
|
||||
'warning. Please, use a more descriptive format than: ' + format
|
||||
);
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
var argIndex = 0;
|
||||
var message = 'Warning: ' +
|
||||
format.replace(/%s/g, function() {
|
||||
return args[argIndex++];
|
||||
});
|
||||
if (typeof console !== 'undefined') {
|
||||
console.error(message);
|
||||
}
|
||||
try {
|
||||
// This error was thrown as a convenience so that you can use this stack
|
||||
// to find the callsite that caused this warning to fire.
|
||||
throw new Error(message);
|
||||
} catch(x) {}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = warning;
|
||||
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/history/~/warning/browser.js
|
||||
// module id = 155
|
||||
// module chunks = 4
|
Loading…
Add table
Add a link
Reference in a new issue