@vue/compiler-dom 3.6.0-rc.1 → 3.6.0-rc.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 +11 -2
- package/dist/compiler-dom.cjs.prod.js +11 -2
- package/dist/compiler-dom.esm-browser.js +46 -14
- package/dist/compiler-dom.esm-browser.prod.js +6 -6
- package/dist/compiler-dom.esm-bundler.js +9 -1
- package/dist/compiler-dom.global.js +46 -14
- package/dist/compiler-dom.global.prod.js +6 -6
- package/package.json +3 -3
package/dist/compiler-dom.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-dom v3.6.0-rc.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -202,6 +202,14 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
202
202
|
const eventOptionModifiers = [];
|
|
203
203
|
for (let i = 0; i < modifiers.length; i++) {
|
|
204
204
|
const modifier = modifiers[i].content;
|
|
205
|
+
if (modifier === "delegate") {
|
|
206
|
+
if (context) {
|
|
207
|
+
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
|
|
208
|
+
error.loc = modifiers[i].loc;
|
|
209
|
+
context.onWarn(error);
|
|
210
|
+
}
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
205
213
|
if (modifier === "native" && context && (0, _vue_compiler_core.checkCompatEnabled)("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
|
|
206
214
|
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
|
|
207
215
|
else {
|
|
@@ -453,10 +461,11 @@ function stringifyElement(node, context) {
|
|
|
453
461
|
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
|
|
454
462
|
continue;
|
|
455
463
|
}
|
|
456
|
-
if ((0, _vue_shared.isBooleanAttr)(p.arg.content) && exp.content === "false") continue;
|
|
464
|
+
if (((0, _vue_shared.isBooleanAttr)(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") continue;
|
|
457
465
|
let evaluated = evaluateConstant(exp);
|
|
458
466
|
if (evaluated != null) {
|
|
459
467
|
const arg = p.arg && p.arg.content;
|
|
468
|
+
if (arg === "hidden" && typeof evaluated === "number" && !(0, _vue_shared.includeBooleanAttr)(evaluated)) continue;
|
|
460
469
|
if (arg === "class") evaluated = (0, _vue_shared.normalizeClass)(evaluated);
|
|
461
470
|
else if (arg === "style") evaluated = (0, _vue_shared.stringifyStyle)((0, _vue_shared.normalizeStyle)(evaluated));
|
|
462
471
|
res += ` ${p.arg.content}="${(0, _vue_shared.escapeHtml)(evaluated)}"`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-dom v3.6.0-rc.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -194,6 +194,14 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
194
194
|
const eventOptionModifiers = [];
|
|
195
195
|
for (let i = 0; i < modifiers.length; i++) {
|
|
196
196
|
const modifier = modifiers[i].content;
|
|
197
|
+
if (modifier === "delegate") {
|
|
198
|
+
if (context) {
|
|
199
|
+
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
|
|
200
|
+
error.loc = modifiers[i].loc;
|
|
201
|
+
context.onWarn(error);
|
|
202
|
+
}
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
197
205
|
if (modifier === "native" && context && (0, _vue_compiler_core.checkCompatEnabled)("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
|
|
198
206
|
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
|
|
199
207
|
else {
|
|
@@ -440,10 +448,11 @@ function stringifyElement(node, context) {
|
|
|
440
448
|
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
|
|
441
449
|
continue;
|
|
442
450
|
}
|
|
443
|
-
if ((0, _vue_shared.isBooleanAttr)(p.arg.content) && exp.content === "false") continue;
|
|
451
|
+
if (((0, _vue_shared.isBooleanAttr)(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") continue;
|
|
444
452
|
let evaluated = evaluateConstant(exp);
|
|
445
453
|
if (evaluated != null) {
|
|
446
454
|
const arg = p.arg && p.arg.content;
|
|
455
|
+
if (arg === "hidden" && typeof evaluated === "number" && !(0, _vue_shared.includeBooleanAttr)(evaluated)) continue;
|
|
447
456
|
if (arg === "class") evaluated = (0, _vue_shared.normalizeClass)(evaluated);
|
|
448
457
|
else if (arg === "style") evaluated = (0, _vue_shared.stringifyStyle)((0, _vue_shared.normalizeStyle)(evaluated));
|
|
449
458
|
res += ` ${p.arg.content}="${(0, _vue_shared.escapeHtml)(evaluated)}"`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-dom v3.6.0-rc.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2662,7 +2662,7 @@ function getSelfName(filename) {
|
|
|
2662
2662
|
const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
|
|
2663
2663
|
return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
|
|
2664
2664
|
}
|
|
2665
|
-
function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false,
|
|
2665
|
+
function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
|
|
2666
2666
|
const context = {
|
|
2667
2667
|
filename,
|
|
2668
2668
|
selfName: getSelfName(filename),
|
|
@@ -2684,7 +2684,6 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
2684
2684
|
bindingMetadata,
|
|
2685
2685
|
inline,
|
|
2686
2686
|
isTS,
|
|
2687
|
-
eventDelegation,
|
|
2688
2687
|
onError,
|
|
2689
2688
|
onWarn,
|
|
2690
2689
|
compatConfig,
|
|
@@ -3511,15 +3510,22 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
|
|
|
3511
3510
|
else {
|
|
3512
3511
|
childBlock = children[0].codegenNode;
|
|
3513
3512
|
if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
|
|
3514
|
-
|
|
3513
|
+
const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
|
|
3514
|
+
if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
|
|
3515
3515
|
removeHelper(OPEN_BLOCK);
|
|
3516
3516
|
removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
3517
3517
|
} else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
3518
|
-
childBlock.isBlock =
|
|
3518
|
+
childBlock.isBlock = shouldUseBlock;
|
|
3519
3519
|
if (childBlock.isBlock) {
|
|
3520
3520
|
helper(OPEN_BLOCK);
|
|
3521
3521
|
helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
3522
|
-
} else
|
|
3522
|
+
} else {
|
|
3523
|
+
helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
3524
|
+
if (childBlock.needsPatch) {
|
|
3525
|
+
var _childBlock$patchFlag;
|
|
3526
|
+
childBlock.patchFlag = ((_childBlock$patchFlag = childBlock.patchFlag) !== null && _childBlock$patchFlag !== void 0 ? _childBlock$patchFlag : 0) | 512;
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3523
3529
|
}
|
|
3524
3530
|
if (memo) {
|
|
3525
3531
|
const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
|
|
@@ -3762,12 +3768,16 @@ const transformElement = (node, context) => {
|
|
|
3762
3768
|
let vnodeDynamicProps;
|
|
3763
3769
|
let dynamicPropNames;
|
|
3764
3770
|
let vnodeDirectives;
|
|
3771
|
+
let needsPatch = false;
|
|
3772
|
+
let isBlockRequired = false;
|
|
3765
3773
|
let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
|
|
3766
3774
|
if (props.length > 0) {
|
|
3767
3775
|
const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
|
|
3768
3776
|
vnodeProps = propsBuildResult.props;
|
|
3769
3777
|
patchFlag = propsBuildResult.patchFlag;
|
|
3770
3778
|
dynamicPropNames = propsBuildResult.dynamicPropNames;
|
|
3779
|
+
needsPatch = propsBuildResult.needsPatch;
|
|
3780
|
+
isBlockRequired = propsBuildResult.isBlockRequired;
|
|
3771
3781
|
const directives = propsBuildResult.directives;
|
|
3772
3782
|
vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
|
|
3773
3783
|
if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
|
|
@@ -3796,7 +3806,10 @@ const transformElement = (node, context) => {
|
|
|
3796
3806
|
} else vnodeChildren = node.children;
|
|
3797
3807
|
}
|
|
3798
3808
|
if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
3799
|
-
node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
|
|
3809
|
+
const vnodeCall = node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
|
|
3810
|
+
needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
|
|
3811
|
+
if (needsPatch) vnodeCall.needsPatch = true;
|
|
3812
|
+
if (isBlockRequired) vnodeCall.isBlockRequired = true;
|
|
3800
3813
|
};
|
|
3801
3814
|
};
|
|
3802
3815
|
function resolveComponentType(node, context, ssr = false) {
|
|
@@ -3830,6 +3843,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3830
3843
|
const runtimeDirectives = [];
|
|
3831
3844
|
const hasChildren = children.length > 0;
|
|
3832
3845
|
let shouldUseBlock = false;
|
|
3846
|
+
let isBlockRequired = false;
|
|
3833
3847
|
let patchFlag = 0;
|
|
3834
3848
|
let hasRef = false;
|
|
3835
3849
|
let hasClassBinding = false;
|
|
@@ -3854,12 +3868,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3854
3868
|
const isEventHandler = isOn(name);
|
|
3855
3869
|
if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !isReservedProp(name)) hasHydrationEventBinding = true;
|
|
3856
3870
|
if (isEventHandler && isReservedProp(name)) hasVnodeHook = true;
|
|
3871
|
+
if (name === "ref") hasRef = true;
|
|
3857
3872
|
if (isEventHandler && value.type === 14) value = value.arguments[0];
|
|
3858
3873
|
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
|
|
3859
|
-
if (name === "
|
|
3860
|
-
else if (name === "class") hasClassBinding = true;
|
|
3874
|
+
if (name === "class") hasClassBinding = true;
|
|
3861
3875
|
else if (name === "style") hasStyleBinding = true;
|
|
3862
|
-
else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
3876
|
+
else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
3863
3877
|
if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
3864
3878
|
} else hasDynamicKeys = true;
|
|
3865
3879
|
};
|
|
@@ -3885,7 +3899,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3885
3899
|
if (name === "once" || name === "memo") continue;
|
|
3886
3900
|
if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
|
|
3887
3901
|
if (isVOn && ssr) continue;
|
|
3888
|
-
if (isVBind && isStaticArgOf(arg, "key")
|
|
3902
|
+
if (isVBind && isStaticArgOf(arg, "key")) shouldUseBlock = true;
|
|
3903
|
+
if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
|
|
3904
|
+
shouldUseBlock = true;
|
|
3905
|
+
isBlockRequired = true;
|
|
3906
|
+
}
|
|
3889
3907
|
if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
|
|
3890
3908
|
if (!arg && (isVBind || isVOn)) {
|
|
3891
3909
|
hasDynamicKeys = true;
|
|
@@ -3927,7 +3945,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3927
3945
|
}
|
|
3928
3946
|
} else if (!isBuiltInDirective(name)) {
|
|
3929
3947
|
runtimeDirectives.push(prop);
|
|
3930
|
-
if (hasChildren)
|
|
3948
|
+
if (hasChildren) {
|
|
3949
|
+
shouldUseBlock = true;
|
|
3950
|
+
isBlockRequired = true;
|
|
3951
|
+
}
|
|
3931
3952
|
}
|
|
3932
3953
|
}
|
|
3933
3954
|
}
|
|
@@ -3944,7 +3965,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3944
3965
|
if (dynamicPropNames.length) patchFlag |= 8;
|
|
3945
3966
|
if (hasHydrationEventBinding) patchFlag |= 32;
|
|
3946
3967
|
}
|
|
3947
|
-
|
|
3968
|
+
const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
|
|
3969
|
+
if (!shouldUseBlock && needsPatch) patchFlag |= 512;
|
|
3948
3970
|
if (!context.inSSR && propsExpression) switch (propsExpression.type) {
|
|
3949
3971
|
case 15:
|
|
3950
3972
|
let classKeyIndex = -1;
|
|
@@ -3974,7 +3996,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3974
3996
|
directives: runtimeDirectives,
|
|
3975
3997
|
patchFlag,
|
|
3976
3998
|
dynamicPropNames,
|
|
3977
|
-
shouldUseBlock
|
|
3999
|
+
shouldUseBlock,
|
|
4000
|
+
needsPatch,
|
|
4001
|
+
isBlockRequired
|
|
3978
4002
|
};
|
|
3979
4003
|
}
|
|
3980
4004
|
function dedupeProperties(properties) {
|
|
@@ -4681,6 +4705,14 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
4681
4705
|
const eventOptionModifiers = [];
|
|
4682
4706
|
for (let i = 0; i < modifiers.length; i++) {
|
|
4683
4707
|
const modifier = modifiers[i].content;
|
|
4708
|
+
if (modifier === "delegate") {
|
|
4709
|
+
if (context) {
|
|
4710
|
+
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
|
|
4711
|
+
error.loc = modifiers[i].loc;
|
|
4712
|
+
context.onWarn(error);
|
|
4713
|
+
}
|
|
4714
|
+
continue;
|
|
4715
|
+
}
|
|
4684
4716
|
if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
|
|
4685
4717
|
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
|
|
4686
4718
|
else {
|