Skip to content

Commit

Permalink
[build] 3.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Nov 23, 2018
1 parent d97d902 commit 7f9ed30
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 160 deletions.
99 changes: 47 additions & 52 deletions dist/vue-router.common.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* vue-router v3.0.1
* (c) 2017 Evan You
/*!
* vue-router v3.0.2
* (c) 2018 Evan You
* @license MIT
*/
'use strict';
Expand All @@ -23,8 +23,15 @@ function isError (err) {
return Object.prototype.toString.call(err).indexOf('Error') > -1
}

function extend (a, b) {
for (var key in b) {
a[key] = b[key];
}
return a
}

var View = {
name: 'router-view',
name: 'RouterView',
functional: true,
props: {
name: {
Expand All @@ -38,6 +45,7 @@ var View = {
var parent = ref.parent;
var data = ref.data;

// used by devtools to display a router-view badge
data.routerView = true;

// directly use parent context's createElement() function
Expand Down Expand Up @@ -112,7 +120,7 @@ var View = {

return h(component, data, children)
}
};
}

function resolveProps (route, config) {
switch (typeof config) {
Expand All @@ -135,13 +143,6 @@ function resolveProps (route, config) {
}
}

function extend (to, from) {
for (var key in from) {
to[key] = from[key];
}
return to
}

/* */

var encodeReserveRE = /[!'()*]/g;
Expand Down Expand Up @@ -240,7 +241,6 @@ function stringifyQuery (obj) {

/* */


var trailingSlashRE = /\/?$/;

function createRoute (
Expand Down Expand Up @@ -383,7 +383,7 @@ var toTypes = [String, Object];
var eventTypes = [String, Array];

var Link = {
name: 'router-link',
name: 'RouterLink',
props: {
to: {
type: toTypes,
Expand Down Expand Up @@ -418,17 +418,17 @@ var Link = {
var globalExactActiveClass = router.options.linkExactActiveClass;
// Support global empty active class
var activeClassFallback = globalActiveClass == null
? 'router-link-active'
: globalActiveClass;
? 'router-link-active'
: globalActiveClass;
var exactActiveClassFallback = globalExactActiveClass == null
? 'router-link-exact-active'
: globalExactActiveClass;
? 'router-link-exact-active'
: globalExactActiveClass;
var activeClass = this.activeClass == null
? activeClassFallback
: this.activeClass;
? activeClassFallback
: this.activeClass;
var exactActiveClass = this.exactActiveClass == null
? exactActiveClassFallback
: this.exactActiveClass;
? exactActiveClassFallback
: this.exactActiveClass;
var compareTarget = location.path
? createRoute(null, location, null, router)
: route;
Expand Down Expand Up @@ -468,7 +468,6 @@ var Link = {
if (a) {
// in case the <a> is a static node
a.isStatic = false;
var extend = _Vue.util.extend;
var aData = a.data = extend({}, a.data);
aData.on = on;
var aAttrs = a.data.attrs = extend({}, a.data.attrs);
Expand All @@ -481,7 +480,7 @@ var Link = {

return h(this.tag, data, this.$slots.default)
}
};
}

function guardEvent (e) {
// don't redirect with control keys
Expand Down Expand Up @@ -559,8 +558,8 @@ function install (Vue) {
get: function get () { return this._routerRoot._route }
});

Vue.component('router-view', View);
Vue.component('router-link', Link);
Vue.component('RouterView', View);
Vue.component('RouterLink', Link);

var strats = Vue.config.optionMergeStrategies;
// use the same hook merging strategy for route hooks
Expand Down Expand Up @@ -1070,7 +1069,6 @@ function pathToRegexp (path, keys, options) {

return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
}

pathToRegexp_1.parse = parse_1;
pathToRegexp_1.compile = compile_1;
pathToRegexp_1.tokensToFunction = tokensToFunction_1;
Expand Down Expand Up @@ -1266,7 +1264,6 @@ function normalizePath (path, parent, strict) {

/* */


function normalizeLocation (
raw,
current,
Expand All @@ -1281,9 +1278,9 @@ function normalizeLocation (

// relative params
if (!next.path && next.params && current) {
next = assign({}, next);
next = extend({}, next);
next._normalized = true;
var params = assign(assign({}, current.params), next.params);
var params = extend(extend({}, current.params), next.params);
if (current.name) {
next.name = current.name;
next.params = params;
Expand Down Expand Up @@ -1321,16 +1318,10 @@ function normalizeLocation (
}
}

function assign (a, b) {
for (var key in b) {
a[key] = b[key];
}
return a
}

/* */



function createMatcher (
routes,
router
Expand Down Expand Up @@ -1398,8 +1389,8 @@ function createMatcher (
) {
var originalRedirect = record.redirect;
var redirect = typeof originalRedirect === 'function'
? originalRedirect(createRoute(record, location, null, router))
: originalRedirect;
? originalRedirect(createRoute(record, location, null, router))
: originalRedirect;

if (typeof redirect === 'string') {
redirect = { path: redirect };
Expand Down Expand Up @@ -1513,7 +1504,8 @@ function matchRoute (
var key = regex.keys[i - 1];
var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
if (key) {
params[key.name] = val;
// Fix #1994: using * with props: true generates a param named 0
params[key.name || 'pathMatch'] = val;
}
}

Expand All @@ -1526,12 +1518,12 @@ function resolveRecordPath (path, record) {

/* */


var positionStore = Object.create(null);

function setupScroll () {
// Fix for #1585 for Firefox
window.history.replaceState({ key: getStateKey() }, '');
// Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
window.history.replaceState({ key: getStateKey() }, '', window.location.href.replace(window.location.origin, ''));
window.addEventListener('popstate', function (e) {
saveScrollPosition();
if (e.state && e.state.key) {
Expand Down Expand Up @@ -1562,7 +1554,7 @@ function handleScroll (
// wait until re-render finishes before scrolling
router.app.$nextTick(function () {
var position = getScrollPosition();
var shouldScroll = behavior(to, from, isPop ? position : null);
var shouldScroll = behavior.call(router, to, from, isPop ? position : null);

if (!shouldScroll) {
return
Expand Down Expand Up @@ -2124,7 +2116,10 @@ function poll (
key,
isValid
) {
if (instances[key]) {
if (
instances[key] &&
!instances[key]._isBeingDestroyed // do not reuse being destroyed instance
) {
cb(instances[key]);
} else if (isValid()) {
setTimeout(function () {
Expand All @@ -2135,16 +2130,16 @@ function poll (

/* */


var HTML5History = (function (History$$1) {
function HTML5History (router, base) {
var this$1 = this;

History$$1.call(this, router, base);

var expectScroll = router.options.scrollBehavior;
var supportsScroll = supportsPushState && expectScroll;

if (expectScroll) {
if (supportsScroll) {
setupScroll();
}

Expand All @@ -2160,7 +2155,7 @@ var HTML5History = (function (History$$1) {
}

this$1.transitionTo(location, function (route) {
if (expectScroll) {
if (supportsScroll) {
handleScroll(router, route, current, true);
}
});
Expand Down Expand Up @@ -2214,7 +2209,7 @@ var HTML5History = (function (History$$1) {
}(History));

function getLocation (base) {
var path = window.location.pathname;
var path = decodeURI(window.location.pathname);
if (base && path.indexOf(base) === 0) {
path = path.slice(base.length);
}
Expand All @@ -2223,7 +2218,6 @@ function getLocation (base) {

/* */


var HashHistory = (function (History$$1) {
function HashHistory (router, base, fallback) {
History$$1.call(this, router, base);
Expand Down Expand Up @@ -2333,7 +2327,7 @@ function getHash () {
// consistent across browsers - Firefox will pre-decode it!
var href = window.location.href;
var index = href.indexOf('#');
return index === -1 ? '' : href.slice(index + 1)
return index === -1 ? '' : decodeURI(href.slice(index + 1))
}

function getUrl (path) {
Expand Down Expand Up @@ -2361,7 +2355,6 @@ function replaceHash (path) {

/* */


var AbstractHistory = (function (History$$1) {
function AbstractHistory (router, base) {
History$$1.call(this, router, base);
Expand Down Expand Up @@ -2420,6 +2413,8 @@ var AbstractHistory = (function (History$$1) {

/* */



var VueRouter = function VueRouter (options) {
if ( options === void 0 ) options = {};

Expand Down Expand Up @@ -2616,7 +2611,7 @@ function createHref (base, fullPath, mode) {
}

VueRouter.install = install;
VueRouter.version = '3.0.1';
VueRouter.version = '3.0.2';

if (inBrowser && window.Vue) {
window.Vue.use(VueRouter);
Expand Down
Loading

0 comments on commit 7f9ed30

Please sign in to comment.