@vue/compiler-dom 3.6.0-rc.1 → 3.6.0-rc.10
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 +60 -51
- package/dist/compiler-dom.cjs.prod.js +59 -50
- package/dist/compiler-dom.d.ts +10 -11
- package/dist/compiler-dom.esm-browser.js +256 -214
- package/dist/compiler-dom.esm-browser.prod.js +6 -6
- package/dist/compiler-dom.esm-bundler.js +57 -49
- package/dist/compiler-dom.global.js +256 -214
- package/dist/compiler-dom.global.prod.js +6 -6
- 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.10
|
|
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) => {
|
|
@@ -142,10 +142,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
142
142
|
//#region packages/shared/src/normalizeProp.ts
|
|
143
143
|
const listDelimiterRE = /;(?![^(]*\))/g;
|
|
144
144
|
const propertyDelimiterRE = /:([^]+)/;
|
|
145
|
-
const styleCommentRE =
|
|
145
|
+
const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
|
|
146
146
|
function parseStringStyle(cssText) {
|
|
147
147
|
const ret = {};
|
|
148
|
-
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
|
148
|
+
cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
|
|
149
149
|
if (item) {
|
|
150
150
|
const tmp = item.split(propertyDelimiterRE);
|
|
151
151
|
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
|
@@ -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,
|
|
@@ -2664,7 +2662,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
2664
2662
|
const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
|
|
2665
2663
|
return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
|
|
2666
2664
|
}
|
|
2667
|
-
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 }) {
|
|
2668
2666
|
const context = {
|
|
2669
2667
|
filename,
|
|
2670
2668
|
selfName: getSelfName(filename),
|
|
@@ -2686,7 +2684,6 @@ var VueCompilerDOM = (function(exports) {
|
|
|
2686
2684
|
bindingMetadata,
|
|
2687
2685
|
inline,
|
|
2688
2686
|
isTS,
|
|
2689
|
-
eventDelegation,
|
|
2690
2687
|
onError,
|
|
2691
2688
|
onWarn,
|
|
2692
2689
|
compatConfig,
|
|
@@ -2779,7 +2776,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
2779
2776
|
traverseNode(root, context);
|
|
2780
2777
|
if (options.hoistStatic) cacheStatic(root, context);
|
|
2781
2778
|
if (!options.ssr) createRootCodegen(root, context);
|
|
2782
|
-
root.helpers = new Set([...context.helpers.keys()]);
|
|
2779
|
+
root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
|
|
2783
2780
|
root.components = [...context.components];
|
|
2784
2781
|
root.directives = [...context.directives];
|
|
2785
2782
|
root.imports = context.imports;
|
|
@@ -2826,8 +2823,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
2826
2823
|
const exitFns = [];
|
|
2827
2824
|
for (let i = 0; i < nodeTransforms.length; i++) {
|
|
2828
2825
|
const onExit = nodeTransforms[i](node, context);
|
|
2829
|
-
if (onExit)
|
|
2830
|
-
|
|
2826
|
+
if (onExit) {
|
|
2827
|
+
if (isArray(onExit)) exitFns.push(...onExit);
|
|
2828
|
+
else exitFns.push(onExit);
|
|
2829
|
+
}
|
|
2831
2830
|
if (!context.currentNode) return;
|
|
2832
2831
|
else node = context.currentNode;
|
|
2833
2832
|
}
|
|
@@ -2844,9 +2843,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
2844
2843
|
case 10:
|
|
2845
2844
|
case 11:
|
|
2846
2845
|
case 1:
|
|
2847
|
-
case 0:
|
|
2848
|
-
traverseChildren(node, context);
|
|
2849
|
-
break;
|
|
2846
|
+
case 0: traverseChildren(node, context);
|
|
2850
2847
|
}
|
|
2851
2848
|
context.currentNode = node;
|
|
2852
2849
|
let i = exitFns.length;
|
|
@@ -3052,10 +3049,12 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3052
3049
|
if (isString(node)) push(node, -3);
|
|
3053
3050
|
else if (isArray(node)) genNodeListAsArray(node, context);
|
|
3054
3051
|
else genNode(node, context);
|
|
3055
|
-
if (i < nodes.length - 1)
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3052
|
+
if (i < nodes.length - 1) {
|
|
3053
|
+
if (multilines) {
|
|
3054
|
+
comma && push(",");
|
|
3055
|
+
newline();
|
|
3056
|
+
} else comma && push(", ");
|
|
3057
|
+
}
|
|
3059
3058
|
}
|
|
3060
3059
|
}
|
|
3061
3060
|
function genNode(node, context) {
|
|
@@ -3167,8 +3166,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3167
3166
|
const { push, helper, pure } = context;
|
|
3168
3167
|
const { tag, props, children, patchFlag, dynamicProps, directives, isBlock, disableTracking, isComponent } = node;
|
|
3169
3168
|
let patchFlagString;
|
|
3170
|
-
if (patchFlag)
|
|
3171
|
-
|
|
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
|
+
}
|
|
3172
3173
|
if (directives) push(helper(WITH_DIRECTIVES) + `(`);
|
|
3173
3174
|
if (isBlock) push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
|
|
3174
3175
|
if (pure) push(PURE_ANNOTATION);
|
|
@@ -3330,7 +3331,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3330
3331
|
}
|
|
3331
3332
|
//#endregion
|
|
3332
3333
|
//#region packages/compiler-core/src/transforms/transformExpression.ts
|
|
3333
|
-
const isLiteralWhitelisted =
|
|
3334
|
+
const isLiteralWhitelisted = /*@__PURE__*/ makeMap("true,false,null,this");
|
|
3334
3335
|
const transformExpression = (node, context) => {
|
|
3335
3336
|
if (node.type === 5) node.content = processExpression(node.content, context);
|
|
3336
3337
|
else if (node.type === 1) {
|
|
@@ -3443,16 +3444,17 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3443
3444
|
const keyProperty = createObjectProperty(`key`, createSimpleExpression(`${keyIndex}`, false, locStub, 2));
|
|
3444
3445
|
const { children } = branch;
|
|
3445
3446
|
const firstChild = children[0];
|
|
3446
|
-
if (children.length !== 1 || firstChild.type !== 1)
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
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
|
+
}
|
|
3450
3457
|
} else {
|
|
3451
|
-
let patchFlag = 64;
|
|
3452
|
-
if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) patchFlag |= 2048;
|
|
3453
|
-
return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag, void 0, void 0, true, false, false, branch.loc);
|
|
3454
|
-
}
|
|
3455
|
-
else {
|
|
3456
3458
|
const ret = firstChild.codegenNode;
|
|
3457
3459
|
const vnodeCall = getMemoedVNodeCall(ret);
|
|
3458
3460
|
if (vnodeCall.type === 13) convertToBlock(vnodeCall, context);
|
|
@@ -3473,9 +3475,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3473
3475
|
return true;
|
|
3474
3476
|
}
|
|
3475
3477
|
function getParentCondition(node) {
|
|
3476
|
-
while (true) if (node.type === 19)
|
|
3477
|
-
|
|
3478
|
-
|
|
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;
|
|
3479
3482
|
}
|
|
3480
3483
|
//#endregion
|
|
3481
3484
|
//#region packages/compiler-core/src/transforms/vFor.ts
|
|
@@ -3513,15 +3516,24 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3513
3516
|
else {
|
|
3514
3517
|
childBlock = children[0].codegenNode;
|
|
3515
3518
|
if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3519
|
+
const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
|
|
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
|
+
}
|
|
3526
|
+
childBlock.isBlock = shouldUseBlock;
|
|
3521
3527
|
if (childBlock.isBlock) {
|
|
3522
3528
|
helper(OPEN_BLOCK);
|
|
3523
3529
|
helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
3524
|
-
} else
|
|
3530
|
+
} else {
|
|
3531
|
+
helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
3532
|
+
if (childBlock.needsPatch) {
|
|
3533
|
+
var _childBlock$patchFlag;
|
|
3534
|
+
childBlock.patchFlag = ((_childBlock$patchFlag = childBlock.patchFlag) !== null && _childBlock$patchFlag !== void 0 ? _childBlock$patchFlag : 0) | 512;
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3525
3537
|
}
|
|
3526
3538
|
if (memo) {
|
|
3527
3539
|
const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
|
|
@@ -3712,8 +3724,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3712
3724
|
return createObjectProperty(`default`, fn);
|
|
3713
3725
|
};
|
|
3714
3726
|
if (!hasTemplateSlots) slotsProperties.push(buildDefaultSlotProperty(void 0, children));
|
|
3715
|
-
else if (implicitDefaultChildren.length && !implicitDefaultChildren.every(isWhitespaceText))
|
|
3716
|
-
|
|
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
|
+
}
|
|
3717
3731
|
}
|
|
3718
3732
|
const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
|
|
3719
3733
|
let slots = createObjectExpression(slotsProperties.concat(createObjectProperty(`_`, createSimpleExpression(slotFlag + ` /* ${slotFlagsText[slotFlag]} */`, false))), loc);
|
|
@@ -3739,10 +3753,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3739
3753
|
if (hasForwardedSlots(child.branches)) return true;
|
|
3740
3754
|
break;
|
|
3741
3755
|
case 10:
|
|
3742
|
-
case 11:
|
|
3743
|
-
if (hasForwardedSlots(child.children)) return true;
|
|
3744
|
-
break;
|
|
3745
|
-
default: break;
|
|
3756
|
+
case 11: if (hasForwardedSlots(child.children)) return true;
|
|
3746
3757
|
}
|
|
3747
3758
|
}
|
|
3748
3759
|
return false;
|
|
@@ -3764,12 +3775,16 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3764
3775
|
let vnodeDynamicProps;
|
|
3765
3776
|
let dynamicPropNames;
|
|
3766
3777
|
let vnodeDirectives;
|
|
3778
|
+
let needsPatch = false;
|
|
3779
|
+
let isBlockRequired = false;
|
|
3767
3780
|
let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
|
|
3768
3781
|
if (props.length > 0) {
|
|
3769
3782
|
const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
|
|
3770
3783
|
vnodeProps = propsBuildResult.props;
|
|
3771
3784
|
patchFlag = propsBuildResult.patchFlag;
|
|
3772
3785
|
dynamicPropNames = propsBuildResult.dynamicPropNames;
|
|
3786
|
+
needsPatch = propsBuildResult.needsPatch;
|
|
3787
|
+
isBlockRequired = propsBuildResult.isBlockRequired;
|
|
3773
3788
|
const directives = propsBuildResult.directives;
|
|
3774
3789
|
vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
|
|
3775
3790
|
if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
|
|
@@ -3798,7 +3813,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3798
3813
|
} else vnodeChildren = node.children;
|
|
3799
3814
|
}
|
|
3800
3815
|
if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
3801
|
-
node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
|
|
3816
|
+
const vnodeCall = node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
|
|
3817
|
+
needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
|
|
3818
|
+
if (needsPatch) vnodeCall.needsPatch = true;
|
|
3819
|
+
if (isBlockRequired) vnodeCall.isBlockRequired = true;
|
|
3802
3820
|
};
|
|
3803
3821
|
};
|
|
3804
3822
|
function resolveComponentType(node, context, ssr = false) {
|
|
@@ -3832,6 +3850,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3832
3850
|
const runtimeDirectives = [];
|
|
3833
3851
|
const hasChildren = children.length > 0;
|
|
3834
3852
|
let shouldUseBlock = false;
|
|
3853
|
+
let isBlockRequired = false;
|
|
3835
3854
|
let patchFlag = 0;
|
|
3836
3855
|
let hasRef = false;
|
|
3837
3856
|
let hasClassBinding = false;
|
|
@@ -3856,12 +3875,12 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3856
3875
|
const isEventHandler = isOn(name);
|
|
3857
3876
|
if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !isReservedProp(name)) hasHydrationEventBinding = true;
|
|
3858
3877
|
if (isEventHandler && isReservedProp(name)) hasVnodeHook = true;
|
|
3878
|
+
if (name === "ref") hasRef = true;
|
|
3859
3879
|
if (isEventHandler && value.type === 14) value = value.arguments[0];
|
|
3860
3880
|
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
|
|
3861
|
-
if (name === "
|
|
3862
|
-
else if (name === "class") hasClassBinding = true;
|
|
3881
|
+
if (name === "class") hasClassBinding = true;
|
|
3863
3882
|
else if (name === "style") hasStyleBinding = true;
|
|
3864
|
-
else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
3883
|
+
else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
3865
3884
|
if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
3866
3885
|
} else hasDynamicKeys = true;
|
|
3867
3886
|
};
|
|
@@ -3887,33 +3906,38 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3887
3906
|
if (name === "once" || name === "memo") continue;
|
|
3888
3907
|
if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
|
|
3889
3908
|
if (isVOn && ssr) continue;
|
|
3890
|
-
if (isVBind && isStaticArgOf(arg, "key")
|
|
3909
|
+
if (isVBind && isStaticArgOf(arg, "key")) shouldUseBlock = true;
|
|
3910
|
+
if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
|
|
3911
|
+
shouldUseBlock = true;
|
|
3912
|
+
isBlockRequired = true;
|
|
3913
|
+
}
|
|
3891
3914
|
if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
|
|
3892
3915
|
if (!arg && (isVBind || isVOn)) {
|
|
3893
3916
|
hasDynamicKeys = true;
|
|
3894
|
-
if (exp)
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
if (
|
|
3898
|
-
if (
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
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));
|
|
3917
3941
|
continue;
|
|
3918
3942
|
}
|
|
3919
3943
|
if (isVBind && modifiers.some((mod) => mod.content === "prop")) patchFlag |= 32;
|
|
@@ -3929,7 +3953,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3929
3953
|
}
|
|
3930
3954
|
} else if (!isBuiltInDirective(name)) {
|
|
3931
3955
|
runtimeDirectives.push(prop);
|
|
3932
|
-
if (hasChildren)
|
|
3956
|
+
if (hasChildren) {
|
|
3957
|
+
shouldUseBlock = true;
|
|
3958
|
+
isBlockRequired = true;
|
|
3959
|
+
}
|
|
3933
3960
|
}
|
|
3934
3961
|
}
|
|
3935
3962
|
}
|
|
@@ -3946,7 +3973,8 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3946
3973
|
if (dynamicPropNames.length) patchFlag |= 8;
|
|
3947
3974
|
if (hasHydrationEventBinding) patchFlag |= 32;
|
|
3948
3975
|
}
|
|
3949
|
-
|
|
3976
|
+
const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
|
|
3977
|
+
if (!shouldUseBlock && needsPatch) patchFlag |= 512;
|
|
3950
3978
|
if (!context.inSSR && propsExpression) switch (propsExpression.type) {
|
|
3951
3979
|
case 15:
|
|
3952
3980
|
let classKeyIndex = -1;
|
|
@@ -3967,16 +3995,16 @@ var VueCompilerDOM = (function(exports) {
|
|
|
3967
3995
|
} else propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [propsExpression]);
|
|
3968
3996
|
break;
|
|
3969
3997
|
case 14: break;
|
|
3970
|
-
default:
|
|
3971
|
-
propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [propsExpression])]);
|
|
3972
|
-
break;
|
|
3998
|
+
default: propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [propsExpression])]);
|
|
3973
3999
|
}
|
|
3974
4000
|
return {
|
|
3975
4001
|
props: propsExpression,
|
|
3976
4002
|
directives: runtimeDirectives,
|
|
3977
4003
|
patchFlag,
|
|
3978
4004
|
dynamicPropNames,
|
|
3979
|
-
shouldUseBlock
|
|
4005
|
+
shouldUseBlock,
|
|
4006
|
+
needsPatch,
|
|
4007
|
+
isBlockRequired
|
|
3980
4008
|
};
|
|
3981
4009
|
}
|
|
3982
4010
|
function dedupeProperties(properties) {
|
|
@@ -4073,10 +4101,12 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4073
4101
|
for (let i = 0; i < node.props.length; i++) {
|
|
4074
4102
|
const p = node.props[i];
|
|
4075
4103
|
if (p.type === 6) {
|
|
4076
|
-
if (p.value)
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
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
|
+
}
|
|
4080
4110
|
}
|
|
4081
4111
|
} else if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
|
|
4082
4112
|
if (p.exp) slotName = p.exp;
|
|
@@ -4102,17 +4132,18 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4102
4132
|
const { loc, modifiers, arg } = dir;
|
|
4103
4133
|
if (!dir.exp && !modifiers.length) context.onError(createCompilerError(35, loc));
|
|
4104
4134
|
let eventName;
|
|
4105
|
-
if (arg.type === 4)
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
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 {
|
|
4116
4147
|
eventName = arg;
|
|
4117
4148
|
eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
|
|
4118
4149
|
eventName.children.push(`)`);
|
|
@@ -4148,11 +4179,14 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4148
4179
|
arg.children.unshift(`(`);
|
|
4149
4180
|
arg.children.push(`) || ""`);
|
|
4150
4181
|
} else if (!arg.isStatic) arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
4151
|
-
if (modifiers.some((mod) => mod.content === "camel"))
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
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
|
+
}
|
|
4156
4190
|
}
|
|
4157
4191
|
if (!context.inSSR) {
|
|
4158
4192
|
if (modifiers.some((mod) => mod.content === "prop")) injectPrefix(arg, ".");
|
|
@@ -4161,9 +4195,10 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4161
4195
|
return { props: [createObjectProperty(arg, exp)] };
|
|
4162
4196
|
};
|
|
4163
4197
|
const injectPrefix = (arg, prefix) => {
|
|
4164
|
-
if (arg.type === 4)
|
|
4165
|
-
|
|
4166
|
-
|
|
4198
|
+
if (arg.type === 4) {
|
|
4199
|
+
if (arg.isStatic) arg.content = prefix + arg.content;
|
|
4200
|
+
else arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
4201
|
+
} else {
|
|
4167
4202
|
arg.children.unshift(`'${prefix}' + (`);
|
|
4168
4203
|
arg.children.push(`)`);
|
|
4169
4204
|
}
|
|
@@ -4310,11 +4345,12 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4310
4345
|
if (c === 96 && prev !== 92) inTemplateString = false;
|
|
4311
4346
|
} else if (inRegex) {
|
|
4312
4347
|
if (c === 47 && prev !== 92) inRegex = false;
|
|
4313
|
-
} else if (c === 124 && exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren)
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
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 {
|
|
4318
4354
|
switch (c) {
|
|
4319
4355
|
case 34:
|
|
4320
4356
|
inDouble = true;
|
|
@@ -4340,9 +4376,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4340
4376
|
case 123:
|
|
4341
4377
|
curly++;
|
|
4342
4378
|
break;
|
|
4343
|
-
case 125:
|
|
4344
|
-
curly--;
|
|
4345
|
-
break;
|
|
4379
|
+
case 125: curly--;
|
|
4346
4380
|
}
|
|
4347
4381
|
if (c === 47) {
|
|
4348
4382
|
let j = i - 1;
|
|
@@ -4658,9 +4692,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4658
4692
|
isInvalidType = true;
|
|
4659
4693
|
context.onError(createDOMCompilerError(60, dir.loc));
|
|
4660
4694
|
break;
|
|
4661
|
-
default:
|
|
4662
|
-
checkDuplicatedValue();
|
|
4663
|
-
break;
|
|
4695
|
+
default: checkDuplicatedValue();
|
|
4664
4696
|
}
|
|
4665
4697
|
} else if (hasDynamicKeyVBind(node)) directiveToUse = V_MODEL_DYNAMIC;
|
|
4666
4698
|
else checkDuplicatedValue();
|
|
@@ -4673,27 +4705,37 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4673
4705
|
};
|
|
4674
4706
|
//#endregion
|
|
4675
4707
|
//#region packages/compiler-dom/src/transforms/vOn.ts
|
|
4676
|
-
const isEventOptionModifier =
|
|
4677
|
-
const isNonKeyModifier =
|
|
4678
|
-
const maybeKeyModifier =
|
|
4679
|
-
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`);
|
|
4680
4712
|
const resolveModifiers = (key, modifiers, context, loc) => {
|
|
4681
4713
|
const keyModifiers = [];
|
|
4682
4714
|
const nonKeyModifiers = [];
|
|
4683
4715
|
const eventOptionModifiers = [];
|
|
4684
4716
|
for (let i = 0; i < modifiers.length; i++) {
|
|
4685
4717
|
const modifier = modifiers[i].content;
|
|
4718
|
+
if (modifier === "delegate") {
|
|
4719
|
+
if (context) {
|
|
4720
|
+
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
|
|
4721
|
+
error.loc = modifiers[i].loc;
|
|
4722
|
+
context.onWarn(error);
|
|
4723
|
+
}
|
|
4724
|
+
continue;
|
|
4725
|
+
}
|
|
4686
4726
|
if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
|
|
4687
4727
|
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
|
|
4688
4728
|
else {
|
|
4689
4729
|
const keyString = isString(key) ? key : isStaticExp(key) ? key.content : null;
|
|
4690
|
-
if (maybeKeyModifier(modifier))
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
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);
|
|
4697
4739
|
else keyModifiers.push(modifier);
|
|
4698
4740
|
}
|
|
4699
4741
|
}
|
|
@@ -4808,7 +4850,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4808
4850
|
}
|
|
4809
4851
|
return true;
|
|
4810
4852
|
}
|
|
4811
|
-
const headings = new Set([
|
|
4853
|
+
const headings = /* @__PURE__ */ new Set([
|
|
4812
4854
|
"h1",
|
|
4813
4855
|
"h2",
|
|
4814
4856
|
"h3",
|
|
@@ -4820,7 +4862,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4820
4862
|
/**
|
|
4821
4863
|
* maps element to set of elements that can be it's children, no other */
|
|
4822
4864
|
const onlyValidChildren = {
|
|
4823
|
-
head: new Set([
|
|
4865
|
+
head: /* @__PURE__ */ new Set([
|
|
4824
4866
|
"base",
|
|
4825
4867
|
"basefront",
|
|
4826
4868
|
"bgsound",
|
|
@@ -4833,24 +4875,24 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4833
4875
|
"script",
|
|
4834
4876
|
"template"
|
|
4835
4877
|
]),
|
|
4836
|
-
optgroup: new Set(["option"]),
|
|
4837
|
-
select: new Set([
|
|
4878
|
+
optgroup: /* @__PURE__ */ new Set(["option"]),
|
|
4879
|
+
select: /* @__PURE__ */ new Set([
|
|
4838
4880
|
"optgroup",
|
|
4839
4881
|
"option",
|
|
4840
4882
|
"hr"
|
|
4841
4883
|
]),
|
|
4842
|
-
table: new Set([
|
|
4884
|
+
table: /* @__PURE__ */ new Set([
|
|
4843
4885
|
"caption",
|
|
4844
4886
|
"colgroup",
|
|
4845
4887
|
"tbody",
|
|
4846
4888
|
"tfoot",
|
|
4847
4889
|
"thead"
|
|
4848
4890
|
]),
|
|
4849
|
-
tr: new Set(["td", "th"]),
|
|
4850
|
-
colgroup: new Set(["col"]),
|
|
4851
|
-
tbody: new Set(["tr"]),
|
|
4852
|
-
thead: new Set(["tr"]),
|
|
4853
|
-
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"]),
|
|
4854
4896
|
script: emptySet,
|
|
4855
4897
|
iframe: emptySet,
|
|
4856
4898
|
option: emptySet,
|
|
@@ -4861,30 +4903,30 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4861
4903
|
/** maps elements to set of elements which can be it's parent, no other */
|
|
4862
4904
|
const onlyValidParents = {
|
|
4863
4905
|
html: emptySet,
|
|
4864
|
-
body: new Set(["html"]),
|
|
4865
|
-
head: new Set(["html"]),
|
|
4866
|
-
td: new Set(["tr"]),
|
|
4867
|
-
colgroup: new Set(["table"]),
|
|
4868
|
-
caption: new Set(["table"]),
|
|
4869
|
-
tbody: new Set(["table"]),
|
|
4870
|
-
tfoot: new Set(["table"]),
|
|
4871
|
-
col: new Set(["colgroup"]),
|
|
4872
|
-
th: new Set(["tr"]),
|
|
4873
|
-
thead: new Set(["table"]),
|
|
4874
|
-
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([
|
|
4875
4917
|
"tbody",
|
|
4876
4918
|
"thead",
|
|
4877
4919
|
"tfoot"
|
|
4878
4920
|
]),
|
|
4879
|
-
dd: new Set(["dl", "div"]),
|
|
4880
|
-
dt: new Set(["dl", "div"]),
|
|
4881
|
-
figcaption: new Set(["figure"]),
|
|
4882
|
-
summary: new Set(["details"]),
|
|
4883
|
-
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"])
|
|
4884
4926
|
};
|
|
4885
4927
|
/** maps element to set of elements that can not be it's children, others can */
|
|
4886
4928
|
const knownInvalidChildren = {
|
|
4887
|
-
p: new Set([
|
|
4929
|
+
p: /* @__PURE__ */ new Set([
|
|
4888
4930
|
"address",
|
|
4889
4931
|
"article",
|
|
4890
4932
|
"aside",
|
|
@@ -4919,7 +4961,7 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4919
4961
|
"table",
|
|
4920
4962
|
"ul"
|
|
4921
4963
|
]),
|
|
4922
|
-
svg: new Set([
|
|
4964
|
+
svg: /* @__PURE__ */ new Set([
|
|
4923
4965
|
"b",
|
|
4924
4966
|
"blockquote",
|
|
4925
4967
|
"br",
|
|
@@ -4960,12 +5002,12 @@ var VueCompilerDOM = (function(exports) {
|
|
|
4960
5002
|
};
|
|
4961
5003
|
/** maps element to set of elements that can not be it's parent, others can */
|
|
4962
5004
|
const knownInvalidParents = {
|
|
4963
|
-
a: new Set(["a"]),
|
|
4964
|
-
button: new Set(["button"]),
|
|
4965
|
-
dd: new Set(["dd", "dt"]),
|
|
4966
|
-
dt: new Set(["dd", "dt"]),
|
|
4967
|
-
form: new Set(["form"]),
|
|
4968
|
-
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"]),
|
|
4969
5011
|
h1: headings,
|
|
4970
5012
|
h2: headings,
|
|
4971
5013
|
h3: headings,
|