@vue/compiler-vapor 3.6.0-beta.15 → 3.6.0-beta.16
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-vapor.cjs.js +154 -61
- package/dist/compiler-vapor.d.ts +30 -16
- package/dist/compiler-vapor.esm-browser.js +144 -51
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-vapor v3.6.0-beta.16
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -152,7 +152,7 @@ const EMPTY_EXPRESSION = (0, _vue_compiler_dom.createSimpleExpression)("", true)
|
|
|
152
152
|
//#region packages/compiler-vapor/src/utils.ts
|
|
153
153
|
const findProp$1 = _vue_compiler_dom.findProp;
|
|
154
154
|
/** find directive */
|
|
155
|
-
const findDir$
|
|
155
|
+
const findDir$3 = _vue_compiler_dom.findDir;
|
|
156
156
|
function propToExpression(prop) {
|
|
157
157
|
return prop.type === 6 ? prop.value ? (0, _vue_compiler_dom.createSimpleExpression)(prop.value.content, true, prop.value.loc) : EMPTY_EXPRESSION : prop.exp;
|
|
158
158
|
}
|
|
@@ -671,6 +671,8 @@ function genPrependNode(oper, { helper }) {
|
|
|
671
671
|
function genExpression(node, context, assignment) {
|
|
672
672
|
node = context.getExpressionReplacement(node);
|
|
673
673
|
const { content, ast, isStatic, loc } = node;
|
|
674
|
+
const { options } = context;
|
|
675
|
+
const { inline } = options;
|
|
674
676
|
if (isStatic) return [[
|
|
675
677
|
JSON.stringify(content),
|
|
676
678
|
-2,
|
|
@@ -692,23 +694,31 @@ function genExpression(node, context, assignment) {
|
|
|
692
694
|
let hasMemberExpression = false;
|
|
693
695
|
if (ids.length) {
|
|
694
696
|
const [frag, push] = buildCodeFragment();
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
const
|
|
698
|
-
const
|
|
699
|
-
const
|
|
700
|
-
if (leadingText.length) push([leadingText, -3]);
|
|
701
|
-
const source = content.slice(start, end);
|
|
697
|
+
let lastEnd = 0;
|
|
698
|
+
ids.sort((a, b) => a.start - b.start).forEach((id) => {
|
|
699
|
+
const idStart = id.start - 1;
|
|
700
|
+
const idEnd = id.end - 1;
|
|
701
|
+
const source = content.slice(idStart, idEnd);
|
|
702
702
|
const parentStack = parentStackMap.get(id);
|
|
703
703
|
const parent = parentStack[parentStack.length - 1];
|
|
704
|
+
let start = idStart;
|
|
705
|
+
let end = idEnd;
|
|
706
|
+
if (inline && options.bindingMetadata && options.bindingMetadata[source] === "setup-let" && parent && parent.type === "UpdateExpression" && parent.argument === id) {
|
|
707
|
+
start = parent.start - 1;
|
|
708
|
+
end = parent.end - 1;
|
|
709
|
+
}
|
|
710
|
+
if (start < lastEnd) return;
|
|
711
|
+
const leadingText = content.slice(lastEnd, start);
|
|
712
|
+
if (leadingText.length) push([leadingText, -3]);
|
|
704
713
|
hasMemberExpression || (hasMemberExpression = parent && (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression"));
|
|
705
714
|
push(...genIdentifier(source, context, {
|
|
706
715
|
start: (0, _vue_compiler_dom.advancePositionWithClone)(node.loc.start, source, start),
|
|
707
716
|
end: (0, _vue_compiler_dom.advancePositionWithClone)(node.loc.start, source, end),
|
|
708
717
|
source
|
|
709
|
-
}, hasMemberExpression ? void 0 : assignment, id, parent, parentStack));
|
|
710
|
-
|
|
718
|
+
}, hasMemberExpression ? void 0 : assignment, id, parent, parentStack, node));
|
|
719
|
+
lastEnd = end;
|
|
711
720
|
});
|
|
721
|
+
if (lastEnd < content.length) push([content.slice(lastEnd), -3]);
|
|
712
722
|
if (assignment && hasMemberExpression) push(` = ${assignment}`);
|
|
713
723
|
return frag;
|
|
714
724
|
} else return [[
|
|
@@ -717,7 +727,7 @@ function genExpression(node, context, assignment) {
|
|
|
717
727
|
loc
|
|
718
728
|
]];
|
|
719
729
|
}
|
|
720
|
-
function genIdentifier(raw, context, loc, assignment, id, parent, parentStack) {
|
|
730
|
+
function genIdentifier(raw, context, loc, assignment, id, parent, parentStack, sourceNode) {
|
|
721
731
|
const { options, helper, identifiers } = context;
|
|
722
732
|
const { inline, bindingMetadata } = options;
|
|
723
733
|
let name = raw;
|
|
@@ -737,19 +747,49 @@ function genIdentifier(raw, context, loc, assignment, id, parent, parentStack) {
|
|
|
737
747
|
else return genExpression(replacement, context, assignment);
|
|
738
748
|
}
|
|
739
749
|
let prefix;
|
|
740
|
-
if ((0, _vue_compiler_dom.isStaticProperty)(parent) && parent.shorthand) prefix = `${raw}: `;
|
|
741
750
|
const type = bindingMetadata && bindingMetadata[raw];
|
|
751
|
+
const isDestructureAssignment = parent && (0, _vue_compiler_dom.isInDestructureAssignment)(parent, parentStack || []);
|
|
752
|
+
const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
|
|
753
|
+
const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
|
|
754
|
+
if ((0, _vue_compiler_dom.isStaticProperty)(parent) && parent.shorthand && !(inline && type === "setup-let" && isDestructureAssignment)) prefix = `${raw}: `;
|
|
742
755
|
if (inline) switch (type) {
|
|
743
756
|
case "setup-let":
|
|
744
|
-
|
|
757
|
+
if (isAssignmentLVal) {
|
|
758
|
+
const { right, operator } = parent;
|
|
759
|
+
const source = sourceNode;
|
|
760
|
+
const sourceContent = source.content;
|
|
761
|
+
const rightStart = right.start - 1;
|
|
762
|
+
const rightEnd = right.end - 1;
|
|
763
|
+
const rightContent = sourceContent.slice(rightStart, rightEnd);
|
|
764
|
+
const rightExp = (0, _vue_compiler_dom.createSimpleExpression)(rightContent, false, {
|
|
765
|
+
start: (0, _vue_compiler_dom.advancePositionWithClone)(source.loc.start, sourceContent, rightStart),
|
|
766
|
+
end: (0, _vue_compiler_dom.advancePositionWithClone)(source.loc.start, sourceContent, rightEnd),
|
|
767
|
+
source: rightContent
|
|
768
|
+
});
|
|
769
|
+
rightExp.ast = parseExp(context, rightContent);
|
|
770
|
+
return [
|
|
771
|
+
prefix,
|
|
772
|
+
`${helper("isRef")}(${raw}) ? ${raw}.value ${operator} `,
|
|
773
|
+
...genExpression(rightExp, context),
|
|
774
|
+
` : `,
|
|
775
|
+
[
|
|
776
|
+
raw,
|
|
777
|
+
-2,
|
|
778
|
+
loc,
|
|
779
|
+
name
|
|
780
|
+
]
|
|
781
|
+
];
|
|
782
|
+
} else if (isUpdateArg) {
|
|
783
|
+
const { prefix: isPrefix, operator } = parent;
|
|
784
|
+
const updatePrefix = isPrefix ? operator : ``;
|
|
785
|
+
const updatePostfix = isPrefix ? `` : operator;
|
|
786
|
+
raw = `${helper("isRef")}(${raw}) ? ${updatePrefix}${raw}.value${updatePostfix} : ${updatePrefix}${raw}${updatePostfix}`;
|
|
787
|
+
} else if (!isDestructureAssignment) name = raw = assignment ? `${helper("isRef")}(${raw}) ? (${raw}.value = ${assignment}) : (${raw} = ${assignment})` : unref();
|
|
745
788
|
break;
|
|
746
789
|
case "setup-ref":
|
|
747
790
|
name = raw = withAssignment(`${raw}.value`);
|
|
748
791
|
break;
|
|
749
792
|
case "setup-maybe-ref":
|
|
750
|
-
const isDestructureAssignment = parent && (0, _vue_compiler_dom.isInDestructureAssignment)(parent, parentStack || []);
|
|
751
|
-
const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
|
|
752
|
-
const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
|
|
753
793
|
raw = isAssignmentLVal || isUpdateArg || isDestructureAssignment ? name = `${raw}.value` : assignment ? `${helper("isRef")}(${raw}) ? (${raw}.value = ${assignment}) : null` : unref();
|
|
754
794
|
break;
|
|
755
795
|
case "props":
|
|
@@ -1653,7 +1693,12 @@ function genPropKey({ key: node, modifier, runtimeCamelize, handler, handlerModi
|
|
|
1653
1693
|
if (runtimeCamelize) {
|
|
1654
1694
|
key.push(" || \"\"");
|
|
1655
1695
|
key = genCall(helper("camelize"), key);
|
|
1656
|
-
}
|
|
1696
|
+
} else if (modifier) key = [
|
|
1697
|
+
"(",
|
|
1698
|
+
...key,
|
|
1699
|
+
" || \"\"",
|
|
1700
|
+
")"
|
|
1701
|
+
];
|
|
1657
1702
|
if (handler) key = genCall(helper("toHandlerKey"), key);
|
|
1658
1703
|
return [
|
|
1659
1704
|
"[",
|
|
@@ -1745,6 +1790,11 @@ function genVShow(oper, context) {
|
|
|
1745
1790
|
])];
|
|
1746
1791
|
}
|
|
1747
1792
|
//#endregion
|
|
1793
|
+
//#region packages/compiler-vapor/src/generators/modifier.ts
|
|
1794
|
+
function genDirectiveModifiers(modifiers) {
|
|
1795
|
+
return modifiers.map((value) => `${(0, _vue_compiler_dom.isSimpleIdentifier)(value) ? value : JSON.stringify(value)}: true`).join(", ");
|
|
1796
|
+
}
|
|
1797
|
+
//#endregion
|
|
1748
1798
|
//#region packages/compiler-vapor/src/generators/vModel.ts
|
|
1749
1799
|
const helperMap = {
|
|
1750
1800
|
text: "applyTextModel",
|
|
@@ -1759,7 +1809,7 @@ function genVModel(oper, context) {
|
|
|
1759
1809
|
`() => (`,
|
|
1760
1810
|
...genExpression(exp, context),
|
|
1761
1811
|
`)`
|
|
1762
|
-
], genModelHandler(exp, context), modifiers.length ? `{ ${modifiers.map((e) => e.content
|
|
1812
|
+
], genModelHandler(exp, context), modifiers.length ? `{ ${genDirectiveModifiers(modifiers.map((e) => e.content))} }` : void 0)];
|
|
1763
1813
|
}
|
|
1764
1814
|
function genModelHandler(exp, context) {
|
|
1765
1815
|
return [
|
|
@@ -1801,14 +1851,15 @@ function genCustomDirectives(opers, context) {
|
|
|
1801
1851
|
return genMulti(DELIMITERS_ARRAY.concat("void 0"), directiveVar, value, argument, modifiers);
|
|
1802
1852
|
}
|
|
1803
1853
|
}
|
|
1804
|
-
function genDirectiveModifiers(modifiers) {
|
|
1805
|
-
return modifiers.map((value) => `${(0, _vue_compiler_dom.isSimpleIdentifier)(value) ? value : JSON.stringify(value)}: true`).join(", ");
|
|
1806
|
-
}
|
|
1807
1854
|
function filterCustomDirectives(id, operations) {
|
|
1808
1855
|
return operations.filter((oper) => oper.type === 14 && oper.element === id && !oper.builtin);
|
|
1809
1856
|
}
|
|
1810
1857
|
//#endregion
|
|
1811
1858
|
//#region packages/compiler-vapor/src/generators/component.ts
|
|
1859
|
+
function genStaticModifierPropKey(name) {
|
|
1860
|
+
const key = (0, _vue_shared.getModifierPropName)(name);
|
|
1861
|
+
return [(0, _vue_compiler_dom.isSimpleIdentifier)(key) ? key : JSON.stringify(key)];
|
|
1862
|
+
}
|
|
1812
1863
|
function genCreateComponent(operation, context) {
|
|
1813
1864
|
const { helper } = context;
|
|
1814
1865
|
const singleUseAssetComponentNames = context.singleUseAssetComponentNames;
|
|
@@ -1950,7 +2001,7 @@ function genStaticProps(props, context, dynamicProps, directStaticLiteralProps =
|
|
|
1950
2001
|
}
|
|
1951
2002
|
const { key, modelModifiers } = prop;
|
|
1952
2003
|
if (modelModifiers && modelModifiers.length) {
|
|
1953
|
-
const modifiersKey = key.isStatic ?
|
|
2004
|
+
const modifiersKey = key.isStatic ? genStaticModifierPropKey(key.content) : [
|
|
1954
2005
|
"[",
|
|
1955
2006
|
...genExpression(key, context),
|
|
1956
2007
|
" + \"Modifiers\"]"
|
|
@@ -1993,7 +2044,7 @@ function genDynamicProps(props, context, directStaticLiteralProps = false) {
|
|
|
1993
2044
|
]);
|
|
1994
2045
|
const { modelModifiers } = p;
|
|
1995
2046
|
if (modelModifiers && modelModifiers.length) {
|
|
1996
|
-
const modifiersKey = p.key.isStatic ?
|
|
2047
|
+
const modifiersKey = p.key.isStatic ? genStaticModifierPropKey(p.key.content) : [
|
|
1997
2048
|
"[",
|
|
1998
2049
|
...genExpression(p.key, context),
|
|
1999
2050
|
" + \"Modifiers\"]"
|
|
@@ -2118,7 +2169,7 @@ function genDynamicSlot(slot, context, withFunction = false) {
|
|
|
2118
2169
|
}
|
|
2119
2170
|
function genBasicDynamicSlot(slot, context) {
|
|
2120
2171
|
const { name, fn } = slot;
|
|
2121
|
-
return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...genExpression(name, context)], ["fn: ", ...genSlotBlockWithProps(fn, context)]);
|
|
2172
|
+
return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...genExpression(name, context)], ["fn: ", ...genSlotBlockWithProps(fn, context, false)]);
|
|
2122
2173
|
}
|
|
2123
2174
|
function genLoopSlot(slot, context) {
|
|
2124
2175
|
const { name, fn, loop } = slot;
|
|
@@ -2130,7 +2181,7 @@ function genLoopSlot(slot, context) {
|
|
|
2130
2181
|
if (rawValue) idMap[rawValue] = rawValue;
|
|
2131
2182
|
if (rawKey) idMap[rawKey] = rawKey;
|
|
2132
2183
|
if (rawIndex) idMap[rawIndex] = rawIndex;
|
|
2133
|
-
const slotExpr = genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...context.withId(() => genExpression(name, context), idMap)], ["fn: ", ...context.withId(() => genSlotBlockWithProps(fn, context), idMap)]);
|
|
2184
|
+
const slotExpr = genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...context.withId(() => genExpression(name, context), idMap)], ["fn: ", ...context.withId(() => genSlotBlockWithProps(fn, context, false), idMap)]);
|
|
2134
2185
|
return [...genCall(context.helper("createForSlots"), genExpression(source, context), [
|
|
2135
2186
|
...genMulti([
|
|
2136
2187
|
"(",
|
|
@@ -2156,7 +2207,7 @@ function genConditionalSlot(slot, context) {
|
|
|
2156
2207
|
INDENT_END
|
|
2157
2208
|
];
|
|
2158
2209
|
}
|
|
2159
|
-
function genSlotBlockWithProps(oper, context) {
|
|
2210
|
+
function genSlotBlockWithProps(oper, context, emitNonStableFlag = true) {
|
|
2160
2211
|
let propsName;
|
|
2161
2212
|
let exitScope;
|
|
2162
2213
|
let depth;
|
|
@@ -2171,10 +2222,45 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
2171
2222
|
const exitSlotBlock = context.enterSlotBlock();
|
|
2172
2223
|
markSlotRootOperations(oper);
|
|
2173
2224
|
let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
|
|
2225
|
+
if (emitNonStableFlag && !hasStableSlotRoot(oper, context)) blockFn = genCall(context.helper("extend"), blockFn, `{ _: 8 }`);
|
|
2174
2226
|
exitSlotBlock();
|
|
2175
2227
|
exitScope && exitScope();
|
|
2176
2228
|
return blockFn;
|
|
2177
2229
|
}
|
|
2230
|
+
const commentOnlyTemplateRE = /^(?:<!--[\s\S]*?-->)+$/;
|
|
2231
|
+
function hasStableSlotRoot(block, context) {
|
|
2232
|
+
let hasValidRoot = false;
|
|
2233
|
+
for (let i = 0; i < block.returns.length; i++) {
|
|
2234
|
+
const id = block.returns[i];
|
|
2235
|
+
const child = findReturnedDynamic$1(block, id);
|
|
2236
|
+
const operation = child && child.operation;
|
|
2237
|
+
if (!operation) {
|
|
2238
|
+
if (child && isStableTemplateSlotRoot(child, context)) hasValidRoot = true;
|
|
2239
|
+
continue;
|
|
2240
|
+
}
|
|
2241
|
+
switch (operation.type) {
|
|
2242
|
+
case 12:
|
|
2243
|
+
if (!operation.dynamic || operation.dynamic.isStatic) {
|
|
2244
|
+
hasValidRoot = true;
|
|
2245
|
+
continue;
|
|
2246
|
+
}
|
|
2247
|
+
return false;
|
|
2248
|
+
case 17:
|
|
2249
|
+
if (hasStableSlotRoot(operation.block, context)) {
|
|
2250
|
+
hasValidRoot = true;
|
|
2251
|
+
continue;
|
|
2252
|
+
}
|
|
2253
|
+
return false;
|
|
2254
|
+
default: return false;
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
return hasValidRoot;
|
|
2258
|
+
}
|
|
2259
|
+
function isStableTemplateSlotRoot(child, context) {
|
|
2260
|
+
if (child.template == null) return false;
|
|
2261
|
+
const content = context.ir.template.entries[child.template].content;
|
|
2262
|
+
return content !== "" && !commentOnlyTemplateRE.test(content.trim());
|
|
2263
|
+
}
|
|
2178
2264
|
//#endregion
|
|
2179
2265
|
//#region packages/compiler-vapor/src/generators/slotOutlet.ts
|
|
2180
2266
|
function genSlotOutlet(oper, context) {
|
|
@@ -2511,7 +2597,7 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
|
2511
2597
|
else if (genEffectsExtraFrag) push(...genEffects([], context, genEffectsExtraFrag));
|
|
2512
2598
|
push(NEWLINE, `return `);
|
|
2513
2599
|
const returnNodes = returns.map((n) => `n${n}`);
|
|
2514
|
-
push(...returnNodes.length > 1 ? genMulti(DELIMITERS_ARRAY, ...returnNodes) : [returnNodes[0] || "
|
|
2600
|
+
push(...returnNodes.length > 1 ? genMulti(DELIMITERS_ARRAY, ...returnNodes) : [returnNodes[0] || "[]"]);
|
|
2515
2601
|
resetBlock();
|
|
2516
2602
|
context.singleUseAssetComponentNames = prevSingleUseAssetComponentNames;
|
|
2517
2603
|
return frag;
|
|
@@ -2850,11 +2936,36 @@ const transformVBind = (dir, node, context) => {
|
|
|
2850
2936
|
};
|
|
2851
2937
|
};
|
|
2852
2938
|
//#endregion
|
|
2939
|
+
//#region packages/compiler-vapor/src/transforms/vHtml.ts
|
|
2940
|
+
function ignoreVHtmlChildren(node, context, clear) {
|
|
2941
|
+
if (!node.children.length) return;
|
|
2942
|
+
const dir = (0, _vue_compiler_dom.findDir)(node, "html");
|
|
2943
|
+
if (!dir) return;
|
|
2944
|
+
context.options.onError((0, _vue_compiler_dom.createDOMCompilerError)(55, dir.loc));
|
|
2945
|
+
if (clear === "node") node.children.length = 0;
|
|
2946
|
+
else context.childrenTemplate.length = 0;
|
|
2947
|
+
}
|
|
2948
|
+
const transformVHtml = (dir, node, context) => {
|
|
2949
|
+
let { exp, loc } = dir;
|
|
2950
|
+
if (!exp) {
|
|
2951
|
+
context.options.onError((0, _vue_compiler_dom.createDOMCompilerError)(54, loc));
|
|
2952
|
+
exp = EMPTY_EXPRESSION;
|
|
2953
|
+
}
|
|
2954
|
+
ignoreVHtmlChildren(node, context, "template");
|
|
2955
|
+
context.registerEffect([exp], {
|
|
2956
|
+
type: 8,
|
|
2957
|
+
element: context.reference(),
|
|
2958
|
+
value: exp,
|
|
2959
|
+
isComponent: node.tagType === 1
|
|
2960
|
+
});
|
|
2961
|
+
};
|
|
2962
|
+
//#endregion
|
|
2853
2963
|
//#region packages/compiler-vapor/src/transforms/transformElement.ts
|
|
2854
2964
|
const isReservedProp = /* @__PURE__ */ (0, _vue_shared.makeMap)(",key,ref,ref_for,ref_key,");
|
|
2855
2965
|
const transformElement = (node, context) => {
|
|
2856
2966
|
let effectIndex = context.block.effect.length;
|
|
2857
2967
|
const getEffectIndex = () => effectIndex++;
|
|
2968
|
+
if (node.type === 1 && node.children.length) ignoreVHtmlChildren(node, context, "node");
|
|
2858
2969
|
let parentSlots;
|
|
2859
2970
|
if (node.type === 1 && (node.tagType === 1 || context.options.isCustomElement(node.tag))) {
|
|
2860
2971
|
parentSlots = context.slots;
|
|
@@ -3005,17 +3116,18 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
3005
3116
|
};
|
|
3006
3117
|
for (const prop of propsResult[1]) {
|
|
3007
3118
|
const { key, values } = prop;
|
|
3119
|
+
const canStringifyAttrName = key.isStatic && !UNSAFE_ATTR_NAME_RE.test(key.content);
|
|
3008
3120
|
let foldedValue;
|
|
3009
|
-
if (context.imports.some((imported) => values[0].content.includes(imported.exp.content))) {
|
|
3121
|
+
if (canStringifyAttrName && context.imports.some((imported) => values[0].content.includes(imported.exp.content))) {
|
|
3010
3122
|
if (!prevWasQuoted) template += ` `;
|
|
3011
3123
|
template += `${key.content}="${IMPORT_EXP_START}${values[0].content}${IMPORT_EXP_END}"`;
|
|
3012
3124
|
prevWasQuoted = true;
|
|
3013
|
-
} else if (
|
|
3125
|
+
} else if (canStringifyAttrName && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
|
|
3014
3126
|
const value = values[0].content === "''" ? "" : values[0].content;
|
|
3015
3127
|
appendTemplateProp(key.content, value);
|
|
3016
|
-
} else if (
|
|
3128
|
+
} else if (canStringifyAttrName && !prop.modifier && (0, _vue_shared.isBooleanAttr)(key.content) && (foldedValue = foldBooleanAttrValue(values)) != null) {
|
|
3017
3129
|
if (foldedValue) appendTemplateProp(key.content);
|
|
3018
|
-
} else if (
|
|
3130
|
+
} else if (canStringifyAttrName && !prop.modifier && hasBoundValue(values) && (foldedValue = key.content === "class" ? foldClassValues(values) : key.content === "style" ? foldStyleValues(values) : void 0) != null) {
|
|
3019
3131
|
if (foldedValue) appendTemplateProp(key.content, foldedValue, true);
|
|
3020
3132
|
} else context.registerEffect(values, {
|
|
3021
3133
|
type: 3,
|
|
@@ -3535,25 +3647,6 @@ const transformVOnce = (node, context) => {
|
|
|
3535
3647
|
if (node.type === 1 && (0, _vue_compiler_dom.findDir)(node, "once", true)) context.inVOnce = true;
|
|
3536
3648
|
};
|
|
3537
3649
|
//#endregion
|
|
3538
|
-
//#region packages/compiler-vapor/src/transforms/vHtml.ts
|
|
3539
|
-
const transformVHtml = (dir, node, context) => {
|
|
3540
|
-
let { exp, loc } = dir;
|
|
3541
|
-
if (!exp) {
|
|
3542
|
-
context.options.onError((0, _vue_compiler_dom.createDOMCompilerError)(54, loc));
|
|
3543
|
-
exp = EMPTY_EXPRESSION;
|
|
3544
|
-
}
|
|
3545
|
-
if (node.children.length) {
|
|
3546
|
-
context.options.onError((0, _vue_compiler_dom.createDOMCompilerError)(55, loc));
|
|
3547
|
-
context.childrenTemplate.length = 0;
|
|
3548
|
-
}
|
|
3549
|
-
context.registerEffect([exp], {
|
|
3550
|
-
type: 8,
|
|
3551
|
-
element: context.reference(),
|
|
3552
|
-
value: exp,
|
|
3553
|
-
isComponent: node.tagType === 1
|
|
3554
|
-
});
|
|
3555
|
-
};
|
|
3556
|
-
//#endregion
|
|
3557
3650
|
//#region packages/shared/src/makeMap.ts
|
|
3558
3651
|
/**
|
|
3559
3652
|
* Make a map and return a function for checking if a key
|
|
@@ -4195,7 +4288,7 @@ function createFallback(node, context) {
|
|
|
4195
4288
|
//#region packages/compiler-vapor/src/transforms/vSlot.ts
|
|
4196
4289
|
const transformVSlot = (node, context) => {
|
|
4197
4290
|
if (node.type !== 1) return;
|
|
4198
|
-
const dir = findDir$
|
|
4291
|
+
const dir = findDir$3(node, "slot", true);
|
|
4199
4292
|
const { tagType, children } = node;
|
|
4200
4293
|
const { parent } = context;
|
|
4201
4294
|
const isComponent = tagType === 1;
|
|
@@ -4246,9 +4339,9 @@ function transformTemplateSlot(node, dir, context) {
|
|
|
4246
4339
|
const resolvedArg = dir.arg && resolveExpression(dir.arg);
|
|
4247
4340
|
let arg = resolvedArg;
|
|
4248
4341
|
if (!arg) arg = (0, _vue_compiler_dom.createSimpleExpression)("default", true);
|
|
4249
|
-
const vFor = findDir$
|
|
4250
|
-
const vIf = findDir$
|
|
4251
|
-
const vElse = findDir$
|
|
4342
|
+
const vFor = findDir$3(node, "for");
|
|
4343
|
+
const vIf = findDir$3(node, "if");
|
|
4344
|
+
const vElse = findDir$3(node, /^else(-if)?$/, true);
|
|
4252
4345
|
const { slots } = context;
|
|
4253
4346
|
const [block, onExit] = createSlotBlock(node, dir, context);
|
|
4254
4347
|
if (!vFor && !vIf && !vElse) {
|
|
@@ -4266,7 +4359,7 @@ function transformTemplateSlot(node, dir, context) {
|
|
|
4266
4359
|
});
|
|
4267
4360
|
else if (vElse) {
|
|
4268
4361
|
const vIfSlot = slots[slots.length - 1];
|
|
4269
|
-
if (vIfSlot.slotType === 3) {
|
|
4362
|
+
if (vIfSlot && vIfSlot.slotType === 3) {
|
|
4270
4363
|
let ifNode = vIfSlot;
|
|
4271
4364
|
while (ifNode.negative && ifNode.negative.slotType === 3) ifNode = ifNode.negative;
|
|
4272
4365
|
const negative = vElse.exp ? {
|
|
@@ -4329,7 +4422,7 @@ function isNonWhitespaceContent(node) {
|
|
|
4329
4422
|
return !!node.content.trim();
|
|
4330
4423
|
}
|
|
4331
4424
|
function isSlotTemplateChild(node) {
|
|
4332
|
-
return node.type === 1 && (0, _vue_compiler_dom.isTemplateNode)(node) && !!findDir$
|
|
4425
|
+
return node.type === 1 && (0, _vue_compiler_dom.isTemplateNode)(node) && !!findDir$3(node, "slot", true);
|
|
4333
4426
|
}
|
|
4334
4427
|
//#endregion
|
|
4335
4428
|
//#region packages/compiler-vapor/src/transforms/transformTransition.ts
|
|
@@ -4342,17 +4435,17 @@ function hasMultipleChildren(node) {
|
|
|
4342
4435
|
const children = node.children = node.children.filter((c) => c.type !== 3 && !(c.type === 2 && !c.content.trim()));
|
|
4343
4436
|
const first = children[0];
|
|
4344
4437
|
if (children.length === 1 && first.type === 1) {
|
|
4345
|
-
if (findDir$
|
|
4438
|
+
if (findDir$3(first, "for")) return true;
|
|
4346
4439
|
if ((0, _vue_compiler_dom.isTemplateNode)(first)) return hasMultipleChildren(first);
|
|
4347
4440
|
}
|
|
4348
|
-
const hasElse = (node) => findDir$
|
|
4349
|
-
if (children.length > 0 && children.every((c, index) => c.type === 1 && (!(0, _vue_compiler_dom.isTemplateNode)(c) || !hasMultipleChildren(c)) && !findDir$
|
|
4441
|
+
const hasElse = (node) => findDir$3(node, "else-if") || findDir$3(node, "else", true);
|
|
4442
|
+
if (children.length > 0 && children.every((c, index) => c.type === 1 && (!(0, _vue_compiler_dom.isTemplateNode)(c) || !hasMultipleChildren(c)) && !findDir$3(c, "for") && (index === 0 ? findDir$3(c, "if") : hasElse(c)))) return false;
|
|
4350
4443
|
return children.length !== 1;
|
|
4351
4444
|
}
|
|
4352
4445
|
//#endregion
|
|
4353
4446
|
//#region packages/compiler-vapor/src/transforms/transformKey.ts
|
|
4354
4447
|
const transformKey = (node, context) => {
|
|
4355
|
-
if (node.type !== 1 || context.inVOnce || findDir$
|
|
4448
|
+
if (node.type !== 1 || context.inVOnce || findDir$3(node, "for")) return;
|
|
4356
4449
|
const dir = findProp$1(node, "key", true, true);
|
|
4357
4450
|
if (!dir || dir.type === 6) return;
|
|
4358
4451
|
let value;
|
package/dist/compiler-vapor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AllNode, BaseCodegenResult, CodegenOptions as CodegenOptions$1, CodegenSourceMapGenerator, CommentNode, CompilerCompatOptions, CompilerError, CompilerOptions as CompilerOptions$1, CompoundExpressionNode, DirectiveNode, ElementNode, RootNode, SimpleExpressionNode, SourceLocation, TemplateChildNode, TemplateNode, TransformOptions, parse } from "@vue/compiler-dom";
|
|
2
|
-
import { IfAny, IsKeyValues, LooseRequired, Namespace, NormalizedStyle, OverloadParameters, PatchFlags, Prettify, SlotFlags, UnionToIntersection, camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from "@vue/shared";
|
|
2
|
+
import { IfAny, IsKeyValues, LooseRequired, Namespace, NormalizedStyle, OverloadParameters, PatchFlags, Prettify, SlotFlags, UnionToIntersection, VaporSlotFlags, camelize, capitalize, extend, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from "@vue/shared";
|
|
3
3
|
//#endregion
|
|
4
4
|
//#region packages/reactivity/src/constants.d.ts
|
|
5
5
|
declare enum TrackOpTypes {
|
|
@@ -1410,6 +1410,7 @@ declare let isHydrating: boolean;
|
|
|
1410
1410
|
type RootHydrateFunction = (vnode: VNode<Node, Element>, container: (Element | ShadowRoot) & {
|
|
1411
1411
|
_vnode?: VNode;
|
|
1412
1412
|
}) => void;
|
|
1413
|
+
declare const logMismatchError: () => void;
|
|
1413
1414
|
declare function createHydrationFunctions(rendererInternals: RendererInternals<Node, Element>): [RootHydrateFunction, (node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized?: boolean) => Node | null];
|
|
1414
1415
|
declare const isTemplateNode: (node: Node) => node is HTMLTemplateElement;
|
|
1415
1416
|
declare function getAttributeMismatch(el: Element, key: string, clientValue: any): {
|
|
@@ -25232,10 +25233,13 @@ declare function setVarsOnNode(el: Node, vars: Record<string, string>): void;
|
|
|
25232
25233
|
type Style = string | null | undefined | Record<string, unknown>;
|
|
25233
25234
|
declare function patchStyle(el: Element, prev: Style, next: Style): void;
|
|
25234
25235
|
//#endregion
|
|
25236
|
+
//#region packages/runtime-dom/src/modules/events.d.ts
|
|
25237
|
+
declare function parseEventName(name: string): [string, EventListenerOptions | undefined];
|
|
25238
|
+
//#endregion
|
|
25235
25239
|
//#region packages/runtime-dom/src/modules/attrs.d.ts
|
|
25236
25240
|
declare const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
25237
25241
|
declare namespace index_d_exports$1 {
|
|
25238
|
-
export { AllowedAttrs, AllowedComponentProps, AnchorHTMLAttributes, App, AppConfig, AppContext, AppMountFn, AppUnmountFn, AreaHTMLAttributes, AriaAttributes, AsyncComponentInternalOptions, AsyncComponentLoader, AsyncComponentOptions, Attrs, AudioHTMLAttributes, BaseHTMLAttributes, BaseTransition, BaseTransitionProps, BaseTransitionPropsValidators, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ClassValue, ColHTMLAttributes, ColgroupHTMLAttributes, Comment$2 as Comment, CompatVue, Component, ComponentCustomElementInterface, ComponentCustomOptions, ComponentCustomProperties, ComponentCustomProps, ComponentInjectOptions, ComponentInstance, ComponentInternalInstance, ComponentInternalOptions, ComponentObjectPropsOptions, ComponentOptions, ComponentOptionsBase, ComponentOptionsMixin, ComponentOptionsWithArrayProps, ComponentOptionsWithObjectProps, ComponentOptionsWithoutProps, ComponentPropsOptions, ComponentProvideOptions, ComponentPublicInstance, ComponentTypeEmits, ComputedGetter, ComputedOptions, ComputedRef, ComputedSetter, ConcreteComponent, CreateAppFunction, CreateComponentPublicInstance, CreateComponentPublicInstanceWithMixins, CustomElementOptions, CustomRefFactory, DataHTMLAttributes, DebuggerEvent, DebuggerEventExtraInfo, DebuggerOptions, DeepReadonly, DefineComponent, DefineProps, DefineSetupFnComponent, DelHTMLAttributes, DeprecationTypes, DetailsHTMLAttributes, DialogHTMLAttributes, Directive$1 as Directive, DirectiveArguments$1 as DirectiveArguments, DirectiveBinding, DirectiveHook, DirectiveModifiers, EffectScheduler, EffectScope, ElementNamespace, ElementWithTransition, EmbedHTMLAttributes, EmitFn, EmitsOptions, EmitsToProps, ErrorCodes, ErrorTypeStrings, Events, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, FieldsetHTMLAttributes, FormHTMLAttributes, Fragment, FunctionDirective, FunctionPlugin, FunctionalComponent, GenericAppContext, GenericComponent, GenericComponentInstance, GlobalComponents, GlobalDirectives, HMRRuntime, HTMLAttributes, HtmlHTMLAttributes, HydrationRenderer, HydrationStrategy, HydrationStrategyFactory, IframeHTMLAttributes, ImgHTMLAttributes, InjectionKey, InputAutoCompleteAttribute, InputHTMLAttributes, InputTypeHTMLAttribute, InsHTMLAttributes, IntrinsicElementAttributes, KeepAlive, KeepAliveContext, KeepAliveProps, KeygenHTMLAttributes, LabelHTMLAttributes, LegacyConfig, LiHTMLAttributes, LifecycleHook, LinkHTMLAttributes, MapHTMLAttributes, MaybeRef, MaybeRefOrGetter, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, MethodOptions, MismatchTypes, ModelRef, MoveType, MultiWatchSources, NULL_DYNAMIC_COMPONENT, NativeElements, NormalizedPropsOptions, ObjectDirective, ObjectEmitsOptions, ObjectHTMLAttributes, ObjectPlugin, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OptionMergeFunction, OutputHTMLAttributes, ParamHTMLAttributes, Plugin, ProgressHTMLAttributes, Prop, PropType, PublicProps, QuoteHTMLAttributes, Raw, Reactive, ReactiveEffect, ReactiveEffectOptions, ReactiveEffectRunner, ReactiveFlags$1 as ReactiveFlags, Ref, RenderFunction, Renderer, RendererElement, RendererInternals, RendererNode, RendererOptions, ReservedProps, RootHydrateFunction, RootRenderFunction, RuntimeCompilerOptions, SVGAttributes, SchedulerJob, SchedulerJobFlags, ScriptHTMLAttributes, SelectHTMLAttributes, SetupContext, ShallowReactive, ShallowRef, ShallowUnwrapRef, ShortEmitsToObject, Slot, Slots, SlotsType, SourceHTMLAttributes, Static, StyleHTMLAttributes, StyleValue, Suspense, SuspenseBoundary, SuspenseProps, TableHTMLAttributes, TdHTMLAttributes, Teleport, TeleportProps, TeleportTargetElement, TemplateRef, Text$1 as Text, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, ToRef, ToRefs, TrackHTMLAttributes, TrackOpTypes, Transition, TransitionElement, TransitionGroup, TransitionGroupProps, TransitionHooks, TransitionHooksContext, TransitionProps, TransitionPropsValidators, TransitionState, TriggerOpTypes, TypeEmitsToOptions, UnwrapNestedRefs, UnwrapRef, VNode, VNodeArrayChildren, VNodeChild, VNodeNormalizedChildren, VNodeNormalizedRef, VNodeProps, VNodeRef, VNodeTypes, VShowElement, VaporInteropInterface, VaporSlot$1 as VaporSlot, VideoHTMLAttributes, VueElement, VueElementBase, VueElementConstructor, WatchCallback, WatchEffect, WatchHandle, WatchOptions, WatchEffectOptions as WatchOptionsBase, WatchSource, WatchStopHandle, WebViewHTMLAttributes, WritableComputedOptions, WritableComputedRef, activate, assertNumber, baseApplyTranslation, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, baseUseCssVars, callPendingCbs, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, checkTransitionMode, cloneVNode, compatUtils, computed, createApp, createAppAPI, createAsyncComponentContext, createBlock, createCanSetSetupRefChecker, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createInternalObject, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, currentInstance, customRef, deactivate, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, devtoolsComponentAdded, effect, effectScope, endMeasure, ensureHydrationRenderer, ensureRenderer, ensureValidVNode, ensureVaporSlotFallback, expose, flushOnAppMount, forceReflow, getAttributeMismatch, getComponentName, getCurrentInstance, getCurrentScope, getCurrentWatcher, getFunctionalFallthrough, getInheritedScopeIds, getTransitionRawChildren, guardReactiveProps, h, handleError, handleMovedChildren, hasCSSTransform, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, initFeatureFlags, inject, invalidateMount, invokeDirectiveHook, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMemoSame, isMismatchAllowed, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isSetEqual, isShallow, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, markRaw, matches, mergeDefaults, mergeModels, mergeProps, nextTick, nextUid, nodeOps, normalizeClass, normalizeContainer, normalizeProps, normalizeRef, normalizeStyle, normalizeVNode, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, patchProp, patchStyle, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popScopeId, popWarningContext, provide, proxyRefs, pushScopeId, pushWarningContext, queueJob, queuePostFlushCb, reactive, readonly, ref$1 as ref, registerHMR, registerRuntimeCompiler, render, renderList, renderSlot, resetShapeFlag, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolvePropValue, resolveTarget as resolveTeleportTarget, resolveTransitionHooks, resolveTransitionProps, setBlockTracking, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setIsHydratingEnabled, setRef, setTransitionHooks, setVarsOnNode, shallowReactive, shallowReadonly, shallowRef, shouldSetAsProp, shouldSetAsPropForVueCE, shouldUpdateComponent, simpleSetCurrentInstance, ssrContextKey, ssrUtils, startMeasure, stop, svgNS, toClassSet, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toStyleMap, toValue, transformVNodeArgs, triggerRef, unref, unregisterHMR, unsafeToTrustedHTML, useAsyncComponentState, useAttrs, useCssModule, useCssVars, useHost, useId, useInstanceOption, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelCheckboxInit, vModelCheckboxUpdate, vModelDynamic, getValue as vModelGetValue, vModelRadio, vModelSelect, vModelSelectInit, vModelSetSelected, vModelText, vModelTextInit, vModelTextUpdate, vShow, vShowHidden, vShowOriginalDisplay, validateComponentName, validateProps, version, warn, warnExtraneousAttributes, warnPropMismatch, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext$1 as withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId, xlinkNS };
|
|
25242
|
+
export { AllowedAttrs, AllowedComponentProps, AnchorHTMLAttributes, App, AppConfig, AppContext, AppMountFn, AppUnmountFn, AreaHTMLAttributes, AriaAttributes, AsyncComponentInternalOptions, AsyncComponentLoader, AsyncComponentOptions, Attrs, AudioHTMLAttributes, BaseHTMLAttributes, BaseTransition, BaseTransitionProps, BaseTransitionPropsValidators, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ClassValue, ColHTMLAttributes, ColgroupHTMLAttributes, Comment$2 as Comment, CompatVue, Component, ComponentCustomElementInterface, ComponentCustomOptions, ComponentCustomProperties, ComponentCustomProps, ComponentInjectOptions, ComponentInstance, ComponentInternalInstance, ComponentInternalOptions, ComponentObjectPropsOptions, ComponentOptions, ComponentOptionsBase, ComponentOptionsMixin, ComponentOptionsWithArrayProps, ComponentOptionsWithObjectProps, ComponentOptionsWithoutProps, ComponentPropsOptions, ComponentProvideOptions, ComponentPublicInstance, ComponentTypeEmits, ComputedGetter, ComputedOptions, ComputedRef, ComputedSetter, ConcreteComponent, CreateAppFunction, CreateComponentPublicInstance, CreateComponentPublicInstanceWithMixins, CustomElementOptions, CustomRefFactory, DataHTMLAttributes, DebuggerEvent, DebuggerEventExtraInfo, DebuggerOptions, DeepReadonly, DefineComponent, DefineProps, DefineSetupFnComponent, DelHTMLAttributes, DeprecationTypes, DetailsHTMLAttributes, DialogHTMLAttributes, Directive$1 as Directive, DirectiveArguments$1 as DirectiveArguments, DirectiveBinding, DirectiveHook, DirectiveModifiers, EffectScheduler, EffectScope, ElementNamespace, ElementWithTransition, EmbedHTMLAttributes, EmitFn, EmitsOptions, EmitsToProps, ErrorCodes, ErrorTypeStrings, Events, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, FieldsetHTMLAttributes, FormHTMLAttributes, Fragment, FunctionDirective, FunctionPlugin, FunctionalComponent, GenericAppContext, GenericComponent, GenericComponentInstance, GlobalComponents, GlobalDirectives, HMRRuntime, HTMLAttributes, HtmlHTMLAttributes, HydrationRenderer, HydrationStrategy, HydrationStrategyFactory, IframeHTMLAttributes, ImgHTMLAttributes, InjectionKey, InputAutoCompleteAttribute, InputHTMLAttributes, InputTypeHTMLAttribute, InsHTMLAttributes, IntrinsicElementAttributes, KeepAlive, KeepAliveContext, KeepAliveProps, KeygenHTMLAttributes, LabelHTMLAttributes, LegacyConfig, LiHTMLAttributes, LifecycleHook, LinkHTMLAttributes, MapHTMLAttributes, MaybeRef, MaybeRefOrGetter, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, MethodOptions, MismatchTypes, ModelRef, MoveType, MultiWatchSources, NULL_DYNAMIC_COMPONENT, NativeElements, NormalizedPropsOptions, ObjectDirective, ObjectEmitsOptions, ObjectHTMLAttributes, ObjectPlugin, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OptionMergeFunction, OutputHTMLAttributes, ParamHTMLAttributes, Plugin, ProgressHTMLAttributes, Prop, PropType, PublicProps, QuoteHTMLAttributes, Raw, Reactive, ReactiveEffect, ReactiveEffectOptions, ReactiveEffectRunner, ReactiveFlags$1 as ReactiveFlags, Ref, RenderFunction, Renderer, RendererElement, RendererInternals, RendererNode, RendererOptions, ReservedProps, RootHydrateFunction, RootRenderFunction, RuntimeCompilerOptions, SVGAttributes, SchedulerJob, SchedulerJobFlags, ScriptHTMLAttributes, SelectHTMLAttributes, SetupContext, ShallowReactive, ShallowRef, ShallowUnwrapRef, ShortEmitsToObject, Slot, Slots, SlotsType, SourceHTMLAttributes, Static, StyleHTMLAttributes, StyleValue, Suspense, SuspenseBoundary, SuspenseProps, TableHTMLAttributes, TdHTMLAttributes, Teleport, TeleportProps, TeleportTargetElement, TemplateRef, Text$1 as Text, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, ToRef, ToRefs, TrackHTMLAttributes, TrackOpTypes, Transition, TransitionElement, TransitionGroup, TransitionGroupProps, TransitionHooks, TransitionHooksContext, TransitionProps, TransitionPropsValidators, TransitionState, TriggerOpTypes, TypeEmitsToOptions, UnwrapNestedRefs, UnwrapRef, VNode, VNodeArrayChildren, VNodeChild, VNodeNormalizedChildren, VNodeNormalizedRef, VNodeProps, VNodeRef, VNodeTypes, VShowElement, VaporInteropInterface, VaporSlot$1 as VaporSlot, VideoHTMLAttributes, VueElement, VueElementBase, VueElementConstructor, WatchCallback, WatchEffect, WatchHandle, WatchOptions, WatchEffectOptions as WatchOptionsBase, WatchSource, WatchStopHandle, WebViewHTMLAttributes, WritableComputedOptions, WritableComputedRef, activate, assertNumber, baseApplyTranslation, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, baseUseCssVars, callPendingCbs, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, checkTransitionMode, cloneVNode, compatUtils, computed, createApp, createAppAPI, createAsyncComponentContext, createBlock, createCanSetSetupRefChecker, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createInternalObject, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, currentInstance, customRef, deactivate, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, devtoolsComponentAdded, effect, effectScope, endMeasure, ensureHydrationRenderer, ensureRenderer, ensureValidVNode, ensureVaporSlotFallback, expose, flushOnAppMount, forceReflow, getAttributeMismatch, getComponentName, getCurrentInstance, getCurrentScope, getCurrentWatcher, getFunctionalFallthrough, getInheritedScopeIds, getTransitionRawChildren, guardReactiveProps, h, handleError, handleMovedChildren, hasCSSTransform, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, initFeatureFlags, inject, invalidateMount, invokeDirectiveHook, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMemoSame, isMismatchAllowed, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isSetEqual, isShallow, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, logMismatchError, markAsyncBoundary, markRaw, matches, mergeDefaults, mergeModels, mergeProps, nextTick, nextUid, nodeOps, normalizeClass, normalizeContainer, normalizeProps, normalizeRef, normalizeStyle, normalizeVNode, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, parseEventName, patchProp, patchStyle, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popScopeId, popWarningContext, provide, proxyRefs, pushScopeId, pushWarningContext, queueJob, queuePostFlushCb, reactive, readonly, ref$1 as ref, registerHMR, registerRuntimeCompiler, render, renderList, renderSlot, resetShapeFlag, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolvePropValue, resolveTarget as resolveTeleportTarget, resolveTransitionHooks, resolveTransitionProps, setBlockTracking, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setIsHydratingEnabled, setRef, setTransitionHooks, setVarsOnNode, shallowReactive, shallowReadonly, shallowRef, shouldSetAsProp, shouldSetAsPropForVueCE, shouldUpdateComponent, simpleSetCurrentInstance, ssrContextKey, ssrUtils, startMeasure, stop, svgNS, toClassSet, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toStyleMap, toValue, transformVNodeArgs, triggerRef, unref, unregisterHMR, unsafeToTrustedHTML, useAsyncComponentState, useAttrs, useCssModule, useCssVars, useHost, useId, useInstanceOption, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelCheckboxInit, vModelCheckboxUpdate, vModelDynamic, getValue as vModelGetValue, vModelRadio, vModelSelect, vModelSelectInit, vModelSetSelected, vModelText, vModelTextInit, vModelTextUpdate, vShow, vShowHidden, vShowOriginalDisplay, validateComponentName, validateProps, version, warn, warnExtraneousAttributes, warnPropMismatch, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext$1 as withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId, xlinkNS };
|
|
25239
25243
|
}
|
|
25240
25244
|
/**
|
|
25241
25245
|
* This is a stub implementation to prevent the need to use dom types.
|
|
@@ -25291,12 +25295,22 @@ declare function createTemplateRefSetter(): setRefFn;
|
|
|
25291
25295
|
declare function setStaticTemplateRef(el: RefEl, ref: NodeRef, refFor?: boolean, refKey?: string): NodeRef | undefined;
|
|
25292
25296
|
declare function setTemplateRefBinding(el: RefEl, getter: () => any, setter?: setRefFn, refFor?: boolean, refKey?: string): void;
|
|
25293
25297
|
//#endregion
|
|
25298
|
+
//#region packages/runtime-vapor/src/slotBoundary.d.ts
|
|
25299
|
+
interface SlotBoundaryContext {
|
|
25300
|
+
parent: SlotBoundaryContext | null;
|
|
25301
|
+
getFallback: () => BlockFn | undefined;
|
|
25302
|
+
run<R>(fn: () => R, scope?: EffectScope): R;
|
|
25303
|
+
markDirty: () => void;
|
|
25304
|
+
redirected?: SlotBoundaryContext;
|
|
25305
|
+
}
|
|
25306
|
+
//#endregion
|
|
25294
25307
|
//#region packages/runtime-vapor/src/keepAlive.d.ts
|
|
25295
25308
|
interface VaporKeepAliveContext {
|
|
25309
|
+
acquireBranchScope(key: any): EffectScope | undefined;
|
|
25310
|
+
runBranchRender(frag: DynamicFragment, fn: () => void): void;
|
|
25296
25311
|
processShapeFlag(block: Block$1): any | false;
|
|
25297
25312
|
cacheBlock(block?: Block$1): void;
|
|
25298
25313
|
cacheScope(cacheKey: any, scopeLookupKey: any, scope: EffectScope): void;
|
|
25299
|
-
getScope(key: any): EffectScope | undefined;
|
|
25300
25314
|
}
|
|
25301
25315
|
//#endregion
|
|
25302
25316
|
//#region packages/runtime-vapor/src/fragment.d.ts
|
|
@@ -25321,6 +25335,9 @@ declare class VaporFragment<T extends Block$1 = Block$1> implements TransitionOp
|
|
|
25321
25335
|
onBeforeRemove?: ((scope: EffectScope) => boolean)[];
|
|
25322
25336
|
onBeforeUpdate?: (() => void)[];
|
|
25323
25337
|
onUpdated?: ((nodes?: Block$1) => void)[];
|
|
25338
|
+
constructor(nodes: T);
|
|
25339
|
+
}
|
|
25340
|
+
declare class RenderContextFragment<T extends Block$1 = Block$1> extends VaporFragment<T> {
|
|
25324
25341
|
readonly renderInstance: GenericComponentInstance | null;
|
|
25325
25342
|
readonly slotOwner: VaporComponentInstance | null;
|
|
25326
25343
|
readonly keepAliveCtx?: VaporKeepAliveContext | null;
|
|
@@ -25333,7 +25350,7 @@ declare class ForFragment extends VaporFragment<Block$1[]> {
|
|
|
25333
25350
|
constructor(nodes: Block$1[], trackSlotBoundary: boolean);
|
|
25334
25351
|
onReset(fn: () => void): void;
|
|
25335
25352
|
}
|
|
25336
|
-
declare class DynamicFragment extends
|
|
25353
|
+
declare class DynamicFragment extends RenderContextFragment {
|
|
25337
25354
|
/**
|
|
25338
25355
|
* @internal marker for duck typing to avoid direct instanceof check
|
|
25339
25356
|
* which prevents tree-shaking of DynamicFragment
|
|
@@ -25350,19 +25367,14 @@ declare class DynamicFragment extends VaporFragment {
|
|
|
25350
25367
|
anchorLabel?: string;
|
|
25351
25368
|
keyed?: boolean;
|
|
25352
25369
|
isSlot?: boolean;
|
|
25370
|
+
forwarded?: boolean;
|
|
25353
25371
|
inTransition?: boolean;
|
|
25354
25372
|
hasFallthroughAttrs?: true;
|
|
25355
|
-
|
|
25356
|
-
|
|
25373
|
+
readonly autoHydrate: boolean;
|
|
25374
|
+
constructor(anchorLabel?: string, keyed?: boolean, locate?: boolean, trackSlotBoundary?: boolean, autoHydrate?: boolean);
|
|
25375
|
+
update(render?: BlockFn, key?: any, noScope?: boolean): void;
|
|
25376
|
+
protected getBranchParent(): ParentNode | null;
|
|
25357
25377
|
renderBranch(render: BlockFn | undefined, transition: VaporTransitionHooks | undefined, parent: ParentNode | null, key: any, noScope?: boolean, notifyUpdated?: boolean): void;
|
|
25358
|
-
hydrate(isEmpty?: boolean): void;
|
|
25359
|
-
}
|
|
25360
|
-
interface SlotBoundaryContext {
|
|
25361
|
-
parent: SlotBoundaryContext | null;
|
|
25362
|
-
getFallback: () => BlockFn | undefined;
|
|
25363
|
-
run<R>(fn: () => R, scope?: EffectScope): R;
|
|
25364
|
-
markDirty: () => void;
|
|
25365
|
-
redirected?: SlotBoundaryContext;
|
|
25366
25378
|
}
|
|
25367
25379
|
declare function isFragment(val: unknown): val is VaporFragment;
|
|
25368
25380
|
//#endregion
|
|
@@ -25417,7 +25429,9 @@ type LooseRawSlots = VaporSlot | (Record<string, VaporSlot | DynamicSlotSource[]
|
|
|
25417
25429
|
$?: DynamicSlotSource[];
|
|
25418
25430
|
});
|
|
25419
25431
|
type StaticSlots = Record<string, VaporSlot>;
|
|
25420
|
-
type VaporSlot = BlockFn
|
|
25432
|
+
type VaporSlot = BlockFn & {
|
|
25433
|
+
_?: VaporSlotFlags.NON_STABLE;
|
|
25434
|
+
};
|
|
25421
25435
|
type DynamicSlot = {
|
|
25422
25436
|
name: string;
|
|
25423
25437
|
fn: VaporSlot;
|
|
@@ -25841,7 +25855,7 @@ declare const VaporTransition: FunctionalVaporComponent<TransitionProps>;
|
|
|
25841
25855
|
//#region packages/runtime-vapor/src/components/TransitionGroup.d.ts
|
|
25842
25856
|
declare const VaporTransitionGroup: DefineVaporComponent<{}, string, TransitionGroupProps>;
|
|
25843
25857
|
declare namespace index_d_exports {
|
|
25844
|
-
export { Block$1 as Block, DefineVaporComponent, DynamicFragment, FunctionalVaporComponent, VaporComponent, VaporComponentInstance, VaporComponentOptions, VaporDirective, VaporElement, VaporElementConstructor, VaporFragment, VaporKeepAlive, VaporKeepAliveContext, VaporPublicProps, VaporRenderResult, VaporSlot, VaporTeleport, VaporTransition, VaporTransitionGroup, VaporTransitionHooks, applyCheckboxModel, applyDynamicModel, applyRadioModel, applySelectModel, applyTextModel, applyVShow, child, createAssetComponent, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createForSlots, createIf, createInvoker, createKeyedFragment, createPlainElement, createSelector, createSlot, createTemplateRefSetter, createTextNode, createVaporApp, createVaporSSRApp, defineVaporAsyncComponent, defineVaporComponent, defineVaporCustomElement, defineVaporSSRCustomElement, delegate, delegateEvents, getDefaultValue, getRestElement, insert$1 as insert, isFragment, isVaporComponent, next, nthChild, on, onBinding, prepend, remove, renderEffect, setAttr, setBlockHtml, setBlockKey, setBlockText, setClass, setClassName, setDOMProp, setDynamicEvents, setDynamicProps, setElementText, setHtml, setInsertionState, setProp, setStaticTemplateRef, setStyle, setTemplateRefBinding, setText, setValue, template, txt, useVaporCssVars, vaporInteropPlugin, withAsyncContext, withVaporDirectives, withVaporKeys, withVaporModifiers };
|
|
25858
|
+
export { Block$1 as Block, DefineVaporComponent, DynamicFragment, FunctionalVaporComponent, VaporComponent, VaporComponentInstance, VaporComponentOptions, VaporDirective, VaporElement, VaporElementConstructor, VaporFragment, VaporKeepAlive, VaporKeepAliveContext, VaporPublicProps, VaporRenderResult, VaporSlot, VaporTeleport, VaporTransition, VaporTransitionGroup, VaporTransitionHooks, applyCheckboxModel, applyDynamicModel, applyRadioModel, applySelectModel, applyTextModel, applyVShow, child, createAssetComponent, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createForSlots, createIf, createInvoker, createKeyedFragment, createPlainElement, createSelector, createSlot, createTemplateRefSetter, createTextNode, createVaporApp, createVaporSSRApp, defineVaporAsyncComponent, defineVaporComponent, defineVaporCustomElement, defineVaporSSRCustomElement, delegate, delegateEvents, extend, getDefaultValue, getRestElement, insert$1 as insert, isFragment, isVaporComponent, next, nthChild, on, onBinding, prepend, remove, renderEffect, setAttr, setBlockHtml, setBlockKey, setBlockText, setClass, setClassName, setDOMProp, setDynamicEvents, setDynamicProps, setElementText, setHtml, setInsertionState, setProp, setStaticTemplateRef, setStyle, setTemplateRefBinding, setText, setValue, template, txt, useVaporCssVars, vaporInteropPlugin, withAsyncContext, withVaporDirectives, withVaporKeys, withVaporModifiers };
|
|
25845
25859
|
}
|
|
25846
25860
|
//#endregion
|
|
25847
25861
|
//#region temp/packages/compiler-vapor/src/ir/component.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-vapor v3.6.0-beta.16
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -19674,6 +19674,8 @@ function _objectSpread2(e) {
|
|
|
19674
19674
|
function genExpression(node, context, assignment) {
|
|
19675
19675
|
node = context.getExpressionReplacement(node);
|
|
19676
19676
|
const { content, ast, isStatic, loc } = node;
|
|
19677
|
+
const { options } = context;
|
|
19678
|
+
const { inline } = options;
|
|
19677
19679
|
if (isStatic) return [[
|
|
19678
19680
|
JSON.stringify(content),
|
|
19679
19681
|
-2,
|
|
@@ -19695,23 +19697,31 @@ function genExpression(node, context, assignment) {
|
|
|
19695
19697
|
let hasMemberExpression = false;
|
|
19696
19698
|
if (ids.length) {
|
|
19697
19699
|
const [frag, push] = buildCodeFragment();
|
|
19698
|
-
|
|
19699
|
-
|
|
19700
|
-
const
|
|
19701
|
-
const
|
|
19702
|
-
const
|
|
19703
|
-
if (leadingText.length) push([leadingText, -3]);
|
|
19704
|
-
const source = content.slice(start, end);
|
|
19700
|
+
let lastEnd = 0;
|
|
19701
|
+
ids.sort((a, b) => a.start - b.start).forEach((id) => {
|
|
19702
|
+
const idStart = id.start - 1;
|
|
19703
|
+
const idEnd = id.end - 1;
|
|
19704
|
+
const source = content.slice(idStart, idEnd);
|
|
19705
19705
|
const parentStack = parentStackMap.get(id);
|
|
19706
19706
|
const parent = parentStack[parentStack.length - 1];
|
|
19707
|
+
let start = idStart;
|
|
19708
|
+
let end = idEnd;
|
|
19709
|
+
if (inline && options.bindingMetadata && options.bindingMetadata[source] === "setup-let" && parent && parent.type === "UpdateExpression" && parent.argument === id) {
|
|
19710
|
+
start = parent.start - 1;
|
|
19711
|
+
end = parent.end - 1;
|
|
19712
|
+
}
|
|
19713
|
+
if (start < lastEnd) return;
|
|
19714
|
+
const leadingText = content.slice(lastEnd, start);
|
|
19715
|
+
if (leadingText.length) push([leadingText, -3]);
|
|
19707
19716
|
hasMemberExpression || (hasMemberExpression = parent && (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression"));
|
|
19708
19717
|
push(...genIdentifier(source, context, {
|
|
19709
19718
|
start: advancePositionWithClone(node.loc.start, source, start),
|
|
19710
19719
|
end: advancePositionWithClone(node.loc.start, source, end),
|
|
19711
19720
|
source
|
|
19712
|
-
}, hasMemberExpression ? void 0 : assignment, id, parent, parentStack));
|
|
19713
|
-
|
|
19721
|
+
}, hasMemberExpression ? void 0 : assignment, id, parent, parentStack, node));
|
|
19722
|
+
lastEnd = end;
|
|
19714
19723
|
});
|
|
19724
|
+
if (lastEnd < content.length) push([content.slice(lastEnd), -3]);
|
|
19715
19725
|
if (assignment && hasMemberExpression) push(` = ${assignment}`);
|
|
19716
19726
|
return frag;
|
|
19717
19727
|
} else return [[
|
|
@@ -19720,7 +19730,7 @@ function genExpression(node, context, assignment) {
|
|
|
19720
19730
|
loc
|
|
19721
19731
|
]];
|
|
19722
19732
|
}
|
|
19723
|
-
function genIdentifier(raw, context, loc, assignment, id, parent, parentStack) {
|
|
19733
|
+
function genIdentifier(raw, context, loc, assignment, id, parent, parentStack, sourceNode) {
|
|
19724
19734
|
const { options, helper, identifiers } = context;
|
|
19725
19735
|
const { inline, bindingMetadata } = options;
|
|
19726
19736
|
let name = raw;
|
|
@@ -19740,19 +19750,49 @@ function genIdentifier(raw, context, loc, assignment, id, parent, parentStack) {
|
|
|
19740
19750
|
else return genExpression(replacement, context, assignment);
|
|
19741
19751
|
}
|
|
19742
19752
|
let prefix;
|
|
19743
|
-
if (isStaticProperty(parent) && parent.shorthand) prefix = `${raw}: `;
|
|
19744
19753
|
const type = bindingMetadata && bindingMetadata[raw];
|
|
19754
|
+
const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack || []);
|
|
19755
|
+
const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
|
|
19756
|
+
const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
|
|
19757
|
+
if (isStaticProperty(parent) && parent.shorthand && !(inline && type === "setup-let" && isDestructureAssignment)) prefix = `${raw}: `;
|
|
19745
19758
|
if (inline) switch (type) {
|
|
19746
19759
|
case "setup-let":
|
|
19747
|
-
|
|
19760
|
+
if (isAssignmentLVal) {
|
|
19761
|
+
const { right, operator } = parent;
|
|
19762
|
+
const source = sourceNode;
|
|
19763
|
+
const sourceContent = source.content;
|
|
19764
|
+
const rightStart = right.start - 1;
|
|
19765
|
+
const rightEnd = right.end - 1;
|
|
19766
|
+
const rightContent = sourceContent.slice(rightStart, rightEnd);
|
|
19767
|
+
const rightExp = createSimpleExpression(rightContent, false, {
|
|
19768
|
+
start: advancePositionWithClone(source.loc.start, sourceContent, rightStart),
|
|
19769
|
+
end: advancePositionWithClone(source.loc.start, sourceContent, rightEnd),
|
|
19770
|
+
source: rightContent
|
|
19771
|
+
});
|
|
19772
|
+
rightExp.ast = parseExp(context, rightContent);
|
|
19773
|
+
return [
|
|
19774
|
+
prefix,
|
|
19775
|
+
`${helper("isRef")}(${raw}) ? ${raw}.value ${operator} `,
|
|
19776
|
+
...genExpression(rightExp, context),
|
|
19777
|
+
` : `,
|
|
19778
|
+
[
|
|
19779
|
+
raw,
|
|
19780
|
+
-2,
|
|
19781
|
+
loc,
|
|
19782
|
+
name
|
|
19783
|
+
]
|
|
19784
|
+
];
|
|
19785
|
+
} else if (isUpdateArg) {
|
|
19786
|
+
const { prefix: isPrefix, operator } = parent;
|
|
19787
|
+
const updatePrefix = isPrefix ? operator : ``;
|
|
19788
|
+
const updatePostfix = isPrefix ? `` : operator;
|
|
19789
|
+
raw = `${helper("isRef")}(${raw}) ? ${updatePrefix}${raw}.value${updatePostfix} : ${updatePrefix}${raw}${updatePostfix}`;
|
|
19790
|
+
} else if (!isDestructureAssignment) name = raw = assignment ? `${helper("isRef")}(${raw}) ? (${raw}.value = ${assignment}) : (${raw} = ${assignment})` : unref();
|
|
19748
19791
|
break;
|
|
19749
19792
|
case "setup-ref":
|
|
19750
19793
|
name = raw = withAssignment(`${raw}.value`);
|
|
19751
19794
|
break;
|
|
19752
19795
|
case "setup-maybe-ref":
|
|
19753
|
-
const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack || []);
|
|
19754
|
-
const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
|
|
19755
|
-
const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
|
|
19756
19796
|
raw = isAssignmentLVal || isUpdateArg || isDestructureAssignment ? name = `${raw}.value` : assignment ? `${helper("isRef")}(${raw}) ? (${raw}.value = ${assignment}) : null` : unref();
|
|
19757
19797
|
break;
|
|
19758
19798
|
case "props":
|
|
@@ -20653,7 +20693,12 @@ function genPropKey({ key: node, modifier, runtimeCamelize, handler, handlerModi
|
|
|
20653
20693
|
if (runtimeCamelize) {
|
|
20654
20694
|
key.push(" || \"\"");
|
|
20655
20695
|
key = genCall(helper("camelize"), key);
|
|
20656
|
-
}
|
|
20696
|
+
} else if (modifier) key = [
|
|
20697
|
+
"(",
|
|
20698
|
+
...key,
|
|
20699
|
+
" || \"\"",
|
|
20700
|
+
")"
|
|
20701
|
+
];
|
|
20657
20702
|
if (handler) key = genCall(helper("toHandlerKey"), key);
|
|
20658
20703
|
return [
|
|
20659
20704
|
"[",
|
|
@@ -20745,6 +20790,11 @@ function genVShow(oper, context) {
|
|
|
20745
20790
|
])];
|
|
20746
20791
|
}
|
|
20747
20792
|
//#endregion
|
|
20793
|
+
//#region packages/compiler-vapor/src/generators/modifier.ts
|
|
20794
|
+
function genDirectiveModifiers(modifiers) {
|
|
20795
|
+
return modifiers.map((value) => `${isSimpleIdentifier(value) ? value : JSON.stringify(value)}: true`).join(", ");
|
|
20796
|
+
}
|
|
20797
|
+
//#endregion
|
|
20748
20798
|
//#region packages/compiler-vapor/src/generators/vModel.ts
|
|
20749
20799
|
const helperMap = {
|
|
20750
20800
|
text: "applyTextModel",
|
|
@@ -20759,7 +20809,7 @@ function genVModel(oper, context) {
|
|
|
20759
20809
|
`() => (`,
|
|
20760
20810
|
...genExpression(exp, context),
|
|
20761
20811
|
`)`
|
|
20762
|
-
], genModelHandler(exp, context), modifiers.length ? `{ ${modifiers.map((e) => e.content
|
|
20812
|
+
], genModelHandler(exp, context), modifiers.length ? `{ ${genDirectiveModifiers(modifiers.map((e) => e.content))} }` : void 0)];
|
|
20763
20813
|
}
|
|
20764
20814
|
function genModelHandler(exp, context) {
|
|
20765
20815
|
return [
|
|
@@ -20801,14 +20851,15 @@ function genCustomDirectives(opers, context) {
|
|
|
20801
20851
|
return genMulti(DELIMITERS_ARRAY.concat("void 0"), directiveVar, value, argument, modifiers);
|
|
20802
20852
|
}
|
|
20803
20853
|
}
|
|
20804
|
-
function genDirectiveModifiers(modifiers) {
|
|
20805
|
-
return modifiers.map((value) => `${isSimpleIdentifier(value) ? value : JSON.stringify(value)}: true`).join(", ");
|
|
20806
|
-
}
|
|
20807
20854
|
function filterCustomDirectives(id, operations) {
|
|
20808
20855
|
return operations.filter((oper) => oper.type === 14 && oper.element === id && !oper.builtin);
|
|
20809
20856
|
}
|
|
20810
20857
|
//#endregion
|
|
20811
20858
|
//#region packages/compiler-vapor/src/generators/component.ts
|
|
20859
|
+
function genStaticModifierPropKey(name) {
|
|
20860
|
+
const key = getModifierPropName(name);
|
|
20861
|
+
return [isSimpleIdentifier(key) ? key : JSON.stringify(key)];
|
|
20862
|
+
}
|
|
20812
20863
|
function genCreateComponent(operation, context) {
|
|
20813
20864
|
const { helper } = context;
|
|
20814
20865
|
const singleUseAssetComponentNames = context.singleUseAssetComponentNames;
|
|
@@ -20950,7 +21001,7 @@ function genStaticProps(props, context, dynamicProps, directStaticLiteralProps =
|
|
|
20950
21001
|
}
|
|
20951
21002
|
const { key, modelModifiers } = prop;
|
|
20952
21003
|
if (modelModifiers && modelModifiers.length) {
|
|
20953
|
-
const modifiersKey = key.isStatic ?
|
|
21004
|
+
const modifiersKey = key.isStatic ? genStaticModifierPropKey(key.content) : [
|
|
20954
21005
|
"[",
|
|
20955
21006
|
...genExpression(key, context),
|
|
20956
21007
|
" + \"Modifiers\"]"
|
|
@@ -20993,7 +21044,7 @@ function genDynamicProps(props, context, directStaticLiteralProps = false) {
|
|
|
20993
21044
|
]);
|
|
20994
21045
|
const { modelModifiers } = p;
|
|
20995
21046
|
if (modelModifiers && modelModifiers.length) {
|
|
20996
|
-
const modifiersKey = p.key.isStatic ?
|
|
21047
|
+
const modifiersKey = p.key.isStatic ? genStaticModifierPropKey(p.key.content) : [
|
|
20997
21048
|
"[",
|
|
20998
21049
|
...genExpression(p.key, context),
|
|
20999
21050
|
" + \"Modifiers\"]"
|
|
@@ -21118,7 +21169,7 @@ function genDynamicSlot(slot, context, withFunction = false) {
|
|
|
21118
21169
|
}
|
|
21119
21170
|
function genBasicDynamicSlot(slot, context) {
|
|
21120
21171
|
const { name, fn } = slot;
|
|
21121
|
-
return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...genExpression(name, context)], ["fn: ", ...genSlotBlockWithProps(fn, context)]);
|
|
21172
|
+
return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...genExpression(name, context)], ["fn: ", ...genSlotBlockWithProps(fn, context, false)]);
|
|
21122
21173
|
}
|
|
21123
21174
|
function genLoopSlot(slot, context) {
|
|
21124
21175
|
const { name, fn, loop } = slot;
|
|
@@ -21130,7 +21181,7 @@ function genLoopSlot(slot, context) {
|
|
|
21130
21181
|
if (rawValue) idMap[rawValue] = rawValue;
|
|
21131
21182
|
if (rawKey) idMap[rawKey] = rawKey;
|
|
21132
21183
|
if (rawIndex) idMap[rawIndex] = rawIndex;
|
|
21133
|
-
const slotExpr = genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...context.withId(() => genExpression(name, context), idMap)], ["fn: ", ...context.withId(() => genSlotBlockWithProps(fn, context), idMap)]);
|
|
21184
|
+
const slotExpr = genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...context.withId(() => genExpression(name, context), idMap)], ["fn: ", ...context.withId(() => genSlotBlockWithProps(fn, context, false), idMap)]);
|
|
21134
21185
|
return [...genCall(context.helper("createForSlots"), genExpression(source, context), [
|
|
21135
21186
|
...genMulti([
|
|
21136
21187
|
"(",
|
|
@@ -21156,7 +21207,7 @@ function genConditionalSlot(slot, context) {
|
|
|
21156
21207
|
INDENT_END
|
|
21157
21208
|
];
|
|
21158
21209
|
}
|
|
21159
|
-
function genSlotBlockWithProps(oper, context) {
|
|
21210
|
+
function genSlotBlockWithProps(oper, context, emitNonStableFlag = true) {
|
|
21160
21211
|
let propsName;
|
|
21161
21212
|
let exitScope;
|
|
21162
21213
|
let depth;
|
|
@@ -21171,10 +21222,45 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
21171
21222
|
const exitSlotBlock = context.enterSlotBlock();
|
|
21172
21223
|
markSlotRootOperations(oper);
|
|
21173
21224
|
let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
|
|
21225
|
+
if (emitNonStableFlag && !hasStableSlotRoot(oper, context)) blockFn = genCall(context.helper("extend"), blockFn, `{ _: 8 }`);
|
|
21174
21226
|
exitSlotBlock();
|
|
21175
21227
|
exitScope && exitScope();
|
|
21176
21228
|
return blockFn;
|
|
21177
21229
|
}
|
|
21230
|
+
const commentOnlyTemplateRE = /^(?:<!--[\s\S]*?-->)+$/;
|
|
21231
|
+
function hasStableSlotRoot(block, context) {
|
|
21232
|
+
let hasValidRoot = false;
|
|
21233
|
+
for (let i = 0; i < block.returns.length; i++) {
|
|
21234
|
+
const id = block.returns[i];
|
|
21235
|
+
const child = findReturnedDynamic$1(block, id);
|
|
21236
|
+
const operation = child && child.operation;
|
|
21237
|
+
if (!operation) {
|
|
21238
|
+
if (child && isStableTemplateSlotRoot(child, context)) hasValidRoot = true;
|
|
21239
|
+
continue;
|
|
21240
|
+
}
|
|
21241
|
+
switch (operation.type) {
|
|
21242
|
+
case 12:
|
|
21243
|
+
if (!operation.dynamic || operation.dynamic.isStatic) {
|
|
21244
|
+
hasValidRoot = true;
|
|
21245
|
+
continue;
|
|
21246
|
+
}
|
|
21247
|
+
return false;
|
|
21248
|
+
case 17:
|
|
21249
|
+
if (hasStableSlotRoot(operation.block, context)) {
|
|
21250
|
+
hasValidRoot = true;
|
|
21251
|
+
continue;
|
|
21252
|
+
}
|
|
21253
|
+
return false;
|
|
21254
|
+
default: return false;
|
|
21255
|
+
}
|
|
21256
|
+
}
|
|
21257
|
+
return hasValidRoot;
|
|
21258
|
+
}
|
|
21259
|
+
function isStableTemplateSlotRoot(child, context) {
|
|
21260
|
+
if (child.template == null) return false;
|
|
21261
|
+
const content = context.ir.template.entries[child.template].content;
|
|
21262
|
+
return content !== "" && !commentOnlyTemplateRE.test(content.trim());
|
|
21263
|
+
}
|
|
21178
21264
|
//#endregion
|
|
21179
21265
|
//#region packages/compiler-vapor/src/generators/slotOutlet.ts
|
|
21180
21266
|
function genSlotOutlet(oper, context) {
|
|
@@ -21511,7 +21597,7 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
|
21511
21597
|
else if (genEffectsExtraFrag) push(...genEffects([], context, genEffectsExtraFrag));
|
|
21512
21598
|
push(NEWLINE, `return `);
|
|
21513
21599
|
const returnNodes = returns.map((n) => `n${n}`);
|
|
21514
|
-
push(...returnNodes.length > 1 ? genMulti(DELIMITERS_ARRAY, ...returnNodes) : [returnNodes[0] || "
|
|
21600
|
+
push(...returnNodes.length > 1 ? genMulti(DELIMITERS_ARRAY, ...returnNodes) : [returnNodes[0] || "[]"]);
|
|
21515
21601
|
resetBlock();
|
|
21516
21602
|
context.singleUseAssetComponentNames = prevSingleUseAssetComponentNames;
|
|
21517
21603
|
return frag;
|
|
@@ -21850,11 +21936,36 @@ const transformVBind = (dir, node, context) => {
|
|
|
21850
21936
|
};
|
|
21851
21937
|
};
|
|
21852
21938
|
//#endregion
|
|
21939
|
+
//#region packages/compiler-vapor/src/transforms/vHtml.ts
|
|
21940
|
+
function ignoreVHtmlChildren(node, context, clear) {
|
|
21941
|
+
if (!node.children.length) return;
|
|
21942
|
+
const dir = findDir$1(node, "html");
|
|
21943
|
+
if (!dir) return;
|
|
21944
|
+
context.options.onError(createDOMCompilerError(55, dir.loc));
|
|
21945
|
+
if (clear === "node") node.children.length = 0;
|
|
21946
|
+
else context.childrenTemplate.length = 0;
|
|
21947
|
+
}
|
|
21948
|
+
const transformVHtml = (dir, node, context) => {
|
|
21949
|
+
let { exp, loc } = dir;
|
|
21950
|
+
if (!exp) {
|
|
21951
|
+
context.options.onError(createDOMCompilerError(54, loc));
|
|
21952
|
+
exp = EMPTY_EXPRESSION;
|
|
21953
|
+
}
|
|
21954
|
+
ignoreVHtmlChildren(node, context, "template");
|
|
21955
|
+
context.registerEffect([exp], {
|
|
21956
|
+
type: 8,
|
|
21957
|
+
element: context.reference(),
|
|
21958
|
+
value: exp,
|
|
21959
|
+
isComponent: node.tagType === 1
|
|
21960
|
+
});
|
|
21961
|
+
};
|
|
21962
|
+
//#endregion
|
|
21853
21963
|
//#region packages/compiler-vapor/src/transforms/transformElement.ts
|
|
21854
21964
|
const isReservedProp = /* @__PURE__ */ makeMap(",key,ref,ref_for,ref_key,");
|
|
21855
21965
|
const transformElement = (node, context) => {
|
|
21856
21966
|
let effectIndex = context.block.effect.length;
|
|
21857
21967
|
const getEffectIndex = () => effectIndex++;
|
|
21968
|
+
if (node.type === 1 && node.children.length) ignoreVHtmlChildren(node, context, "node");
|
|
21858
21969
|
let parentSlots;
|
|
21859
21970
|
if (node.type === 1 && (node.tagType === 1 || context.options.isCustomElement(node.tag))) {
|
|
21860
21971
|
parentSlots = context.slots;
|
|
@@ -22005,17 +22116,18 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
22005
22116
|
};
|
|
22006
22117
|
for (const prop of propsResult[1]) {
|
|
22007
22118
|
const { key, values } = prop;
|
|
22119
|
+
const canStringifyAttrName = key.isStatic && !UNSAFE_ATTR_NAME_RE.test(key.content);
|
|
22008
22120
|
let foldedValue;
|
|
22009
|
-
if (context.imports.some((imported) => values[0].content.includes(imported.exp.content))) {
|
|
22121
|
+
if (canStringifyAttrName && context.imports.some((imported) => values[0].content.includes(imported.exp.content))) {
|
|
22010
22122
|
if (!prevWasQuoted) template += ` `;
|
|
22011
22123
|
template += `${key.content}="${IMPORT_EXP_START}${values[0].content}${IMPORT_EXP_END}"`;
|
|
22012
22124
|
prevWasQuoted = true;
|
|
22013
|
-
} else if (
|
|
22125
|
+
} else if (canStringifyAttrName && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
|
|
22014
22126
|
const value = values[0].content === "''" ? "" : values[0].content;
|
|
22015
22127
|
appendTemplateProp(key.content, value);
|
|
22016
|
-
} else if (
|
|
22128
|
+
} else if (canStringifyAttrName && !prop.modifier && isBooleanAttr(key.content) && (foldedValue = foldBooleanAttrValue(values)) != null) {
|
|
22017
22129
|
if (foldedValue) appendTemplateProp(key.content);
|
|
22018
|
-
} else if (
|
|
22130
|
+
} else if (canStringifyAttrName && !prop.modifier && hasBoundValue(values) && (foldedValue = key.content === "class" ? foldClassValues(values) : key.content === "style" ? foldStyleValues(values) : void 0) != null) {
|
|
22019
22131
|
if (foldedValue) appendTemplateProp(key.content, foldedValue, true);
|
|
22020
22132
|
} else context.registerEffect(values, {
|
|
22021
22133
|
type: 3,
|
|
@@ -22535,25 +22647,6 @@ const transformVOnce = (node, context) => {
|
|
|
22535
22647
|
if (node.type === 1 && findDir$1(node, "once", true)) context.inVOnce = true;
|
|
22536
22648
|
};
|
|
22537
22649
|
//#endregion
|
|
22538
|
-
//#region packages/compiler-vapor/src/transforms/vHtml.ts
|
|
22539
|
-
const transformVHtml = (dir, node, context) => {
|
|
22540
|
-
let { exp, loc } = dir;
|
|
22541
|
-
if (!exp) {
|
|
22542
|
-
context.options.onError(createDOMCompilerError(54, loc));
|
|
22543
|
-
exp = EMPTY_EXPRESSION;
|
|
22544
|
-
}
|
|
22545
|
-
if (node.children.length) {
|
|
22546
|
-
context.options.onError(createDOMCompilerError(55, loc));
|
|
22547
|
-
context.childrenTemplate.length = 0;
|
|
22548
|
-
}
|
|
22549
|
-
context.registerEffect([exp], {
|
|
22550
|
-
type: 8,
|
|
22551
|
-
element: context.reference(),
|
|
22552
|
-
value: exp,
|
|
22553
|
-
isComponent: node.tagType === 1
|
|
22554
|
-
});
|
|
22555
|
-
};
|
|
22556
|
-
//#endregion
|
|
22557
22650
|
//#region packages/compiler-vapor/src/transforms/transformText.ts
|
|
22558
22651
|
const seen = /* @__PURE__ */ new WeakMap();
|
|
22559
22652
|
function markNonTemplate(node, context) {
|
|
@@ -23246,7 +23339,7 @@ function transformTemplateSlot(node, dir, context) {
|
|
|
23246
23339
|
});
|
|
23247
23340
|
else if (vElse) {
|
|
23248
23341
|
const vIfSlot = slots[slots.length - 1];
|
|
23249
|
-
if (vIfSlot.slotType === 3) {
|
|
23342
|
+
if (vIfSlot && vIfSlot.slotType === 3) {
|
|
23250
23343
|
let ifNode = vIfSlot;
|
|
23251
23344
|
while (ifNode.negative && ifNode.negative.slotType === 3) ifNode = ifNode.negative;
|
|
23252
23345
|
const negative = vElse.exp ? {
|
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.16",
|
|
4
4
|
"description": "@vue/compiler-vapor",
|
|
5
5
|
"main": "dist/compiler-vapor.cjs.js",
|
|
6
6
|
"module": "dist/compiler-vapor.esm-browser.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@babel/parser": "^7.29.7",
|
|
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.16",
|
|
49
|
+
"@vue/shared": "3.6.0-beta.16"
|
|
50
50
|
}
|
|
51
51
|
}
|