@vue/compiler-dom 3.6.0-rc.5 → 3.6.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler-dom.cjs.js +50 -50
- package/dist/compiler-dom.cjs.prod.js +49 -49
- package/dist/compiler-dom.d.ts +10 -11
- package/dist/compiler-dom.esm-browser.js +210 -200
- package/dist/compiler-dom.esm-browser.prod.js +5 -5
- package/dist/compiler-dom.esm-bundler.js +49 -49
- package/dist/compiler-dom.global.js +210 -200
- package/dist/compiler-dom.global.prod.js +5 -5
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-dom v3.6.0-rc.7
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -13,7 +13,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
13
13
|
* \/\*#\_\_PURE\_\_\*\/
|
|
14
14
|
* So that they can be tree-shaken if necessary.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
17
17
|
function makeMap(str) {
|
|
18
18
|
const map = Object.create(null);
|
|
19
19
|
for (const key of str.split(",")) map[key] = 1;
|
|
@@ -34,8 +34,8 @@ var VueCompilerDOM = (function(exports) {
|
|
|
34
34
|
const isString = (val) => typeof val === "string";
|
|
35
35
|
const isSymbol = (val) => typeof val === "symbol";
|
|
36
36
|
const isObject = (val) => val !== null && typeof val === "object";
|
|
37
|
-
const isReservedProp =
|
|
38
|
-
const isBuiltInDirective =
|
|
37
|
+
const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
|
|
38
|
+
const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
|
|
39
39
|
const cacheStringFunction = (fn) => {
|
|
40
40
|
const cache = Object.create(null);
|
|
41
41
|
return ((str) => {
|
|
@@ -163,22 +163,22 @@ var VueCompilerDOM = (function(exports) {
|
|
|
163
163
|
* Compiler only.
|
|
164
164
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
165
165
|
*/
|
|
166
|
-
const isHTMLTag =
|
|
166
|
+
const isHTMLTag = /*@__PURE__*/ makeMap(HTML_TAGS);
|
|
167
167
|
/**
|
|
168
168
|
* Compiler only.
|
|
169
169
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
170
170
|
*/
|
|
171
|
-
const isSVGTag =
|
|
171
|
+
const isSVGTag = /*@__PURE__*/ makeMap(SVG_TAGS);
|
|
172
172
|
/**
|
|
173
173
|
* Compiler only.
|
|
174
174
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
175
175
|
*/
|
|
176
|
-
const isMathMLTag =
|
|
176
|
+
const isMathMLTag = /*@__PURE__*/ makeMap(MATH_TAGS);
|
|
177
177
|
/**
|
|
178
178
|
* Compiler only.
|
|
179
179
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
180
180
|
*/
|
|
181
|
-
const isVoidTag =
|
|
181
|
+
const isVoidTag = /*@__PURE__*/ makeMap(VOID_TAGS);
|
|
182
182
|
//#endregion
|
|
183
183
|
//#region packages/compiler-core/src/runtimeHelpers.ts
|
|
184
184
|
const FRAGMENT = Symbol(`Fragment`);
|
|
@@ -723,13 +723,14 @@ var VueCompilerDOM = (function(exports) {
|
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
725
|
stateInterpolationOpen(c) {
|
|
726
|
-
if (c === this.delimiterOpen[this.delimiterIndex])
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
726
|
+
if (c === this.delimiterOpen[this.delimiterIndex]) {
|
|
727
|
+
if (this.delimiterIndex === this.delimiterOpen.length - 1) {
|
|
728
|
+
const start = this.index + 1 - this.delimiterOpen.length;
|
|
729
|
+
if (start > this.sectionStart) this.cbs.ontext(this.sectionStart, start);
|
|
730
|
+
this.state = 3;
|
|
731
|
+
this.sectionStart = start;
|
|
732
|
+
} else this.delimiterIndex++;
|
|
733
|
+
} else if (this.inRCDATA) {
|
|
733
734
|
this.state = 32;
|
|
734
735
|
this.stateInRCDATA(c);
|
|
735
736
|
} else {
|
|
@@ -745,13 +746,14 @@ var VueCompilerDOM = (function(exports) {
|
|
|
745
746
|
}
|
|
746
747
|
}
|
|
747
748
|
stateInterpolationClose(c) {
|
|
748
|
-
if (c === this.delimiterClose[this.delimiterIndex])
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
749
|
+
if (c === this.delimiterClose[this.delimiterIndex]) {
|
|
750
|
+
if (this.delimiterIndex === this.delimiterClose.length - 1) {
|
|
751
|
+
this.cbs.oninterpolation(this.sectionStart, this.index + 1);
|
|
752
|
+
if (this.inRCDATA) this.state = 32;
|
|
753
|
+
else this.state = 1;
|
|
754
|
+
this.sectionStart = this.index + 1;
|
|
755
|
+
} else this.delimiterIndex++;
|
|
756
|
+
} else {
|
|
755
757
|
this.state = 3;
|
|
756
758
|
this.stateInterpolation(c);
|
|
757
759
|
}
|
|
@@ -866,9 +868,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
866
868
|
this.sectionStart = this.index;
|
|
867
869
|
if (this.mode === 0) this.state = 6;
|
|
868
870
|
else if (this.inSFCRoot) this.state = 34;
|
|
869
|
-
else if (!this.inXML)
|
|
870
|
-
|
|
871
|
-
|
|
871
|
+
else if (!this.inXML) {
|
|
872
|
+
if (c === 116) this.state = 30;
|
|
873
|
+
else this.state = c === 115 ? 29 : 6;
|
|
874
|
+
} else this.state = 6;
|
|
872
875
|
} else if (c === 47) this.state = 8;
|
|
873
876
|
else {
|
|
874
877
|
this.state = 1;
|
|
@@ -1221,9 +1224,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
1221
1224
|
case 24:
|
|
1222
1225
|
this.stateInProcessingInstruction(c);
|
|
1223
1226
|
break;
|
|
1224
|
-
case 33:
|
|
1225
|
-
this.stateInEntity();
|
|
1226
|
-
break;
|
|
1227
|
+
case 33: this.stateInEntity();
|
|
1227
1228
|
}
|
|
1228
1229
|
this.index++;
|
|
1229
1230
|
}
|
|
@@ -1252,9 +1253,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
1252
1253
|
handleTrailingData() {
|
|
1253
1254
|
const endIndex = this.buffer.length;
|
|
1254
1255
|
if (this.sectionStart >= endIndex) return;
|
|
1255
|
-
if (this.state === 28)
|
|
1256
|
-
|
|
1257
|
-
|
|
1256
|
+
if (this.state === 28) {
|
|
1257
|
+
if (this.currentSequence === Sequences.CdataEnd) this.cbs.oncdata(this.sectionStart, endIndex);
|
|
1258
|
+
else this.cbs.oncomment(this.sectionStart, endIndex);
|
|
1259
|
+
} else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) {} else this.cbs.ontext(this.sectionStart, endIndex);
|
|
1258
1260
|
}
|
|
1259
1261
|
emitCodePoint(cp, consumed) {}
|
|
1260
1262
|
};
|
|
@@ -1587,9 +1589,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
1587
1589
|
case "RestElement":
|
|
1588
1590
|
extractIdentifiers(param.argument, nodes);
|
|
1589
1591
|
break;
|
|
1590
|
-
case "AssignmentPattern":
|
|
1591
|
-
extractIdentifiers(param.left, nodes);
|
|
1592
|
-
break;
|
|
1592
|
+
case "AssignmentPattern": extractIdentifiers(param.left, nodes);
|
|
1593
1593
|
}
|
|
1594
1594
|
return nodes;
|
|
1595
1595
|
}
|
|
@@ -1725,12 +1725,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
1725
1725
|
if (!--currentOpenParensCount) state = stateStack.pop();
|
|
1726
1726
|
}
|
|
1727
1727
|
break;
|
|
1728
|
-
case 3:
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
}
|
|
1733
|
-
break;
|
|
1728
|
+
case 3: if (char === currentStringType) {
|
|
1729
|
+
state = stateStack.pop();
|
|
1730
|
+
currentStringType = null;
|
|
1731
|
+
}
|
|
1734
1732
|
}
|
|
1735
1733
|
}
|
|
1736
1734
|
return !currentOpenBracketCount && !currentOpenParensCount;
|
|
@@ -1801,7 +1799,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
1801
1799
|
function isSlotOutlet(node) {
|
|
1802
1800
|
return node.type === 1 && node.tagType === 2;
|
|
1803
1801
|
}
|
|
1804
|
-
const propsHelperSet = new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
|
|
1802
|
+
const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
|
|
1805
1803
|
function getUnnormalizedProps(props, callPath = []) {
|
|
1806
1804
|
if (props && !isString(props) && props.type === 14) {
|
|
1807
1805
|
const callee = props.callee;
|
|
@@ -1844,9 +1842,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
1844
1842
|
propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [createObjectExpression([prop]), props]);
|
|
1845
1843
|
if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) parentCall = callPath[callPath.length - 2];
|
|
1846
1844
|
}
|
|
1847
|
-
if (node.type === 13)
|
|
1848
|
-
|
|
1849
|
-
|
|
1845
|
+
if (node.type === 13) {
|
|
1846
|
+
if (parentCall) parentCall.arguments[0] = propsWithInjection;
|
|
1847
|
+
else node.props = propsWithInjection;
|
|
1848
|
+
} else if (parentCall) parentCall.arguments[0] = propsWithInjection;
|
|
1850
1849
|
else node.arguments[2] = propsWithInjection;
|
|
1851
1850
|
}
|
|
1852
1851
|
function injectSlotKey(node, prop) {
|
|
@@ -2161,10 +2160,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
2161
2160
|
case 18:
|
|
2162
2161
|
case 19:
|
|
2163
2162
|
case 20:
|
|
2164
|
-
case 21:
|
|
2165
|
-
emitError(9, end);
|
|
2166
|
-
break;
|
|
2167
|
-
default: break;
|
|
2163
|
+
case 21: emitError(9, end);
|
|
2168
2164
|
}
|
|
2169
2165
|
for (let index = 0; index < stack.length; index++) {
|
|
2170
2166
|
onCloseTag(stack[index], end - 1);
|
|
@@ -2314,7 +2310,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
2314
2310
|
while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
|
|
2315
2311
|
return i;
|
|
2316
2312
|
}
|
|
2317
|
-
const specialTemplateDir = new Set([
|
|
2313
|
+
const specialTemplateDir = /* @__PURE__ */ new Set([
|
|
2318
2314
|
"if",
|
|
2319
2315
|
"else",
|
|
2320
2316
|
"else-if",
|
|
@@ -2350,16 +2346,18 @@ var VueCompilerDOM = (function(exports) {
|
|
|
2350
2346
|
let removedWhitespace = false;
|
|
2351
2347
|
for (let i = 0; i < nodes.length; i++) {
|
|
2352
2348
|
const node = nodes[i];
|
|
2353
|
-
if (node.type === 2)
|
|
2354
|
-
if (
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2349
|
+
if (node.type === 2) {
|
|
2350
|
+
if (!inPre) {
|
|
2351
|
+
if (isAllWhitespace(node.content)) {
|
|
2352
|
+
const prev = nodes[i - 1] && nodes[i - 1].type;
|
|
2353
|
+
const next = nodes[i + 1] && nodes[i + 1].type;
|
|
2354
|
+
if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
|
|
2355
|
+
removedWhitespace = true;
|
|
2356
|
+
nodes[i] = null;
|
|
2357
|
+
} else node.content = " ";
|
|
2358
|
+
} else if (shouldCondense) node.content = condense(node.content);
|
|
2359
|
+
} else node.content = node.content.replace(windowsNewlineRE, "\n");
|
|
2360
|
+
}
|
|
2363
2361
|
}
|
|
2364
2362
|
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
2365
2363
|
}
|
|
@@ -2620,7 +2618,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
2620
2618
|
default: return 0;
|
|
2621
2619
|
}
|
|
2622
2620
|
}
|
|
2623
|
-
const allowHoistedHelperSet = new Set([
|
|
2621
|
+
const allowHoistedHelperSet = /* @__PURE__ */ new Set([
|
|
2624
2622
|
NORMALIZE_CLASS,
|
|
2625
2623
|
NORMALIZE_STYLE,
|
|
2626
2624
|
NORMALIZE_PROPS,
|
|
@@ -2778,7 +2776,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
2778
2776
|
traverseNode(root, context);
|
|
2779
2777
|
if (options.hoistStatic) cacheStatic(root, context);
|
|
2780
2778
|
if (!options.ssr) createRootCodegen(root, context);
|
|
2781
|
-
root.helpers = new Set([...context.helpers.keys()]);
|
|
2779
|
+
root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
|
|
2782
2780
|
root.components = [...context.components];
|
|
2783
2781
|
root.directives = [...context.directives];
|
|
2784
2782
|
root.imports = context.imports;
|
|
@@ -2825,8 +2823,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
2825
2823
|
const exitFns = [];
|
|
2826
2824
|
for (let i = 0; i < nodeTransforms.length; i++) {
|
|
2827
2825
|
const onExit = nodeTransforms[i](node, context);
|
|
2828
|
-
if (onExit)
|
|
2829
|
-
|
|
2826
|
+
if (onExit) {
|
|
2827
|
+
if (isArray(onExit)) exitFns.push(...onExit);
|
|
2828
|
+
else exitFns.push(onExit);
|
|
2829
|
+
}
|
|
2830
2830
|
if (!context.currentNode) return;
|
|
2831
2831
|
else node = context.currentNode;
|
|
2832
2832
|
}
|
|
@@ -2843,9 +2843,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
2843
2843
|
case 10:
|
|
2844
2844
|
case 11:
|
|
2845
2845
|
case 1:
|
|
2846
|
-
case 0:
|
|
2847
|
-
traverseChildren(node, context);
|
|
2848
|
-
break;
|
|
2846
|
+
case 0: traverseChildren(node, context);
|
|
2849
2847
|
}
|
|
2850
2848
|
context.currentNode = node;
|
|
2851
2849
|
let i = exitFns.length;
|
|
@@ -3051,10 +3049,12 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3051
3049
|
if (isString(node)) push(node, -3);
|
|
3052
3050
|
else if (isArray(node)) genNodeListAsArray(node, context);
|
|
3053
3051
|
else genNode(node, context);
|
|
3054
|
-
if (i < nodes.length - 1)
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3052
|
+
if (i < nodes.length - 1) {
|
|
3053
|
+
if (multilines) {
|
|
3054
|
+
comma && push(",");
|
|
3055
|
+
newline();
|
|
3056
|
+
} else comma && push(", ");
|
|
3057
|
+
}
|
|
3058
3058
|
}
|
|
3059
3059
|
}
|
|
3060
3060
|
function genNode(node, context) {
|
|
@@ -3166,8 +3166,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3166
3166
|
const { push, helper, pure } = context;
|
|
3167
3167
|
const { tag, props, children, patchFlag, dynamicProps, directives, isBlock, disableTracking, isComponent } = node;
|
|
3168
3168
|
let patchFlagString;
|
|
3169
|
-
if (patchFlag)
|
|
3170
|
-
|
|
3169
|
+
if (patchFlag) {
|
|
3170
|
+
if (patchFlag < 0) patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
|
|
3171
|
+
else patchFlagString = patchFlag + ` /* ${Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `)} */`;
|
|
3172
|
+
}
|
|
3171
3173
|
if (directives) push(helper(WITH_DIRECTIVES) + `(`);
|
|
3172
3174
|
if (isBlock) push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
|
|
3173
3175
|
if (pure) push(PURE_ANNOTATION);
|
|
@@ -3329,7 +3331,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3329
3331
|
}
|
|
3330
3332
|
//#endregion
|
|
3331
3333
|
//#region packages/compiler-core/src/transforms/transformExpression.ts
|
|
3332
|
-
const isLiteralWhitelisted =
|
|
3334
|
+
const isLiteralWhitelisted = /*@__PURE__*/ makeMap("true,false,null,this");
|
|
3333
3335
|
const transformExpression = (node, context) => {
|
|
3334
3336
|
if (node.type === 5) node.content = processExpression(node.content, context);
|
|
3335
3337
|
else if (node.type === 1) {
|
|
@@ -3442,16 +3444,17 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3442
3444
|
const keyProperty = createObjectProperty(`key`, createSimpleExpression(`${keyIndex}`, false, locStub, 2));
|
|
3443
3445
|
const { children } = branch;
|
|
3444
3446
|
const firstChild = children[0];
|
|
3445
|
-
if (children.length !== 1 || firstChild.type !== 1)
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3447
|
+
if (children.length !== 1 || firstChild.type !== 1) {
|
|
3448
|
+
if (children.length === 1 && firstChild.type === 11) {
|
|
3449
|
+
const vnodeCall = firstChild.codegenNode;
|
|
3450
|
+
injectProp(vnodeCall, keyProperty, context);
|
|
3451
|
+
return vnodeCall;
|
|
3452
|
+
} else {
|
|
3453
|
+
let patchFlag = 64;
|
|
3454
|
+
if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) patchFlag |= 2048;
|
|
3455
|
+
return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag, void 0, void 0, true, false, false, branch.loc);
|
|
3456
|
+
}
|
|
3449
3457
|
} else {
|
|
3450
|
-
let patchFlag = 64;
|
|
3451
|
-
if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) patchFlag |= 2048;
|
|
3452
|
-
return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag, void 0, void 0, true, false, false, branch.loc);
|
|
3453
|
-
}
|
|
3454
|
-
else {
|
|
3455
3458
|
const ret = firstChild.codegenNode;
|
|
3456
3459
|
const vnodeCall = getMemoedVNodeCall(ret);
|
|
3457
3460
|
if (vnodeCall.type === 13) convertToBlock(vnodeCall, context);
|
|
@@ -3472,9 +3475,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3472
3475
|
return true;
|
|
3473
3476
|
}
|
|
3474
3477
|
function getParentCondition(node) {
|
|
3475
|
-
while (true) if (node.type === 19)
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
+
while (true) if (node.type === 19) {
|
|
3479
|
+
if (node.alternate.type === 19) node = node.alternate;
|
|
3480
|
+
else return node;
|
|
3481
|
+
} else if (node.type === 20) node = node.value;
|
|
3478
3482
|
}
|
|
3479
3483
|
//#endregion
|
|
3480
3484
|
//#region packages/compiler-core/src/transforms/vFor.ts
|
|
@@ -3513,10 +3517,12 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3513
3517
|
childBlock = children[0].codegenNode;
|
|
3514
3518
|
if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
|
|
3515
3519
|
const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
|
|
3516
|
-
if (childBlock.isBlock !== shouldUseBlock)
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
+
if (childBlock.isBlock !== shouldUseBlock) {
|
|
3521
|
+
if (childBlock.isBlock) {
|
|
3522
|
+
removeHelper(OPEN_BLOCK);
|
|
3523
|
+
removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
3524
|
+
} else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
3525
|
+
}
|
|
3520
3526
|
childBlock.isBlock = shouldUseBlock;
|
|
3521
3527
|
if (childBlock.isBlock) {
|
|
3522
3528
|
helper(OPEN_BLOCK);
|
|
@@ -3718,8 +3724,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3718
3724
|
return createObjectProperty(`default`, fn);
|
|
3719
3725
|
};
|
|
3720
3726
|
if (!hasTemplateSlots) slotsProperties.push(buildDefaultSlotProperty(void 0, children));
|
|
3721
|
-
else if (implicitDefaultChildren.length && !implicitDefaultChildren.every(isWhitespaceText))
|
|
3722
|
-
|
|
3727
|
+
else if (implicitDefaultChildren.length && !implicitDefaultChildren.every(isWhitespaceText)) {
|
|
3728
|
+
if (hasNamedDefaultSlot) context.onError(createCompilerError(39, implicitDefaultChildren[0].loc));
|
|
3729
|
+
else slotsProperties.push(buildDefaultSlotProperty(void 0, implicitDefaultChildren));
|
|
3730
|
+
}
|
|
3723
3731
|
}
|
|
3724
3732
|
const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
|
|
3725
3733
|
let slots = createObjectExpression(slotsProperties.concat(createObjectProperty(`_`, createSimpleExpression(slotFlag + ` /* ${slotFlagsText[slotFlag]} */`, false))), loc);
|
|
@@ -3745,10 +3753,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3745
3753
|
if (hasForwardedSlots(child.branches)) return true;
|
|
3746
3754
|
break;
|
|
3747
3755
|
case 10:
|
|
3748
|
-
case 11:
|
|
3749
|
-
if (hasForwardedSlots(child.children)) return true;
|
|
3750
|
-
break;
|
|
3751
|
-
default: break;
|
|
3756
|
+
case 11: if (hasForwardedSlots(child.children)) return true;
|
|
3752
3757
|
}
|
|
3753
3758
|
}
|
|
3754
3759
|
return false;
|
|
@@ -3909,29 +3914,30 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3909
3914
|
if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
|
|
3910
3915
|
if (!arg && (isVBind || isVOn)) {
|
|
3911
3916
|
hasDynamicKeys = true;
|
|
3912
|
-
if (exp)
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
if (
|
|
3916
|
-
if (
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3917
|
+
if (exp) {
|
|
3918
|
+
if (isVBind) {
|
|
3919
|
+
pushMergeArg();
|
|
3920
|
+
if (mergeArgs.some((arg) => {
|
|
3921
|
+
if (arg.type === 15) return arg.properties.some(({ key }) => {
|
|
3922
|
+
if (key.type !== 4 || !key.isStatic) return true;
|
|
3923
|
+
return key.content !== "class" && key.content !== "style" && !isOn(key.content);
|
|
3924
|
+
});
|
|
3925
|
+
else return true;
|
|
3926
|
+
})) checkCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER", context, loc);
|
|
3927
|
+
if (isCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER", context)) {
|
|
3928
|
+
mergeArgs.unshift(exp);
|
|
3929
|
+
continue;
|
|
3930
|
+
}
|
|
3931
|
+
pushRefVForMarker();
|
|
3932
|
+
pushMergeArg();
|
|
3933
|
+
mergeArgs.push(exp);
|
|
3934
|
+
} else pushMergeArg({
|
|
3935
|
+
type: 14,
|
|
3936
|
+
loc,
|
|
3937
|
+
callee: context.helper(TO_HANDLERS),
|
|
3938
|
+
arguments: isComponent ? [exp] : [exp, `true`]
|
|
3939
|
+
});
|
|
3940
|
+
} else context.onError(createCompilerError(isVBind ? 34 : 35, loc));
|
|
3935
3941
|
continue;
|
|
3936
3942
|
}
|
|
3937
3943
|
if (isVBind && modifiers.some((mod) => mod.content === "prop")) patchFlag |= 32;
|
|
@@ -3989,9 +3995,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3989
3995
|
} else propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [propsExpression]);
|
|
3990
3996
|
break;
|
|
3991
3997
|
case 14: break;
|
|
3992
|
-
default:
|
|
3993
|
-
propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [propsExpression])]);
|
|
3994
|
-
break;
|
|
3998
|
+
default: propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [propsExpression])]);
|
|
3995
3999
|
}
|
|
3996
4000
|
return {
|
|
3997
4001
|
props: propsExpression,
|
|
@@ -4097,10 +4101,12 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4097
4101
|
for (let i = 0; i < node.props.length; i++) {
|
|
4098
4102
|
const p = node.props[i];
|
|
4099
4103
|
if (p.type === 6) {
|
|
4100
|
-
if (p.value)
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
+
if (p.value) {
|
|
4105
|
+
if (p.name === "name") slotName = JSON.stringify(p.value.content);
|
|
4106
|
+
else {
|
|
4107
|
+
p.name = camelize(p.name);
|
|
4108
|
+
nonNameProps.push(p);
|
|
4109
|
+
}
|
|
4104
4110
|
}
|
|
4105
4111
|
} else if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
|
|
4106
4112
|
if (p.exp) slotName = p.exp;
|
|
@@ -4126,17 +4132,18 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4126
4132
|
const { loc, modifiers, arg } = dir;
|
|
4127
4133
|
if (!dir.exp && !modifiers.length) context.onError(createCompilerError(35, loc));
|
|
4128
4134
|
let eventName;
|
|
4129
|
-
if (arg.type === 4)
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4135
|
+
if (arg.type === 4) {
|
|
4136
|
+
if (arg.isStatic) {
|
|
4137
|
+
let rawName = arg.content;
|
|
4138
|
+
if (rawName.startsWith("vnode")) context.onError(createCompilerError(52, arg.loc));
|
|
4139
|
+
if (rawName.startsWith("vue:")) rawName = `vnode-${rawName.slice(4)}`;
|
|
4140
|
+
eventName = createSimpleExpression(node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? toHandlerKey(camelize(rawName)) : `on:${rawName}`, true, arg.loc);
|
|
4141
|
+
} else eventName = createCompoundExpression([
|
|
4142
|
+
`${context.helperString(TO_HANDLER_KEY)}(`,
|
|
4143
|
+
arg,
|
|
4144
|
+
`)`
|
|
4145
|
+
]);
|
|
4146
|
+
} else {
|
|
4140
4147
|
eventName = arg;
|
|
4141
4148
|
eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
|
|
4142
4149
|
eventName.children.push(`)`);
|
|
@@ -4172,11 +4179,14 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4172
4179
|
arg.children.unshift(`(`);
|
|
4173
4180
|
arg.children.push(`) || ""`);
|
|
4174
4181
|
} else if (!arg.isStatic) arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
4175
|
-
if (modifiers.some((mod) => mod.content === "camel"))
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4182
|
+
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
4183
|
+
if (arg.type === 4) {
|
|
4184
|
+
if (arg.isStatic) arg.content = camelize(arg.content);
|
|
4185
|
+
else arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
4186
|
+
} else {
|
|
4187
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
4188
|
+
arg.children.push(`)`);
|
|
4189
|
+
}
|
|
4180
4190
|
}
|
|
4181
4191
|
if (!context.inSSR) {
|
|
4182
4192
|
if (modifiers.some((mod) => mod.content === "prop")) injectPrefix(arg, ".");
|
|
@@ -4185,9 +4195,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4185
4195
|
return { props: [createObjectProperty(arg, exp)] };
|
|
4186
4196
|
};
|
|
4187
4197
|
const injectPrefix = (arg, prefix) => {
|
|
4188
|
-
if (arg.type === 4)
|
|
4189
|
-
|
|
4190
|
-
|
|
4198
|
+
if (arg.type === 4) {
|
|
4199
|
+
if (arg.isStatic) arg.content = prefix + arg.content;
|
|
4200
|
+
else arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
4201
|
+
} else {
|
|
4191
4202
|
arg.children.unshift(`'${prefix}' + (`);
|
|
4192
4203
|
arg.children.push(`)`);
|
|
4193
4204
|
}
|
|
@@ -4334,11 +4345,12 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4334
4345
|
if (c === 96 && prev !== 92) inTemplateString = false;
|
|
4335
4346
|
} else if (inRegex) {
|
|
4336
4347
|
if (c === 47 && prev !== 92) inRegex = false;
|
|
4337
|
-
} else if (c === 124 && exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren)
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4348
|
+
} else if (c === 124 && exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren) {
|
|
4349
|
+
if (expression === void 0) {
|
|
4350
|
+
lastFilterIndex = i + 1;
|
|
4351
|
+
expression = exp.slice(0, i).trim();
|
|
4352
|
+
} else pushFilter();
|
|
4353
|
+
} else {
|
|
4342
4354
|
switch (c) {
|
|
4343
4355
|
case 34:
|
|
4344
4356
|
inDouble = true;
|
|
@@ -4364,9 +4376,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4364
4376
|
case 123:
|
|
4365
4377
|
curly++;
|
|
4366
4378
|
break;
|
|
4367
|
-
case 125:
|
|
4368
|
-
curly--;
|
|
4369
|
-
break;
|
|
4379
|
+
case 125: curly--;
|
|
4370
4380
|
}
|
|
4371
4381
|
if (c === 47) {
|
|
4372
4382
|
let j = i - 1;
|
|
@@ -4682,9 +4692,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4682
4692
|
isInvalidType = true;
|
|
4683
4693
|
context.onError(createDOMCompilerError(60, dir.loc));
|
|
4684
4694
|
break;
|
|
4685
|
-
default:
|
|
4686
|
-
checkDuplicatedValue();
|
|
4687
|
-
break;
|
|
4695
|
+
default: checkDuplicatedValue();
|
|
4688
4696
|
}
|
|
4689
4697
|
} else if (hasDynamicKeyVBind(node)) directiveToUse = V_MODEL_DYNAMIC;
|
|
4690
4698
|
else checkDuplicatedValue();
|
|
@@ -4697,10 +4705,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4697
4705
|
};
|
|
4698
4706
|
//#endregion
|
|
4699
4707
|
//#region packages/compiler-dom/src/transforms/vOn.ts
|
|
4700
|
-
const isEventOptionModifier =
|
|
4701
|
-
const isNonKeyModifier =
|
|
4702
|
-
const maybeKeyModifier =
|
|
4703
|
-
const isKeyboardEvent =
|
|
4708
|
+
const isEventOptionModifier = /*@__PURE__*/ makeMap(`passive,once,capture`);
|
|
4709
|
+
const isNonKeyModifier = /*@__PURE__*/ makeMap("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
|
|
4710
|
+
const maybeKeyModifier = /*@__PURE__*/ makeMap("left,right");
|
|
4711
|
+
const isKeyboardEvent = /*@__PURE__*/ makeMap(`onkeyup,onkeydown,onkeypress`);
|
|
4704
4712
|
const resolveModifiers = (key, modifiers, context, loc) => {
|
|
4705
4713
|
const keyModifiers = [];
|
|
4706
4714
|
const nonKeyModifiers = [];
|
|
@@ -4719,13 +4727,15 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4719
4727
|
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
|
|
4720
4728
|
else {
|
|
4721
4729
|
const keyString = isString(key) ? key : isStaticExp(key) ? key.content : null;
|
|
4722
|
-
if (maybeKeyModifier(modifier))
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4730
|
+
if (maybeKeyModifier(modifier)) {
|
|
4731
|
+
if (keyString) {
|
|
4732
|
+
if (isKeyboardEvent(keyString.toLowerCase())) keyModifiers.push(modifier);
|
|
4733
|
+
else nonKeyModifiers.push(modifier);
|
|
4734
|
+
} else {
|
|
4735
|
+
keyModifiers.push(modifier);
|
|
4736
|
+
nonKeyModifiers.push(modifier);
|
|
4737
|
+
}
|
|
4738
|
+
} else if (isNonKeyModifier(modifier)) nonKeyModifiers.push(modifier);
|
|
4729
4739
|
else keyModifiers.push(modifier);
|
|
4730
4740
|
}
|
|
4731
4741
|
}
|
|
@@ -4840,7 +4850,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4840
4850
|
}
|
|
4841
4851
|
return true;
|
|
4842
4852
|
}
|
|
4843
|
-
const headings = new Set([
|
|
4853
|
+
const headings = /* @__PURE__ */ new Set([
|
|
4844
4854
|
"h1",
|
|
4845
4855
|
"h2",
|
|
4846
4856
|
"h3",
|
|
@@ -4852,7 +4862,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4852
4862
|
/**
|
|
4853
4863
|
* maps element to set of elements that can be it's children, no other */
|
|
4854
4864
|
const onlyValidChildren = {
|
|
4855
|
-
head: new Set([
|
|
4865
|
+
head: /* @__PURE__ */ new Set([
|
|
4856
4866
|
"base",
|
|
4857
4867
|
"basefront",
|
|
4858
4868
|
"bgsound",
|
|
@@ -4865,24 +4875,24 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4865
4875
|
"script",
|
|
4866
4876
|
"template"
|
|
4867
4877
|
]),
|
|
4868
|
-
optgroup: new Set(["option"]),
|
|
4869
|
-
select: new Set([
|
|
4878
|
+
optgroup: /* @__PURE__ */ new Set(["option"]),
|
|
4879
|
+
select: /* @__PURE__ */ new Set([
|
|
4870
4880
|
"optgroup",
|
|
4871
4881
|
"option",
|
|
4872
4882
|
"hr"
|
|
4873
4883
|
]),
|
|
4874
|
-
table: new Set([
|
|
4884
|
+
table: /* @__PURE__ */ new Set([
|
|
4875
4885
|
"caption",
|
|
4876
4886
|
"colgroup",
|
|
4877
4887
|
"tbody",
|
|
4878
4888
|
"tfoot",
|
|
4879
4889
|
"thead"
|
|
4880
4890
|
]),
|
|
4881
|
-
tr: new Set(["td", "th"]),
|
|
4882
|
-
colgroup: new Set(["col"]),
|
|
4883
|
-
tbody: new Set(["tr"]),
|
|
4884
|
-
thead: new Set(["tr"]),
|
|
4885
|
-
tfoot: new Set(["tr"]),
|
|
4891
|
+
tr: /* @__PURE__ */ new Set(["td", "th"]),
|
|
4892
|
+
colgroup: /* @__PURE__ */ new Set(["col"]),
|
|
4893
|
+
tbody: /* @__PURE__ */ new Set(["tr"]),
|
|
4894
|
+
thead: /* @__PURE__ */ new Set(["tr"]),
|
|
4895
|
+
tfoot: /* @__PURE__ */ new Set(["tr"]),
|
|
4886
4896
|
script: emptySet,
|
|
4887
4897
|
iframe: emptySet,
|
|
4888
4898
|
option: emptySet,
|
|
@@ -4893,30 +4903,30 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4893
4903
|
/** maps elements to set of elements which can be it's parent, no other */
|
|
4894
4904
|
const onlyValidParents = {
|
|
4895
4905
|
html: emptySet,
|
|
4896
|
-
body: new Set(["html"]),
|
|
4897
|
-
head: new Set(["html"]),
|
|
4898
|
-
td: new Set(["tr"]),
|
|
4899
|
-
colgroup: new Set(["table"]),
|
|
4900
|
-
caption: new Set(["table"]),
|
|
4901
|
-
tbody: new Set(["table"]),
|
|
4902
|
-
tfoot: new Set(["table"]),
|
|
4903
|
-
col: new Set(["colgroup"]),
|
|
4904
|
-
th: new Set(["tr"]),
|
|
4905
|
-
thead: new Set(["table"]),
|
|
4906
|
-
tr: new Set([
|
|
4906
|
+
body: /* @__PURE__ */ new Set(["html"]),
|
|
4907
|
+
head: /* @__PURE__ */ new Set(["html"]),
|
|
4908
|
+
td: /* @__PURE__ */ new Set(["tr"]),
|
|
4909
|
+
colgroup: /* @__PURE__ */ new Set(["table"]),
|
|
4910
|
+
caption: /* @__PURE__ */ new Set(["table"]),
|
|
4911
|
+
tbody: /* @__PURE__ */ new Set(["table"]),
|
|
4912
|
+
tfoot: /* @__PURE__ */ new Set(["table"]),
|
|
4913
|
+
col: /* @__PURE__ */ new Set(["colgroup"]),
|
|
4914
|
+
th: /* @__PURE__ */ new Set(["tr"]),
|
|
4915
|
+
thead: /* @__PURE__ */ new Set(["table"]),
|
|
4916
|
+
tr: /* @__PURE__ */ new Set([
|
|
4907
4917
|
"tbody",
|
|
4908
4918
|
"thead",
|
|
4909
4919
|
"tfoot"
|
|
4910
4920
|
]),
|
|
4911
|
-
dd: new Set(["dl", "div"]),
|
|
4912
|
-
dt: new Set(["dl", "div"]),
|
|
4913
|
-
figcaption: new Set(["figure"]),
|
|
4914
|
-
summary: new Set(["details"]),
|
|
4915
|
-
area: new Set(["map"])
|
|
4921
|
+
dd: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
4922
|
+
dt: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
4923
|
+
figcaption: /* @__PURE__ */ new Set(["figure"]),
|
|
4924
|
+
summary: /* @__PURE__ */ new Set(["details"]),
|
|
4925
|
+
area: /* @__PURE__ */ new Set(["map"])
|
|
4916
4926
|
};
|
|
4917
4927
|
/** maps element to set of elements that can not be it's children, others can */
|
|
4918
4928
|
const knownInvalidChildren = {
|
|
4919
|
-
p: new Set([
|
|
4929
|
+
p: /* @__PURE__ */ new Set([
|
|
4920
4930
|
"address",
|
|
4921
4931
|
"article",
|
|
4922
4932
|
"aside",
|
|
@@ -4951,7 +4961,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4951
4961
|
"table",
|
|
4952
4962
|
"ul"
|
|
4953
4963
|
]),
|
|
4954
|
-
svg: new Set([
|
|
4964
|
+
svg: /* @__PURE__ */ new Set([
|
|
4955
4965
|
"b",
|
|
4956
4966
|
"blockquote",
|
|
4957
4967
|
"br",
|
|
@@ -4992,12 +5002,12 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4992
5002
|
};
|
|
4993
5003
|
/** maps element to set of elements that can not be it's parent, others can */
|
|
4994
5004
|
const knownInvalidParents = {
|
|
4995
|
-
a: new Set(["a"]),
|
|
4996
|
-
button: new Set(["button"]),
|
|
4997
|
-
dd: new Set(["dd", "dt"]),
|
|
4998
|
-
dt: new Set(["dd", "dt"]),
|
|
4999
|
-
form: new Set(["form"]),
|
|
5000
|
-
li: new Set(["li"]),
|
|
5005
|
+
a: /* @__PURE__ */ new Set(["a"]),
|
|
5006
|
+
button: /* @__PURE__ */ new Set(["button"]),
|
|
5007
|
+
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
5008
|
+
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
5009
|
+
form: /* @__PURE__ */ new Set(["form"]),
|
|
5010
|
+
li: /* @__PURE__ */ new Set(["li"]),
|
|
5001
5011
|
h1: headings,
|
|
5002
5012
|
h2: headings,
|
|
5003
5013
|
h3: headings,
|