mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-05-17 03:49:38 +03:00
chore(release): 2.3.3
This commit is contained in:
@@ -2,6 +2,14 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [2.3.3](https://github.com/nuxt/vue-meta/compare/v2.3.2...v2.3.3) (2020-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* memory leak, use hook events (thanks [#522](https://github.com/nuxt/vue-meta/issues/522)) ([21621e1](https://github.com/nuxt/vue-meta/commit/21621e13f53f45eeef5d75c76ed01c7703ad78b9))
|
||||
* support once (with skip) client side (fix [#498](https://github.com/nuxt/vue-meta/issues/498)) ([c74c645](https://github.com/nuxt/vue-meta/commit/c74c645d1881e22569a2ea7ac0c903a4f6ee2243))
|
||||
|
||||
### [2.3.2](https://github.com/nuxt/vue-meta/compare/v2.3.1...v2.3.2) (2020-01-12)
|
||||
|
||||
|
||||
|
||||
Vendored
+59
-56
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue-meta v2.3.2
|
||||
* vue-meta v2.3.3
|
||||
* (c) 2020
|
||||
* - Declan de Wet
|
||||
* - Sébastien Chopin (@Atinux)
|
||||
@@ -14,9 +14,11 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
||||
|
||||
var deepmerge = _interopDefault(require('deepmerge'));
|
||||
|
||||
var version = "2.3.2";
|
||||
var version = "2.3.3";
|
||||
|
||||
function _typeof(obj) {
|
||||
"@babel/helpers - typeof";
|
||||
|
||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||||
_typeof = function (obj) {
|
||||
return typeof obj;
|
||||
@@ -220,7 +222,7 @@ var tagsWithoutEndTag = ['base', 'meta', 'link']; // HTML elements which can hav
|
||||
var tagsWithInnerContent = ['noscript', 'script', 'style']; // Attributes which are inserted as childNodes instead of HTMLAttribute
|
||||
|
||||
var tagAttributeAsInnerContent = ['innerHTML', 'cssText', 'json'];
|
||||
var tagProperties = ['once', 'template']; // Attributes which should be added with data- prefix
|
||||
var tagProperties = ['once', 'skip', 'template']; // Attributes which should be added with data- prefix
|
||||
|
||||
var commonDataAttributes = ['body', 'pbody']; // from: https://github.com/kangax/html-minifier/blob/gh-pages/src/htmlminifier.js#L202
|
||||
|
||||
@@ -325,22 +327,6 @@ function includes(array, value) {
|
||||
return array.includes(value);
|
||||
}
|
||||
|
||||
function ensureIsArray(arg, key) {
|
||||
if (!key || !isObject(arg)) {
|
||||
return isArray(arg) ? arg : [];
|
||||
}
|
||||
|
||||
if (!isArray(arg[key])) {
|
||||
arg[key] = [];
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
function ensuredPush(object, key, el) {
|
||||
ensureIsArray(object, key);
|
||||
object[key].push(el);
|
||||
}
|
||||
|
||||
function hasMetaInfo(vm) {
|
||||
vm = vm || this;
|
||||
return vm && (vm[rootConfigKey] === true || isObject(vm[rootConfigKey]));
|
||||
@@ -397,6 +383,8 @@ function createMixin(Vue, options) {
|
||||
|
||||
return {
|
||||
beforeCreate: function beforeCreate() {
|
||||
var _this2 = this;
|
||||
|
||||
var rootKey = '$root';
|
||||
var $root = this[rootKey];
|
||||
var $options = this.$options;
|
||||
@@ -466,7 +454,7 @@ function createMixin(Vue, options) {
|
||||
// if computed $metaInfo exists, watch it for updates & trigger a refresh
|
||||
// when it changes (i.e. automatically handle async actions that affect metaInfo)
|
||||
// credit for this suggestion goes to [Sébastien Chopin](https://github.com/Atinux)
|
||||
ensuredPush($options, 'created', function () {
|
||||
this.$on('hook:created', function () {
|
||||
this.$watch('$metaInfo', function () {
|
||||
triggerUpdate(options, this[rootKey], 'watcher');
|
||||
});
|
||||
@@ -484,7 +472,7 @@ function createMixin(Vue, options) {
|
||||
if (!$root[rootConfigKey].initialized) {
|
||||
if (!$root[rootConfigKey].initializedSsr) {
|
||||
$root[rootConfigKey].initializedSsr = true;
|
||||
ensuredPush($options, 'beforeMount', function () {
|
||||
this.$on('hook:beforeMount', function () {
|
||||
var $root = this; // if this Vue-app was server rendered, set the appId to 'ssr'
|
||||
// only one SSR app per page is supported
|
||||
|
||||
@@ -495,7 +483,7 @@ function createMixin(Vue, options) {
|
||||
} // we use the mounted hook here as on page load
|
||||
|
||||
|
||||
ensuredPush($options, 'mounted', function () {
|
||||
this.$on('hook:mounted', function () {
|
||||
var $root = this[rootKey];
|
||||
|
||||
if (!$root[rootConfigKey].initialized) {
|
||||
@@ -535,8 +523,38 @@ function createMixin(Vue, options) {
|
||||
addNavGuards($root);
|
||||
}
|
||||
}
|
||||
} // do not trigger refresh on the server side
|
||||
}
|
||||
|
||||
this.$on('hook:destroyed', function () {
|
||||
var _this = this;
|
||||
|
||||
// do not trigger refresh:
|
||||
// - when user configured to not wait for transitions on destroyed
|
||||
// - when the component doesnt have a parent
|
||||
// - doesnt have metaInfo defined
|
||||
if (!this.$parent || !hasMetaInfo(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._hasMetaInfo;
|
||||
this.$nextTick(function () {
|
||||
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
return;
|
||||
} // Wait that element is hidden before refreshing meta tags (to support animations)
|
||||
|
||||
|
||||
var interval = setInterval(function () {
|
||||
if (_this.$el && _this.$el.offsetParent !== null) {
|
||||
/* istanbul ignore next line */
|
||||
return;
|
||||
}
|
||||
|
||||
clearInterval(interval);
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
}, 50);
|
||||
});
|
||||
}); // do not trigger refresh on the server side
|
||||
|
||||
if (this.$isServer) {
|
||||
/* istanbul ignore next */
|
||||
@@ -545,41 +563,10 @@ function createMixin(Vue, options) {
|
||||
|
||||
|
||||
updateOnLifecycleHook.forEach(function (lifecycleHook) {
|
||||
ensuredPush($options, lifecycleHook, function () {
|
||||
_this2.$on("hook:".concat(lifecycleHook), function () {
|
||||
triggerUpdate(options, this[rootKey], lifecycleHook);
|
||||
});
|
||||
});
|
||||
},
|
||||
// TODO: move back into beforeCreate when Vue issue is resolved
|
||||
destroyed: function destroyed() {
|
||||
var _this = this;
|
||||
|
||||
// do not trigger refresh:
|
||||
// - when user configured to not wait for transitions on destroyed
|
||||
// - when the component doesnt have a parent
|
||||
// - doesnt have metaInfo defined
|
||||
if (!this.$parent || !hasMetaInfo(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._hasMetaInfo;
|
||||
this.$nextTick(function () {
|
||||
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
return;
|
||||
} // Wait that element is hidden before refreshing meta tags (to support animations)
|
||||
|
||||
|
||||
var interval = setInterval(function () {
|
||||
if (_this.$el && _this.$el.offsetParent !== null) {
|
||||
/* istanbul ignore next line */
|
||||
return;
|
||||
}
|
||||
|
||||
clearInterval(interval);
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
}, 50);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -617,6 +604,18 @@ function getOptions(options) {
|
||||
return optionsCopy;
|
||||
}
|
||||
|
||||
function ensureIsArray(arg, key) {
|
||||
if (!key || !isObject(arg)) {
|
||||
return isArray(arg) ? arg : [];
|
||||
}
|
||||
|
||||
if (!isArray(arg[key])) {
|
||||
arg[key] = [];
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
var serverSequences = [[/&/g, '&'], [/</g, '<'], [/>/g, '>'], [/"/g, '"'], [/'/g, ''']];
|
||||
var clientSequences = [[/&/g, "&"], [/</g, "<"], [/>/g, ">"], [/"/g, "\""], [/'/g, "'"]]; // sanitizes potentially dangerous characters
|
||||
|
||||
@@ -1196,7 +1195,11 @@ function updateTag(appId, options, type, tags, head, body) {
|
||||
}
|
||||
|
||||
var newElement = document.createElement(type);
|
||||
newElement.setAttribute(attribute, appId);
|
||||
|
||||
if (!tag.once) {
|
||||
newElement.setAttribute(attribute, appId);
|
||||
}
|
||||
|
||||
Object.keys(tag).forEach(function (attr) {
|
||||
/* istanbul ignore next */
|
||||
if (includes(tagProperties, attr)) {
|
||||
|
||||
Vendored
+59
-56
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue-meta v2.3.2
|
||||
* vue-meta v2.3.3
|
||||
* (c) 2020
|
||||
* - Declan de Wet
|
||||
* - Sébastien Chopin (@Atinux)
|
||||
@@ -10,9 +10,11 @@
|
||||
|
||||
import deepmerge from 'deepmerge';
|
||||
|
||||
var version = "2.3.2";
|
||||
var version = "2.3.3";
|
||||
|
||||
function _typeof(obj) {
|
||||
"@babel/helpers - typeof";
|
||||
|
||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||||
_typeof = function (obj) {
|
||||
return typeof obj;
|
||||
@@ -143,7 +145,7 @@ var metaInfoOptionKeys = [defaultInfoKeys[1], defaultInfoKeys[2], 'changed'].con
|
||||
var metaInfoAttributeKeys = [defaultInfoKeys[3], defaultInfoKeys[4], defaultInfoKeys[5]]; // HTML elements which support the onload event
|
||||
|
||||
var tagsSupportingOnload = ['link', 'style', 'script']; // HTML elements which dont have a head tag (shortened to our needs)
|
||||
var tagProperties = ['once', 'template']; // Attributes which should be added with data- prefix
|
||||
var tagProperties = ['once', 'skip', 'template']; // Attributes which should be added with data- prefix
|
||||
|
||||
var commonDataAttributes = ['body', 'pbody']; // from: https://github.com/kangax/html-minifier/blob/gh-pages/src/htmlminifier.js#L202
|
||||
|
||||
@@ -248,22 +250,6 @@ function includes(array, value) {
|
||||
return array.includes(value);
|
||||
}
|
||||
|
||||
function ensureIsArray(arg, key) {
|
||||
if (!key || !isObject(arg)) {
|
||||
return isArray(arg) ? arg : [];
|
||||
}
|
||||
|
||||
if (!isArray(arg[key])) {
|
||||
arg[key] = [];
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
function ensuredPush(object, key, el) {
|
||||
ensureIsArray(object, key);
|
||||
object[key].push(el);
|
||||
}
|
||||
|
||||
function hasMetaInfo(vm) {
|
||||
vm = vm || this;
|
||||
return vm && (vm[rootConfigKey] === true || isObject(vm[rootConfigKey]));
|
||||
@@ -320,6 +306,8 @@ function createMixin(Vue, options) {
|
||||
|
||||
return {
|
||||
beforeCreate: function beforeCreate() {
|
||||
var _this2 = this;
|
||||
|
||||
var rootKey = '$root';
|
||||
var $root = this[rootKey];
|
||||
var $options = this.$options;
|
||||
@@ -389,7 +377,7 @@ function createMixin(Vue, options) {
|
||||
// if computed $metaInfo exists, watch it for updates & trigger a refresh
|
||||
// when it changes (i.e. automatically handle async actions that affect metaInfo)
|
||||
// credit for this suggestion goes to [Sébastien Chopin](https://github.com/Atinux)
|
||||
ensuredPush($options, 'created', function () {
|
||||
this.$on('hook:created', function () {
|
||||
this.$watch('$metaInfo', function () {
|
||||
triggerUpdate(options, this[rootKey], 'watcher');
|
||||
});
|
||||
@@ -407,7 +395,7 @@ function createMixin(Vue, options) {
|
||||
if (!$root[rootConfigKey].initialized) {
|
||||
if (!$root[rootConfigKey].initializedSsr) {
|
||||
$root[rootConfigKey].initializedSsr = true;
|
||||
ensuredPush($options, 'beforeMount', function () {
|
||||
this.$on('hook:beforeMount', function () {
|
||||
var $root = this; // if this Vue-app was server rendered, set the appId to 'ssr'
|
||||
// only one SSR app per page is supported
|
||||
|
||||
@@ -418,7 +406,7 @@ function createMixin(Vue, options) {
|
||||
} // we use the mounted hook here as on page load
|
||||
|
||||
|
||||
ensuredPush($options, 'mounted', function () {
|
||||
this.$on('hook:mounted', function () {
|
||||
var $root = this[rootKey];
|
||||
|
||||
if (!$root[rootConfigKey].initialized) {
|
||||
@@ -458,8 +446,38 @@ function createMixin(Vue, options) {
|
||||
addNavGuards($root);
|
||||
}
|
||||
}
|
||||
} // do not trigger refresh on the server side
|
||||
}
|
||||
|
||||
this.$on('hook:destroyed', function () {
|
||||
var _this = this;
|
||||
|
||||
// do not trigger refresh:
|
||||
// - when user configured to not wait for transitions on destroyed
|
||||
// - when the component doesnt have a parent
|
||||
// - doesnt have metaInfo defined
|
||||
if (!this.$parent || !hasMetaInfo(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._hasMetaInfo;
|
||||
this.$nextTick(function () {
|
||||
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
return;
|
||||
} // Wait that element is hidden before refreshing meta tags (to support animations)
|
||||
|
||||
|
||||
var interval = setInterval(function () {
|
||||
if (_this.$el && _this.$el.offsetParent !== null) {
|
||||
/* istanbul ignore next line */
|
||||
return;
|
||||
}
|
||||
|
||||
clearInterval(interval);
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
}, 50);
|
||||
});
|
||||
}); // do not trigger refresh on the server side
|
||||
|
||||
if (this.$isServer) {
|
||||
/* istanbul ignore next */
|
||||
@@ -468,41 +486,10 @@ function createMixin(Vue, options) {
|
||||
|
||||
|
||||
updateOnLifecycleHook.forEach(function (lifecycleHook) {
|
||||
ensuredPush($options, lifecycleHook, function () {
|
||||
_this2.$on("hook:".concat(lifecycleHook), function () {
|
||||
triggerUpdate(options, this[rootKey], lifecycleHook);
|
||||
});
|
||||
});
|
||||
},
|
||||
// TODO: move back into beforeCreate when Vue issue is resolved
|
||||
destroyed: function destroyed() {
|
||||
var _this = this;
|
||||
|
||||
// do not trigger refresh:
|
||||
// - when user configured to not wait for transitions on destroyed
|
||||
// - when the component doesnt have a parent
|
||||
// - doesnt have metaInfo defined
|
||||
if (!this.$parent || !hasMetaInfo(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._hasMetaInfo;
|
||||
this.$nextTick(function () {
|
||||
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
return;
|
||||
} // Wait that element is hidden before refreshing meta tags (to support animations)
|
||||
|
||||
|
||||
var interval = setInterval(function () {
|
||||
if (_this.$el && _this.$el.offsetParent !== null) {
|
||||
/* istanbul ignore next line */
|
||||
return;
|
||||
}
|
||||
|
||||
clearInterval(interval);
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
}, 50);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -540,6 +527,18 @@ function getOptions(options) {
|
||||
return optionsCopy;
|
||||
}
|
||||
|
||||
function ensureIsArray(arg, key) {
|
||||
if (!key || !isObject(arg)) {
|
||||
return isArray(arg) ? arg : [];
|
||||
}
|
||||
|
||||
if (!isArray(arg[key])) {
|
||||
arg[key] = [];
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
var clientSequences = [[/&/g, "&"], [/</g, "<"], [/>/g, ">"], [/"/g, "\""], [/'/g, "'"]]; // sanitizes potentially dangerous characters
|
||||
|
||||
function escape(info, options, escapeOptions, escapeKeys) {
|
||||
@@ -1118,7 +1117,11 @@ function updateTag(appId, options, type, tags, head, body) {
|
||||
}
|
||||
|
||||
var newElement = document.createElement(type);
|
||||
newElement.setAttribute(attribute, appId);
|
||||
|
||||
if (!tag.once) {
|
||||
newElement.setAttribute(attribute, appId);
|
||||
}
|
||||
|
||||
Object.keys(tag).forEach(function (attr) {
|
||||
/* istanbul ignore next */
|
||||
if (includes(tagProperties, attr)) {
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
Vendored
+59
-56
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue-meta v2.3.2
|
||||
* vue-meta v2.3.3
|
||||
* (c) 2020
|
||||
* - Declan de Wet
|
||||
* - Sébastien Chopin (@Atinux)
|
||||
@@ -10,9 +10,11 @@
|
||||
|
||||
import deepmerge from 'deepmerge';
|
||||
|
||||
var version = "2.3.2";
|
||||
var version = "2.3.3";
|
||||
|
||||
function _typeof(obj) {
|
||||
"@babel/helpers - typeof";
|
||||
|
||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||||
_typeof = function (obj) {
|
||||
return typeof obj;
|
||||
@@ -216,7 +218,7 @@ var tagsWithoutEndTag = ['base', 'meta', 'link']; // HTML elements which can hav
|
||||
var tagsWithInnerContent = ['noscript', 'script', 'style']; // Attributes which are inserted as childNodes instead of HTMLAttribute
|
||||
|
||||
var tagAttributeAsInnerContent = ['innerHTML', 'cssText', 'json'];
|
||||
var tagProperties = ['once', 'template']; // Attributes which should be added with data- prefix
|
||||
var tagProperties = ['once', 'skip', 'template']; // Attributes which should be added with data- prefix
|
||||
|
||||
var commonDataAttributes = ['body', 'pbody']; // from: https://github.com/kangax/html-minifier/blob/gh-pages/src/htmlminifier.js#L202
|
||||
|
||||
@@ -321,22 +323,6 @@ function includes(array, value) {
|
||||
return array.includes(value);
|
||||
}
|
||||
|
||||
function ensureIsArray(arg, key) {
|
||||
if (!key || !isObject(arg)) {
|
||||
return isArray(arg) ? arg : [];
|
||||
}
|
||||
|
||||
if (!isArray(arg[key])) {
|
||||
arg[key] = [];
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
function ensuredPush(object, key, el) {
|
||||
ensureIsArray(object, key);
|
||||
object[key].push(el);
|
||||
}
|
||||
|
||||
function hasMetaInfo(vm) {
|
||||
vm = vm || this;
|
||||
return vm && (vm[rootConfigKey] === true || isObject(vm[rootConfigKey]));
|
||||
@@ -393,6 +379,8 @@ function createMixin(Vue, options) {
|
||||
|
||||
return {
|
||||
beforeCreate: function beforeCreate() {
|
||||
var _this2 = this;
|
||||
|
||||
var rootKey = '$root';
|
||||
var $root = this[rootKey];
|
||||
var $options = this.$options;
|
||||
@@ -462,7 +450,7 @@ function createMixin(Vue, options) {
|
||||
// if computed $metaInfo exists, watch it for updates & trigger a refresh
|
||||
// when it changes (i.e. automatically handle async actions that affect metaInfo)
|
||||
// credit for this suggestion goes to [Sébastien Chopin](https://github.com/Atinux)
|
||||
ensuredPush($options, 'created', function () {
|
||||
this.$on('hook:created', function () {
|
||||
this.$watch('$metaInfo', function () {
|
||||
triggerUpdate(options, this[rootKey], 'watcher');
|
||||
});
|
||||
@@ -480,7 +468,7 @@ function createMixin(Vue, options) {
|
||||
if (!$root[rootConfigKey].initialized) {
|
||||
if (!$root[rootConfigKey].initializedSsr) {
|
||||
$root[rootConfigKey].initializedSsr = true;
|
||||
ensuredPush($options, 'beforeMount', function () {
|
||||
this.$on('hook:beforeMount', function () {
|
||||
var $root = this; // if this Vue-app was server rendered, set the appId to 'ssr'
|
||||
// only one SSR app per page is supported
|
||||
|
||||
@@ -491,7 +479,7 @@ function createMixin(Vue, options) {
|
||||
} // we use the mounted hook here as on page load
|
||||
|
||||
|
||||
ensuredPush($options, 'mounted', function () {
|
||||
this.$on('hook:mounted', function () {
|
||||
var $root = this[rootKey];
|
||||
|
||||
if (!$root[rootConfigKey].initialized) {
|
||||
@@ -531,8 +519,38 @@ function createMixin(Vue, options) {
|
||||
addNavGuards($root);
|
||||
}
|
||||
}
|
||||
} // do not trigger refresh on the server side
|
||||
}
|
||||
|
||||
this.$on('hook:destroyed', function () {
|
||||
var _this = this;
|
||||
|
||||
// do not trigger refresh:
|
||||
// - when user configured to not wait for transitions on destroyed
|
||||
// - when the component doesnt have a parent
|
||||
// - doesnt have metaInfo defined
|
||||
if (!this.$parent || !hasMetaInfo(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._hasMetaInfo;
|
||||
this.$nextTick(function () {
|
||||
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
return;
|
||||
} // Wait that element is hidden before refreshing meta tags (to support animations)
|
||||
|
||||
|
||||
var interval = setInterval(function () {
|
||||
if (_this.$el && _this.$el.offsetParent !== null) {
|
||||
/* istanbul ignore next line */
|
||||
return;
|
||||
}
|
||||
|
||||
clearInterval(interval);
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
}, 50);
|
||||
});
|
||||
}); // do not trigger refresh on the server side
|
||||
|
||||
if (this.$isServer) {
|
||||
/* istanbul ignore next */
|
||||
@@ -541,41 +559,10 @@ function createMixin(Vue, options) {
|
||||
|
||||
|
||||
updateOnLifecycleHook.forEach(function (lifecycleHook) {
|
||||
ensuredPush($options, lifecycleHook, function () {
|
||||
_this2.$on("hook:".concat(lifecycleHook), function () {
|
||||
triggerUpdate(options, this[rootKey], lifecycleHook);
|
||||
});
|
||||
});
|
||||
},
|
||||
// TODO: move back into beforeCreate when Vue issue is resolved
|
||||
destroyed: function destroyed() {
|
||||
var _this = this;
|
||||
|
||||
// do not trigger refresh:
|
||||
// - when user configured to not wait for transitions on destroyed
|
||||
// - when the component doesnt have a parent
|
||||
// - doesnt have metaInfo defined
|
||||
if (!this.$parent || !hasMetaInfo(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._hasMetaInfo;
|
||||
this.$nextTick(function () {
|
||||
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
return;
|
||||
} // Wait that element is hidden before refreshing meta tags (to support animations)
|
||||
|
||||
|
||||
var interval = setInterval(function () {
|
||||
if (_this.$el && _this.$el.offsetParent !== null) {
|
||||
/* istanbul ignore next line */
|
||||
return;
|
||||
}
|
||||
|
||||
clearInterval(interval);
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
}, 50);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -613,6 +600,18 @@ function getOptions(options) {
|
||||
return optionsCopy;
|
||||
}
|
||||
|
||||
function ensureIsArray(arg, key) {
|
||||
if (!key || !isObject(arg)) {
|
||||
return isArray(arg) ? arg : [];
|
||||
}
|
||||
|
||||
if (!isArray(arg[key])) {
|
||||
arg[key] = [];
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
var serverSequences = [[/&/g, '&'], [/</g, '<'], [/>/g, '>'], [/"/g, '"'], [/'/g, ''']];
|
||||
var clientSequences = [[/&/g, "&"], [/</g, "<"], [/>/g, ">"], [/"/g, "\""], [/'/g, "'"]]; // sanitizes potentially dangerous characters
|
||||
|
||||
@@ -1192,7 +1191,11 @@ function updateTag(appId, options, type, tags, head, body) {
|
||||
}
|
||||
|
||||
var newElement = document.createElement(type);
|
||||
newElement.setAttribute(attribute, appId);
|
||||
|
||||
if (!tag.once) {
|
||||
newElement.setAttribute(attribute, appId);
|
||||
}
|
||||
|
||||
Object.keys(tag).forEach(function (attr) {
|
||||
/* istanbul ignore next */
|
||||
if (includes(tagProperties, attr)) {
|
||||
|
||||
Vendored
+59
-56
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue-meta v2.3.2
|
||||
* vue-meta v2.3.3
|
||||
* (c) 2020
|
||||
* - Declan de Wet
|
||||
* - Sébastien Chopin (@Atinux)
|
||||
@@ -14,9 +14,11 @@
|
||||
(global = global || self, global.VueMeta = factory());
|
||||
}(this, (function () { 'use strict';
|
||||
|
||||
var version = "2.3.2";
|
||||
var version = "2.3.3";
|
||||
|
||||
function _typeof(obj) {
|
||||
"@babel/helpers - typeof";
|
||||
|
||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||||
_typeof = function (obj) {
|
||||
return typeof obj;
|
||||
@@ -147,7 +149,7 @@
|
||||
var metaInfoAttributeKeys = [defaultInfoKeys[3], defaultInfoKeys[4], defaultInfoKeys[5]]; // HTML elements which support the onload event
|
||||
|
||||
var tagsSupportingOnload = ['link', 'style', 'script']; // HTML elements which dont have a head tag (shortened to our needs)
|
||||
var tagProperties = ['once', 'template']; // Attributes which should be added with data- prefix
|
||||
var tagProperties = ['once', 'skip', 'template']; // Attributes which should be added with data- prefix
|
||||
|
||||
var commonDataAttributes = ['body', 'pbody']; // from: https://github.com/kangax/html-minifier/blob/gh-pages/src/htmlminifier.js#L202
|
||||
|
||||
@@ -252,22 +254,6 @@
|
||||
return array.includes(value);
|
||||
}
|
||||
|
||||
function ensureIsArray(arg, key) {
|
||||
if (!key || !isObject(arg)) {
|
||||
return isArray(arg) ? arg : [];
|
||||
}
|
||||
|
||||
if (!isArray(arg[key])) {
|
||||
arg[key] = [];
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
function ensuredPush(object, key, el) {
|
||||
ensureIsArray(object, key);
|
||||
object[key].push(el);
|
||||
}
|
||||
|
||||
function hasMetaInfo(vm) {
|
||||
vm = vm || this;
|
||||
return vm && (vm[rootConfigKey] === true || isObject(vm[rootConfigKey]));
|
||||
@@ -324,6 +310,8 @@
|
||||
|
||||
return {
|
||||
beforeCreate: function beforeCreate() {
|
||||
var _this2 = this;
|
||||
|
||||
var rootKey = '$root';
|
||||
var $root = this[rootKey];
|
||||
var $options = this.$options;
|
||||
@@ -393,7 +381,7 @@
|
||||
// if computed $metaInfo exists, watch it for updates & trigger a refresh
|
||||
// when it changes (i.e. automatically handle async actions that affect metaInfo)
|
||||
// credit for this suggestion goes to [Sébastien Chopin](https://github.com/Atinux)
|
||||
ensuredPush($options, 'created', function () {
|
||||
this.$on('hook:created', function () {
|
||||
this.$watch('$metaInfo', function () {
|
||||
triggerUpdate(options, this[rootKey], 'watcher');
|
||||
});
|
||||
@@ -411,7 +399,7 @@
|
||||
if (!$root[rootConfigKey].initialized) {
|
||||
if (!$root[rootConfigKey].initializedSsr) {
|
||||
$root[rootConfigKey].initializedSsr = true;
|
||||
ensuredPush($options, 'beforeMount', function () {
|
||||
this.$on('hook:beforeMount', function () {
|
||||
var $root = this; // if this Vue-app was server rendered, set the appId to 'ssr'
|
||||
// only one SSR app per page is supported
|
||||
|
||||
@@ -422,7 +410,7 @@
|
||||
} // we use the mounted hook here as on page load
|
||||
|
||||
|
||||
ensuredPush($options, 'mounted', function () {
|
||||
this.$on('hook:mounted', function () {
|
||||
var $root = this[rootKey];
|
||||
|
||||
if (!$root[rootConfigKey].initialized) {
|
||||
@@ -462,8 +450,38 @@
|
||||
addNavGuards($root);
|
||||
}
|
||||
}
|
||||
} // do not trigger refresh on the server side
|
||||
}
|
||||
|
||||
this.$on('hook:destroyed', function () {
|
||||
var _this = this;
|
||||
|
||||
// do not trigger refresh:
|
||||
// - when user configured to not wait for transitions on destroyed
|
||||
// - when the component doesnt have a parent
|
||||
// - doesnt have metaInfo defined
|
||||
if (!this.$parent || !hasMetaInfo(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._hasMetaInfo;
|
||||
this.$nextTick(function () {
|
||||
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
return;
|
||||
} // Wait that element is hidden before refreshing meta tags (to support animations)
|
||||
|
||||
|
||||
var interval = setInterval(function () {
|
||||
if (_this.$el && _this.$el.offsetParent !== null) {
|
||||
/* istanbul ignore next line */
|
||||
return;
|
||||
}
|
||||
|
||||
clearInterval(interval);
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
}, 50);
|
||||
});
|
||||
}); // do not trigger refresh on the server side
|
||||
|
||||
if (this.$isServer) {
|
||||
/* istanbul ignore next */
|
||||
@@ -472,41 +490,10 @@
|
||||
|
||||
|
||||
updateOnLifecycleHook.forEach(function (lifecycleHook) {
|
||||
ensuredPush($options, lifecycleHook, function () {
|
||||
_this2.$on("hook:".concat(lifecycleHook), function () {
|
||||
triggerUpdate(options, this[rootKey], lifecycleHook);
|
||||
});
|
||||
});
|
||||
},
|
||||
// TODO: move back into beforeCreate when Vue issue is resolved
|
||||
destroyed: function destroyed() {
|
||||
var _this = this;
|
||||
|
||||
// do not trigger refresh:
|
||||
// - when user configured to not wait for transitions on destroyed
|
||||
// - when the component doesnt have a parent
|
||||
// - doesnt have metaInfo defined
|
||||
if (!this.$parent || !hasMetaInfo(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._hasMetaInfo;
|
||||
this.$nextTick(function () {
|
||||
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
return;
|
||||
} // Wait that element is hidden before refreshing meta tags (to support animations)
|
||||
|
||||
|
||||
var interval = setInterval(function () {
|
||||
if (_this.$el && _this.$el.offsetParent !== null) {
|
||||
/* istanbul ignore next line */
|
||||
return;
|
||||
}
|
||||
|
||||
clearInterval(interval);
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
}, 50);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -544,6 +531,18 @@
|
||||
return optionsCopy;
|
||||
}
|
||||
|
||||
function ensureIsArray(arg, key) {
|
||||
if (!key || !isObject(arg)) {
|
||||
return isArray(arg) ? arg : [];
|
||||
}
|
||||
|
||||
if (!isArray(arg[key])) {
|
||||
arg[key] = [];
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
var clientSequences = [[/&/g, "&"], [/</g, "<"], [/>/g, ">"], [/"/g, "\""], [/'/g, "'"]]; // sanitizes potentially dangerous characters
|
||||
|
||||
function escape(info, options, escapeOptions, escapeKeys) {
|
||||
@@ -1209,7 +1208,11 @@
|
||||
}
|
||||
|
||||
var newElement = document.createElement(type);
|
||||
newElement.setAttribute(attribute, appId);
|
||||
|
||||
if (!tag.once) {
|
||||
newElement.setAttribute(attribute, appId);
|
||||
}
|
||||
|
||||
Object.keys(tag).forEach(function (attr) {
|
||||
/* istanbul ignore next */
|
||||
if (includes(tagProperties, attr)) {
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue-meta",
|
||||
"version": "2.3.2",
|
||||
"version": "2.3.3",
|
||||
"description": "Manage HTML metadata in Vue.js components with ssr support",
|
||||
"keywords": [
|
||||
"attribute",
|
||||
|
||||
Reference in New Issue
Block a user