build: build 2.6.0

This commit is contained in:
Evan You 2019-02-04 10:57:00 -05:00
parent 9b33f206f8
commit 076dc8d84f
19 changed files with 572 additions and 389 deletions

115
dist/vue.common.dev.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Vue.js v2.6.0-beta.3 * Vue.js v2.6.0
* (c) 2014-2019 Evan You * (c) 2014-2019 Evan You
* Released under the MIT License. * Released under the MIT License.
*/ */
@ -2752,7 +2752,7 @@ function resolveScopedSlots (
var slot = fns[i]; var slot = fns[i];
if (Array.isArray(slot)) { if (Array.isArray(slot)) {
resolveScopedSlots(slot, hasDynamicKeys, res); resolveScopedSlots(slot, hasDynamicKeys, res);
} else { } else if (slot) {
res[slot.key] = slot.fn; res[slot.key] = slot.fn;
} }
} }
@ -3899,7 +3899,7 @@ function normalizeScopedSlots (
} }
} }
res._normalized = true; res._normalized = true;
res.$stable = slots && slots.$stable; res.$stable = slots ? slots.$stable : true;
return res return res
} }
@ -5319,7 +5319,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
value: FunctionalRenderContext value: FunctionalRenderContext
}); });
Vue.version = '2.6.0-beta.3'; Vue.version = '2.6.0';
/* */ /* */
@ -5340,6 +5340,17 @@ var mustUseProp = function (tag, type, attr) {
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
var convertEnumeratedValue = function (key, value) {
return isFalsyAttrValue(value) || value === 'false'
? 'false'
// allow arbitrary string value for contenteditable
: key === 'contenteditable' && isValidContentEditableValue(value)
? value
: 'true'
};
var isBooleanAttr = makeMap( var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
@ -6607,7 +6618,7 @@ function setAttr (el, key, value) {
el.setAttribute(key, value); el.setAttribute(key, value);
} }
} else if (isEnumeratedAttr(key)) { } else if (isEnumeratedAttr(key)) {
el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true'); el.setAttribute(key, convertEnumeratedValue(key, value));
} else if (isXlink(key)) { } else if (isXlink(key)) {
if (isFalsyAttrValue(value)) { if (isFalsyAttrValue(value)) {
el.removeAttributeNS(xlinkNS, getXlinkProp(key)); el.removeAttributeNS(xlinkNS, getXlinkProp(key));
@ -7622,7 +7633,7 @@ var setProp = function (el, name, val) {
if (cssVarRE.test(name)) { if (cssVarRE.test(name)) {
el.style.setProperty(name, val); el.style.setProperty(name, val);
} else if (importantRE.test(val)) { } else if (importantRE.test(val)) {
el.style.setProperty(name, val.replace(importantRE, ''), 'important'); el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
} else { } else {
var normalizedName = normalize(name); var normalizedName = normalize(name);
if (Array.isArray(val)) { if (Array.isArray(val)) {
@ -9380,7 +9391,7 @@ function parseHTML (html, options) {
/* */ /* */
var onRE = /^@|^v-on:/; var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^\./; var dirRE = /^v-|^@|^:/;
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
var stripParensRE = /^\(|\)$/g; var stripParensRE = /^\(|\)$/g;
@ -9388,7 +9399,6 @@ var dynamicArgRE = /^\[.*\]$/;
var argRE = /:(.*)$/; var argRE = /:(.*)$/;
var bindRE = /^:|^\.|^v-bind:/; var bindRE = /^:|^\.|^v-bind:/;
var propBindRE = /^\./;
var modifierRE = /\.[^.]+/g; var modifierRE = /\.[^.]+/g;
var slotRE = /^v-slot(:|$)|^#/; var slotRE = /^v-slot(:|$)|^#/;
@ -9465,6 +9475,7 @@ function parse (
} }
function closeElement (element) { function closeElement (element) {
trimEndingWhitespace(element);
if (!inVPre && !element.processed) { if (!inVPre && !element.processed) {
element = processElement(element, options); element = processElement(element, options);
} }
@ -9491,14 +9502,25 @@ function parse (
if (currentParent && !element.forbidden) { if (currentParent && !element.forbidden) {
if (element.elseif || element.else) { if (element.elseif || element.else) {
processIfConditions(element, currentParent); processIfConditions(element, currentParent);
} else if (element.slotScope) { // scoped slot
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
} else { } else {
if (element.slotScope) {
// scoped slot
// keep it in the children list so that v-else(-if) conditions can
// find it as the prev node.
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
}
currentParent.children.push(element); currentParent.children.push(element);
element.parent = currentParent; element.parent = currentParent;
} }
} }
// final children cleanup
// filter out scoped slots
element.children = element.children.filter(function (c) { return !(c).slotScope; });
// remove trailing whitespace node again
trimEndingWhitespace(element);
// check pre state // check pre state
if (element.pre) { if (element.pre) {
inVPre = false; inVPre = false;
@ -9512,6 +9534,20 @@ function parse (
} }
} }
function trimEndingWhitespace (el) {
// remove trailing whitespace node
if (!inPre) {
var lastNode;
while (
(lastNode = el.children[el.children.length - 1]) &&
lastNode.type === 3 &&
lastNode.text === ' '
) {
el.children.pop();
}
}
}
function checkRootConstraints (el) { function checkRootConstraints (el) {
if (el.tag === 'slot' || el.tag === 'template') { if (el.tag === 'slot' || el.tag === 'template') {
warnOnce( warnOnce(
@ -9626,13 +9662,6 @@ function parse (
end: function end (tag, start, end$1) { end: function end (tag, start, end$1) {
var element = stack[stack.length - 1]; var element = stack[stack.length - 1];
if (!inPre) {
// remove trailing whitespace node
var lastNode = element.children[element.children.length - 1];
if (lastNode && lastNode.type === 3 && lastNode.text === ' ') {
element.children.pop();
}
}
// pop stack // pop stack
stack.length -= 1; stack.length -= 1;
currentParent = stack[stack.length - 1]; currentParent = stack[stack.length - 1];
@ -9976,6 +10005,13 @@ function processSlotContent (el) {
el el
); );
} }
if (el.parent && !maybeComponent(el.parent)) {
warn$2(
"<template v-slot> can only appear at the root level inside " +
"the receiving the component",
el
);
}
} }
var ref = getSlotName(slotBinding); var ref = getSlotName(slotBinding);
var name = ref.name; var name = ref.name;
@ -10015,8 +10051,9 @@ function processSlotContent (el) {
var name$1 = ref$1.name; var name$1 = ref$1.name;
var dynamic$1 = ref$1.dynamic; var dynamic$1 = ref$1.dynamic;
var slotContainer = slots[name$1] = createASTElement('template', [], el); var slotContainer = slots[name$1] = createASTElement('template', [], el);
slotContainer.slotTarget = name$1;
slotContainer.slotTargetDynamic = dynamic$1; slotContainer.slotTargetDynamic = dynamic$1;
slotContainer.children = el.children; slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; });
slotContainer.slotScope = slotBinding$1.value || "_"; slotContainer.slotScope = slotBinding$1.value || "_";
// remove children as they are returned from scopedSlots now // remove children as they are returned from scopedSlots now
el.children = []; el.children = [];
@ -10083,10 +10120,7 @@ function processAttrs (el) {
// modifiers // modifiers
modifiers = parseModifiers(name.replace(dirRE, '')); modifiers = parseModifiers(name.replace(dirRE, ''));
// support .foo shorthand syntax for the .prop modifier // support .foo shorthand syntax for the .prop modifier
if (propBindRE.test(name)) { if (modifiers) {
(modifiers || (modifiers = {})).prop = true;
name = "." + name.slice(1).replace(modifierRE, '');
} else if (modifiers) {
name = name.replace(modifierRE, ''); name = name.replace(modifierRE, '');
} }
if (bindRE.test(name)) { // v-bind if (bindRE.test(name)) { // v-bind
@ -11023,43 +11057,30 @@ function genScopedSlots (
slots, slots,
state state
) { ) {
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; }); var hasDynamicKeys = Object.keys(slots).some(function (key) {
var slot = slots[key];
return slot.slotTargetDynamic || slot.if || slot.for
});
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
return genScopedSlot(key, slots[key], state) return genScopedSlot(slots[key], state)
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")") }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
} }
function genScopedSlot ( function genScopedSlot (
key,
el, el,
state state
) { ) {
if (el.if && !el.ifProcessed) {
return genIf(el, state, genScopedSlot, "null")
}
if (el.for && !el.forProcessed) { if (el.for && !el.forProcessed) {
return genForScopedSlot(key, el, state) return genFor(el, state, genScopedSlot)
} }
var fn = "function(" + (String(el.slotScope)) + "){" + var fn = "function(" + (String(el.slotScope)) + "){" +
"return " + (el.tag === 'template' "return " + (el.tag === 'template'
? el.if ? genChildren(el, state) || 'undefined'
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
: genChildren(el, state) || 'undefined'
: genElement(el, state)) + "}"; : genElement(el, state)) + "}";
return ("{key:" + key + ",fn:" + fn + "}") return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + "}")
}
function genForScopedSlot (
key,
el,
state
) {
var exp = el.for;
var alias = el.alias;
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
el.forProcessed = true; // avoid recursion
return "_l((" + exp + ")," +
"function(" + alias + iterator1 + iterator2 + "){" +
"return " + (genScopedSlot(key, el, state)) +
'})'
} }
function genChildren ( function genChildren (

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Vue.js v2.6.0-beta.3 * Vue.js v2.6.0
* (c) 2014-2019 Evan You * (c) 2014-2019 Evan You
* Released under the MIT License. * Released under the MIT License.
*/ */
@ -2780,7 +2780,7 @@ function resolveScopedSlots (
const slot = fns[i]; const slot = fns[i];
if (Array.isArray(slot)) { if (Array.isArray(slot)) {
resolveScopedSlots(slot, hasDynamicKeys, res); resolveScopedSlots(slot, hasDynamicKeys, res);
} else { } else if (slot) {
res[slot.key] = slot.fn; res[slot.key] = slot.fn;
} }
} }
@ -3945,7 +3945,7 @@ function normalizeScopedSlots (
} }
} }
res._normalized = true; res._normalized = true;
res.$stable = slots && slots.$stable; res.$stable = slots ? slots.$stable : true;
return res return res
} }
@ -5352,7 +5352,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
value: FunctionalRenderContext value: FunctionalRenderContext
}); });
Vue.version = '2.6.0-beta.3'; Vue.version = '2.6.0';
/* */ /* */
@ -5373,6 +5373,17 @@ const mustUseProp = (tag, type, attr) => {
const isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); const isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
const isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
const convertEnumeratedValue = (key, value) => {
return isFalsyAttrValue(value) || value === 'false'
? 'false'
// allow arbitrary string value for contenteditable
: key === 'contenteditable' && isValidContentEditableValue(value)
? value
: 'true'
};
const isBooleanAttr = makeMap( const isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
@ -6637,7 +6648,7 @@ function setAttr (el, key, value) {
el.setAttribute(key, value); el.setAttribute(key, value);
} }
} else if (isEnumeratedAttr(key)) { } else if (isEnumeratedAttr(key)) {
el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true'); el.setAttribute(key, convertEnumeratedValue(key, value));
} else if (isXlink(key)) { } else if (isXlink(key)) {
if (isFalsyAttrValue(value)) { if (isFalsyAttrValue(value)) {
el.removeAttributeNS(xlinkNS, getXlinkProp(key)); el.removeAttributeNS(xlinkNS, getXlinkProp(key));
@ -7647,7 +7658,7 @@ const setProp = (el, name, val) => {
if (cssVarRE.test(name)) { if (cssVarRE.test(name)) {
el.style.setProperty(name, val); el.style.setProperty(name, val);
} else if (importantRE.test(val)) { } else if (importantRE.test(val)) {
el.style.setProperty(name, val.replace(importantRE, ''), 'important'); el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
} else { } else {
const normalizedName = normalize(name); const normalizedName = normalize(name);
if (Array.isArray(val)) { if (Array.isArray(val)) {
@ -9399,7 +9410,7 @@ function parseHTML (html, options) {
/* */ /* */
const onRE = /^@|^v-on:/; const onRE = /^@|^v-on:/;
const dirRE = /^v-|^@|^:|^\./; const dirRE = /^v-|^@|^:/;
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
const stripParensRE = /^\(|\)$/g; const stripParensRE = /^\(|\)$/g;
@ -9407,7 +9418,6 @@ const dynamicArgRE = /^\[.*\]$/;
const argRE = /:(.*)$/; const argRE = /:(.*)$/;
const bindRE = /^:|^\.|^v-bind:/; const bindRE = /^:|^\.|^v-bind:/;
const propBindRE = /^\./;
const modifierRE = /\.[^.]+/g; const modifierRE = /\.[^.]+/g;
const slotRE = /^v-slot(:|$)|^#/; const slotRE = /^v-slot(:|$)|^#/;
@ -9484,6 +9494,7 @@ function parse (
} }
function closeElement (element) { function closeElement (element) {
trimEndingWhitespace(element);
if (!inVPre && !element.processed) { if (!inVPre && !element.processed) {
element = processElement(element, options); element = processElement(element, options);
} }
@ -9510,14 +9521,25 @@ function parse (
if (currentParent && !element.forbidden) { if (currentParent && !element.forbidden) {
if (element.elseif || element.else) { if (element.elseif || element.else) {
processIfConditions(element, currentParent); processIfConditions(element, currentParent);
} else if (element.slotScope) { // scoped slot
const name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
} else { } else {
if (element.slotScope) {
// scoped slot
// keep it in the children list so that v-else(-if) conditions can
// find it as the prev node.
const name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
}
currentParent.children.push(element); currentParent.children.push(element);
element.parent = currentParent; element.parent = currentParent;
} }
} }
// final children cleanup
// filter out scoped slots
element.children = element.children.filter(c => !(c).slotScope);
// remove trailing whitespace node again
trimEndingWhitespace(element);
// check pre state // check pre state
if (element.pre) { if (element.pre) {
inVPre = false; inVPre = false;
@ -9531,6 +9553,20 @@ function parse (
} }
} }
function trimEndingWhitespace (el) {
// remove trailing whitespace node
if (!inPre) {
let lastNode;
while (
(lastNode = el.children[el.children.length - 1]) &&
lastNode.type === 3 &&
lastNode.text === ' '
) {
el.children.pop();
}
}
}
function checkRootConstraints (el) { function checkRootConstraints (el) {
if (el.tag === 'slot' || el.tag === 'template') { if (el.tag === 'slot' || el.tag === 'template') {
warnOnce( warnOnce(
@ -9645,13 +9681,6 @@ function parse (
end (tag, start, end) { end (tag, start, end) {
const element = stack[stack.length - 1]; const element = stack[stack.length - 1];
if (!inPre) {
// remove trailing whitespace node
const lastNode = element.children[element.children.length - 1];
if (lastNode && lastNode.type === 3 && lastNode.text === ' ') {
element.children.pop();
}
}
// pop stack // pop stack
stack.length -= 1; stack.length -= 1;
currentParent = stack[stack.length - 1]; currentParent = stack[stack.length - 1];
@ -9995,6 +10024,13 @@ function processSlotContent (el) {
el el
); );
} }
if (el.parent && !maybeComponent(el.parent)) {
warn$2(
`<template v-slot> can only appear at the root level inside ` +
`the receiving the component`,
el
);
}
} }
const { name, dynamic } = getSlotName(slotBinding); const { name, dynamic } = getSlotName(slotBinding);
el.slotTarget = name; el.slotTarget = name;
@ -10030,8 +10066,9 @@ function processSlotContent (el) {
const slots = el.scopedSlots || (el.scopedSlots = {}); const slots = el.scopedSlots || (el.scopedSlots = {});
const { name, dynamic } = getSlotName(slotBinding); const { name, dynamic } = getSlotName(slotBinding);
const slotContainer = slots[name] = createASTElement('template', [], el); const slotContainer = slots[name] = createASTElement('template', [], el);
slotContainer.slotTarget = name;
slotContainer.slotTargetDynamic = dynamic; slotContainer.slotTargetDynamic = dynamic;
slotContainer.children = el.children; slotContainer.children = el.children.filter(c => !(c).slotScope);
slotContainer.slotScope = slotBinding.value || `_`; slotContainer.slotScope = slotBinding.value || `_`;
// remove children as they are returned from scopedSlots now // remove children as they are returned from scopedSlots now
el.children = []; el.children = [];
@ -10098,10 +10135,7 @@ function processAttrs (el) {
// modifiers // modifiers
modifiers = parseModifiers(name.replace(dirRE, '')); modifiers = parseModifiers(name.replace(dirRE, ''));
// support .foo shorthand syntax for the .prop modifier // support .foo shorthand syntax for the .prop modifier
if (propBindRE.test(name)) { if (modifiers) {
(modifiers || (modifiers = {})).prop = true;
name = `.` + name.slice(1).replace(modifierRE, '');
} else if (modifiers) {
name = name.replace(modifierRE, ''); name = name.replace(modifierRE, '');
} }
if (bindRE.test(name)) { // v-bind if (bindRE.test(name)) { // v-bind
@ -11084,46 +11118,33 @@ function genScopedSlots (
slots, slots,
state state
) { ) {
const hasDynamicKeys = Object.keys(slots).some(key => slots[key].slotTargetDynamic); const hasDynamicKeys = Object.keys(slots).some(key => {
const slot = slots[key];
return slot.slotTargetDynamic || slot.if || slot.for
});
return `scopedSlots:_u([${ return `scopedSlots:_u([${
Object.keys(slots).map(key => { Object.keys(slots).map(key => {
return genScopedSlot(key, slots[key], state) return genScopedSlot(slots[key], state)
}).join(',') }).join(',')
}]${hasDynamicKeys ? `,true` : ``})` }]${hasDynamicKeys ? `,true` : ``})`
} }
function genScopedSlot ( function genScopedSlot (
key,
el, el,
state state
) { ) {
if (el.if && !el.ifProcessed) {
return genIf(el, state, genScopedSlot, `null`)
}
if (el.for && !el.forProcessed) { if (el.for && !el.forProcessed) {
return genForScopedSlot(key, el, state) return genFor(el, state, genScopedSlot)
} }
const fn = `function(${String(el.slotScope)}){` + const fn = `function(${String(el.slotScope)}){` +
`return ${el.tag === 'template' `return ${el.tag === 'template'
? el.if ? genChildren(el, state) || 'undefined'
? `(${el.if})?${genChildren(el, state) || 'undefined'}:undefined`
: genChildren(el, state) || 'undefined'
: genElement(el, state) : genElement(el, state)
}}`; }}`;
return `{key:${key},fn:${fn}}` return `{key:${el.slotTarget || `"default"`},fn:${fn}}`
}
function genForScopedSlot (
key,
el,
state
) {
const exp = el.for;
const alias = el.alias;
const iterator1 = el.iterator1 ? `,${el.iterator1}` : '';
const iterator2 = el.iterator2 ? `,${el.iterator2}` : '';
el.forProcessed = true; // avoid recursion
return `_l((${exp}),` +
`function(${alias}${iterator1}${iterator2}){` +
`return ${genScopedSlot(key, el, state)}` +
'})'
} }
function genChildren ( function genChildren (

File diff suppressed because one or more lines are too long

115
dist/vue.esm.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Vue.js v2.6.0-beta.3 * Vue.js v2.6.0
* (c) 2014-2019 Evan You * (c) 2014-2019 Evan You
* Released under the MIT License. * Released under the MIT License.
*/ */
@ -2758,7 +2758,7 @@ function resolveScopedSlots (
var slot = fns[i]; var slot = fns[i];
if (Array.isArray(slot)) { if (Array.isArray(slot)) {
resolveScopedSlots(slot, hasDynamicKeys, res); resolveScopedSlots(slot, hasDynamicKeys, res);
} else { } else if (slot) {
res[slot.key] = slot.fn; res[slot.key] = slot.fn;
} }
} }
@ -3912,7 +3912,7 @@ function normalizeScopedSlots (
} }
} }
res._normalized = true; res._normalized = true;
res.$stable = slots && slots.$stable; res.$stable = slots ? slots.$stable : true;
return res return res
} }
@ -5339,7 +5339,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
value: FunctionalRenderContext value: FunctionalRenderContext
}); });
Vue.version = '2.6.0-beta.3'; Vue.version = '2.6.0';
/* */ /* */
@ -5360,6 +5360,17 @@ var mustUseProp = function (tag, type, attr) {
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
var convertEnumeratedValue = function (key, value) {
return isFalsyAttrValue(value) || value === 'false'
? 'false'
// allow arbitrary string value for contenteditable
: key === 'contenteditable' && isValidContentEditableValue(value)
? value
: 'true'
};
var isBooleanAttr = makeMap( var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
@ -6629,7 +6640,7 @@ function setAttr (el, key, value) {
el.setAttribute(key, value); el.setAttribute(key, value);
} }
} else if (isEnumeratedAttr(key)) { } else if (isEnumeratedAttr(key)) {
el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true'); el.setAttribute(key, convertEnumeratedValue(key, value));
} else if (isXlink(key)) { } else if (isXlink(key)) {
if (isFalsyAttrValue(value)) { if (isFalsyAttrValue(value)) {
el.removeAttributeNS(xlinkNS, getXlinkProp(key)); el.removeAttributeNS(xlinkNS, getXlinkProp(key));
@ -7644,7 +7655,7 @@ var setProp = function (el, name, val) {
if (cssVarRE.test(name)) { if (cssVarRE.test(name)) {
el.style.setProperty(name, val); el.style.setProperty(name, val);
} else if (importantRE.test(val)) { } else if (importantRE.test(val)) {
el.style.setProperty(name, val.replace(importantRE, ''), 'important'); el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
} else { } else {
var normalizedName = normalize(name); var normalizedName = normalize(name);
if (Array.isArray(val)) { if (Array.isArray(val)) {
@ -9409,7 +9420,7 @@ function parseHTML (html, options) {
/* */ /* */
var onRE = /^@|^v-on:/; var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^\./; var dirRE = /^v-|^@|^:/;
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
var stripParensRE = /^\(|\)$/g; var stripParensRE = /^\(|\)$/g;
@ -9417,7 +9428,6 @@ var dynamicArgRE = /^\[.*\]$/;
var argRE = /:(.*)$/; var argRE = /:(.*)$/;
var bindRE = /^:|^\.|^v-bind:/; var bindRE = /^:|^\.|^v-bind:/;
var propBindRE = /^\./;
var modifierRE = /\.[^.]+/g; var modifierRE = /\.[^.]+/g;
var slotRE = /^v-slot(:|$)|^#/; var slotRE = /^v-slot(:|$)|^#/;
@ -9494,6 +9504,7 @@ function parse (
} }
function closeElement (element) { function closeElement (element) {
trimEndingWhitespace(element);
if (!inVPre && !element.processed) { if (!inVPre && !element.processed) {
element = processElement(element, options); element = processElement(element, options);
} }
@ -9520,14 +9531,25 @@ function parse (
if (currentParent && !element.forbidden) { if (currentParent && !element.forbidden) {
if (element.elseif || element.else) { if (element.elseif || element.else) {
processIfConditions(element, currentParent); processIfConditions(element, currentParent);
} else if (element.slotScope) { // scoped slot
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
} else { } else {
if (element.slotScope) {
// scoped slot
// keep it in the children list so that v-else(-if) conditions can
// find it as the prev node.
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
}
currentParent.children.push(element); currentParent.children.push(element);
element.parent = currentParent; element.parent = currentParent;
} }
} }
// final children cleanup
// filter out scoped slots
element.children = element.children.filter(function (c) { return !(c).slotScope; });
// remove trailing whitespace node again
trimEndingWhitespace(element);
// check pre state // check pre state
if (element.pre) { if (element.pre) {
inVPre = false; inVPre = false;
@ -9541,6 +9563,20 @@ function parse (
} }
} }
function trimEndingWhitespace (el) {
// remove trailing whitespace node
if (!inPre) {
var lastNode;
while (
(lastNode = el.children[el.children.length - 1]) &&
lastNode.type === 3 &&
lastNode.text === ' '
) {
el.children.pop();
}
}
}
function checkRootConstraints (el) { function checkRootConstraints (el) {
if (el.tag === 'slot' || el.tag === 'template') { if (el.tag === 'slot' || el.tag === 'template') {
warnOnce( warnOnce(
@ -9655,13 +9691,6 @@ function parse (
end: function end (tag, start, end$1) { end: function end (tag, start, end$1) {
var element = stack[stack.length - 1]; var element = stack[stack.length - 1];
if (!inPre) {
// remove trailing whitespace node
var lastNode = element.children[element.children.length - 1];
if (lastNode && lastNode.type === 3 && lastNode.text === ' ') {
element.children.pop();
}
}
// pop stack // pop stack
stack.length -= 1; stack.length -= 1;
currentParent = stack[stack.length - 1]; currentParent = stack[stack.length - 1];
@ -10005,6 +10034,13 @@ function processSlotContent (el) {
el el
); );
} }
if (el.parent && !maybeComponent(el.parent)) {
warn$2(
"<template v-slot> can only appear at the root level inside " +
"the receiving the component",
el
);
}
} }
var ref = getSlotName(slotBinding); var ref = getSlotName(slotBinding);
var name = ref.name; var name = ref.name;
@ -10044,8 +10080,9 @@ function processSlotContent (el) {
var name$1 = ref$1.name; var name$1 = ref$1.name;
var dynamic$1 = ref$1.dynamic; var dynamic$1 = ref$1.dynamic;
var slotContainer = slots[name$1] = createASTElement('template', [], el); var slotContainer = slots[name$1] = createASTElement('template', [], el);
slotContainer.slotTarget = name$1;
slotContainer.slotTargetDynamic = dynamic$1; slotContainer.slotTargetDynamic = dynamic$1;
slotContainer.children = el.children; slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; });
slotContainer.slotScope = slotBinding$1.value || "_"; slotContainer.slotScope = slotBinding$1.value || "_";
// remove children as they are returned from scopedSlots now // remove children as they are returned from scopedSlots now
el.children = []; el.children = [];
@ -10112,10 +10149,7 @@ function processAttrs (el) {
// modifiers // modifiers
modifiers = parseModifiers(name.replace(dirRE, '')); modifiers = parseModifiers(name.replace(dirRE, ''));
// support .foo shorthand syntax for the .prop modifier // support .foo shorthand syntax for the .prop modifier
if (propBindRE.test(name)) { if (modifiers) {
(modifiers || (modifiers = {})).prop = true;
name = "." + name.slice(1).replace(modifierRE, '');
} else if (modifiers) {
name = name.replace(modifierRE, ''); name = name.replace(modifierRE, '');
} }
if (bindRE.test(name)) { // v-bind if (bindRE.test(name)) { // v-bind
@ -11057,43 +11091,30 @@ function genScopedSlots (
slots, slots,
state state
) { ) {
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; }); var hasDynamicKeys = Object.keys(slots).some(function (key) {
var slot = slots[key];
return slot.slotTargetDynamic || slot.if || slot.for
});
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
return genScopedSlot(key, slots[key], state) return genScopedSlot(slots[key], state)
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")") }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
} }
function genScopedSlot ( function genScopedSlot (
key,
el, el,
state state
) { ) {
if (el.if && !el.ifProcessed) {
return genIf(el, state, genScopedSlot, "null")
}
if (el.for && !el.forProcessed) { if (el.for && !el.forProcessed) {
return genForScopedSlot(key, el, state) return genFor(el, state, genScopedSlot)
} }
var fn = "function(" + (String(el.slotScope)) + "){" + var fn = "function(" + (String(el.slotScope)) + "){" +
"return " + (el.tag === 'template' "return " + (el.tag === 'template'
? el.if ? genChildren(el, state) || 'undefined'
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
: genChildren(el, state) || 'undefined'
: genElement(el, state)) + "}"; : genElement(el, state)) + "}";
return ("{key:" + key + ",fn:" + fn + "}") return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + "}")
}
function genForScopedSlot (
key,
el,
state
) {
var exp = el.for;
var alias = el.alias;
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
el.forProcessed = true; // avoid recursion
return "_l((" + exp + ")," +
"function(" + alias + iterator1 + iterator2 + "){" +
"return " + (genScopedSlot(key, el, state)) +
'})'
} }
function genChildren ( function genChildren (

115
dist/vue.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Vue.js v2.6.0-beta.3 * Vue.js v2.6.0
* (c) 2014-2019 Evan You * (c) 2014-2019 Evan You
* Released under the MIT License. * Released under the MIT License.
*/ */
@ -2756,7 +2756,7 @@
var slot = fns[i]; var slot = fns[i];
if (Array.isArray(slot)) { if (Array.isArray(slot)) {
resolveScopedSlots(slot, hasDynamicKeys, res); resolveScopedSlots(slot, hasDynamicKeys, res);
} else { } else if (slot) {
res[slot.key] = slot.fn; res[slot.key] = slot.fn;
} }
} }
@ -3903,7 +3903,7 @@
} }
} }
res._normalized = true; res._normalized = true;
res.$stable = slots && slots.$stable; res.$stable = slots ? slots.$stable : true;
return res return res
} }
@ -5323,7 +5323,7 @@
value: FunctionalRenderContext value: FunctionalRenderContext
}); });
Vue.version = '2.6.0-beta.3'; Vue.version = '2.6.0';
/* */ /* */
@ -5344,6 +5344,17 @@
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
var convertEnumeratedValue = function (key, value) {
return isFalsyAttrValue(value) || value === 'false'
? 'false'
// allow arbitrary string value for contenteditable
: key === 'contenteditable' && isValidContentEditableValue(value)
? value
: 'true'
};
var isBooleanAttr = makeMap( var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
@ -6611,7 +6622,7 @@
el.setAttribute(key, value); el.setAttribute(key, value);
} }
} else if (isEnumeratedAttr(key)) { } else if (isEnumeratedAttr(key)) {
el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true'); el.setAttribute(key, convertEnumeratedValue(key, value));
} else if (isXlink(key)) { } else if (isXlink(key)) {
if (isFalsyAttrValue(value)) { if (isFalsyAttrValue(value)) {
el.removeAttributeNS(xlinkNS, getXlinkProp(key)); el.removeAttributeNS(xlinkNS, getXlinkProp(key));
@ -7626,7 +7637,7 @@
if (cssVarRE.test(name)) { if (cssVarRE.test(name)) {
el.style.setProperty(name, val); el.style.setProperty(name, val);
} else if (importantRE.test(val)) { } else if (importantRE.test(val)) {
el.style.setProperty(name, val.replace(importantRE, ''), 'important'); el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
} else { } else {
var normalizedName = normalize(name); var normalizedName = normalize(name);
if (Array.isArray(val)) { if (Array.isArray(val)) {
@ -9384,7 +9395,7 @@
/* */ /* */
var onRE = /^@|^v-on:/; var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^\./; var dirRE = /^v-|^@|^:/;
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
var stripParensRE = /^\(|\)$/g; var stripParensRE = /^\(|\)$/g;
@ -9392,7 +9403,6 @@
var argRE = /:(.*)$/; var argRE = /:(.*)$/;
var bindRE = /^:|^\.|^v-bind:/; var bindRE = /^:|^\.|^v-bind:/;
var propBindRE = /^\./;
var modifierRE = /\.[^.]+/g; var modifierRE = /\.[^.]+/g;
var slotRE = /^v-slot(:|$)|^#/; var slotRE = /^v-slot(:|$)|^#/;
@ -9469,6 +9479,7 @@
} }
function closeElement (element) { function closeElement (element) {
trimEndingWhitespace(element);
if (!inVPre && !element.processed) { if (!inVPre && !element.processed) {
element = processElement(element, options); element = processElement(element, options);
} }
@ -9495,14 +9506,25 @@
if (currentParent && !element.forbidden) { if (currentParent && !element.forbidden) {
if (element.elseif || element.else) { if (element.elseif || element.else) {
processIfConditions(element, currentParent); processIfConditions(element, currentParent);
} else if (element.slotScope) { // scoped slot
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
} else { } else {
if (element.slotScope) {
// scoped slot
// keep it in the children list so that v-else(-if) conditions can
// find it as the prev node.
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
}
currentParent.children.push(element); currentParent.children.push(element);
element.parent = currentParent; element.parent = currentParent;
} }
} }
// final children cleanup
// filter out scoped slots
element.children = element.children.filter(function (c) { return !(c).slotScope; });
// remove trailing whitespace node again
trimEndingWhitespace(element);
// check pre state // check pre state
if (element.pre) { if (element.pre) {
inVPre = false; inVPre = false;
@ -9516,6 +9538,20 @@
} }
} }
function trimEndingWhitespace (el) {
// remove trailing whitespace node
if (!inPre) {
var lastNode;
while (
(lastNode = el.children[el.children.length - 1]) &&
lastNode.type === 3 &&
lastNode.text === ' '
) {
el.children.pop();
}
}
}
function checkRootConstraints (el) { function checkRootConstraints (el) {
if (el.tag === 'slot' || el.tag === 'template') { if (el.tag === 'slot' || el.tag === 'template') {
warnOnce( warnOnce(
@ -9630,13 +9666,6 @@
end: function end (tag, start, end$1) { end: function end (tag, start, end$1) {
var element = stack[stack.length - 1]; var element = stack[stack.length - 1];
if (!inPre) {
// remove trailing whitespace node
var lastNode = element.children[element.children.length - 1];
if (lastNode && lastNode.type === 3 && lastNode.text === ' ') {
element.children.pop();
}
}
// pop stack // pop stack
stack.length -= 1; stack.length -= 1;
currentParent = stack[stack.length - 1]; currentParent = stack[stack.length - 1];
@ -9980,6 +10009,13 @@
el el
); );
} }
if (el.parent && !maybeComponent(el.parent)) {
warn$2(
"<template v-slot> can only appear at the root level inside " +
"the receiving the component",
el
);
}
} }
var ref = getSlotName(slotBinding); var ref = getSlotName(slotBinding);
var name = ref.name; var name = ref.name;
@ -10019,8 +10055,9 @@
var name$1 = ref$1.name; var name$1 = ref$1.name;
var dynamic$1 = ref$1.dynamic; var dynamic$1 = ref$1.dynamic;
var slotContainer = slots[name$1] = createASTElement('template', [], el); var slotContainer = slots[name$1] = createASTElement('template', [], el);
slotContainer.slotTarget = name$1;
slotContainer.slotTargetDynamic = dynamic$1; slotContainer.slotTargetDynamic = dynamic$1;
slotContainer.children = el.children; slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; });
slotContainer.slotScope = slotBinding$1.value || "_"; slotContainer.slotScope = slotBinding$1.value || "_";
// remove children as they are returned from scopedSlots now // remove children as they are returned from scopedSlots now
el.children = []; el.children = [];
@ -10087,10 +10124,7 @@
// modifiers // modifiers
modifiers = parseModifiers(name.replace(dirRE, '')); modifiers = parseModifiers(name.replace(dirRE, ''));
// support .foo shorthand syntax for the .prop modifier // support .foo shorthand syntax for the .prop modifier
if (propBindRE.test(name)) { if (modifiers) {
(modifiers || (modifiers = {})).prop = true;
name = "." + name.slice(1).replace(modifierRE, '');
} else if (modifiers) {
name = name.replace(modifierRE, ''); name = name.replace(modifierRE, '');
} }
if (bindRE.test(name)) { // v-bind if (bindRE.test(name)) { // v-bind
@ -11027,43 +11061,30 @@
slots, slots,
state state
) { ) {
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; }); var hasDynamicKeys = Object.keys(slots).some(function (key) {
var slot = slots[key];
return slot.slotTargetDynamic || slot.if || slot.for
});
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
return genScopedSlot(key, slots[key], state) return genScopedSlot(slots[key], state)
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")") }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
} }
function genScopedSlot ( function genScopedSlot (
key,
el, el,
state state
) { ) {
if (el.if && !el.ifProcessed) {
return genIf(el, state, genScopedSlot, "null")
}
if (el.for && !el.forProcessed) { if (el.for && !el.forProcessed) {
return genForScopedSlot(key, el, state) return genFor(el, state, genScopedSlot)
} }
var fn = "function(" + (String(el.slotScope)) + "){" + var fn = "function(" + (String(el.slotScope)) + "){" +
"return " + (el.tag === 'template' "return " + (el.tag === 'template'
? el.if ? genChildren(el, state) || 'undefined'
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
: genChildren(el, state) || 'undefined'
: genElement(el, state)) + "}"; : genElement(el, state)) + "}";
return ("{key:" + key + ",fn:" + fn + "}") return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + "}")
}
function genForScopedSlot (
key,
el,
state
) {
var exp = el.for;
var alias = el.alias;
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
el.forProcessed = true; // avoid recursion
return "_l((" + exp + ")," +
"function(" + alias + iterator1 + iterator2 + "){" +
"return " + (genScopedSlot(key, el, state)) +
'})'
} }
function genChildren ( function genChildren (

4
dist/vue.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Vue.js v2.6.0-beta.3 * Vue.js v2.6.0
* (c) 2014-2019 Evan You * (c) 2014-2019 Evan You
* Released under the MIT License. * Released under the MIT License.
*/ */
@ -2743,7 +2743,7 @@ function resolveScopedSlots (
var slot = fns[i]; var slot = fns[i];
if (Array.isArray(slot)) { if (Array.isArray(slot)) {
resolveScopedSlots(slot, hasDynamicKeys, res); resolveScopedSlots(slot, hasDynamicKeys, res);
} else { } else if (slot) {
res[slot.key] = slot.fn; res[slot.key] = slot.fn;
} }
} }
@ -3890,7 +3890,7 @@ function normalizeScopedSlots (
} }
} }
res._normalized = true; res._normalized = true;
res.$stable = slots && slots.$stable; res.$stable = slots ? slots.$stable : true;
return res return res
} }
@ -5310,7 +5310,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
value: FunctionalRenderContext value: FunctionalRenderContext
}); });
Vue.version = '2.6.0-beta.3'; Vue.version = '2.6.0';
/* */ /* */
@ -5331,6 +5331,17 @@ var mustUseProp = function (tag, type, attr) {
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
var convertEnumeratedValue = function (key, value) {
return isFalsyAttrValue(value) || value === 'false'
? 'false'
// allow arbitrary string value for contenteditable
: key === 'contenteditable' && isValidContentEditableValue(value)
? value
: 'true'
};
var isBooleanAttr = makeMap( var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
@ -6596,7 +6607,7 @@ function setAttr (el, key, value) {
el.setAttribute(key, value); el.setAttribute(key, value);
} }
} else if (isEnumeratedAttr(key)) { } else if (isEnumeratedAttr(key)) {
el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true'); el.setAttribute(key, convertEnumeratedValue(key, value));
} else if (isXlink(key)) { } else if (isXlink(key)) {
if (isFalsyAttrValue(value)) { if (isFalsyAttrValue(value)) {
el.removeAttributeNS(xlinkNS, getXlinkProp(key)); el.removeAttributeNS(xlinkNS, getXlinkProp(key));
@ -6974,7 +6985,7 @@ var setProp = function (el, name, val) {
if (cssVarRE.test(name)) { if (cssVarRE.test(name)) {
el.style.setProperty(name, val); el.style.setProperty(name, val);
} else if (importantRE.test(val)) { } else if (importantRE.test(val)) {
el.style.setProperty(name, val.replace(importantRE, ''), 'important'); el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
} else { } else {
var normalizedName = normalize(name); var normalizedName = normalize(name);
if (Array.isArray(val)) { if (Array.isArray(val)) {

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Vue.js v2.6.0-beta.3 * Vue.js v2.6.0
* (c) 2014-2019 Evan You * (c) 2014-2019 Evan You
* Released under the MIT License. * Released under the MIT License.
*/ */
@ -2749,7 +2749,7 @@ function resolveScopedSlots (
var slot = fns[i]; var slot = fns[i];
if (Array.isArray(slot)) { if (Array.isArray(slot)) {
resolveScopedSlots(slot, hasDynamicKeys, res); resolveScopedSlots(slot, hasDynamicKeys, res);
} else { } else if (slot) {
res[slot.key] = slot.fn; res[slot.key] = slot.fn;
} }
} }
@ -3903,7 +3903,7 @@ function normalizeScopedSlots (
} }
} }
res._normalized = true; res._normalized = true;
res.$stable = slots && slots.$stable; res.$stable = slots ? slots.$stable : true;
return res return res
} }
@ -5330,7 +5330,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
value: FunctionalRenderContext value: FunctionalRenderContext
}); });
Vue.version = '2.6.0-beta.3'; Vue.version = '2.6.0';
/* */ /* */
@ -5351,6 +5351,17 @@ var mustUseProp = function (tag, type, attr) {
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
var convertEnumeratedValue = function (key, value) {
return isFalsyAttrValue(value) || value === 'false'
? 'false'
// allow arbitrary string value for contenteditable
: key === 'contenteditable' && isValidContentEditableValue(value)
? value
: 'true'
};
var isBooleanAttr = makeMap( var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
@ -6618,7 +6629,7 @@ function setAttr (el, key, value) {
el.setAttribute(key, value); el.setAttribute(key, value);
} }
} else if (isEnumeratedAttr(key)) { } else if (isEnumeratedAttr(key)) {
el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true'); el.setAttribute(key, convertEnumeratedValue(key, value));
} else if (isXlink(key)) { } else if (isXlink(key)) {
if (isFalsyAttrValue(value)) { if (isFalsyAttrValue(value)) {
el.removeAttributeNS(xlinkNS, getXlinkProp(key)); el.removeAttributeNS(xlinkNS, getXlinkProp(key));
@ -6996,7 +7007,7 @@ var setProp = function (el, name, val) {
if (cssVarRE.test(name)) { if (cssVarRE.test(name)) {
el.style.setProperty(name, val); el.style.setProperty(name, val);
} else if (importantRE.test(val)) { } else if (importantRE.test(val)) {
el.style.setProperty(name, val.replace(importantRE, ''), 'important'); el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
} else { } else {
var normalizedName = normalize(name); var normalizedName = normalize(name);
if (Array.isArray(val)) { if (Array.isArray(val)) {

23
dist/vue.runtime.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Vue.js v2.6.0-beta.3 * Vue.js v2.6.0
* (c) 2014-2019 Evan You * (c) 2014-2019 Evan You
* Released under the MIT License. * Released under the MIT License.
*/ */
@ -2747,7 +2747,7 @@
var slot = fns[i]; var slot = fns[i];
if (Array.isArray(slot)) { if (Array.isArray(slot)) {
resolveScopedSlots(slot, hasDynamicKeys, res); resolveScopedSlots(slot, hasDynamicKeys, res);
} else { } else if (slot) {
res[slot.key] = slot.fn; res[slot.key] = slot.fn;
} }
} }
@ -3894,7 +3894,7 @@
} }
} }
res._normalized = true; res._normalized = true;
res.$stable = slots && slots.$stable; res.$stable = slots ? slots.$stable : true;
return res return res
} }
@ -5314,7 +5314,7 @@
value: FunctionalRenderContext value: FunctionalRenderContext
}); });
Vue.version = '2.6.0-beta.3'; Vue.version = '2.6.0';
/* */ /* */
@ -5335,6 +5335,17 @@
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
var convertEnumeratedValue = function (key, value) {
return isFalsyAttrValue(value) || value === 'false'
? 'false'
// allow arbitrary string value for contenteditable
: key === 'contenteditable' && isValidContentEditableValue(value)
? value
: 'true'
};
var isBooleanAttr = makeMap( var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
@ -6600,7 +6611,7 @@
el.setAttribute(key, value); el.setAttribute(key, value);
} }
} else if (isEnumeratedAttr(key)) { } else if (isEnumeratedAttr(key)) {
el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true'); el.setAttribute(key, convertEnumeratedValue(key, value));
} else if (isXlink(key)) { } else if (isXlink(key)) {
if (isFalsyAttrValue(value)) { if (isFalsyAttrValue(value)) {
el.removeAttributeNS(xlinkNS, getXlinkProp(key)); el.removeAttributeNS(xlinkNS, getXlinkProp(key));
@ -6978,7 +6989,7 @@
if (cssVarRE.test(name)) { if (cssVarRE.test(name)) {
el.style.setProperty(name, val); el.style.setProperty(name, val);
} else if (importantRE.test(val)) { } else if (importantRE.test(val)) {
el.style.setProperty(name, val.replace(importantRE, ''), 'important'); el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
} else { } else {
var normalizedName = normalize(name); var normalizedName = normalize(name);
if (Array.isArray(val)) { if (Array.isArray(val)) {

File diff suppressed because one or more lines are too long

View File

@ -449,6 +449,17 @@
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
var convertEnumeratedValue = function (key, value) {
return isFalsyAttrValue(value) || value === 'false'
? 'false'
// allow arbitrary string value for contenteditable
: key === 'contenteditable' && isValidContentEditableValue(value)
? value
: 'true'
};
var isBooleanAttr = makeMap( var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
@ -502,7 +513,7 @@
return (" " + key + "=\"" + key + "\"") return (" " + key + "=\"" + key + "\"")
} }
} else if (isEnumeratedAttr(key)) { } else if (isEnumeratedAttr(key)) {
return (" " + key + "=\"" + (isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true') + "\"") return (" " + key + "=\"" + (escape(convertEnumeratedValue(key, value))) + "\"")
} else if (!isFalsyAttrValue(value)) { } else if (!isFalsyAttrValue(value)) {
return (" " + key + "=\"" + (escape(String(value))) + "\"") return (" " + key + "=\"" + (escape(String(value))) + "\"")
} }
@ -3783,7 +3794,7 @@
/* */ /* */
var onRE = /^@|^v-on:/; var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^\./; var dirRE = /^v-|^@|^:/;
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
var stripParensRE = /^\(|\)$/g; var stripParensRE = /^\(|\)$/g;
@ -3791,7 +3802,6 @@
var argRE = /:(.*)$/; var argRE = /:(.*)$/;
var bindRE = /^:|^\.|^v-bind:/; var bindRE = /^:|^\.|^v-bind:/;
var propBindRE = /^\./;
var modifierRE = /\.[^.]+/g; var modifierRE = /\.[^.]+/g;
var slotRE = /^v-slot(:|$)|^#/; var slotRE = /^v-slot(:|$)|^#/;
@ -3868,6 +3878,7 @@
} }
function closeElement (element) { function closeElement (element) {
trimEndingWhitespace(element);
if (!inVPre && !element.processed) { if (!inVPre && !element.processed) {
element = processElement(element, options); element = processElement(element, options);
} }
@ -3894,14 +3905,25 @@
if (currentParent && !element.forbidden) { if (currentParent && !element.forbidden) {
if (element.elseif || element.else) { if (element.elseif || element.else) {
processIfConditions(element, currentParent); processIfConditions(element, currentParent);
} else if (element.slotScope) { // scoped slot
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
} else { } else {
if (element.slotScope) {
// scoped slot
// keep it in the children list so that v-else(-if) conditions can
// find it as the prev node.
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
}
currentParent.children.push(element); currentParent.children.push(element);
element.parent = currentParent; element.parent = currentParent;
} }
} }
// final children cleanup
// filter out scoped slots
element.children = element.children.filter(function (c) { return !(c).slotScope; });
// remove trailing whitespace node again
trimEndingWhitespace(element);
// check pre state // check pre state
if (element.pre) { if (element.pre) {
inVPre = false; inVPre = false;
@ -3915,6 +3937,20 @@
} }
} }
function trimEndingWhitespace (el) {
// remove trailing whitespace node
if (!inPre) {
var lastNode;
while (
(lastNode = el.children[el.children.length - 1]) &&
lastNode.type === 3 &&
lastNode.text === ' '
) {
el.children.pop();
}
}
}
function checkRootConstraints (el) { function checkRootConstraints (el) {
if (el.tag === 'slot' || el.tag === 'template') { if (el.tag === 'slot' || el.tag === 'template') {
warnOnce( warnOnce(
@ -4029,13 +4065,6 @@
end: function end (tag, start, end$1) { end: function end (tag, start, end$1) {
var element = stack[stack.length - 1]; var element = stack[stack.length - 1];
if (!inPre) {
// remove trailing whitespace node
var lastNode = element.children[element.children.length - 1];
if (lastNode && lastNode.type === 3 && lastNode.text === ' ') {
element.children.pop();
}
}
// pop stack // pop stack
stack.length -= 1; stack.length -= 1;
currentParent = stack[stack.length - 1]; currentParent = stack[stack.length - 1];
@ -4379,6 +4408,13 @@
el el
); );
} }
if (el.parent && !maybeComponent(el.parent)) {
warn$1(
"<template v-slot> can only appear at the root level inside " +
"the receiving the component",
el
);
}
} }
var ref = getSlotName(slotBinding); var ref = getSlotName(slotBinding);
var name = ref.name; var name = ref.name;
@ -4418,8 +4454,9 @@
var name$1 = ref$1.name; var name$1 = ref$1.name;
var dynamic$1 = ref$1.dynamic; var dynamic$1 = ref$1.dynamic;
var slotContainer = slots[name$1] = createASTElement('template', [], el); var slotContainer = slots[name$1] = createASTElement('template', [], el);
slotContainer.slotTarget = name$1;
slotContainer.slotTargetDynamic = dynamic$1; slotContainer.slotTargetDynamic = dynamic$1;
slotContainer.children = el.children; slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; });
slotContainer.slotScope = slotBinding$1.value || "_"; slotContainer.slotScope = slotBinding$1.value || "_";
// remove children as they are returned from scopedSlots now // remove children as they are returned from scopedSlots now
el.children = []; el.children = [];
@ -4486,10 +4523,7 @@
// modifiers // modifiers
modifiers = parseModifiers(name.replace(dirRE, '')); modifiers = parseModifiers(name.replace(dirRE, ''));
// support .foo shorthand syntax for the .prop modifier // support .foo shorthand syntax for the .prop modifier
if (propBindRE.test(name)) { if (modifiers) {
(modifiers || (modifiers = {})).prop = true;
name = "." + name.slice(1).replace(modifierRE, '');
} else if (modifiers) {
name = name.replace(modifierRE, ''); name = name.replace(modifierRE, '');
} }
if (bindRE.test(name)) { // v-bind if (bindRE.test(name)) { // v-bind
@ -5465,43 +5499,30 @@
slots, slots,
state state
) { ) {
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; }); var hasDynamicKeys = Object.keys(slots).some(function (key) {
var slot = slots[key];
return slot.slotTargetDynamic || slot.if || slot.for
});
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
return genScopedSlot(key, slots[key], state) return genScopedSlot(slots[key], state)
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")") }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
} }
function genScopedSlot ( function genScopedSlot (
key,
el, el,
state state
) { ) {
if (el.if && !el.ifProcessed) {
return genIf(el, state, genScopedSlot, "null")
}
if (el.for && !el.forProcessed) { if (el.for && !el.forProcessed) {
return genForScopedSlot(key, el, state) return genFor(el, state, genScopedSlot)
} }
var fn = "function(" + (String(el.slotScope)) + "){" + var fn = "function(" + (String(el.slotScope)) + "){" +
"return " + (el.tag === 'template' "return " + (el.tag === 'template'
? el.if ? genChildren(el, state) || 'undefined'
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
: genChildren(el, state) || 'undefined'
: genElement(el, state)) + "}"; : genElement(el, state)) + "}";
return ("{key:" + key + ",fn:" + fn + "}") return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + "}")
}
function genForScopedSlot (
key,
el,
state
) {
var exp = el.for;
var alias = el.alias;
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
el.forProcessed = true; // avoid recursion
return "_l((" + exp + ")," +
"function(" + alias + iterator1 + iterator2 + "){" +
"return " + (genScopedSlot(key, el, state)) +
'})'
} }
function genChildren ( function genChildren (
@ -7146,7 +7167,7 @@
var slot = fns[i]; var slot = fns[i];
if (Array.isArray(slot)) { if (Array.isArray(slot)) {
resolveScopedSlots(slot, hasDynamicKeys, res); resolveScopedSlots(slot, hasDynamicKeys, res);
} else { } else if (slot) {
res[slot.key] = slot.fn; res[slot.key] = slot.fn;
} }
} }
@ -7780,7 +7801,7 @@
} }
} }
res._normalized = true; res._normalized = true;
res.$stable = slots && slots.$stable; res.$stable = slots ? slots.$stable : true;
return res return res
} }

View File

@ -451,6 +451,17 @@ var mustUseProp = function (tag, type, attr) {
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
var convertEnumeratedValue = function (key, value) {
return isFalsyAttrValue(value) || value === 'false'
? 'false'
// allow arbitrary string value for contenteditable
: key === 'contenteditable' && isValidContentEditableValue(value)
? value
: 'true'
};
var isBooleanAttr = makeMap( var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
@ -504,7 +515,7 @@ function renderAttr (key, value) {
return (" " + key + "=\"" + key + "\"") return (" " + key + "=\"" + key + "\"")
} }
} else if (isEnumeratedAttr(key)) { } else if (isEnumeratedAttr(key)) {
return (" " + key + "=\"" + (isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true') + "\"") return (" " + key + "=\"" + (escape(convertEnumeratedValue(key, value))) + "\"")
} else if (!isFalsyAttrValue(value)) { } else if (!isFalsyAttrValue(value)) {
return (" " + key + "=\"" + (escape(String(value))) + "\"") return (" " + key + "=\"" + (escape(String(value))) + "\"")
} }
@ -3533,7 +3544,7 @@ function parseString (chr) {
/* */ /* */
var onRE = /^@|^v-on:/; var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^\./; var dirRE = /^v-|^@|^:/;
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
var stripParensRE = /^\(|\)$/g; var stripParensRE = /^\(|\)$/g;
@ -3541,7 +3552,6 @@ var dynamicArgRE = /^\[.*\]$/;
var argRE = /:(.*)$/; var argRE = /:(.*)$/;
var bindRE = /^:|^\.|^v-bind:/; var bindRE = /^:|^\.|^v-bind:/;
var propBindRE = /^\./;
var modifierRE = /\.[^.]+/g; var modifierRE = /\.[^.]+/g;
var slotRE = /^v-slot(:|$)|^#/; var slotRE = /^v-slot(:|$)|^#/;
@ -3618,6 +3628,7 @@ function parse (
} }
function closeElement (element) { function closeElement (element) {
trimEndingWhitespace(element);
if (!inVPre && !element.processed) { if (!inVPre && !element.processed) {
element = processElement(element, options); element = processElement(element, options);
} }
@ -3644,14 +3655,25 @@ function parse (
if (currentParent && !element.forbidden) { if (currentParent && !element.forbidden) {
if (element.elseif || element.else) { if (element.elseif || element.else) {
processIfConditions(element, currentParent); processIfConditions(element, currentParent);
} else if (element.slotScope) { // scoped slot
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
} else { } else {
if (element.slotScope) {
// scoped slot
// keep it in the children list so that v-else(-if) conditions can
// find it as the prev node.
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
}
currentParent.children.push(element); currentParent.children.push(element);
element.parent = currentParent; element.parent = currentParent;
} }
} }
// final children cleanup
// filter out scoped slots
element.children = element.children.filter(function (c) { return !(c).slotScope; });
// remove trailing whitespace node again
trimEndingWhitespace(element);
// check pre state // check pre state
if (element.pre) { if (element.pre) {
inVPre = false; inVPre = false;
@ -3665,6 +3687,20 @@ function parse (
} }
} }
function trimEndingWhitespace (el) {
// remove trailing whitespace node
if (!inPre) {
var lastNode;
while (
(lastNode = el.children[el.children.length - 1]) &&
lastNode.type === 3 &&
lastNode.text === ' '
) {
el.children.pop();
}
}
}
function checkRootConstraints (el) { function checkRootConstraints (el) {
if (el.tag === 'slot' || el.tag === 'template') { if (el.tag === 'slot' || el.tag === 'template') {
warnOnce( warnOnce(
@ -3779,13 +3815,6 @@ function parse (
end: function end (tag, start, end$1) { end: function end (tag, start, end$1) {
var element = stack[stack.length - 1]; var element = stack[stack.length - 1];
if (!inPre) {
// remove trailing whitespace node
var lastNode = element.children[element.children.length - 1];
if (lastNode && lastNode.type === 3 && lastNode.text === ' ') {
element.children.pop();
}
}
// pop stack // pop stack
stack.length -= 1; stack.length -= 1;
currentParent = stack[stack.length - 1]; currentParent = stack[stack.length - 1];
@ -4129,6 +4158,13 @@ function processSlotContent (el) {
el el
); );
} }
if (el.parent && !maybeComponent(el.parent)) {
warn$1(
"<template v-slot> can only appear at the root level inside " +
"the receiving the component",
el
);
}
} }
var ref = getSlotName(slotBinding); var ref = getSlotName(slotBinding);
var name = ref.name; var name = ref.name;
@ -4168,8 +4204,9 @@ function processSlotContent (el) {
var name$1 = ref$1.name; var name$1 = ref$1.name;
var dynamic$1 = ref$1.dynamic; var dynamic$1 = ref$1.dynamic;
var slotContainer = slots[name$1] = createASTElement('template', [], el); var slotContainer = slots[name$1] = createASTElement('template', [], el);
slotContainer.slotTarget = name$1;
slotContainer.slotTargetDynamic = dynamic$1; slotContainer.slotTargetDynamic = dynamic$1;
slotContainer.children = el.children; slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; });
slotContainer.slotScope = slotBinding$1.value || "_"; slotContainer.slotScope = slotBinding$1.value || "_";
// remove children as they are returned from scopedSlots now // remove children as they are returned from scopedSlots now
el.children = []; el.children = [];
@ -4236,10 +4273,7 @@ function processAttrs (el) {
// modifiers // modifiers
modifiers = parseModifiers(name.replace(dirRE, '')); modifiers = parseModifiers(name.replace(dirRE, ''));
// support .foo shorthand syntax for the .prop modifier // support .foo shorthand syntax for the .prop modifier
if (propBindRE.test(name)) { if (modifiers) {
(modifiers || (modifiers = {})).prop = true;
name = "." + name.slice(1).replace(modifierRE, '');
} else if (modifiers) {
name = name.replace(modifierRE, ''); name = name.replace(modifierRE, '');
} }
if (bindRE.test(name)) { // v-bind if (bindRE.test(name)) { // v-bind
@ -5215,43 +5249,30 @@ function genScopedSlots (
slots, slots,
state state
) { ) {
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; }); var hasDynamicKeys = Object.keys(slots).some(function (key) {
var slot = slots[key];
return slot.slotTargetDynamic || slot.if || slot.for
});
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
return genScopedSlot(key, slots[key], state) return genScopedSlot(slots[key], state)
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")") }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
} }
function genScopedSlot ( function genScopedSlot (
key,
el, el,
state state
) { ) {
if (el.if && !el.ifProcessed) {
return genIf(el, state, genScopedSlot, "null")
}
if (el.for && !el.forProcessed) { if (el.for && !el.forProcessed) {
return genForScopedSlot(key, el, state) return genFor(el, state, genScopedSlot)
} }
var fn = "function(" + (String(el.slotScope)) + "){" + var fn = "function(" + (String(el.slotScope)) + "){" +
"return " + (el.tag === 'template' "return " + (el.tag === 'template'
? el.if ? genChildren(el, state) || 'undefined'
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
: genChildren(el, state) || 'undefined'
: genElement(el, state)) + "}"; : genElement(el, state)) + "}";
return ("{key:" + key + ",fn:" + fn + "}") return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + "}")
}
function genForScopedSlot (
key,
el,
state
) {
var exp = el.for;
var alias = el.alias;
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
el.forProcessed = true; // avoid recursion
return "_l((" + exp + ")," +
"function(" + alias + iterator1 + iterator2 + "){" +
"return " + (genScopedSlot(key, el, state)) +
'})'
} }
function genChildren ( function genChildren (
@ -6896,7 +6917,7 @@ function resolveScopedSlots (
var slot = fns[i]; var slot = fns[i];
if (Array.isArray(slot)) { if (Array.isArray(slot)) {
resolveScopedSlots(slot, hasDynamicKeys, res); resolveScopedSlots(slot, hasDynamicKeys, res);
} else { } else if (slot) {
res[slot.key] = slot.fn; res[slot.key] = slot.fn;
} }
} }
@ -7530,7 +7551,7 @@ function normalizeScopedSlots (
} }
} }
res._normalized = true; res._normalized = true;
res.$stable = slots && slots.$stable; res.$stable = slots ? slots.$stable : true;
return res return res
} }

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "vue-server-renderer", "name": "vue-server-renderer",
"version": "2.6.0-beta.3", "version": "2.6.0",
"description": "server renderer for Vue 2.0", "description": "server renderer for Vue 2.0",
"main": "index.js", "main": "index.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",

View File

@ -1694,6 +1694,8 @@
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
var isBooleanAttr = makeMap( var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
@ -2725,7 +2727,7 @@
/* */ /* */
var onRE = /^@|^v-on:/; var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^\./; var dirRE = /^v-|^@|^:/;
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
var stripParensRE = /^\(|\)$/g; var stripParensRE = /^\(|\)$/g;
@ -2733,7 +2735,6 @@
var argRE = /:(.*)$/; var argRE = /:(.*)$/;
var bindRE = /^:|^\.|^v-bind:/; var bindRE = /^:|^\.|^v-bind:/;
var propBindRE = /^\./;
var modifierRE = /\.[^.]+/g; var modifierRE = /\.[^.]+/g;
var slotRE = /^v-slot(:|$)|^#/; var slotRE = /^v-slot(:|$)|^#/;
@ -2810,6 +2811,7 @@
} }
function closeElement (element) { function closeElement (element) {
trimEndingWhitespace(element);
if (!inVPre && !element.processed) { if (!inVPre && !element.processed) {
element = processElement(element, options); element = processElement(element, options);
} }
@ -2836,14 +2838,25 @@
if (currentParent && !element.forbidden) { if (currentParent && !element.forbidden) {
if (element.elseif || element.else) { if (element.elseif || element.else) {
processIfConditions(element, currentParent); processIfConditions(element, currentParent);
} else if (element.slotScope) { // scoped slot
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
} else { } else {
if (element.slotScope) {
// scoped slot
// keep it in the children list so that v-else(-if) conditions can
// find it as the prev node.
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
}
currentParent.children.push(element); currentParent.children.push(element);
element.parent = currentParent; element.parent = currentParent;
} }
} }
// final children cleanup
// filter out scoped slots
element.children = element.children.filter(function (c) { return !(c).slotScope; });
// remove trailing whitespace node again
trimEndingWhitespace(element);
// check pre state // check pre state
if (element.pre) { if (element.pre) {
inVPre = false; inVPre = false;
@ -2857,6 +2870,20 @@
} }
} }
function trimEndingWhitespace (el) {
// remove trailing whitespace node
if (!inPre) {
var lastNode;
while (
(lastNode = el.children[el.children.length - 1]) &&
lastNode.type === 3 &&
lastNode.text === ' '
) {
el.children.pop();
}
}
}
function checkRootConstraints (el) { function checkRootConstraints (el) {
if (el.tag === 'slot' || el.tag === 'template') { if (el.tag === 'slot' || el.tag === 'template') {
warnOnce( warnOnce(
@ -2971,13 +2998,6 @@
end: function end (tag, start, end$1) { end: function end (tag, start, end$1) {
var element = stack[stack.length - 1]; var element = stack[stack.length - 1];
if (!inPre) {
// remove trailing whitespace node
var lastNode = element.children[element.children.length - 1];
if (lastNode && lastNode.type === 3 && lastNode.text === ' ') {
element.children.pop();
}
}
// pop stack // pop stack
stack.length -= 1; stack.length -= 1;
currentParent = stack[stack.length - 1]; currentParent = stack[stack.length - 1];
@ -3321,6 +3341,13 @@
el el
); );
} }
if (el.parent && !maybeComponent(el.parent)) {
warn$1(
"<template v-slot> can only appear at the root level inside " +
"the receiving the component",
el
);
}
} }
var ref = getSlotName(slotBinding); var ref = getSlotName(slotBinding);
var name = ref.name; var name = ref.name;
@ -3360,8 +3387,9 @@
var name$1 = ref$1.name; var name$1 = ref$1.name;
var dynamic$1 = ref$1.dynamic; var dynamic$1 = ref$1.dynamic;
var slotContainer = slots[name$1] = createASTElement('template', [], el); var slotContainer = slots[name$1] = createASTElement('template', [], el);
slotContainer.slotTarget = name$1;
slotContainer.slotTargetDynamic = dynamic$1; slotContainer.slotTargetDynamic = dynamic$1;
slotContainer.children = el.children; slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; });
slotContainer.slotScope = slotBinding$1.value || "_"; slotContainer.slotScope = slotBinding$1.value || "_";
// remove children as they are returned from scopedSlots now // remove children as they are returned from scopedSlots now
el.children = []; el.children = [];
@ -3428,10 +3456,7 @@
// modifiers // modifiers
modifiers = parseModifiers(name.replace(dirRE, '')); modifiers = parseModifiers(name.replace(dirRE, ''));
// support .foo shorthand syntax for the .prop modifier // support .foo shorthand syntax for the .prop modifier
if (propBindRE.test(name)) { if (modifiers) {
(modifiers || (modifiers = {})).prop = true;
name = "." + name.slice(1).replace(modifierRE, '');
} else if (modifiers) {
name = name.replace(modifierRE, ''); name = name.replace(modifierRE, '');
} }
if (bindRE.test(name)) { // v-bind if (bindRE.test(name)) { // v-bind
@ -4534,43 +4559,30 @@
slots, slots,
state state
) { ) {
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; }); var hasDynamicKeys = Object.keys(slots).some(function (key) {
var slot = slots[key];
return slot.slotTargetDynamic || slot.if || slot.for
});
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
return genScopedSlot(key, slots[key], state) return genScopedSlot(slots[key], state)
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")") }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
} }
function genScopedSlot ( function genScopedSlot (
key,
el, el,
state state
) { ) {
if (el.if && !el.ifProcessed) {
return genIf(el, state, genScopedSlot, "null")
}
if (el.for && !el.forProcessed) { if (el.for && !el.forProcessed) {
return genForScopedSlot(key, el, state) return genFor(el, state, genScopedSlot)
} }
var fn = "function(" + (String(el.slotScope)) + "){" + var fn = "function(" + (String(el.slotScope)) + "){" +
"return " + (el.tag === 'template' "return " + (el.tag === 'template'
? el.if ? genChildren(el, state) || 'undefined'
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
: genChildren(el, state) || 'undefined'
: genElement(el, state)) + "}"; : genElement(el, state)) + "}";
return ("{key:" + key + ",fn:" + fn + "}") return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + "}")
}
function genForScopedSlot (
key,
el,
state
) {
var exp = el.for;
var alias = el.alias;
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
el.forProcessed = true; // avoid recursion
return "_l((" + exp + ")," +
"function(" + alias + iterator1 + iterator2 + "){" +
"return " + (genScopedSlot(key, el, state)) +
'})'
} }
function genChildren ( function genChildren (

View File

@ -1659,6 +1659,8 @@ var mustUseProp = function (tag, type, attr) {
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
var isBooleanAttr = makeMap( var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
@ -2345,7 +2347,7 @@ function parseString (chr) {
/* */ /* */
var onRE = /^@|^v-on:/; var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^\./; var dirRE = /^v-|^@|^:/;
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
var stripParensRE = /^\(|\)$/g; var stripParensRE = /^\(|\)$/g;
@ -2353,7 +2355,6 @@ var dynamicArgRE = /^\[.*\]$/;
var argRE = /:(.*)$/; var argRE = /:(.*)$/;
var bindRE = /^:|^\.|^v-bind:/; var bindRE = /^:|^\.|^v-bind:/;
var propBindRE = /^\./;
var modifierRE = /\.[^.]+/g; var modifierRE = /\.[^.]+/g;
var slotRE = /^v-slot(:|$)|^#/; var slotRE = /^v-slot(:|$)|^#/;
@ -2430,6 +2431,7 @@ function parse (
} }
function closeElement (element) { function closeElement (element) {
trimEndingWhitespace(element);
if (!inVPre && !element.processed) { if (!inVPre && !element.processed) {
element = processElement(element, options); element = processElement(element, options);
} }
@ -2456,14 +2458,25 @@ function parse (
if (currentParent && !element.forbidden) { if (currentParent && !element.forbidden) {
if (element.elseif || element.else) { if (element.elseif || element.else) {
processIfConditions(element, currentParent); processIfConditions(element, currentParent);
} else if (element.slotScope) { // scoped slot
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
} else { } else {
if (element.slotScope) {
// scoped slot
// keep it in the children list so that v-else(-if) conditions can
// find it as the prev node.
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
}
currentParent.children.push(element); currentParent.children.push(element);
element.parent = currentParent; element.parent = currentParent;
} }
} }
// final children cleanup
// filter out scoped slots
element.children = element.children.filter(function (c) { return !(c).slotScope; });
// remove trailing whitespace node again
trimEndingWhitespace(element);
// check pre state // check pre state
if (element.pre) { if (element.pre) {
inVPre = false; inVPre = false;
@ -2477,6 +2490,20 @@ function parse (
} }
} }
function trimEndingWhitespace (el) {
// remove trailing whitespace node
if (!inPre) {
var lastNode;
while (
(lastNode = el.children[el.children.length - 1]) &&
lastNode.type === 3 &&
lastNode.text === ' '
) {
el.children.pop();
}
}
}
function checkRootConstraints (el) { function checkRootConstraints (el) {
if (el.tag === 'slot' || el.tag === 'template') { if (el.tag === 'slot' || el.tag === 'template') {
warnOnce( warnOnce(
@ -2591,13 +2618,6 @@ function parse (
end: function end (tag, start, end$1) { end: function end (tag, start, end$1) {
var element = stack[stack.length - 1]; var element = stack[stack.length - 1];
if (!inPre) {
// remove trailing whitespace node
var lastNode = element.children[element.children.length - 1];
if (lastNode && lastNode.type === 3 && lastNode.text === ' ') {
element.children.pop();
}
}
// pop stack // pop stack
stack.length -= 1; stack.length -= 1;
currentParent = stack[stack.length - 1]; currentParent = stack[stack.length - 1];
@ -2941,6 +2961,13 @@ function processSlotContent (el) {
el el
); );
} }
if (el.parent && !maybeComponent(el.parent)) {
warn$1(
"<template v-slot> can only appear at the root level inside " +
"the receiving the component",
el
);
}
} }
var ref = getSlotName(slotBinding); var ref = getSlotName(slotBinding);
var name = ref.name; var name = ref.name;
@ -2980,8 +3007,9 @@ function processSlotContent (el) {
var name$1 = ref$1.name; var name$1 = ref$1.name;
var dynamic$1 = ref$1.dynamic; var dynamic$1 = ref$1.dynamic;
var slotContainer = slots[name$1] = createASTElement('template', [], el); var slotContainer = slots[name$1] = createASTElement('template', [], el);
slotContainer.slotTarget = name$1;
slotContainer.slotTargetDynamic = dynamic$1; slotContainer.slotTargetDynamic = dynamic$1;
slotContainer.children = el.children; slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; });
slotContainer.slotScope = slotBinding$1.value || "_"; slotContainer.slotScope = slotBinding$1.value || "_";
// remove children as they are returned from scopedSlots now // remove children as they are returned from scopedSlots now
el.children = []; el.children = [];
@ -3048,10 +3076,7 @@ function processAttrs (el) {
// modifiers // modifiers
modifiers = parseModifiers(name.replace(dirRE, '')); modifiers = parseModifiers(name.replace(dirRE, ''));
// support .foo shorthand syntax for the .prop modifier // support .foo shorthand syntax for the .prop modifier
if (propBindRE.test(name)) { if (modifiers) {
(modifiers || (modifiers = {})).prop = true;
name = "." + name.slice(1).replace(modifierRE, '');
} else if (modifiers) {
name = name.replace(modifierRE, ''); name = name.replace(modifierRE, '');
} }
if (bindRE.test(name)) { // v-bind if (bindRE.test(name)) { // v-bind
@ -4167,43 +4192,30 @@ function genScopedSlots (
slots, slots,
state state
) { ) {
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; }); var hasDynamicKeys = Object.keys(slots).some(function (key) {
var slot = slots[key];
return slot.slotTargetDynamic || slot.if || slot.for
});
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
return genScopedSlot(key, slots[key], state) return genScopedSlot(slots[key], state)
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")") }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
} }
function genScopedSlot ( function genScopedSlot (
key,
el, el,
state state
) { ) {
if (el.if && !el.ifProcessed) {
return genIf(el, state, genScopedSlot, "null")
}
if (el.for && !el.forProcessed) { if (el.for && !el.forProcessed) {
return genForScopedSlot(key, el, state) return genFor(el, state, genScopedSlot)
} }
var fn = "function(" + (String(el.slotScope)) + "){" + var fn = "function(" + (String(el.slotScope)) + "){" +
"return " + (el.tag === 'template' "return " + (el.tag === 'template'
? el.if ? genChildren(el, state) || 'undefined'
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
: genChildren(el, state) || 'undefined'
: genElement(el, state)) + "}"; : genElement(el, state)) + "}";
return ("{key:" + key + ",fn:" + fn + "}") return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + "}")
}
function genForScopedSlot (
key,
el,
state
) {
var exp = el.for;
var alias = el.alias;
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
el.forProcessed = true; // avoid recursion
return "_l((" + exp + ")," +
"function(" + alias + iterator1 + iterator2 + "){" +
"return " + (genScopedSlot(key, el, state)) +
'})'
} }
function genChildren ( function genChildren (

View File

@ -1,6 +1,6 @@
{ {
"name": "vue-template-compiler", "name": "vue-template-compiler",
"version": "2.6.0-beta.3", "version": "2.6.0",
"description": "template compiler for Vue 2.0", "description": "template compiler for Vue 2.0",
"main": "index.js", "main": "index.js",
"unpkg": "browser.js", "unpkg": "browser.js",