@vue/compiler-dom 3.6.0-beta.9 → 3.6.0-rc.2
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 +10 -2
- package/dist/compiler-dom.cjs.prod.js +10 -2
- package/dist/compiler-dom.esm-browser.js +38 -11
- package/dist/compiler-dom.esm-browser.prod.js +6 -6
- package/dist/compiler-dom.esm-bundler.js +10 -2
- package/dist/compiler-dom.global.js +38 -11
- 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-
|
|
2
|
+
* @vue/compiler-dom v3.6.0-rc.2
|
|
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 {
|
|
@@ -278,7 +286,7 @@ function postTransformTransition(node, onError, hasMultipleChildren = defaultHas
|
|
|
278
286
|
source: ""
|
|
279
287
|
}));
|
|
280
288
|
const child = node.children[0];
|
|
281
|
-
if (child.type === 1) {
|
|
289
|
+
if (child.type === 1 && !(0, _vue_compiler_core.findDir)(child, "if")) {
|
|
282
290
|
for (const p of child.props) if (p.type === 7 && p.name === "show") node.props.push({
|
|
283
291
|
type: 6,
|
|
284
292
|
name: "persisted",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.6.0-
|
|
2
|
+
* @vue/compiler-dom v3.6.0-rc.2
|
|
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 {
|
|
@@ -265,7 +273,7 @@ function postTransformTransition(node, onError, hasMultipleChildren = defaultHas
|
|
|
265
273
|
source: ""
|
|
266
274
|
}));
|
|
267
275
|
const child = node.children[0];
|
|
268
|
-
if (child.type === 1) {
|
|
276
|
+
if (child.type === 1 && !(0, _vue_compiler_core.findDir)(child, "if")) {
|
|
269
277
|
for (const p of child.props) if (p.type === 7 && p.name === "show") node.props.push({
|
|
270
278
|
type: 6,
|
|
271
279
|
name: "persisted",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.6.0-
|
|
2
|
+
* @vue/compiler-dom v3.6.0-rc.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -46,8 +46,6 @@ const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
|
|
|
46
46
|
* @private
|
|
47
47
|
*/
|
|
48
48
|
const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
|
|
49
|
-
const hyphenateRE = /\B([A-Z])/g;
|
|
50
|
-
cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
51
49
|
/**
|
|
52
50
|
* @private
|
|
53
51
|
*/
|
|
@@ -1810,6 +1808,7 @@ function getUnnormalizedProps(props, callPath = []) {
|
|
|
1810
1808
|
return [props, callPath];
|
|
1811
1809
|
}
|
|
1812
1810
|
function injectProp(node, prop, context) {
|
|
1811
|
+
if (node.type !== 13 && injectSlotKey(node, prop)) return;
|
|
1813
1812
|
let propsWithInjection;
|
|
1814
1813
|
/**
|
|
1815
1814
|
* 1. mergeProps(...)
|
|
@@ -1848,6 +1847,20 @@ function injectProp(node, prop, context) {
|
|
|
1848
1847
|
else if (parentCall) parentCall.arguments[0] = propsWithInjection;
|
|
1849
1848
|
else node.arguments[2] = propsWithInjection;
|
|
1850
1849
|
}
|
|
1850
|
+
function injectSlotKey(node, prop) {
|
|
1851
|
+
var _node$arguments, _node$arguments2, _node$arguments3;
|
|
1852
|
+
if (prop.key.type !== 4 || prop.key.content !== "key") return false;
|
|
1853
|
+
const props = node.arguments[2];
|
|
1854
|
+
if (props && !isString(props)) {
|
|
1855
|
+
const [unnormalizedProps] = getUnnormalizedProps(props);
|
|
1856
|
+
if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) return true;
|
|
1857
|
+
}
|
|
1858
|
+
(_node$arguments = node.arguments)[2] || (_node$arguments[2] = "{}");
|
|
1859
|
+
(_node$arguments2 = node.arguments)[3] || (_node$arguments2[3] = "undefined");
|
|
1860
|
+
(_node$arguments3 = node.arguments)[4] || (_node$arguments3[4] = "undefined");
|
|
1861
|
+
node.arguments[5] = prop.value;
|
|
1862
|
+
return true;
|
|
1863
|
+
}
|
|
1851
1864
|
function hasProp(prop, props) {
|
|
1852
1865
|
let result = false;
|
|
1853
1866
|
if (prop.key.type === 4) {
|
|
@@ -2157,7 +2170,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2157
2170
|
}
|
|
2158
2171
|
},
|
|
2159
2172
|
oncdata(start, end) {
|
|
2160
|
-
if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
|
|
2173
|
+
if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
|
|
2161
2174
|
else emitError(1, start - 9);
|
|
2162
2175
|
},
|
|
2163
2176
|
onprocessinginstruction(start) {
|
|
@@ -2682,8 +2695,10 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
2682
2695
|
imports: [],
|
|
2683
2696
|
cached: [],
|
|
2684
2697
|
constantCache: /* @__PURE__ */ new WeakMap(),
|
|
2698
|
+
vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
|
|
2685
2699
|
temps: 0,
|
|
2686
2700
|
identifiers: Object.create(null),
|
|
2701
|
+
identifierScopes: Object.create(null),
|
|
2687
2702
|
scopes: {
|
|
2688
2703
|
vFor: 0,
|
|
2689
2704
|
vSlot: 0,
|
|
@@ -2734,8 +2749,12 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
2734
2749
|
context.parent.children.splice(removalIndex, 1);
|
|
2735
2750
|
},
|
|
2736
2751
|
onNodeRemoved: NOOP,
|
|
2737
|
-
addIdentifiers(exp) {},
|
|
2752
|
+
addIdentifiers(exp, type = "local") {},
|
|
2738
2753
|
removeIdentifiers(exp) {},
|
|
2754
|
+
isSlotScopeIdentifier(name) {
|
|
2755
|
+
const scopes = context.identifierScopes[name];
|
|
2756
|
+
return scopes ? scopes[scopes.length - 1] === "slot" : false;
|
|
2757
|
+
},
|
|
2739
2758
|
hoist(exp) {
|
|
2740
2759
|
if (isString(exp)) exp = createSimpleExpression(exp);
|
|
2741
2760
|
context.hoists.push(exp);
|
|
@@ -3099,6 +3118,7 @@ function genNode(node, context) {
|
|
|
3099
3118
|
case 24: break;
|
|
3100
3119
|
case 25: break;
|
|
3101
3120
|
case 26: break;
|
|
3121
|
+
/* v8 ignore start */
|
|
3102
3122
|
case 10: break;
|
|
3103
3123
|
default:
|
|
3104
3124
|
assert(false, `unhandled codegen node type: ${node.type}`);
|
|
@@ -3317,7 +3337,7 @@ const transformExpression = (node, context) => {
|
|
|
3317
3337
|
if (dir.type === 7 && dir.name !== "for") {
|
|
3318
3338
|
const exp = dir.exp;
|
|
3319
3339
|
const arg = dir.arg;
|
|
3320
|
-
if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
|
|
3340
|
+
if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
|
|
3321
3341
|
if (arg && arg.type === 4 && !arg.isStatic) dir.arg = processExpression(arg, context);
|
|
3322
3342
|
}
|
|
3323
3343
|
}
|
|
@@ -3463,10 +3483,9 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
|
|
|
3463
3483
|
const isTemplate = isTemplateNode(node);
|
|
3464
3484
|
const memo = findDir(node, "memo");
|
|
3465
3485
|
const keyProp = findProp(node, `key`, false, true);
|
|
3466
|
-
|
|
3486
|
+
keyProp && keyProp.type;
|
|
3467
3487
|
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
3468
|
-
|
|
3469
|
-
const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
3488
|
+
const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
3470
3489
|
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
3471
3490
|
const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
|
|
3472
3491
|
forNode.codegenNode = createVNodeCall(context, helper(FRAGMENT), void 0, renderExp, fragmentFlag, void 0, void 0, true, !isStableFragment, false, node.loc);
|
|
@@ -4262,7 +4281,7 @@ function rewriteFilter(node, context) {
|
|
|
4262
4281
|
const child = node.children[i];
|
|
4263
4282
|
if (typeof child !== "object") continue;
|
|
4264
4283
|
if (child.type === 4) parseFilter(child, context);
|
|
4265
|
-
else if (child.type === 8) rewriteFilter(
|
|
4284
|
+
else if (child.type === 8) rewriteFilter(child, context);
|
|
4266
4285
|
else if (child.type === 5) rewriteFilter(child.content, context);
|
|
4267
4286
|
}
|
|
4268
4287
|
}
|
|
@@ -4661,6 +4680,14 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
4661
4680
|
const eventOptionModifiers = [];
|
|
4662
4681
|
for (let i = 0; i < modifiers.length; i++) {
|
|
4663
4682
|
const modifier = modifiers[i].content;
|
|
4683
|
+
if (modifier === "delegate") {
|
|
4684
|
+
if (context) {
|
|
4685
|
+
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
|
|
4686
|
+
error.loc = modifiers[i].loc;
|
|
4687
|
+
context.onWarn(error);
|
|
4688
|
+
}
|
|
4689
|
+
continue;
|
|
4690
|
+
}
|
|
4664
4691
|
if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
|
|
4665
4692
|
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
|
|
4666
4693
|
else {
|
|
@@ -4737,7 +4764,7 @@ function postTransformTransition(node, onError, hasMultipleChildren = defaultHas
|
|
|
4737
4764
|
source: ""
|
|
4738
4765
|
}));
|
|
4739
4766
|
const child = node.children[0];
|
|
4740
|
-
if (child.type === 1) {
|
|
4767
|
+
if (child.type === 1 && !findDir(child, "if")) {
|
|
4741
4768
|
for (const p of child.props) if (p.type === 7 && p.name === "show") node.props.push({
|
|
4742
4769
|
type: 6,
|
|
4743
4770
|
name: "persisted",
|