@vue/compiler-vapor 3.6.0-beta.3 → 3.6.0-beta.4
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-vapor v3.6.0-beta.4
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -187,6 +187,9 @@ class TransformContext {
|
|
|
187
187
|
// whether this node is on the rightmost path of the tree
|
|
188
188
|
// (all ancestors are also last effective children)
|
|
189
189
|
this.isOnRightmostPath = true;
|
|
190
|
+
// whether there is an inline ancestor that needs closing
|
|
191
|
+
// (i.e. is an inline tag and not on the rightmost path)
|
|
192
|
+
this.hasInlineAncestorNeedingClose = false;
|
|
190
193
|
this.globalId = 0;
|
|
191
194
|
this.nextIdMap = null;
|
|
192
195
|
this.increaseId = () => {
|
|
@@ -273,6 +276,14 @@ class TransformContext {
|
|
|
273
276
|
}
|
|
274
277
|
const isLastEffectiveChild = this.isEffectivelyLastChild(index);
|
|
275
278
|
const isOnRightmostPath = this.isOnRightmostPath && isLastEffectiveChild;
|
|
279
|
+
let hasInlineAncestorNeedingClose = this.hasInlineAncestorNeedingClose;
|
|
280
|
+
if (this.node.type === 1) {
|
|
281
|
+
if (this.node.tag === "template") {
|
|
282
|
+
hasInlineAncestorNeedingClose = false;
|
|
283
|
+
} else if (!hasInlineAncestorNeedingClose && !this.isOnRightmostPath && shared.isInlineTag(this.node.tag)) {
|
|
284
|
+
hasInlineAncestorNeedingClose = true;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
276
287
|
return Object.assign(Object.create(TransformContext.prototype), this, {
|
|
277
288
|
node,
|
|
278
289
|
parent: this,
|
|
@@ -282,7 +293,8 @@ class TransformContext {
|
|
|
282
293
|
dynamic: newDynamic(),
|
|
283
294
|
effectiveParent,
|
|
284
295
|
isLastEffectiveChild,
|
|
285
|
-
isOnRightmostPath
|
|
296
|
+
isOnRightmostPath,
|
|
297
|
+
hasInlineAncestorNeedingClose
|
|
286
298
|
});
|
|
287
299
|
}
|
|
288
300
|
isEffectivelyLastChild(index) {
|
|
@@ -1771,8 +1783,8 @@ function genRefValue(value, context) {
|
|
|
1771
1783
|
|
|
1772
1784
|
function genSetText(oper, context) {
|
|
1773
1785
|
const { helper } = context;
|
|
1774
|
-
const { element, values, generated,
|
|
1775
|
-
const texts = combineValues(values, context
|
|
1786
|
+
const { element, values, generated, isComponent } = oper;
|
|
1787
|
+
const texts = combineValues(values, context);
|
|
1776
1788
|
return [
|
|
1777
1789
|
NEWLINE,
|
|
1778
1790
|
...genCall(
|
|
@@ -1783,14 +1795,14 @@ function genSetText(oper, context) {
|
|
|
1783
1795
|
)
|
|
1784
1796
|
];
|
|
1785
1797
|
}
|
|
1786
|
-
function combineValues(values, context
|
|
1798
|
+
function combineValues(values, context) {
|
|
1787
1799
|
return values.flatMap((value, i) => {
|
|
1788
1800
|
let exp = genExpression(value, context);
|
|
1789
|
-
if (
|
|
1801
|
+
if (getLiteralExpressionValue(value, true) == null) {
|
|
1790
1802
|
exp = genCall(context.helper("toDisplayString"), exp);
|
|
1791
1803
|
}
|
|
1792
1804
|
if (i > 0) {
|
|
1793
|
-
exp.unshift(
|
|
1805
|
+
exp.unshift(" + ");
|
|
1794
1806
|
}
|
|
1795
1807
|
return exp;
|
|
1796
1808
|
});
|
|
@@ -2515,17 +2527,17 @@ function genEffect({ operations }, context) {
|
|
|
2515
2527
|
return frag;
|
|
2516
2528
|
}
|
|
2517
2529
|
function genInsertionState(operation, context) {
|
|
2518
|
-
const { parent, anchor, append, last } = operation;
|
|
2530
|
+
const { parent, anchor, logicalIndex, append, last } = operation;
|
|
2519
2531
|
return [
|
|
2520
2532
|
NEWLINE,
|
|
2521
2533
|
...genCall(
|
|
2522
2534
|
context.helper("setInsertionState"),
|
|
2523
2535
|
`n${parent}`,
|
|
2524
2536
|
anchor == null ? void 0 : anchor === -1 ? `0` : append ? (
|
|
2525
|
-
//
|
|
2526
|
-
|
|
2527
|
-
anchor === 0 ? "null" : `${anchor}`
|
|
2537
|
+
// for append, always use null since we have logicalIndex
|
|
2538
|
+
"null"
|
|
2528
2539
|
) : `n${anchor}`,
|
|
2540
|
+
logicalIndex !== void 0 ? String(logicalIndex) : void 0,
|
|
2529
2541
|
last && "true"
|
|
2530
2542
|
)
|
|
2531
2543
|
];
|
|
@@ -2570,16 +2582,9 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`) {
|
|
|
2570
2582
|
const { children } = dynamic;
|
|
2571
2583
|
let offset = 0;
|
|
2572
2584
|
let prev;
|
|
2573
|
-
let ifBranchCount = 0;
|
|
2574
|
-
let prependCount = 0;
|
|
2575
2585
|
for (const [index, child] of children.entries()) {
|
|
2576
|
-
if (child.operation && child.operation.anchor === -1) {
|
|
2577
|
-
prependCount++;
|
|
2578
|
-
}
|
|
2579
2586
|
if (child.flags & 2) {
|
|
2580
2587
|
offset--;
|
|
2581
|
-
} else if (child.ifBranch) {
|
|
2582
|
-
ifBranchCount++;
|
|
2583
2588
|
}
|
|
2584
2589
|
const id = child.flags & 1 ? child.flags & 4 ? child.anchor : child.id : void 0;
|
|
2585
2590
|
if (id === void 0 && !child.hasDynamicChild) {
|
|
@@ -2587,19 +2592,19 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`) {
|
|
|
2587
2592
|
continue;
|
|
2588
2593
|
}
|
|
2589
2594
|
const elementIndex = index + offset;
|
|
2590
|
-
const logicalIndex =
|
|
2595
|
+
const logicalIndex = child.logicalIndex !== void 0 ? String(child.logicalIndex) : void 0;
|
|
2591
2596
|
const variable = id === void 0 ? context.pName(context.block.tempId++) : `n${id}`;
|
|
2592
2597
|
pushBlock(NEWLINE, `const ${variable} = `);
|
|
2593
2598
|
if (prev) {
|
|
2594
2599
|
if (elementIndex - prev[1] === 1) {
|
|
2595
|
-
pushBlock(...genCall(helper("next"), prev[0],
|
|
2600
|
+
pushBlock(...genCall(helper("next"), prev[0], logicalIndex));
|
|
2596
2601
|
} else {
|
|
2597
2602
|
pushBlock(
|
|
2598
2603
|
...genCall(
|
|
2599
2604
|
helper("nthChild"),
|
|
2600
2605
|
from,
|
|
2601
2606
|
String(elementIndex),
|
|
2602
|
-
|
|
2607
|
+
logicalIndex
|
|
2603
2608
|
)
|
|
2604
2609
|
);
|
|
2605
2610
|
}
|
|
@@ -2609,19 +2614,19 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`) {
|
|
|
2609
2614
|
...genCall(
|
|
2610
2615
|
helper("child"),
|
|
2611
2616
|
from,
|
|
2612
|
-
logicalIndex !== 0 ?
|
|
2617
|
+
child.logicalIndex !== 0 ? logicalIndex : void 0
|
|
2613
2618
|
)
|
|
2614
2619
|
);
|
|
2615
2620
|
} else {
|
|
2616
2621
|
let init = genCall(helper("child"), from);
|
|
2617
2622
|
if (elementIndex === 1) {
|
|
2618
|
-
init = genCall(helper("next"), init,
|
|
2623
|
+
init = genCall(helper("next"), init, logicalIndex);
|
|
2619
2624
|
} else if (elementIndex > 1) {
|
|
2620
2625
|
init = genCall(
|
|
2621
2626
|
helper("nthChild"),
|
|
2622
2627
|
from,
|
|
2623
2628
|
String(elementIndex),
|
|
2624
|
-
|
|
2629
|
+
logicalIndex
|
|
2625
2630
|
);
|
|
2626
2631
|
}
|
|
2627
2632
|
pushBlock(...init);
|
|
@@ -2918,11 +2923,15 @@ function processDynamicChildren(context) {
|
|
|
2918
2923
|
let dynamicCount = 0;
|
|
2919
2924
|
let lastInsertionChild;
|
|
2920
2925
|
const children = context.dynamic.children;
|
|
2926
|
+
let logicalIndex = 0;
|
|
2921
2927
|
for (const [index, child] of children.entries()) {
|
|
2922
2928
|
if (child.flags & 4) {
|
|
2929
|
+
child.logicalIndex = logicalIndex;
|
|
2923
2930
|
prevDynamics.push(lastInsertionChild = child);
|
|
2931
|
+
logicalIndex++;
|
|
2924
2932
|
}
|
|
2925
2933
|
if (!(child.flags & 2)) {
|
|
2934
|
+
child.logicalIndex = logicalIndex;
|
|
2926
2935
|
if (prevDynamics.length) {
|
|
2927
2936
|
if (staticCount) {
|
|
2928
2937
|
context.childrenTemplate[index - prevDynamics.length] = `<!>`;
|
|
@@ -2941,6 +2950,7 @@ function processDynamicChildren(context) {
|
|
|
2941
2950
|
prevDynamics = [];
|
|
2942
2951
|
}
|
|
2943
2952
|
staticCount++;
|
|
2953
|
+
logicalIndex++;
|
|
2944
2954
|
}
|
|
2945
2955
|
}
|
|
2946
2956
|
if (prevDynamics.length) {
|
|
@@ -2958,6 +2968,7 @@ function processDynamicChildren(context) {
|
|
|
2958
2968
|
}
|
|
2959
2969
|
function registerInsertion(dynamics, context, anchor, append) {
|
|
2960
2970
|
for (const child of dynamics) {
|
|
2971
|
+
const logicalIndex = child.logicalIndex;
|
|
2961
2972
|
if (child.template != null) {
|
|
2962
2973
|
context.registerOperation({
|
|
2963
2974
|
type: 9,
|
|
@@ -2968,6 +2979,7 @@ function registerInsertion(dynamics, context, anchor, append) {
|
|
|
2968
2979
|
} else if (child.operation && isBlockOperation(child.operation)) {
|
|
2969
2980
|
child.operation.parent = context.reference();
|
|
2970
2981
|
child.operation.anchor = anchor;
|
|
2982
|
+
child.operation.logicalIndex = logicalIndex;
|
|
2971
2983
|
child.operation.append = append;
|
|
2972
2984
|
}
|
|
2973
2985
|
}
|
|
@@ -3041,9 +3053,15 @@ function canOmitEndTag(node, context) {
|
|
|
3041
3053
|
if (block !== parent.block) {
|
|
3042
3054
|
return true;
|
|
3043
3055
|
}
|
|
3056
|
+
if (shared.isAlwaysCloseTag(node.tag) && !context.isOnRightmostPath) {
|
|
3057
|
+
return false;
|
|
3058
|
+
}
|
|
3044
3059
|
if (shared.isFormattingTag(node.tag) || parent.node.type === 1 && node.tag === parent.node.tag) {
|
|
3045
3060
|
return context.isOnRightmostPath;
|
|
3046
3061
|
}
|
|
3062
|
+
if (shared.isBlockTag(node.tag) && context.hasInlineAncestorNeedingClose) {
|
|
3063
|
+
return false;
|
|
3064
|
+
}
|
|
3047
3065
|
return context.isLastEffectiveChild;
|
|
3048
3066
|
}
|
|
3049
3067
|
function isSingleRoot(context) {
|
|
@@ -3603,6 +3621,7 @@ function markNonTemplate(node, context) {
|
|
|
3603
3621
|
seen.get(context.root).add(node);
|
|
3604
3622
|
}
|
|
3605
3623
|
const transformText = (node, context) => {
|
|
3624
|
+
var _a;
|
|
3606
3625
|
if (!seen.has(context.root)) seen.set(context.root, /* @__PURE__ */ new WeakSet());
|
|
3607
3626
|
if (seen.get(context.root).has(node)) {
|
|
3608
3627
|
context.dynamic.flags |= 2;
|
|
@@ -3636,7 +3655,9 @@ const transformText = (node, context) => {
|
|
|
3636
3655
|
} else if (node.type === 5) {
|
|
3637
3656
|
processInterpolation(context);
|
|
3638
3657
|
} else if (node.type === 2) {
|
|
3639
|
-
context.
|
|
3658
|
+
const parent = (_a = context.parent) == null ? void 0 : _a.node;
|
|
3659
|
+
const isRootText = !parent || parent.type === 0 || parent.type === 1 && (parent.tagType === 3 || parent.tagType === 1);
|
|
3660
|
+
context.template += isRootText ? node.content : shared.escapeHtml(node.content);
|
|
3640
3661
|
}
|
|
3641
3662
|
};
|
|
3642
3663
|
function processInterpolation(context) {
|
|
@@ -3870,7 +3891,6 @@ function processIf(node, dir, context) {
|
|
|
3870
3891
|
};
|
|
3871
3892
|
} else {
|
|
3872
3893
|
const siblingIf = getSiblingIf(context, true);
|
|
3873
|
-
context.dynamic.ifBranch = true;
|
|
3874
3894
|
const siblings = context.parent && context.parent.dynamic.children;
|
|
3875
3895
|
let lastIfNode;
|
|
3876
3896
|
if (siblings) {
|
|
@@ -4308,7 +4328,7 @@ function hasMultipleChildren(node) {
|
|
|
4308
4328
|
(c, index) => c.type === 1 && // not template
|
|
4309
4329
|
!compilerDom.isTemplateNode(c) && // not has v-for
|
|
4310
4330
|
!findDir(c, "for") && // if the first child has v-if, the rest should also have v-else-if/v-else
|
|
4311
|
-
(index === 0 ? findDir(c, "if") : hasElse(c))
|
|
4331
|
+
(index === 0 ? findDir(c, "if") : hasElse(c))
|
|
4312
4332
|
)) {
|
|
4313
4333
|
return false;
|
|
4314
4334
|
}
|
package/dist/compiler-vapor.d.ts
CHANGED
|
@@ -116,6 +116,7 @@ export interface IfIRNode extends BaseIRNode {
|
|
|
116
116
|
once?: boolean;
|
|
117
117
|
parent?: number;
|
|
118
118
|
anchor?: number;
|
|
119
|
+
logicalIndex?: number;
|
|
119
120
|
append?: boolean;
|
|
120
121
|
last?: boolean;
|
|
121
122
|
}
|
|
@@ -135,6 +136,7 @@ export interface ForIRNode extends BaseIRNode, IRFor {
|
|
|
135
136
|
onlyChild: boolean;
|
|
136
137
|
parent?: number;
|
|
137
138
|
anchor?: number;
|
|
139
|
+
logicalIndex?: number;
|
|
138
140
|
append?: boolean;
|
|
139
141
|
last?: boolean;
|
|
140
142
|
}
|
|
@@ -160,7 +162,6 @@ export interface SetTextIRNode extends BaseIRNode {
|
|
|
160
162
|
element: number;
|
|
161
163
|
values: SimpleExpressionNode[];
|
|
162
164
|
generated?: boolean;
|
|
163
|
-
jsx?: boolean;
|
|
164
165
|
isComponent?: boolean;
|
|
165
166
|
}
|
|
166
167
|
export type KeyOverride = [find: string, replacement: string];
|
|
@@ -226,6 +227,7 @@ export interface CreateComponentIRNode extends BaseIRNode {
|
|
|
226
227
|
isCustomElement: boolean;
|
|
227
228
|
parent?: number;
|
|
228
229
|
anchor?: number;
|
|
230
|
+
logicalIndex?: number;
|
|
229
231
|
append?: boolean;
|
|
230
232
|
last?: boolean;
|
|
231
233
|
}
|
|
@@ -239,6 +241,7 @@ export interface SlotOutletIRNode extends BaseIRNode {
|
|
|
239
241
|
once?: boolean;
|
|
240
242
|
parent?: number;
|
|
241
243
|
anchor?: number;
|
|
244
|
+
logicalIndex?: number;
|
|
242
245
|
append?: boolean;
|
|
243
246
|
last?: boolean;
|
|
244
247
|
}
|
|
@@ -267,11 +270,11 @@ export interface IRDynamicInfo {
|
|
|
267
270
|
id?: number;
|
|
268
271
|
flags: DynamicFlag;
|
|
269
272
|
anchor?: number;
|
|
273
|
+
logicalIndex?: number;
|
|
270
274
|
children: IRDynamicInfo[];
|
|
271
275
|
template?: number;
|
|
272
276
|
hasDynamicChild?: boolean;
|
|
273
277
|
operation?: OperationNode;
|
|
274
|
-
ifBranch?: boolean;
|
|
275
278
|
}
|
|
276
279
|
export interface IREffect {
|
|
277
280
|
expressions: SimpleExpressionNode[];
|
|
@@ -325,6 +328,7 @@ export declare class TransformContext<T extends AllNode = AllNode> {
|
|
|
325
328
|
slots: IRSlots[];
|
|
326
329
|
isLastEffectiveChild: boolean;
|
|
327
330
|
isOnRightmostPath: boolean;
|
|
331
|
+
hasInlineAncestorNeedingClose: boolean;
|
|
328
332
|
private globalId;
|
|
329
333
|
private nextIdMap;
|
|
330
334
|
constructor(ir: RootIRNode, node: T, options?: TransformOptions);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-vapor v3.6.0-beta.4
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -67,11 +67,17 @@ const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,col
|
|
|
67
67
|
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
|
|
68
68
|
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
|
69
69
|
const FORMATTING_TAGS = "a,b,big,code,em,font,i,nobr,s,small,strike,strong,tt,u";
|
|
70
|
+
const ALWAYS_CLOSE_TAGS = "title,style,script,noscript,template,object,table,button,textarea,select,iframe,fieldset";
|
|
71
|
+
const INLINE_TAGS = "a,abbr,acronym,b,bdi,bdo,big,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,label,map,mark,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,small,span,strong,sub,sup,svg,textarea,time,u,tt,var,video";
|
|
72
|
+
const BLOCK_TAGS = "address,article,aside,blockquote,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,main,menu,nav,ol,p,pre,section,table,ul";
|
|
70
73
|
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
|
71
74
|
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
|
72
75
|
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
|
|
73
76
|
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
|
74
77
|
const isFormattingTag = /* @__PURE__ */ makeMap(FORMATTING_TAGS);
|
|
78
|
+
const isAlwaysCloseTag = /* @__PURE__ */ makeMap(ALWAYS_CLOSE_TAGS);
|
|
79
|
+
const isInlineTag = /* @__PURE__ */ makeMap(INLINE_TAGS);
|
|
80
|
+
const isBlockTag = /* @__PURE__ */ makeMap(BLOCK_TAGS);
|
|
75
81
|
|
|
76
82
|
function shouldSetAsAttr(tagName, key) {
|
|
77
83
|
if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
|
|
@@ -23849,6 +23855,9 @@ class TransformContext {
|
|
|
23849
23855
|
// whether this node is on the rightmost path of the tree
|
|
23850
23856
|
// (all ancestors are also last effective children)
|
|
23851
23857
|
this.isOnRightmostPath = true;
|
|
23858
|
+
// whether there is an inline ancestor that needs closing
|
|
23859
|
+
// (i.e. is an inline tag and not on the rightmost path)
|
|
23860
|
+
this.hasInlineAncestorNeedingClose = false;
|
|
23852
23861
|
this.globalId = 0;
|
|
23853
23862
|
this.nextIdMap = null;
|
|
23854
23863
|
this.increaseId = () => {
|
|
@@ -23935,6 +23944,14 @@ class TransformContext {
|
|
|
23935
23944
|
}
|
|
23936
23945
|
const isLastEffectiveChild = this.isEffectivelyLastChild(index);
|
|
23937
23946
|
const isOnRightmostPath = this.isOnRightmostPath && isLastEffectiveChild;
|
|
23947
|
+
let hasInlineAncestorNeedingClose = this.hasInlineAncestorNeedingClose;
|
|
23948
|
+
if (this.node.type === 1) {
|
|
23949
|
+
if (this.node.tag === "template") {
|
|
23950
|
+
hasInlineAncestorNeedingClose = false;
|
|
23951
|
+
} else if (!hasInlineAncestorNeedingClose && !this.isOnRightmostPath && isInlineTag(this.node.tag)) {
|
|
23952
|
+
hasInlineAncestorNeedingClose = true;
|
|
23953
|
+
}
|
|
23954
|
+
}
|
|
23938
23955
|
return Object.assign(Object.create(TransformContext.prototype), this, {
|
|
23939
23956
|
node,
|
|
23940
23957
|
parent: this,
|
|
@@ -23944,7 +23961,8 @@ class TransformContext {
|
|
|
23944
23961
|
dynamic: newDynamic(),
|
|
23945
23962
|
effectiveParent,
|
|
23946
23963
|
isLastEffectiveChild,
|
|
23947
|
-
isOnRightmostPath
|
|
23964
|
+
isOnRightmostPath,
|
|
23965
|
+
hasInlineAncestorNeedingClose
|
|
23948
23966
|
});
|
|
23949
23967
|
}
|
|
23950
23968
|
isEffectivelyLastChild(index) {
|
|
@@ -25433,8 +25451,8 @@ function genRefValue(value, context) {
|
|
|
25433
25451
|
|
|
25434
25452
|
function genSetText(oper, context) {
|
|
25435
25453
|
const { helper } = context;
|
|
25436
|
-
const { element, values, generated,
|
|
25437
|
-
const texts = combineValues(values, context
|
|
25454
|
+
const { element, values, generated, isComponent } = oper;
|
|
25455
|
+
const texts = combineValues(values, context);
|
|
25438
25456
|
return [
|
|
25439
25457
|
NEWLINE,
|
|
25440
25458
|
...genCall(
|
|
@@ -25445,14 +25463,14 @@ function genSetText(oper, context) {
|
|
|
25445
25463
|
)
|
|
25446
25464
|
];
|
|
25447
25465
|
}
|
|
25448
|
-
function combineValues(values, context
|
|
25466
|
+
function combineValues(values, context) {
|
|
25449
25467
|
return values.flatMap((value, i) => {
|
|
25450
25468
|
let exp = genExpression(value, context);
|
|
25451
|
-
if (
|
|
25469
|
+
if (getLiteralExpressionValue(value, true) == null) {
|
|
25452
25470
|
exp = genCall(context.helper("toDisplayString"), exp);
|
|
25453
25471
|
}
|
|
25454
25472
|
if (i > 0) {
|
|
25455
|
-
exp.unshift(
|
|
25473
|
+
exp.unshift(" + ");
|
|
25456
25474
|
}
|
|
25457
25475
|
return exp;
|
|
25458
25476
|
});
|
|
@@ -26177,17 +26195,17 @@ function genEffect({ operations }, context) {
|
|
|
26177
26195
|
return frag;
|
|
26178
26196
|
}
|
|
26179
26197
|
function genInsertionState(operation, context) {
|
|
26180
|
-
const { parent, anchor, append, last } = operation;
|
|
26198
|
+
const { parent, anchor, logicalIndex, append, last } = operation;
|
|
26181
26199
|
return [
|
|
26182
26200
|
NEWLINE,
|
|
26183
26201
|
...genCall(
|
|
26184
26202
|
context.helper("setInsertionState"),
|
|
26185
26203
|
`n${parent}`,
|
|
26186
26204
|
anchor == null ? void 0 : anchor === -1 ? `0` : append ? (
|
|
26187
|
-
//
|
|
26188
|
-
|
|
26189
|
-
anchor === 0 ? "null" : `${anchor}`
|
|
26205
|
+
// for append, always use null since we have logicalIndex
|
|
26206
|
+
"null"
|
|
26190
26207
|
) : `n${anchor}`,
|
|
26208
|
+
logicalIndex !== void 0 ? String(logicalIndex) : void 0,
|
|
26191
26209
|
last && "true"
|
|
26192
26210
|
)
|
|
26193
26211
|
];
|
|
@@ -26232,16 +26250,9 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`) {
|
|
|
26232
26250
|
const { children } = dynamic;
|
|
26233
26251
|
let offset = 0;
|
|
26234
26252
|
let prev;
|
|
26235
|
-
let ifBranchCount = 0;
|
|
26236
|
-
let prependCount = 0;
|
|
26237
26253
|
for (const [index, child] of children.entries()) {
|
|
26238
|
-
if (child.operation && child.operation.anchor === -1) {
|
|
26239
|
-
prependCount++;
|
|
26240
|
-
}
|
|
26241
26254
|
if (child.flags & 2) {
|
|
26242
26255
|
offset--;
|
|
26243
|
-
} else if (child.ifBranch) {
|
|
26244
|
-
ifBranchCount++;
|
|
26245
26256
|
}
|
|
26246
26257
|
const id = child.flags & 1 ? child.flags & 4 ? child.anchor : child.id : void 0;
|
|
26247
26258
|
if (id === void 0 && !child.hasDynamicChild) {
|
|
@@ -26249,19 +26260,19 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`) {
|
|
|
26249
26260
|
continue;
|
|
26250
26261
|
}
|
|
26251
26262
|
const elementIndex = index + offset;
|
|
26252
|
-
const logicalIndex =
|
|
26263
|
+
const logicalIndex = child.logicalIndex !== void 0 ? String(child.logicalIndex) : void 0;
|
|
26253
26264
|
const variable = id === void 0 ? context.pName(context.block.tempId++) : `n${id}`;
|
|
26254
26265
|
pushBlock(NEWLINE, `const ${variable} = `);
|
|
26255
26266
|
if (prev) {
|
|
26256
26267
|
if (elementIndex - prev[1] === 1) {
|
|
26257
|
-
pushBlock(...genCall(helper("next"), prev[0],
|
|
26268
|
+
pushBlock(...genCall(helper("next"), prev[0], logicalIndex));
|
|
26258
26269
|
} else {
|
|
26259
26270
|
pushBlock(
|
|
26260
26271
|
...genCall(
|
|
26261
26272
|
helper("nthChild"),
|
|
26262
26273
|
from,
|
|
26263
26274
|
String(elementIndex),
|
|
26264
|
-
|
|
26275
|
+
logicalIndex
|
|
26265
26276
|
)
|
|
26266
26277
|
);
|
|
26267
26278
|
}
|
|
@@ -26271,19 +26282,19 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`) {
|
|
|
26271
26282
|
...genCall(
|
|
26272
26283
|
helper("child"),
|
|
26273
26284
|
from,
|
|
26274
|
-
logicalIndex !== 0 ?
|
|
26285
|
+
child.logicalIndex !== 0 ? logicalIndex : void 0
|
|
26275
26286
|
)
|
|
26276
26287
|
);
|
|
26277
26288
|
} else {
|
|
26278
26289
|
let init = genCall(helper("child"), from);
|
|
26279
26290
|
if (elementIndex === 1) {
|
|
26280
|
-
init = genCall(helper("next"), init,
|
|
26291
|
+
init = genCall(helper("next"), init, logicalIndex);
|
|
26281
26292
|
} else if (elementIndex > 1) {
|
|
26282
26293
|
init = genCall(
|
|
26283
26294
|
helper("nthChild"),
|
|
26284
26295
|
from,
|
|
26285
26296
|
String(elementIndex),
|
|
26286
|
-
|
|
26297
|
+
logicalIndex
|
|
26287
26298
|
);
|
|
26288
26299
|
}
|
|
26289
26300
|
pushBlock(...init);
|
|
@@ -26580,11 +26591,15 @@ function processDynamicChildren(context) {
|
|
|
26580
26591
|
let dynamicCount = 0;
|
|
26581
26592
|
let lastInsertionChild;
|
|
26582
26593
|
const children = context.dynamic.children;
|
|
26594
|
+
let logicalIndex = 0;
|
|
26583
26595
|
for (const [index, child] of children.entries()) {
|
|
26584
26596
|
if (child.flags & 4) {
|
|
26597
|
+
child.logicalIndex = logicalIndex;
|
|
26585
26598
|
prevDynamics.push(lastInsertionChild = child);
|
|
26599
|
+
logicalIndex++;
|
|
26586
26600
|
}
|
|
26587
26601
|
if (!(child.flags & 2)) {
|
|
26602
|
+
child.logicalIndex = logicalIndex;
|
|
26588
26603
|
if (prevDynamics.length) {
|
|
26589
26604
|
if (staticCount) {
|
|
26590
26605
|
context.childrenTemplate[index - prevDynamics.length] = `<!>`;
|
|
@@ -26603,6 +26618,7 @@ function processDynamicChildren(context) {
|
|
|
26603
26618
|
prevDynamics = [];
|
|
26604
26619
|
}
|
|
26605
26620
|
staticCount++;
|
|
26621
|
+
logicalIndex++;
|
|
26606
26622
|
}
|
|
26607
26623
|
}
|
|
26608
26624
|
if (prevDynamics.length) {
|
|
@@ -26620,6 +26636,7 @@ function processDynamicChildren(context) {
|
|
|
26620
26636
|
}
|
|
26621
26637
|
function registerInsertion(dynamics, context, anchor, append) {
|
|
26622
26638
|
for (const child of dynamics) {
|
|
26639
|
+
const logicalIndex = child.logicalIndex;
|
|
26623
26640
|
if (child.template != null) {
|
|
26624
26641
|
context.registerOperation({
|
|
26625
26642
|
type: 9,
|
|
@@ -26630,6 +26647,7 @@ function registerInsertion(dynamics, context, anchor, append) {
|
|
|
26630
26647
|
} else if (child.operation && isBlockOperation(child.operation)) {
|
|
26631
26648
|
child.operation.parent = context.reference();
|
|
26632
26649
|
child.operation.anchor = anchor;
|
|
26650
|
+
child.operation.logicalIndex = logicalIndex;
|
|
26633
26651
|
child.operation.append = append;
|
|
26634
26652
|
}
|
|
26635
26653
|
}
|
|
@@ -26703,9 +26721,15 @@ function canOmitEndTag(node, context) {
|
|
|
26703
26721
|
if (block !== parent.block) {
|
|
26704
26722
|
return true;
|
|
26705
26723
|
}
|
|
26724
|
+
if (isAlwaysCloseTag(node.tag) && !context.isOnRightmostPath) {
|
|
26725
|
+
return false;
|
|
26726
|
+
}
|
|
26706
26727
|
if (isFormattingTag(node.tag) || parent.node.type === 1 && node.tag === parent.node.tag) {
|
|
26707
26728
|
return context.isOnRightmostPath;
|
|
26708
26729
|
}
|
|
26730
|
+
if (isBlockTag(node.tag) && context.hasInlineAncestorNeedingClose) {
|
|
26731
|
+
return false;
|
|
26732
|
+
}
|
|
26709
26733
|
return context.isLastEffectiveChild;
|
|
26710
26734
|
}
|
|
26711
26735
|
function isSingleRoot(context) {
|
|
@@ -27252,6 +27276,7 @@ function markNonTemplate(node, context) {
|
|
|
27252
27276
|
seen.get(context.root).add(node);
|
|
27253
27277
|
}
|
|
27254
27278
|
const transformText = (node, context) => {
|
|
27279
|
+
var _a;
|
|
27255
27280
|
if (!seen.has(context.root)) seen.set(context.root, /* @__PURE__ */ new WeakSet());
|
|
27256
27281
|
if (seen.get(context.root).has(node)) {
|
|
27257
27282
|
context.dynamic.flags |= 2;
|
|
@@ -27285,7 +27310,9 @@ const transformText = (node, context) => {
|
|
|
27285
27310
|
} else if (node.type === 5) {
|
|
27286
27311
|
processInterpolation(context);
|
|
27287
27312
|
} else if (node.type === 2) {
|
|
27288
|
-
context.
|
|
27313
|
+
const parent = (_a = context.parent) == null ? void 0 : _a.node;
|
|
27314
|
+
const isRootText = !parent || parent.type === 0 || parent.type === 1 && (parent.tagType === 3 || parent.tagType === 1);
|
|
27315
|
+
context.template += isRootText ? node.content : escapeHtml(node.content);
|
|
27289
27316
|
}
|
|
27290
27317
|
};
|
|
27291
27318
|
function processInterpolation(context) {
|
|
@@ -27519,7 +27546,6 @@ function processIf(node, dir, context) {
|
|
|
27519
27546
|
};
|
|
27520
27547
|
} else {
|
|
27521
27548
|
const siblingIf = getSiblingIf(context, true);
|
|
27522
|
-
context.dynamic.ifBranch = true;
|
|
27523
27549
|
const siblings = context.parent && context.parent.dynamic.children;
|
|
27524
27550
|
let lastIfNode;
|
|
27525
27551
|
if (siblings) {
|
|
@@ -27957,7 +27983,7 @@ function hasMultipleChildren(node) {
|
|
|
27957
27983
|
(c, index) => c.type === 1 && // not template
|
|
27958
27984
|
!isTemplateNode(c) && // not has v-for
|
|
27959
27985
|
!findDir(c, "for") && // if the first child has v-if, the rest should also have v-else-if/v-else
|
|
27960
|
-
(index === 0 ? findDir(c, "if") : hasElse(c))
|
|
27986
|
+
(index === 0 ? findDir(c, "if") : hasElse(c))
|
|
27961
27987
|
)) {
|
|
27962
27988
|
return false;
|
|
27963
27989
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-vapor",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.4",
|
|
4
4
|
"description": "@vue/compiler-vapor",
|
|
5
5
|
"main": "dist/compiler-vapor.cjs.js",
|
|
6
6
|
"module": "dist/compiler-vapor.esm-bundler.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@babel/parser": "^7.28.5",
|
|
46
46
|
"estree-walker": "^2.0.2",
|
|
47
47
|
"source-map-js": "^1.2.1",
|
|
48
|
-
"@vue/
|
|
49
|
-
"@vue/
|
|
48
|
+
"@vue/compiler-dom": "3.6.0-beta.4",
|
|
49
|
+
"@vue/shared": "3.6.0-beta.4"
|
|
50
50
|
}
|
|
51
51
|
}
|