Updated vue.js version

This commit is contained in:
Sebastian Lay 2021-08-02 20:33:48 +02:00
parent 54f214b1fc
commit 7c9f57d225
No known key found for this signature in database
GPG Key ID: A699D9B80D6068AA
2 changed files with 130 additions and 81 deletions

201
js/vue.js
View File

@ -1,6 +1,6 @@
/*! /*!
* Vue.js v2.6.11 * Vue.js v2.6.14
* (c) 2014-2019 Evan You * (c) 2014-2021 Evan You
* Released under the MIT License. * Released under the MIT License.
*/ */
(function (global, factory) { (function (global, factory) {
@ -1704,13 +1704,14 @@
type = [type]; type = [type];
} }
for (var i = 0; i < type.length && !valid; i++) { for (var i = 0; i < type.length && !valid; i++) {
var assertedType = assertType(value, type[i]); var assertedType = assertType(value, type[i], vm);
expectedTypes.push(assertedType.expectedType || ''); expectedTypes.push(assertedType.expectedType || '');
valid = assertedType.valid; valid = assertedType.valid;
} }
} }
if (!valid) { var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
if (!valid && haveExpectedTypes) {
warn( warn(
getInvalidTypeMessage(name, value, expectedTypes), getInvalidTypeMessage(name, value, expectedTypes),
vm vm
@ -1728,9 +1729,9 @@
} }
} }
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/; var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
function assertType (value, type) { function assertType (value, type, vm) {
var valid; var valid;
var expectedType = getType(type); var expectedType = getType(type);
if (simpleCheckRE.test(expectedType)) { if (simpleCheckRE.test(expectedType)) {
@ -1745,7 +1746,12 @@
} else if (expectedType === 'Array') { } else if (expectedType === 'Array') {
valid = Array.isArray(value); valid = Array.isArray(value);
} else { } else {
try {
valid = value instanceof type; valid = value instanceof type;
} catch (e) {
warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
valid = false;
}
} }
return { return {
valid: valid, valid: valid,
@ -1753,13 +1759,15 @@
} }
} }
var functionTypeCheckRE = /^\s*function (\w+)/;
/** /**
* Use function string name to check built-in types, * Use function string name to check built-in types,
* because a simple equality check will fail when running * because a simple equality check will fail when running
* across different vms / iframes. * across different vms / iframes.
*/ */
function getType (fn) { function getType (fn) {
var match = fn && fn.toString().match(/^\s*function (\w+)/); var match = fn && fn.toString().match(functionTypeCheckRE);
return match ? match[1] : '' return match ? match[1] : ''
} }
@ -1784,18 +1792,19 @@
" Expected " + (expectedTypes.map(capitalize).join(', ')); " Expected " + (expectedTypes.map(capitalize).join(', '));
var expectedType = expectedTypes[0]; var expectedType = expectedTypes[0];
var receivedType = toRawType(value); var receivedType = toRawType(value);
var expectedValue = styleValue(value, expectedType);
var receivedValue = styleValue(value, receivedType);
// check if we need to specify expected value // check if we need to specify expected value
if (expectedTypes.length === 1 && if (
expectedTypes.length === 1 &&
isExplicable(expectedType) && isExplicable(expectedType) &&
!isBoolean(expectedType, receivedType)) { isExplicable(typeof value) &&
message += " with value " + expectedValue; !isBoolean(expectedType, receivedType)
) {
message += " with value " + (styleValue(value, expectedType));
} }
message += ", got " + receivedType + " "; message += ", got " + receivedType + " ";
// check if we need to specify received value // check if we need to specify received value
if (isExplicable(receivedType)) { if (isExplicable(receivedType)) {
message += "with value " + receivedValue + "."; message += "with value " + (styleValue(value, receivedType)) + ".";
} }
return message return message
} }
@ -1810,9 +1819,9 @@
} }
} }
var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
function isExplicable (value) { function isExplicable (value) {
var explicitTypes = ['string', 'number', 'boolean']; return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; })
return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
} }
function isBoolean () { function isBoolean () {
@ -2039,7 +2048,7 @@
var allowedGlobals = makeMap( var allowedGlobals = makeMap(
'Infinity,undefined,NaN,isFinite,isNaN,' + 'Infinity,undefined,NaN,isFinite,isNaN,' +
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' + 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
'require' // for Webpack/Browserify 'require' // for Webpack/Browserify
); );
@ -2542,6 +2551,12 @@
/* */ /* */
function isAsyncPlaceholder (node) {
return node.isComment && node.asyncFactory
}
/* */
function normalizeScopedSlots ( function normalizeScopedSlots (
slots, slots,
normalSlots, normalSlots,
@ -2598,9 +2613,10 @@
res = res && typeof res === 'object' && !Array.isArray(res) res = res && typeof res === 'object' && !Array.isArray(res)
? [res] // single vnode ? [res] // single vnode
: normalizeChildren(res); : normalizeChildren(res);
var vnode = res && res[0];
return res && ( return res && (
res.length === 0 || !vnode ||
(res.length === 1 && res[0].isComment) // #9658 (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
) ? undefined ) ? undefined
: res : res
}; };
@ -2673,26 +2689,28 @@
*/ */
function renderSlot ( function renderSlot (
name, name,
fallback, fallbackRender,
props, props,
bindObject bindObject
) { ) {
var scopedSlotFn = this.$scopedSlots[name]; var scopedSlotFn = this.$scopedSlots[name];
var nodes; var nodes;
if (scopedSlotFn) { // scoped slot if (scopedSlotFn) {
// scoped slot
props = props || {}; props = props || {};
if (bindObject) { if (bindObject) {
if (!isObject(bindObject)) { if (!isObject(bindObject)) {
warn( warn('slot v-bind without argument expects an Object', this);
'slot v-bind without argument expects an Object',
this
);
} }
props = extend(extend({}, bindObject), props); props = extend(extend({}, bindObject), props);
} }
nodes = scopedSlotFn(props) || fallback; nodes =
scopedSlotFn(props) ||
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
} else { } else {
nodes = this.$slots[name] || fallback; nodes =
this.$slots[name] ||
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
} }
var target = props && props.slot; var target = props && props.slot;
@ -2742,6 +2760,7 @@
} else if (eventKeyName) { } else if (eventKeyName) {
return hyphenate(eventKeyName) !== key return hyphenate(eventKeyName) !== key
} }
return eventKeyCode === undefined
} }
/* */ /* */
@ -3273,8 +3292,10 @@
} }
function createComponentInstanceForVnode ( function createComponentInstanceForVnode (
vnode, // we know it's MountedComponentVNode but flow doesn't // we know it's MountedComponentVNode but flow doesn't
parent // activeInstance in lifecycle state vnode,
// activeInstance in lifecycle state
parent
) { ) {
var options = { var options = {
_isComponent: true, _isComponent: true,
@ -3413,7 +3434,7 @@
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
if (config.isReservedTag(tag)) { if (config.isReservedTag(tag)) {
// platform built-in elements // platform built-in elements
if (isDef(data) && isDef(data.nativeOn)) { if (isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') {
warn( warn(
("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."), ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
context context
@ -3739,12 +3760,6 @@
/* */ /* */
function isAsyncPlaceholder (node) {
return node.isComment && node.asyncFactory
}
/* */
function getFirstComponentChild (children) { function getFirstComponentChild (children) {
if (Array.isArray(children)) { if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) { for (var i = 0; i < children.length; i++) {
@ -4111,7 +4126,8 @@
var hasDynamicScopedSlot = !!( var hasDynamicScopedSlot = !!(
(newScopedSlots && !newScopedSlots.$stable) || (newScopedSlots && !newScopedSlots.$stable) ||
(oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) || (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
(!newScopedSlots && vm.$scopedSlots.$key)
); );
// Any static slot children from the parent may have changed during parent's // Any static slot children from the parent may have changed during parent's
@ -4563,11 +4579,8 @@
var oldValue = this.value; var oldValue = this.value;
this.value = value; this.value = value;
if (this.user) { if (this.user) {
try { var info = "callback for watcher \"" + (this.expression) + "\"";
this.cb.call(this.vm, value, oldValue); invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
} catch (e) {
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
}
} else { } else {
this.cb.call(this.vm, value, oldValue); this.cb.call(this.vm, value, oldValue);
} }
@ -4789,6 +4802,8 @@
warn(("The computed property \"" + key + "\" is already defined in data."), vm); warn(("The computed property \"" + key + "\" is already defined in data."), vm);
} else if (vm.$options.props && key in vm.$options.props) { } else if (vm.$options.props && key in vm.$options.props) {
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
} else if (vm.$options.methods && key in vm.$options.methods) {
warn(("The computed property \"" + key + "\" is already defined as a method."), vm);
} }
} }
} }
@ -4941,11 +4956,10 @@
options.user = true; options.user = true;
var watcher = new Watcher(vm, expOrFn, cb, options); var watcher = new Watcher(vm, expOrFn, cb, options);
if (options.immediate) { if (options.immediate) {
try { var info = "callback for immediate watcher \"" + (watcher.expression) + "\"";
cb.call(vm, watcher.value); pushTarget();
} catch (error) { invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); popTarget();
}
} }
return function unwatchFn () { return function unwatchFn () {
watcher.teardown(); watcher.teardown();
@ -5243,6 +5257,8 @@
function getComponentName (opts) { function getComponentName (opts) {
return opts && (opts.Ctor.options.name || opts.tag) return opts && (opts.Ctor.options.name || opts.tag)
} }
@ -5264,9 +5280,9 @@
var keys = keepAliveInstance.keys; var keys = keepAliveInstance.keys;
var _vnode = keepAliveInstance._vnode; var _vnode = keepAliveInstance._vnode;
for (var key in cache) { for (var key in cache) {
var cachedNode = cache[key]; var entry = cache[key];
if (cachedNode) { if (entry) {
var name = getComponentName(cachedNode.componentOptions); var name = entry.name;
if (name && !filter(name)) { if (name && !filter(name)) {
pruneCacheEntry(cache, key, keys, _vnode); pruneCacheEntry(cache, key, keys, _vnode);
} }
@ -5280,9 +5296,9 @@
keys, keys,
current current
) { ) {
var cached$$1 = cache[key]; var entry = cache[key];
if (cached$$1 && (!current || cached$$1.tag !== current.tag)) { if (entry && (!current || entry.tag !== current.tag)) {
cached$$1.componentInstance.$destroy(); entry.componentInstance.$destroy();
} }
cache[key] = null; cache[key] = null;
remove(keys, key); remove(keys, key);
@ -5300,6 +5316,32 @@
max: [String, Number] max: [String, Number]
}, },
methods: {
cacheVNode: function cacheVNode() {
var ref = this;
var cache = ref.cache;
var keys = ref.keys;
var vnodeToCache = ref.vnodeToCache;
var keyToCache = ref.keyToCache;
if (vnodeToCache) {
var tag = vnodeToCache.tag;
var componentInstance = vnodeToCache.componentInstance;
var componentOptions = vnodeToCache.componentOptions;
cache[keyToCache] = {
name: getComponentName(componentOptions),
tag: tag,
componentInstance: componentInstance,
};
keys.push(keyToCache);
// prune oldest entry
if (this.max && keys.length > parseInt(this.max)) {
pruneCacheEntry(cache, keys[0], keys, this._vnode);
}
this.vnodeToCache = null;
}
}
},
created: function created () { created: function created () {
this.cache = Object.create(null); this.cache = Object.create(null);
this.keys = []; this.keys = [];
@ -5314,6 +5356,7 @@
mounted: function mounted () { mounted: function mounted () {
var this$1 = this; var this$1 = this;
this.cacheVNode();
this.$watch('include', function (val) { this.$watch('include', function (val) {
pruneCache(this$1, function (name) { return matches(val, name); }); pruneCache(this$1, function (name) { return matches(val, name); });
}); });
@ -5322,6 +5365,10 @@
}); });
}, },
updated: function updated () {
this.cacheVNode();
},
render: function render () { render: function render () {
var slot = this.$slots.default; var slot = this.$slots.default;
var vnode = getFirstComponentChild(slot); var vnode = getFirstComponentChild(slot);
@ -5355,12 +5402,9 @@
remove(keys, key); remove(keys, key);
keys.push(key); keys.push(key);
} else { } else {
cache[key] = vnode; // delay setting the cache until update
keys.push(key); this.vnodeToCache = vnode;
// prune oldest entry this.keyToCache = key;
if (this.max && keys.length > parseInt(this.max)) {
pruneCacheEntry(cache, keys[0], keys, this._vnode);
}
} }
vnode.data.keepAlive = true; vnode.data.keepAlive = true;
@ -5443,7 +5487,7 @@
value: FunctionalRenderContext value: FunctionalRenderContext
}); });
Vue.version = '2.6.11'; Vue.version = '2.6.14';
/* */ /* */
@ -5480,7 +5524,7 @@
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' + 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' + 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
'required,reversed,scoped,seamless,selected,sortable,translate,' + 'required,reversed,scoped,seamless,selected,sortable,' +
'truespeed,typemustmatch,visible' 'truespeed,typemustmatch,visible'
); );
@ -5604,7 +5648,7 @@
// contain child elements. // contain child elements.
var isSVG = makeMap( var isSVG = makeMap(
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' + 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
true true
); );
@ -5809,7 +5853,8 @@
function sameVnode (a, b) { function sameVnode (a, b) {
return ( return (
a.key === b.key && ( a.key === b.key &&
a.asyncFactory === b.asyncFactory && (
( (
a.tag === b.tag && a.tag === b.tag &&
a.isComment === b.isComment && a.isComment === b.isComment &&
@ -5817,7 +5862,6 @@
sameInputType(a, b) sameInputType(a, b)
) || ( ) || (
isTrue(a.isAsyncPlaceholder) && isTrue(a.isAsyncPlaceholder) &&
a.asyncFactory === b.asyncFactory &&
isUndef(b.asyncFactory.error) isUndef(b.asyncFactory.error)
) )
) )
@ -6705,7 +6749,7 @@
cur = attrs[key]; cur = attrs[key];
old = oldAttrs[key]; old = oldAttrs[key];
if (old !== cur) { if (old !== cur) {
setAttr(elm, key, cur); setAttr(elm, key, cur, vnode.data.pre);
} }
} }
// #4391: in IE9, setting type can reset value for input[type=radio] // #4391: in IE9, setting type can reset value for input[type=radio]
@ -6725,8 +6769,8 @@
} }
} }
function setAttr (el, key, value) { function setAttr (el, key, value, isInPre) {
if (el.tagName.indexOf('-') > -1) { if (isInPre || el.tagName.indexOf('-') > -1) {
baseSetAttr(el, key, value); baseSetAttr(el, key, value);
} else if (isBooleanAttr(key)) { } else if (isBooleanAttr(key)) {
// set attribute for blank value // set attribute for blank value
@ -7649,7 +7693,7 @@
// skip the update if old and new VDOM state is the same. // skip the update if old and new VDOM state is the same.
// `value` is handled separately because the DOM value may be temporarily // `value` is handled separately because the DOM value may be temporarily
// out of sync with VDOM state due to focus, composition and modifiers. // out of sync with VDOM state due to focus, composition and modifiers.
// This #4521 by skipping the unnecesarry `checked` update. // This #4521 by skipping the unnecessary `checked` update.
cur !== oldProps[key] cur !== oldProps[key]
) { ) {
// some property updates can throw // some property updates can throw
@ -9247,7 +9291,7 @@
// Regular Expressions for parsing tags and attributes // Regular Expressions for parsing tags and attributes
var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*"; var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")"; var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
var startTagOpen = new RegExp(("^<" + qnameCapture)); var startTagOpen = new RegExp(("^<" + qnameCapture));
@ -9552,7 +9596,7 @@
var slotRE = /^v-slot(:|$)|^#/; var slotRE = /^v-slot(:|$)|^#/;
var lineBreakRE = /[\r\n]/; var lineBreakRE = /[\r\n]/;
var whitespaceRE$1 = /\s+/g; var whitespaceRE$1 = /[ \f\t\r\n]+/g;
var invalidAttributeRE = /[\s"'<>\/=]/; var invalidAttributeRE = /[\s"'<>\/=]/;
@ -9600,8 +9644,12 @@
platformMustUseProp = options.mustUseProp || no; platformMustUseProp = options.mustUseProp || no;
platformGetTagNamespace = options.getTagNamespace || no; platformGetTagNamespace = options.getTagNamespace || no;
var isReservedTag = options.isReservedTag || no; var isReservedTag = options.isReservedTag || no;
maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); }; maybeComponent = function (el) { return !!(
el.component ||
el.attrsMap[':is'] ||
el.attrsMap['v-bind:is'] ||
!(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag))
); };
transforms = pluckModuleFunction(options.modules, 'transformNode'); transforms = pluckModuleFunction(options.modules, 'transformNode');
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode'); preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode'); postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
@ -9894,7 +9942,7 @@
} }
}, },
comment: function comment (text, start, end) { comment: function comment (text, start, end) {
// adding anyting as a sibling to the root node is forbidden // adding anything as a sibling to the root node is forbidden
// comments should still be allowed, but ignored // comments should still be allowed, but ignored
if (currentParent) { if (currentParent) {
var child = { var child = {
@ -10850,9 +10898,9 @@
code += genModifierCode; code += genModifierCode;
} }
var handlerCode = isMethodPath var handlerCode = isMethodPath
? ("return " + (handler.value) + "($event)") ? ("return " + (handler.value) + ".apply(null, arguments)")
: isFunctionExpression : isFunctionExpression
? ("return (" + (handler.value) + ")($event)") ? ("return (" + (handler.value) + ").apply(null, arguments)")
: isFunctionInvocation : isFunctionInvocation
? ("return " + (handler.value)) ? ("return " + (handler.value))
: handler.value; : handler.value;
@ -10938,7 +10986,8 @@
options options
) { ) {
var state = new CodegenState(options); var state = new CodegenState(options);
var code = ast ? genElement(ast, state) : '_c("div")'; // fix #11483, Root level <script> tags should not be rendered.
var code = ast ? (ast.tag === 'script' ? 'null' : genElement(ast, state)) : '_c("div")';
return { return {
render: ("with(this){return " + code + "}"), render: ("with(this){return " + code + "}"),
staticRenderFns: state.staticRenderFns staticRenderFns: state.staticRenderFns
@ -11400,7 +11449,7 @@
function genSlot (el, state) { function genSlot (el, state) {
var slotName = el.slotName || '"default"'; var slotName = el.slotName || '"default"';
var children = genChildren(el, state); var children = genChildren(el, state);
var res = "_t(" + slotName + (children ? ("," + children) : ''); var res = "_t(" + slotName + (children ? (",function(){return " + children + "}") : '');
var attrs = el.attrs || el.dynamicAttrs var attrs = el.attrs || el.dynamicAttrs
? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({ ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
// slot props are camelized // slot props are camelized

6
js/vue.min.js vendored

File diff suppressed because one or more lines are too long