@vue/compiler-dom 3.3.0-alpha.2 → 3.3.0-alpha.3
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 +64 -64
- package/dist/compiler-dom.cjs.prod.js +56 -56
- package/dist/compiler-dom.esm-browser.js +410 -410
- package/dist/compiler-dom.esm-browser.prod.js +1 -1
- package/dist/compiler-dom.esm-bundler.js +44 -44
- package/dist/compiler-dom.global.js +410 -410
- package/dist/compiler-dom.global.prod.js +1 -1
- package/package.json +3 -3
package/dist/compiler-dom.cjs.js
CHANGED
|
@@ -2386,30 +2386,30 @@ const parserOptions = {
|
|
|
2386
2386
|
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
|
2387
2387
|
getNamespace(tag, parent) {
|
|
2388
2388
|
let ns = parent ? parent.ns : 0;
|
|
2389
|
-
if (parent && ns === 2) {
|
|
2389
|
+
if (parent && ns === "2") {
|
|
2390
2390
|
if (parent.tag === "annotation-xml") {
|
|
2391
2391
|
if (tag === "svg") {
|
|
2392
|
-
return 1;
|
|
2392
|
+
return "1";
|
|
2393
2393
|
}
|
|
2394
2394
|
if (parent.props.some(
|
|
2395
|
-
(a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
|
|
2395
|
+
(a) => a.type === "6" && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
|
|
2396
2396
|
)) {
|
|
2397
2397
|
ns = 0;
|
|
2398
2398
|
}
|
|
2399
2399
|
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
|
|
2400
2400
|
ns = 0;
|
|
2401
2401
|
}
|
|
2402
|
-
} else if (parent && ns === 1) {
|
|
2402
|
+
} else if (parent && ns === "1") {
|
|
2403
2403
|
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
|
|
2404
2404
|
ns = 0;
|
|
2405
2405
|
}
|
|
2406
2406
|
}
|
|
2407
2407
|
if (ns === 0) {
|
|
2408
2408
|
if (tag === "svg") {
|
|
2409
|
-
return 1;
|
|
2409
|
+
return "1";
|
|
2410
2410
|
}
|
|
2411
2411
|
if (tag === "math") {
|
|
2412
|
-
return 2;
|
|
2412
|
+
return "2";
|
|
2413
2413
|
}
|
|
2414
2414
|
}
|
|
2415
2415
|
return ns;
|
|
@@ -2418,22 +2418,22 @@ const parserOptions = {
|
|
|
2418
2418
|
getTextMode({ tag, ns }) {
|
|
2419
2419
|
if (ns === 0) {
|
|
2420
2420
|
if (tag === "textarea" || tag === "title") {
|
|
2421
|
-
return 1;
|
|
2421
|
+
return "1";
|
|
2422
2422
|
}
|
|
2423
2423
|
if (isRawTextContainer(tag)) {
|
|
2424
|
-
return 2;
|
|
2424
|
+
return "2";
|
|
2425
2425
|
}
|
|
2426
2426
|
}
|
|
2427
|
-
return 0;
|
|
2427
|
+
return "0";
|
|
2428
2428
|
}
|
|
2429
2429
|
};
|
|
2430
2430
|
|
|
2431
2431
|
const transformStyle = (node) => {
|
|
2432
|
-
if (node.type === "
|
|
2432
|
+
if (node.type === "1") {
|
|
2433
2433
|
node.props.forEach((p, i) => {
|
|
2434
|
-
if (p.type === 6 && p.name === "style" && p.value) {
|
|
2434
|
+
if (p.type === "6" && p.name === "style" && p.value) {
|
|
2435
2435
|
node.props[i] = {
|
|
2436
|
-
type: 7,
|
|
2436
|
+
type: "7",
|
|
2437
2437
|
name: `bind`,
|
|
2438
2438
|
arg: compilerCore.createSimpleExpression(`style`, true, p.loc),
|
|
2439
2439
|
exp: parseInlineCSS(p.value.content, p.loc),
|
|
@@ -2450,7 +2450,7 @@ const parseInlineCSS = (cssText, loc) => {
|
|
|
2450
2450
|
JSON.stringify(normalized),
|
|
2451
2451
|
false,
|
|
2452
2452
|
loc,
|
|
2453
|
-
3
|
|
2453
|
+
"3"
|
|
2454
2454
|
);
|
|
2455
2455
|
};
|
|
2456
2456
|
|
|
@@ -2463,16 +2463,16 @@ function createDOMCompilerError(code, loc) {
|
|
|
2463
2463
|
}
|
|
2464
2464
|
const DOMErrorMessages = {
|
|
2465
2465
|
[51]: `v-html is missing expression.`,
|
|
2466
|
-
[52]: `v-html will override element children.`,
|
|
2467
|
-
[53]: `v-text is missing expression.`,
|
|
2468
|
-
[54]: `v-text will override element children.`,
|
|
2469
|
-
[55]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
|
2470
|
-
[56]: `v-model argument is not supported on plain elements.`,
|
|
2471
|
-
[57]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
|
2472
|
-
[58]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
|
2473
|
-
[59]: `v-show is missing expression.`,
|
|
2474
|
-
[60]: `<Transition> expects exactly one child element or component.`,
|
|
2475
|
-
[61]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
|
2466
|
+
["52"]: `v-html will override element children.`,
|
|
2467
|
+
["53"]: `v-text is missing expression.`,
|
|
2468
|
+
["54"]: `v-text will override element children.`,
|
|
2469
|
+
["55"]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
|
2470
|
+
["56"]: `v-model argument is not supported on plain elements.`,
|
|
2471
|
+
["57"]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
|
2472
|
+
["58"]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
|
2473
|
+
["59"]: `v-show is missing expression.`,
|
|
2474
|
+
["60"]: `<Transition> expects exactly one child element or component.`,
|
|
2475
|
+
["61"]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
|
2476
2476
|
};
|
|
2477
2477
|
|
|
2478
2478
|
const transformVHtml = (dir, node, context) => {
|
|
@@ -2484,7 +2484,7 @@ const transformVHtml = (dir, node, context) => {
|
|
|
2484
2484
|
}
|
|
2485
2485
|
if (node.children.length) {
|
|
2486
2486
|
context.onError(
|
|
2487
|
-
createDOMCompilerError(52, loc)
|
|
2487
|
+
createDOMCompilerError("52", loc)
|
|
2488
2488
|
);
|
|
2489
2489
|
node.children.length = 0;
|
|
2490
2490
|
}
|
|
@@ -2502,12 +2502,12 @@ const transformVText = (dir, node, context) => {
|
|
|
2502
2502
|
const { exp, loc } = dir;
|
|
2503
2503
|
if (!exp) {
|
|
2504
2504
|
context.onError(
|
|
2505
|
-
createDOMCompilerError(53, loc)
|
|
2505
|
+
createDOMCompilerError("53", loc)
|
|
2506
2506
|
);
|
|
2507
2507
|
}
|
|
2508
2508
|
if (node.children.length) {
|
|
2509
2509
|
context.onError(
|
|
2510
|
-
createDOMCompilerError(54, loc)
|
|
2510
|
+
createDOMCompilerError("54", loc)
|
|
2511
2511
|
);
|
|
2512
2512
|
node.children.length = 0;
|
|
2513
2513
|
}
|
|
@@ -2527,13 +2527,13 @@ const transformVText = (dir, node, context) => {
|
|
|
2527
2527
|
|
|
2528
2528
|
const transformModel = (dir, node, context) => {
|
|
2529
2529
|
const baseResult = compilerCore.transformModel(dir, node, context);
|
|
2530
|
-
if (!baseResult.props.length || node.tagType === 1) {
|
|
2530
|
+
if (!baseResult.props.length || node.tagType === "1") {
|
|
2531
2531
|
return baseResult;
|
|
2532
2532
|
}
|
|
2533
2533
|
if (dir.arg) {
|
|
2534
2534
|
context.onError(
|
|
2535
2535
|
createDOMCompilerError(
|
|
2536
|
-
56,
|
|
2536
|
+
"56",
|
|
2537
2537
|
dir.arg.loc
|
|
2538
2538
|
)
|
|
2539
2539
|
);
|
|
@@ -2543,7 +2543,7 @@ const transformModel = (dir, node, context) => {
|
|
|
2543
2543
|
if (value) {
|
|
2544
2544
|
context.onError(
|
|
2545
2545
|
createDOMCompilerError(
|
|
2546
|
-
58,
|
|
2546
|
+
"58",
|
|
2547
2547
|
value.loc
|
|
2548
2548
|
)
|
|
2549
2549
|
);
|
|
@@ -2557,7 +2557,7 @@ const transformModel = (dir, node, context) => {
|
|
|
2557
2557
|
if (tag === "input" || isCustomElement) {
|
|
2558
2558
|
const type = compilerCore.findProp(node, `type`);
|
|
2559
2559
|
if (type) {
|
|
2560
|
-
if (type.type === 7) {
|
|
2560
|
+
if (type.type === "7") {
|
|
2561
2561
|
directiveToUse = V_MODEL_DYNAMIC;
|
|
2562
2562
|
} else if (type.value) {
|
|
2563
2563
|
switch (type.value.content) {
|
|
@@ -2571,7 +2571,7 @@ const transformModel = (dir, node, context) => {
|
|
|
2571
2571
|
isInvalidType = true;
|
|
2572
2572
|
context.onError(
|
|
2573
2573
|
createDOMCompilerError(
|
|
2574
|
-
57,
|
|
2574
|
+
"57",
|
|
2575
2575
|
dir.loc
|
|
2576
2576
|
)
|
|
2577
2577
|
);
|
|
@@ -2597,13 +2597,13 @@ const transformModel = (dir, node, context) => {
|
|
|
2597
2597
|
} else {
|
|
2598
2598
|
context.onError(
|
|
2599
2599
|
createDOMCompilerError(
|
|
2600
|
-
55,
|
|
2600
|
+
"55",
|
|
2601
2601
|
dir.loc
|
|
2602
2602
|
)
|
|
2603
2603
|
);
|
|
2604
2604
|
}
|
|
2605
2605
|
baseResult.props = baseResult.props.filter(
|
|
2606
|
-
(p) => !(p.key.type === 4 && p.key.content === "modelValue")
|
|
2606
|
+
(p) => !(p.key.type === "4" && p.key.content === "modelValue")
|
|
2607
2607
|
);
|
|
2608
2608
|
return baseResult;
|
|
2609
2609
|
};
|
|
@@ -2661,7 +2661,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
2661
2661
|
};
|
|
2662
2662
|
const transformClick = (key, event) => {
|
|
2663
2663
|
const isStaticClick = compilerCore.isStaticExp(key) && key.content.toLowerCase() === "onclick";
|
|
2664
|
-
return isStaticClick ? compilerCore.createSimpleExpression(event, true) : key.type !== 4 ? compilerCore.createCompoundExpression([
|
|
2664
|
+
return isStaticClick ? compilerCore.createSimpleExpression(event, true) : key.type !== "4" ? compilerCore.createCompoundExpression([
|
|
2665
2665
|
`(`,
|
|
2666
2666
|
key,
|
|
2667
2667
|
`) === "onClick" ? "${event}" : (`,
|
|
@@ -2709,7 +2709,7 @@ const transformShow = (dir, node, context) => {
|
|
|
2709
2709
|
const { exp, loc } = dir;
|
|
2710
2710
|
if (!exp) {
|
|
2711
2711
|
context.onError(
|
|
2712
|
-
createDOMCompilerError(59, loc)
|
|
2712
|
+
createDOMCompilerError("59", loc)
|
|
2713
2713
|
);
|
|
2714
2714
|
}
|
|
2715
2715
|
return {
|
|
@@ -2719,7 +2719,7 @@ const transformShow = (dir, node, context) => {
|
|
|
2719
2719
|
};
|
|
2720
2720
|
|
|
2721
2721
|
const transformTransition = (node, context) => {
|
|
2722
|
-
if (node.type === "
|
|
2722
|
+
if (node.type === "1" && node.tagType === "1") {
|
|
2723
2723
|
const component = context.isBuiltInComponent(node.tag);
|
|
2724
2724
|
if (component === TRANSITION) {
|
|
2725
2725
|
return () => {
|
|
@@ -2729,7 +2729,7 @@ const transformTransition = (node, context) => {
|
|
|
2729
2729
|
if (hasMultipleChildren(node)) {
|
|
2730
2730
|
context.onError(
|
|
2731
2731
|
createDOMCompilerError(
|
|
2732
|
-
60,
|
|
2732
|
+
"60",
|
|
2733
2733
|
{
|
|
2734
2734
|
start: node.children[0].loc.start,
|
|
2735
2735
|
end: node.children[node.children.length - 1].loc.end,
|
|
@@ -2739,11 +2739,11 @@ const transformTransition = (node, context) => {
|
|
|
2739
2739
|
);
|
|
2740
2740
|
}
|
|
2741
2741
|
const child = node.children[0];
|
|
2742
|
-
if (child.type === "
|
|
2742
|
+
if (child.type === "1") {
|
|
2743
2743
|
for (const p of child.props) {
|
|
2744
|
-
if (p.type === 7 && p.name === "show") {
|
|
2744
|
+
if (p.type === "7" && p.name === "show") {
|
|
2745
2745
|
node.props.push({
|
|
2746
|
-
type: 6,
|
|
2746
|
+
type: "6",
|
|
2747
2747
|
name: "persisted",
|
|
2748
2748
|
value: void 0,
|
|
2749
2749
|
loc: node.loc
|
|
@@ -2757,10 +2757,10 @@ const transformTransition = (node, context) => {
|
|
|
2757
2757
|
};
|
|
2758
2758
|
function hasMultipleChildren(node) {
|
|
2759
2759
|
const children = node.children = node.children.filter(
|
|
2760
|
-
(c) => c.type !== "
|
|
2760
|
+
(c) => c.type !== "3" && !(c.type === "2" && !c.content.trim())
|
|
2761
2761
|
);
|
|
2762
2762
|
const child = children[0];
|
|
2763
|
-
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
|
|
2763
|
+
return children.length !== 1 || child.type === "11" || child.type === "9" && child.branches.some(hasMultipleChildren);
|
|
2764
2764
|
}
|
|
2765
2765
|
|
|
2766
2766
|
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
|
|
@@ -2814,10 +2814,10 @@ const stringifyStatic = (children, context, parent) => {
|
|
|
2814
2814
|
}
|
|
2815
2815
|
stringifyCurrentChunk(i);
|
|
2816
2816
|
};
|
|
2817
|
-
const getHoistedNode = (node) => (node.type === "
|
|
2817
|
+
const getHoistedNode = (node) => (node.type === "1" && node.tagType === "0" || node.type == "12") && node.codegenNode && node.codegenNode.type === "4" && node.codegenNode.hoisted;
|
|
2818
2818
|
const dataAriaRE = /^(data|aria)-/;
|
|
2819
2819
|
const isStringifiableAttr = (name, ns) => {
|
|
2820
|
-
return (ns === 0 ? shared.isKnownHtmlAttr(name) : ns === 1 ? shared.isKnownSvgAttr(name) : false) || dataAriaRE.test(name);
|
|
2820
|
+
return (ns === 0 ? shared.isKnownHtmlAttr(name) : ns === "1" ? shared.isKnownSvgAttr(name) : false) || dataAriaRE.test(name);
|
|
2821
2821
|
};
|
|
2822
2822
|
const replaceHoist = (node, replacement, context) => {
|
|
2823
2823
|
const hoistToReplace = node.codegenNode.hoisted;
|
|
@@ -2827,10 +2827,10 @@ const isNonStringifiable = /* @__PURE__ */ shared.makeMap(
|
|
|
2827
2827
|
`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
|
|
2828
2828
|
);
|
|
2829
2829
|
function analyzeNode(node) {
|
|
2830
|
-
if (node.type === "
|
|
2830
|
+
if (node.type === "1" && isNonStringifiable(node.tag)) {
|
|
2831
2831
|
return false;
|
|
2832
2832
|
}
|
|
2833
|
-
if (node.type === 12) {
|
|
2833
|
+
if (node.type === "12") {
|
|
2834
2834
|
return [1, 0];
|
|
2835
2835
|
}
|
|
2836
2836
|
let nc = 1;
|
|
@@ -2843,14 +2843,14 @@ function analyzeNode(node) {
|
|
|
2843
2843
|
function walk(node2) {
|
|
2844
2844
|
for (let i = 0; i < node2.props.length; i++) {
|
|
2845
2845
|
const p = node2.props[i];
|
|
2846
|
-
if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
|
|
2846
|
+
if (p.type === "6" && !isStringifiableAttr(p.name, node2.ns)) {
|
|
2847
2847
|
return bail();
|
|
2848
2848
|
}
|
|
2849
|
-
if (p.type === 7 && p.name === "bind") {
|
|
2850
|
-
if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node2.ns))) {
|
|
2849
|
+
if (p.type === "7" && p.name === "bind") {
|
|
2850
|
+
if (p.arg && (p.arg.type === "8" || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node2.ns))) {
|
|
2851
2851
|
return bail();
|
|
2852
2852
|
}
|
|
2853
|
-
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
|
|
2853
|
+
if (p.exp && (p.exp.type === "8" || p.exp.constType < "3")) {
|
|
2854
2854
|
return bail();
|
|
2855
2855
|
}
|
|
2856
2856
|
}
|
|
@@ -2858,7 +2858,7 @@ function analyzeNode(node) {
|
|
|
2858
2858
|
for (let i = 0; i < node2.children.length; i++) {
|
|
2859
2859
|
nc++;
|
|
2860
2860
|
const child = node2.children[i];
|
|
2861
|
-
if (child.type === "
|
|
2861
|
+
if (child.type === "1") {
|
|
2862
2862
|
if (child.props.length > 0) {
|
|
2863
2863
|
ec++;
|
|
2864
2864
|
}
|
|
@@ -2880,17 +2880,17 @@ function stringifyNode(node, context) {
|
|
|
2880
2880
|
return ``;
|
|
2881
2881
|
}
|
|
2882
2882
|
switch (node.type) {
|
|
2883
|
-
case "
|
|
2883
|
+
case "1":
|
|
2884
2884
|
return stringifyElement(node, context);
|
|
2885
|
-
case "
|
|
2885
|
+
case "2":
|
|
2886
2886
|
return shared.escapeHtml(node.content);
|
|
2887
|
-
case "
|
|
2887
|
+
case "3":
|
|
2888
2888
|
return `<!--${shared.escapeHtml(node.content)}-->`;
|
|
2889
|
-
case 5:
|
|
2889
|
+
case "5":
|
|
2890
2890
|
return shared.escapeHtml(shared.toDisplayString(evaluateConstant(node.content)));
|
|
2891
|
-
case 8:
|
|
2891
|
+
case "8":
|
|
2892
2892
|
return shared.escapeHtml(evaluateConstant(node));
|
|
2893
|
-
case 12:
|
|
2893
|
+
case "12":
|
|
2894
2894
|
return stringifyNode(node.content, context);
|
|
2895
2895
|
default:
|
|
2896
2896
|
return "";
|
|
@@ -2901,12 +2901,12 @@ function stringifyElement(node, context) {
|
|
|
2901
2901
|
let innerHTML = "";
|
|
2902
2902
|
for (let i = 0; i < node.props.length; i++) {
|
|
2903
2903
|
const p = node.props[i];
|
|
2904
|
-
if (p.type === 6) {
|
|
2904
|
+
if (p.type === "6") {
|
|
2905
2905
|
res += ` ${p.name}`;
|
|
2906
2906
|
if (p.value) {
|
|
2907
2907
|
res += `="${shared.escapeHtml(p.value.content)}"`;
|
|
2908
2908
|
}
|
|
2909
|
-
} else if (p.type === 7) {
|
|
2909
|
+
} else if (p.type === "7") {
|
|
2910
2910
|
if (p.name === "bind") {
|
|
2911
2911
|
const exp = p.exp;
|
|
2912
2912
|
if (exp.content[0] === "_") {
|
|
@@ -2954,7 +2954,7 @@ function stringifyElement(node, context) {
|
|
|
2954
2954
|
return res;
|
|
2955
2955
|
}
|
|
2956
2956
|
function evaluateConstant(exp) {
|
|
2957
|
-
if (exp.type === 4) {
|
|
2957
|
+
if (exp.type === "4") {
|
|
2958
2958
|
return new Function(`return ${exp.content}`)();
|
|
2959
2959
|
} else {
|
|
2960
2960
|
let res = ``;
|
|
@@ -2962,9 +2962,9 @@ function evaluateConstant(exp) {
|
|
|
2962
2962
|
if (shared.isString(c) || shared.isSymbol(c)) {
|
|
2963
2963
|
return;
|
|
2964
2964
|
}
|
|
2965
|
-
if (c.type === "
|
|
2965
|
+
if (c.type === "2") {
|
|
2966
2966
|
res += c.content;
|
|
2967
|
-
} else if (c.type === 5) {
|
|
2967
|
+
} else if (c.type === "5") {
|
|
2968
2968
|
res += shared.toDisplayString(evaluateConstant(c.content));
|
|
2969
2969
|
} else {
|
|
2970
2970
|
res += evaluateConstant(c);
|
|
@@ -2975,9 +2975,9 @@ function evaluateConstant(exp) {
|
|
|
2975
2975
|
}
|
|
2976
2976
|
|
|
2977
2977
|
const ignoreSideEffectTags = (node, context) => {
|
|
2978
|
-
if (node.type === "
|
|
2978
|
+
if (node.type === "1" && node.tagType === "0" && (node.tag === "script" || node.tag === "style")) {
|
|
2979
2979
|
context.onError(
|
|
2980
|
-
createDOMCompilerError(61, node.loc)
|
|
2980
|
+
createDOMCompilerError("61", node.loc)
|
|
2981
2981
|
);
|
|
2982
2982
|
context.removeNode();
|
|
2983
2983
|
}
|