@vue/compiler-vapor 3.6.0-beta.13 → 3.6.0-beta.15
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 +90 -131
- package/dist/compiler-vapor.d.ts +35 -75
- package/dist/compiler-vapor.esm-browser.js +91 -132
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-vapor v3.6.0-beta.15
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -193,6 +193,13 @@ function getLiteralExpressionValue(exp, excludeNumber) {
|
|
|
193
193
|
}
|
|
194
194
|
return exp.isStatic ? exp.content : null;
|
|
195
195
|
}
|
|
196
|
+
function isInTransition(context) {
|
|
197
|
+
const parentNode = context.parent && context.parent.node;
|
|
198
|
+
return !!(parentNode && isTransitionNode(parentNode));
|
|
199
|
+
}
|
|
200
|
+
function isTransitionNode(node) {
|
|
201
|
+
return node.type === 1 && isTransitionTag(node.tag);
|
|
202
|
+
}
|
|
196
203
|
function isTransitionTag(tag) {
|
|
197
204
|
tag = tag.toLowerCase();
|
|
198
205
|
return tag === "transition" || tag === "vaportransition";
|
|
@@ -424,6 +431,7 @@ const defaultOptions = {
|
|
|
424
431
|
bindingMetadata: _vue_shared.EMPTY_OBJ,
|
|
425
432
|
inline: false,
|
|
426
433
|
isTS: false,
|
|
434
|
+
eventDelegation: true,
|
|
427
435
|
onError: _vue_compiler_dom.defaultOnError,
|
|
428
436
|
onWarn: _vue_compiler_dom.defaultOnWarn
|
|
429
437
|
};
|
|
@@ -1142,7 +1150,7 @@ function isConstantBinding(value, context) {
|
|
|
1142
1150
|
//#region packages/compiler-vapor/src/generators/for.ts
|
|
1143
1151
|
function genFor(oper, context) {
|
|
1144
1152
|
const { helper } = context;
|
|
1145
|
-
const { source, value, key, index, render, keyProp, once, id, component, onlyChild } = oper;
|
|
1153
|
+
const { source, value, key, index, render, keyProp, once, id, component, onlyChild, slotRoot } = oper;
|
|
1146
1154
|
const rawValue = value && value.content;
|
|
1147
1155
|
const rawKey = key && key.content;
|
|
1148
1156
|
const rawIndex = index && index.content;
|
|
@@ -1201,6 +1209,7 @@ function genFor(oper, context) {
|
|
|
1201
1209
|
if (isFragmentBlock(render)) flags |= 16;
|
|
1202
1210
|
if (!component && isSingleNodeBlock(render)) flags |= 8;
|
|
1203
1211
|
if (once) flags |= 4;
|
|
1212
|
+
if (slotRoot) flags |= 32;
|
|
1204
1213
|
const onResetCalls = [];
|
|
1205
1214
|
for (let i = 0; i < selectorPatterns.length; i++) onResetCalls.push(NEWLINE, `n${id}.onReset(${selectorName(i)}.reset)`);
|
|
1206
1215
|
return [
|
|
@@ -1282,7 +1291,7 @@ function parseValueDestructure(value, context) {
|
|
|
1282
1291
|
if (child.type === "AssignmentPattern" && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
|
|
1283
1292
|
isDynamic = true;
|
|
1284
1293
|
helper = context.helper("getDefaultValue");
|
|
1285
|
-
helperArgs = rawValue.slice(child.right.start - 1, child.right.end - 1)
|
|
1294
|
+
helperArgs = `() => (${rawValue.slice(child.right.start - 1, child.right.end - 1)})`;
|
|
1286
1295
|
}
|
|
1287
1296
|
}
|
|
1288
1297
|
map.set(id.name, {
|
|
@@ -1430,9 +1439,9 @@ function genSetHtml(oper, context) {
|
|
|
1430
1439
|
//#region packages/compiler-vapor/src/generators/if.ts
|
|
1431
1440
|
function genIf(oper, context, isNested = false) {
|
|
1432
1441
|
const { helper } = context;
|
|
1433
|
-
const { condition, positive, negative, once, index, blockShape } = oper;
|
|
1442
|
+
const { condition, positive, negative, once, slotRoot, index, blockShape } = oper;
|
|
1434
1443
|
const [frag, push] = buildCodeFragment();
|
|
1435
|
-
const flags = genIfFlags(blockShape, once, negative ? index : void 0);
|
|
1444
|
+
const flags = genIfFlags(blockShape, once, slotRoot, negative ? index : void 0);
|
|
1436
1445
|
const conditionExpr = [
|
|
1437
1446
|
"() => (",
|
|
1438
1447
|
...genExpression(condition, context),
|
|
@@ -1446,19 +1455,21 @@ function genIf(oper, context, isNested = false) {
|
|
|
1446
1455
|
push(...genCall(helper("createIf"), conditionExpr, positiveArg, negativeArg, flags));
|
|
1447
1456
|
return frag;
|
|
1448
1457
|
}
|
|
1449
|
-
function genIfFlags(blockShape, once, index) {
|
|
1458
|
+
function genIfFlags(blockShape, once, slotRoot, index) {
|
|
1450
1459
|
let flags = blockShape;
|
|
1460
|
+
if (slotRoot) flags |= 128;
|
|
1451
1461
|
if (once) flags |= 16;
|
|
1452
|
-
else if (index !== void 0) flags |= index + 1 <<
|
|
1462
|
+
else if (index !== void 0) flags |= index + 1 << 8;
|
|
1453
1463
|
if (flags === 1) return false;
|
|
1454
|
-
return `${flags} /* ${genIfFlagNames(once, index, blockShape)} */`;
|
|
1464
|
+
return `${flags} /* ${genIfFlagNames(once, slotRoot, index, blockShape)} */`;
|
|
1455
1465
|
}
|
|
1456
|
-
function genIfFlagNames(once, index, blockShape) {
|
|
1466
|
+
function genIfFlagNames(once, slotRoot, index, blockShape) {
|
|
1457
1467
|
const names = ["BLOCK_SHAPE"];
|
|
1458
1468
|
if (blockShape & 32) names.push("TRUE_NO_SCOPE");
|
|
1459
1469
|
if (blockShape & 64) names.push("FALSE_NO_SCOPE");
|
|
1460
1470
|
if (once) names.push("ONCE");
|
|
1461
|
-
|
|
1471
|
+
if (slotRoot) names.push("SLOT_ROOT");
|
|
1472
|
+
if (!once && index !== void 0) names.push("INDEX_SHIFT");
|
|
1462
1473
|
return names.join(", ");
|
|
1463
1474
|
}
|
|
1464
1475
|
//#endregion
|
|
@@ -1804,7 +1815,9 @@ function genCreateComponent(operation, context) {
|
|
|
1804
1815
|
const useAssetComponentHelper = operation.asset && !operation.dynamic && context.block === context.ir.block && !!singleUseAssetComponentNames && singleUseAssetComponentNames.has(operation.tag);
|
|
1805
1816
|
const maybeSelfReference = useAssetComponentHelper && operation.tag.endsWith("__self");
|
|
1806
1817
|
const tag = genTag();
|
|
1807
|
-
const { root, props, slots, once } = operation;
|
|
1818
|
+
const { root, props, slots, once, slotRoot } = operation;
|
|
1819
|
+
const isRuntimeDynamicComponent = !!(operation.dynamic && !operation.dynamic.isStatic);
|
|
1820
|
+
const dynamicComponentFlags = isRuntimeDynamicComponent ? (root ? 1 : 0) | (once ? 2 : 0) | (slotRoot ? 4 : 0) : 0;
|
|
1808
1821
|
const rawSlots = genRawSlots(slots, context);
|
|
1809
1822
|
const [ids, handlers] = processInlineHandlers(props, context);
|
|
1810
1823
|
const rawProps = context.withId(() => genRawProps(props, context, true), ids);
|
|
@@ -1820,7 +1833,7 @@ function genCreateComponent(operation, context) {
|
|
|
1820
1833
|
];
|
|
1821
1834
|
}, []),
|
|
1822
1835
|
`const n${operation.id} = `,
|
|
1823
|
-
...genCall(
|
|
1836
|
+
...genCall(isRuntimeDynamicComponent ? helper("createDynamicComponent") : operation.useCreateElement ? helper("createPlainElement") : useAssetComponentHelper ? helper("createAssetComponent") : operation.asset ? helper("createComponentWithFallback") : helper("createComponent"), tag, rawProps, rawSlots, isRuntimeDynamicComponent ? dynamicComponentFlags ? String(dynamicComponentFlags) : false : root ? "true" : false, isRuntimeDynamicComponent ? false : once && "true", isRuntimeDynamicComponent ? false : maybeSelfReference && "true"),
|
|
1824
1837
|
...genDirectivesForElement(operation.id, context)
|
|
1825
1838
|
];
|
|
1826
1839
|
function genTag() {
|
|
@@ -2097,23 +2110,12 @@ function genDynamicSlot(slot, context, withFunction = false) {
|
|
|
2097
2110
|
break;
|
|
2098
2111
|
}
|
|
2099
2112
|
if (!withFunction) return frag;
|
|
2100
|
-
return
|
|
2101
|
-
`${context.helper("withVaporCtx")}(() => (`,
|
|
2102
|
-
...frag,
|
|
2103
|
-
"))"
|
|
2104
|
-
] : [
|
|
2113
|
+
return [
|
|
2105
2114
|
"() => (",
|
|
2106
2115
|
...frag,
|
|
2107
2116
|
")"
|
|
2108
2117
|
];
|
|
2109
2118
|
}
|
|
2110
|
-
function needsDynamicSlotSourceCtx(slot) {
|
|
2111
|
-
switch (slot.slotType) {
|
|
2112
|
-
case 1: return needsVaporCtx(slot.fn);
|
|
2113
|
-
case 2: return needsVaporCtx(slot.fn);
|
|
2114
|
-
case 3: return needsDynamicSlotSourceCtx(slot.positive) || (slot.negative ? needsDynamicSlotSourceCtx(slot.negative) : false);
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
2119
|
function genBasicDynamicSlot(slot, context) {
|
|
2118
2120
|
const { name, fn } = slot;
|
|
2119
2121
|
return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...genExpression(name, context)], ["fn: ", ...genSlotBlockWithProps(fn, context)]);
|
|
@@ -2158,7 +2160,7 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
2158
2160
|
let propsName;
|
|
2159
2161
|
let exitScope;
|
|
2160
2162
|
let depth;
|
|
2161
|
-
const { props
|
|
2163
|
+
const { props } = oper;
|
|
2162
2164
|
const idToPathMap = props ? parseValueDestructure(props, context) : /* @__PURE__ */ new Map();
|
|
2163
2165
|
if (props) if (props.ast) {
|
|
2164
2166
|
[depth, exitScope] = context.enterScope();
|
|
@@ -2167,64 +2169,12 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
2167
2169
|
const idMap = idToPathMap.size ? buildDestructureIdMap(idToPathMap, propsName || "", context.options.expressionPlugins) : {};
|
|
2168
2170
|
if (propsName) idMap[propsName] = null;
|
|
2169
2171
|
const exitSlotBlock = context.enterSlotBlock();
|
|
2172
|
+
markSlotRootOperations(oper);
|
|
2170
2173
|
let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
|
|
2171
2174
|
exitSlotBlock();
|
|
2172
2175
|
exitScope && exitScope();
|
|
2173
|
-
if (node.type === 1) {
|
|
2174
|
-
if (needsVaporCtx(oper)) blockFn = [
|
|
2175
|
-
`${context.helper("withVaporCtx")}(`,
|
|
2176
|
-
...blockFn,
|
|
2177
|
-
`)`
|
|
2178
|
-
];
|
|
2179
|
-
}
|
|
2180
2176
|
return blockFn;
|
|
2181
2177
|
}
|
|
2182
|
-
/**
|
|
2183
|
-
* Check if a slot block needs withVaporCtx wrapper.
|
|
2184
|
-
* Returns true if the block contains:
|
|
2185
|
-
* - Component creation (needs scopeId inheritance)
|
|
2186
|
-
* - Slot outlet (needs rawSlots from slot owner)
|
|
2187
|
-
*/
|
|
2188
|
-
function needsVaporCtx(block) {
|
|
2189
|
-
return hasComponentOrSlotInBlock(block);
|
|
2190
|
-
}
|
|
2191
|
-
function hasComponentOrSlotInBlock(block) {
|
|
2192
|
-
if (hasComponentOrSlotInOperations(block.operation)) return true;
|
|
2193
|
-
return hasComponentOrSlotInDynamic(block.dynamic);
|
|
2194
|
-
}
|
|
2195
|
-
function hasComponentOrSlotInDynamic(dynamic) {
|
|
2196
|
-
if (dynamic.operation) {
|
|
2197
|
-
const type = dynamic.operation.type;
|
|
2198
|
-
if (type === 12 || type === 13) return true;
|
|
2199
|
-
if (type === 15) {
|
|
2200
|
-
if (hasComponentOrSlotInIf(dynamic.operation)) return true;
|
|
2201
|
-
}
|
|
2202
|
-
if (type === 16) {
|
|
2203
|
-
if (hasComponentOrSlotInBlock(dynamic.operation.render)) return true;
|
|
2204
|
-
}
|
|
2205
|
-
}
|
|
2206
|
-
for (const child of dynamic.children) if (hasComponentOrSlotInDynamic(child)) return true;
|
|
2207
|
-
return false;
|
|
2208
|
-
}
|
|
2209
|
-
function hasComponentOrSlotInOperations(operations) {
|
|
2210
|
-
for (const op of operations) switch (op.type) {
|
|
2211
|
-
case 12:
|
|
2212
|
-
case 13: return true;
|
|
2213
|
-
case 15:
|
|
2214
|
-
if (hasComponentOrSlotInIf(op)) return true;
|
|
2215
|
-
break;
|
|
2216
|
-
case 16:
|
|
2217
|
-
if (hasComponentOrSlotInBlock(op.render)) return true;
|
|
2218
|
-
break;
|
|
2219
|
-
}
|
|
2220
|
-
return false;
|
|
2221
|
-
}
|
|
2222
|
-
function hasComponentOrSlotInIf(node) {
|
|
2223
|
-
if (hasComponentOrSlotInBlock(node.positive)) return true;
|
|
2224
|
-
if (node.negative) if ("positive" in node.negative) return hasComponentOrSlotInIf(node.negative);
|
|
2225
|
-
else return hasComponentOrSlotInBlock(node.negative);
|
|
2226
|
-
return false;
|
|
2227
|
-
}
|
|
2228
2178
|
//#endregion
|
|
2229
2179
|
//#region packages/compiler-vapor/src/generators/slotOutlet.ts
|
|
2230
2180
|
function genSlotOutlet(oper, context) {
|
|
@@ -2232,7 +2182,10 @@ function genSlotOutlet(oper, context) {
|
|
|
2232
2182
|
const { id, name, fallback, flags } = oper;
|
|
2233
2183
|
const [frag, push] = buildCodeFragment();
|
|
2234
2184
|
let fallbackArg;
|
|
2235
|
-
if (fallback)
|
|
2185
|
+
if (fallback) {
|
|
2186
|
+
markSlotRootOperations(fallback);
|
|
2187
|
+
fallbackArg = genBlock(fallback, context);
|
|
2188
|
+
}
|
|
2236
2189
|
const createSlot = helper("createSlot");
|
|
2237
2190
|
const rawPropsArg = genRawProps(oper.props, context, true);
|
|
2238
2191
|
const nameArg = name.isStatic && name.content === "default" && !rawPropsArg && !fallbackArg && !flags ? void 0 : name.isStatic ? genExpression(name, context) : [
|
|
@@ -2566,6 +2519,42 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
|
2566
2519
|
for (const name of context.ir[kind]) push(NEWLINE, `const ${(0, _vue_compiler_dom.toValidAssetId)(name, kind)} = `, ...genCall(context.helper(helper), JSON.stringify(name)));
|
|
2567
2520
|
}
|
|
2568
2521
|
}
|
|
2522
|
+
function markSlotRootOperations(block) {
|
|
2523
|
+
for (let i = 0; i < block.returns.length; i++) {
|
|
2524
|
+
const child = findReturnedDynamic$1(block, block.returns[i]);
|
|
2525
|
+
const operation = child && child.operation;
|
|
2526
|
+
if (!operation) continue;
|
|
2527
|
+
if (operation.type === 15) markSlotRootIf(operation);
|
|
2528
|
+
else if (operation.type === 16) markSlotRootFor(operation);
|
|
2529
|
+
else if (operation.type === 13) markSlotRootSlotOutlet(operation);
|
|
2530
|
+
else if (operation.type === 12) markSlotRootComponent(operation);
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
function markSlotRootIf(operation) {
|
|
2534
|
+
if (!operation.once) operation.slotRoot = true;
|
|
2535
|
+
markSlotRootOperations(operation.positive);
|
|
2536
|
+
const negative = operation.negative;
|
|
2537
|
+
if (!negative) return;
|
|
2538
|
+
if (negative.type === 15) markSlotRootIf(negative);
|
|
2539
|
+
else markSlotRootOperations(negative);
|
|
2540
|
+
}
|
|
2541
|
+
function markSlotRootFor(operation) {
|
|
2542
|
+
if (!operation.once) operation.slotRoot = true;
|
|
2543
|
+
markSlotRootOperations(operation.render);
|
|
2544
|
+
}
|
|
2545
|
+
function markSlotRootSlotOutlet(operation) {
|
|
2546
|
+
operation.flags |= 4;
|
|
2547
|
+
if (operation.fallback) markSlotRootOperations(operation.fallback);
|
|
2548
|
+
}
|
|
2549
|
+
function markSlotRootComponent(operation) {
|
|
2550
|
+
if (!operation.once && operation.dynamic && !operation.dynamic.isStatic) operation.slotRoot = true;
|
|
2551
|
+
}
|
|
2552
|
+
function findReturnedDynamic$1(block, id) {
|
|
2553
|
+
for (let i = 0; i < block.dynamic.children.length; i++) {
|
|
2554
|
+
const child = block.dynamic.children[i];
|
|
2555
|
+
if (child.id === id) return child;
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2569
2558
|
function collectSingleUseAssetComponents(block) {
|
|
2570
2559
|
const usageMap = /* @__PURE__ */ new Map();
|
|
2571
2560
|
const seenOperations = /* @__PURE__ */ new Set();
|
|
@@ -2996,7 +2985,6 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
2996
2985
|
let template = "";
|
|
2997
2986
|
template += `<${tag}`;
|
|
2998
2987
|
if (scopeId) template += ` ${scopeId}`;
|
|
2999
|
-
const dynamicProps = [];
|
|
3000
2988
|
if (propsResult[0]) {
|
|
3001
2989
|
const [, dynamicArgs, expressions] = propsResult;
|
|
3002
2990
|
context.registerEffect(expressions, {
|
|
@@ -3017,54 +3005,24 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
3017
3005
|
};
|
|
3018
3006
|
for (const prop of propsResult[1]) {
|
|
3019
3007
|
const { key, values } = prop;
|
|
3008
|
+
let foldedValue;
|
|
3020
3009
|
if (context.imports.some((imported) => values[0].content.includes(imported.exp.content))) {
|
|
3021
3010
|
if (!prevWasQuoted) template += ` `;
|
|
3022
3011
|
template += `${key.content}="${IMPORT_EXP_START}${values[0].content}${IMPORT_EXP_END}"`;
|
|
3023
3012
|
prevWasQuoted = true;
|
|
3024
|
-
} else if (key.isStatic && !prop.modifier && (0, _vue_shared.isBooleanAttr)(key.content)) if (values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
|
|
3025
|
-
const value = values[0].content === "''" ? "" : values[0].content;
|
|
3026
|
-
appendTemplateProp(key.content, value);
|
|
3027
|
-
} else {
|
|
3028
|
-
const include = foldBooleanAttrValue(values);
|
|
3029
|
-
if (include != null) {
|
|
3030
|
-
if (include) appendTemplateProp(key.content);
|
|
3031
|
-
} else {
|
|
3032
|
-
dynamicProps.push(key.content);
|
|
3033
|
-
context.registerEffect(values, {
|
|
3034
|
-
type: 3,
|
|
3035
|
-
element: context.reference(),
|
|
3036
|
-
prop,
|
|
3037
|
-
tag
|
|
3038
|
-
}, getEffectIndex);
|
|
3039
|
-
}
|
|
3040
|
-
}
|
|
3041
|
-
else if (key.isStatic && !prop.modifier && hasBoundValue(values)) {
|
|
3042
|
-
let foldedValue;
|
|
3043
|
-
if (key.content === "class") foldedValue = foldClassValues(values);
|
|
3044
|
-
else if (key.content === "style") foldedValue = foldStyleValues(values);
|
|
3045
|
-
if (foldedValue != null) {
|
|
3046
|
-
if (foldedValue) appendTemplateProp(key.content, foldedValue, true);
|
|
3047
|
-
} else {
|
|
3048
|
-
dynamicProps.push(key.content);
|
|
3049
|
-
context.registerEffect(values, {
|
|
3050
|
-
type: 3,
|
|
3051
|
-
element: context.reference(),
|
|
3052
|
-
prop,
|
|
3053
|
-
tag
|
|
3054
|
-
}, getEffectIndex);
|
|
3055
|
-
}
|
|
3056
3013
|
} else if (key.isStatic && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
|
|
3057
3014
|
const value = values[0].content === "''" ? "" : values[0].content;
|
|
3058
3015
|
appendTemplateProp(key.content, value);
|
|
3059
|
-
} else {
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3016
|
+
} else if (key.isStatic && !prop.modifier && (0, _vue_shared.isBooleanAttr)(key.content) && (foldedValue = foldBooleanAttrValue(values)) != null) {
|
|
3017
|
+
if (foldedValue) appendTemplateProp(key.content);
|
|
3018
|
+
} else if (key.isStatic && !prop.modifier && hasBoundValue(values) && (foldedValue = key.content === "class" ? foldClassValues(values) : key.content === "style" ? foldStyleValues(values) : void 0) != null) {
|
|
3019
|
+
if (foldedValue) appendTemplateProp(key.content, foldedValue, true);
|
|
3020
|
+
} else context.registerEffect(values, {
|
|
3021
|
+
type: 3,
|
|
3022
|
+
element: context.reference(),
|
|
3023
|
+
prop,
|
|
3024
|
+
tag
|
|
3025
|
+
}, getEffectIndex);
|
|
3068
3026
|
}
|
|
3069
3027
|
}
|
|
3070
3028
|
template += `>` + context.childrenTemplate.join("");
|
|
@@ -3813,12 +3771,10 @@ const transformVOn = (dir, node, context) => {
|
|
|
3813
3771
|
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = (0, _vue_compiler_dom.resolveModifiers)(arg.isStatic ? `on${arg.content}` : arg, modifiers, null, loc);
|
|
3814
3772
|
let keyOverride;
|
|
3815
3773
|
const isStaticClick = arg.isStatic && arg.content.toLowerCase() === "click";
|
|
3816
|
-
if (nonKeyModifiers.includes("middle")) {
|
|
3817
|
-
if (keyOverride) {}
|
|
3818
|
-
if (!isStaticClick && !arg.isStatic) keyOverride = ["click", "mouseup"];
|
|
3819
|
-
}
|
|
3820
3774
|
if (nonKeyModifiers.includes("right")) {
|
|
3821
3775
|
if (!isStaticClick && !arg.isStatic) keyOverride = ["click", "contextmenu"];
|
|
3776
|
+
} else if (nonKeyModifiers.includes("middle")) {
|
|
3777
|
+
if (!isStaticClick && !arg.isStatic) keyOverride = ["click", "mouseup"];
|
|
3822
3778
|
}
|
|
3823
3779
|
arg = normalizeStaticEventArg(arg, nonKeyModifiers);
|
|
3824
3780
|
if (keyModifiers.length && (0, _vue_compiler_dom.isStaticExp)(arg) && !(0, _vue_compiler_dom.isKeyboardEvent)(`on${arg.content.toLowerCase()}`)) keyModifiers.length = 0;
|
|
@@ -3832,7 +3788,7 @@ const transformVOn = (dir, node, context) => {
|
|
|
3832
3788
|
options: eventOptionModifiers
|
|
3833
3789
|
}
|
|
3834
3790
|
};
|
|
3835
|
-
const delegate = arg.isStatic && !eventOptionModifiers.length && !hasStopHandlerForStaticEvent(node, arg.content) && delegatedEvents(arg.content);
|
|
3791
|
+
const delegate = context.options.eventDelegation && arg.isStatic && !eventOptionModifiers.length && !hasStopHandlerForStaticEvent(node, arg.content) && delegatedEvents(arg.content);
|
|
3836
3792
|
const operation = {
|
|
3837
3793
|
type: 6,
|
|
3838
3794
|
element: context.reference(),
|
|
@@ -3853,8 +3809,8 @@ function normalizeStaticEventArg(arg, nonKeyModifiers) {
|
|
|
3853
3809
|
if (!arg.isStatic) return arg;
|
|
3854
3810
|
let normalized = arg;
|
|
3855
3811
|
const isStaticClick = arg.content.toLowerCase() === "click";
|
|
3856
|
-
if (nonKeyModifiers.includes("middle") && isStaticClick) normalized = (0, _vue_shared.extend)({}, normalized, { content: "mouseup" });
|
|
3857
3812
|
if (nonKeyModifiers.includes("right") && isStaticClick) normalized = (0, _vue_shared.extend)({}, normalized, { content: "contextmenu" });
|
|
3813
|
+
else if (nonKeyModifiers.includes("middle") && isStaticClick) normalized = (0, _vue_shared.extend)({}, normalized, { content: "mouseup" });
|
|
3858
3814
|
return normalized;
|
|
3859
3815
|
}
|
|
3860
3816
|
function hasStopHandlerForStaticEvent(node, eventName) {
|
|
@@ -4054,11 +4010,14 @@ function processIf(node, dir, context) {
|
|
|
4054
4010
|
}
|
|
4055
4011
|
while (lastIfNode.negative && lastIfNode.negative.type === 15) lastIfNode = lastIfNode.negative;
|
|
4056
4012
|
if (dir.name === "else-if" && lastIfNode.negative) context.options.onError((0, _vue_compiler_dom.createCompilerError)(30, node.loc));
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4013
|
+
const comments = context.comment;
|
|
4014
|
+
if (comments.length) {
|
|
4015
|
+
if (!isInTransition(context)) {
|
|
4016
|
+
node = wrapTemplate(node, ["else-if", "else"]);
|
|
4017
|
+
context.node = node = (0, _vue_shared.extend)({}, node, { children: [...comments, ...node.children] });
|
|
4018
|
+
}
|
|
4019
|
+
comments.length = 0;
|
|
4060
4020
|
}
|
|
4061
|
-
context.root.comment = [];
|
|
4062
4021
|
const [branch, onExit] = createIfBranch(node, context);
|
|
4063
4022
|
if (dir.name === "else") lastIfNode.negative = branch;
|
|
4064
4023
|
else lastIfNode.negative = {
|
package/dist/compiler-vapor.d.ts
CHANGED
|
@@ -2036,7 +2036,7 @@ interface VaporInteropInterface {
|
|
|
2036
2036
|
setTransitionHooks(component: ComponentInternalInstance, transition: TransitionHooks): void;
|
|
2037
2037
|
vdomMount: (component: ConcreteComponent, parentComponent: any, props?: any, slots?: any, once?: boolean) => any;
|
|
2038
2038
|
vdomUnmount: UnmountComponentFn;
|
|
2039
|
-
vdomSlot: (slots: any, name: string | (() => string), props: Record<string, any>, parentComponent: any, fallback?: any, once?: boolean) => any;
|
|
2039
|
+
vdomSlot: (slots: any, name: string | (() => string), props: Record<string, any>, parentComponent: any, fallback?: any, once?: boolean, slotRoot?: boolean) => any;
|
|
2040
2040
|
vdomMountVNode: (vnode: VNode, parentComponent: any) => any;
|
|
2041
2041
|
}
|
|
2042
2042
|
/**
|
|
@@ -3072,7 +3072,7 @@ type AsyncComponentContext<T, C = ConcreteComponent> = {
|
|
|
3072
3072
|
setPendingRequest: (request: Promise<C> | null) => void;
|
|
3073
3073
|
};
|
|
3074
3074
|
declare function createAsyncComponentContext<T, C = ConcreteComponent>(source: AsyncComponentLoader<T> | AsyncComponentOptions<T>): AsyncComponentContext<T, C>;
|
|
3075
|
-
declare const useAsyncComponentState: (delay: number | undefined, timeout: number | undefined, onError: (err: Error) => void) => {
|
|
3075
|
+
declare const useAsyncComponentState: (delay: number | undefined, timeout: number | undefined, onError: (err: Error) => void, instance?: GenericComponentInstance | null) => {
|
|
3076
3076
|
loaded: Ref<boolean>;
|
|
3077
3077
|
error: Ref<Error | undefined>;
|
|
3078
3078
|
delayed: Ref<boolean>;
|
|
@@ -25301,13 +25301,18 @@ interface VaporKeepAliveContext {
|
|
|
25301
25301
|
//#endregion
|
|
25302
25302
|
//#region packages/runtime-vapor/src/fragment.d.ts
|
|
25303
25303
|
declare class VaporFragment<T extends Block$1 = Block$1> implements TransitionOptions {
|
|
25304
|
+
/**
|
|
25305
|
+
* @internal marker for duck typing to avoid direct instanceof check
|
|
25306
|
+
* which prevents tree-shaking of VaporFragment
|
|
25307
|
+
*/
|
|
25308
|
+
readonly __vf = true;
|
|
25304
25309
|
$key?: any;
|
|
25305
25310
|
$transition?: VaporTransitionHooks | undefined;
|
|
25306
25311
|
nodes: T;
|
|
25307
25312
|
vnode?: VNode | null;
|
|
25308
25313
|
anchor?: Node;
|
|
25309
|
-
parentComponent?: GenericComponentInstance | null;
|
|
25310
25314
|
validityPending?: boolean;
|
|
25315
|
+
isBlockValid?: () => boolean;
|
|
25311
25316
|
insert?: (parent: ParentNode, anchor: Node | null, transitionHooks?: TransitionHooks) => void;
|
|
25312
25317
|
remove?: (parent?: ParentNode, transitionHooks?: TransitionHooks) => void;
|
|
25313
25318
|
hydrate?(...args: any[]): void;
|
|
@@ -25325,10 +25330,15 @@ declare class VaporFragment<T extends Block$1 = Block$1> implements TransitionOp
|
|
|
25325
25330
|
}
|
|
25326
25331
|
declare class ForFragment extends VaporFragment<Block$1[]> {
|
|
25327
25332
|
resetListeners?: (() => void)[];
|
|
25328
|
-
constructor(nodes: Block$1[]);
|
|
25333
|
+
constructor(nodes: Block$1[], trackSlotBoundary: boolean);
|
|
25329
25334
|
onReset(fn: () => void): void;
|
|
25330
25335
|
}
|
|
25331
25336
|
declare class DynamicFragment extends VaporFragment {
|
|
25337
|
+
/**
|
|
25338
|
+
* @internal marker for duck typing to avoid direct instanceof check
|
|
25339
|
+
* which prevents tree-shaking of DynamicFragment
|
|
25340
|
+
*/
|
|
25341
|
+
readonly __df = true;
|
|
25332
25342
|
anchor: Node;
|
|
25333
25343
|
scope: EffectScope | undefined;
|
|
25334
25344
|
current?: BlockFn;
|
|
@@ -25339,12 +25349,13 @@ declare class DynamicFragment extends VaporFragment {
|
|
|
25339
25349
|
};
|
|
25340
25350
|
anchorLabel?: string;
|
|
25341
25351
|
keyed?: boolean;
|
|
25352
|
+
isSlot?: boolean;
|
|
25342
25353
|
inTransition?: boolean;
|
|
25343
25354
|
hasFallthroughAttrs?: true;
|
|
25344
25355
|
constructor(anchorLabel?: string, keyed?: boolean, locate?: boolean, trackSlotBoundary?: boolean);
|
|
25345
|
-
update(render?: BlockFn, key?: any, noScope?: boolean): void;
|
|
25346
|
-
renderBranch(render: BlockFn | undefined, transition: VaporTransitionHooks | undefined, parent: ParentNode | null, key: any, noScope?: boolean): void;
|
|
25347
|
-
hydrate(isEmpty?: boolean
|
|
25356
|
+
update(render?: BlockFn, key?: any, noScope?: boolean, shouldInsert?: boolean): void;
|
|
25357
|
+
renderBranch(render: BlockFn | undefined, transition: VaporTransitionHooks | undefined, parent: ParentNode | null, key: any, noScope?: boolean, notifyUpdated?: boolean): void;
|
|
25358
|
+
hydrate(isEmpty?: boolean): void;
|
|
25348
25359
|
}
|
|
25349
25360
|
interface SlotBoundaryContext {
|
|
25350
25361
|
parent: SlotBoundaryContext | null;
|
|
@@ -25353,7 +25364,7 @@ interface SlotBoundaryContext {
|
|
|
25353
25364
|
markDirty: () => void;
|
|
25354
25365
|
redirected?: SlotBoundaryContext;
|
|
25355
25366
|
}
|
|
25356
|
-
declare function isFragment(val:
|
|
25367
|
+
declare function isFragment(val: unknown): val is VaporFragment;
|
|
25357
25368
|
//#endregion
|
|
25358
25369
|
//#region packages/runtime-vapor/src/block.d.ts
|
|
25359
25370
|
interface VaporTransitionHooks extends TransitionHooks {
|
|
@@ -25402,6 +25413,9 @@ declare function renderEffect(fn: () => void, noLifecycle?: boolean): void;
|
|
|
25402
25413
|
type RawSlots = Record<string, VaporSlot> & {
|
|
25403
25414
|
$?: DynamicSlotSource[];
|
|
25404
25415
|
};
|
|
25416
|
+
type LooseRawSlots = VaporSlot | (Record<string, VaporSlot | DynamicSlotSource[]> & {
|
|
25417
|
+
$?: DynamicSlotSource[];
|
|
25418
|
+
});
|
|
25405
25419
|
type StaticSlots = Record<string, VaporSlot>;
|
|
25406
25420
|
type VaporSlot = BlockFn;
|
|
25407
25421
|
type DynamicSlot = {
|
|
@@ -25410,14 +25424,6 @@ type DynamicSlot = {
|
|
|
25410
25424
|
};
|
|
25411
25425
|
type DynamicSlotFn = () => DynamicSlot | DynamicSlot[];
|
|
25412
25426
|
type DynamicSlotSource = StaticSlots | DynamicSlotFn;
|
|
25413
|
-
/**
|
|
25414
|
-
* Wrap a slot function to track the slot owner.
|
|
25415
|
-
*
|
|
25416
|
-
* This ensures:
|
|
25417
|
-
* 1. createSlot gets rawSlots from the correct instance (slot owner)
|
|
25418
|
-
* 2. elements inherit the slot owner's scopeId
|
|
25419
|
-
*/
|
|
25420
|
-
declare function withVaporCtx(fn: Function): BlockFn;
|
|
25421
25427
|
declare function createSlot(name?: string | (() => string), rawProps?: LooseRawProps | null, fallback?: VaporSlot, flags?: number): Block$1;
|
|
25422
25428
|
//#endregion
|
|
25423
25429
|
//#region packages/runtime-vapor/src/apiDefineComponent.d.ts
|
|
@@ -25463,50 +25469,6 @@ declare function defineVaporComponent<TypeProps, RuntimePropsOptions extends Com
|
|
|
25463
25469
|
__typeEl?: TypeBlock;
|
|
25464
25470
|
} & ThisType<void>): DefineVaporComponent<RuntimePropsOptions, RuntimePropsKeys, InferredProps, ResolvedEmits, RuntimeEmitsKeys, Slots, Exposed extends Block$1 ? Record<string, any> : Exposed, TypeBlock, TypeRefs, unknown extends TypeProps ? true : false>;
|
|
25465
25471
|
//#endregion
|
|
25466
|
-
//#region packages/runtime-vapor/src/components/Teleport.d.ts
|
|
25467
|
-
declare class TeleportFragment extends VaporFragment {
|
|
25468
|
-
/**
|
|
25469
|
-
* @internal marker for duck typing to avoid direct instanceof check
|
|
25470
|
-
* which prevents tree-shaking of TeleportFragment
|
|
25471
|
-
*/
|
|
25472
|
-
readonly __isTeleportFragment = true;
|
|
25473
|
-
anchor?: Node;
|
|
25474
|
-
private rawProps?;
|
|
25475
|
-
private resolvedProps?;
|
|
25476
|
-
private rawSlots?;
|
|
25477
|
-
isDisabled?: boolean;
|
|
25478
|
-
private isMounted;
|
|
25479
|
-
private childrenInitialized;
|
|
25480
|
-
private readonly ownerInstance;
|
|
25481
|
-
private readonly childrenScope;
|
|
25482
|
-
target?: ParentNode | null;
|
|
25483
|
-
targetAnchor?: Node | null;
|
|
25484
|
-
targetStart?: Node | null;
|
|
25485
|
-
placeholder?: Node;
|
|
25486
|
-
mountContainer?: ParentNode | null;
|
|
25487
|
-
mountAnchor?: Node | null;
|
|
25488
|
-
private mountToTargetJob?;
|
|
25489
|
-
constructor(props: LooseRawProps, slots?: RawSlots | null);
|
|
25490
|
-
get parent(): ParentNode | null;
|
|
25491
|
-
private initChildren;
|
|
25492
|
-
private ensureChildrenInitialized;
|
|
25493
|
-
private registerUpdateCssVars;
|
|
25494
|
-
private bindChildren;
|
|
25495
|
-
private handleChildrenUpdate;
|
|
25496
|
-
private mount;
|
|
25497
|
-
private mountToTarget;
|
|
25498
|
-
private clearMainViewChildren;
|
|
25499
|
-
private handlePropsUpdate;
|
|
25500
|
-
insert: (container: ParentNode, anchor: Node | null) => void;
|
|
25501
|
-
dispose: () => void;
|
|
25502
|
-
remove: (_parent?: ParentNode) => void;
|
|
25503
|
-
private hydrateTargetAnchors;
|
|
25504
|
-
private hydrateDisabledTeleport;
|
|
25505
|
-
private mountChildren;
|
|
25506
|
-
hydrate: () => void;
|
|
25507
|
-
}
|
|
25508
|
-
declare const VaporTeleport: DefineVaporSetupFnComponent<TeleportProps>;
|
|
25509
|
-
//#endregion
|
|
25510
25472
|
//#region packages/runtime-vapor/src/component.d.ts
|
|
25511
25473
|
type VaporComponent = FunctionalVaporComponent<any> | VaporComponentOptions | DefineVaporComponent;
|
|
25512
25474
|
type FunctionalVaporComponent<Props = {}, Emits extends EmitsOptions = {}, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>> = ((props: Props & EmitsToProps<Emits>, ctx: {
|
|
@@ -25532,10 +25494,6 @@ interface VaporComponentOptions<Props = {}, Emits extends EmitsOptions = {}, Run
|
|
|
25532
25494
|
name?: string;
|
|
25533
25495
|
vapor?: boolean;
|
|
25534
25496
|
components?: Record<string, VaporComponent>;
|
|
25535
|
-
/**
|
|
25536
|
-
* @internal custom element interception hook
|
|
25537
|
-
*/
|
|
25538
|
-
ce?: (instance: VaporComponentInstance) => void;
|
|
25539
25497
|
}
|
|
25540
25498
|
interface SharedInternalOptions {
|
|
25541
25499
|
/**
|
|
@@ -25556,10 +25514,7 @@ interface SharedInternalOptions {
|
|
|
25556
25514
|
type LooseRawProps = Record<string, unknown> & {
|
|
25557
25515
|
$?: DynamicPropsSource[];
|
|
25558
25516
|
};
|
|
25559
|
-
|
|
25560
|
-
$?: DynamicSlotSource[];
|
|
25561
|
-
});
|
|
25562
|
-
declare function createComponent(component: VaporComponent, rawProps?: LooseRawProps | null, rawSlots?: LooseRawSlots | null, isSingleRoot?: boolean, once?: boolean, appContext?: GenericAppContext, managedMount?: boolean): VaporComponentInstance;
|
|
25517
|
+
declare function createComponent(component: VaporComponent, rawProps?: LooseRawProps | null, rawSlots?: LooseRawSlots | null, isSingleRoot?: boolean, once?: boolean, appContext?: GenericAppContext, managedMount?: boolean, ce?: (instance: VaporComponentInstance) => void): VaporComponentInstance;
|
|
25563
25518
|
declare class VaporComponentInstance<Props extends Record<string, any> = {}, Emits extends EmitsOptions = {}, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block$1 = Block$1, TypeRefs extends Record<string, any> = Record<string, any>> implements GenericComponentInstance {
|
|
25564
25519
|
vapor: true;
|
|
25565
25520
|
uid: number;
|
|
@@ -25592,7 +25547,6 @@ declare class VaporComponentInstance<Props extends Record<string, any> = {}, Emi
|
|
|
25592
25547
|
asyncResolved: boolean;
|
|
25593
25548
|
restoreAsyncContext?: () => void | (() => void);
|
|
25594
25549
|
deferredHydrationBoundary?: () => void;
|
|
25595
|
-
renderEffects?: RenderEffect[];
|
|
25596
25550
|
hasFallthrough: boolean;
|
|
25597
25551
|
shapeFlag?: number;
|
|
25598
25552
|
$key?: any;
|
|
@@ -25620,10 +25574,10 @@ declare class VaporComponentInstance<Props extends Record<string, any> = {}, Emi
|
|
|
25620
25574
|
devtoolsRawSetupState?: any;
|
|
25621
25575
|
hmrRerender?: () => void;
|
|
25622
25576
|
hmrReload?: (newComp: VaporComponent) => void;
|
|
25623
|
-
parentTeleport?: TeleportFragment | null;
|
|
25624
25577
|
propsOptions?: NormalizedPropsOptions;
|
|
25625
25578
|
emitsOptions?: ObjectEmitsOptions | null;
|
|
25626
25579
|
isSingleRoot?: boolean;
|
|
25580
|
+
renderEffects?: RenderEffect[];
|
|
25627
25581
|
/**
|
|
25628
25582
|
* dev only flag to track whether $attrs was used during render.
|
|
25629
25583
|
* If $attrs was used during render then the warning for failed attrs
|
|
@@ -25634,7 +25588,7 @@ declare class VaporComponentInstance<Props extends Record<string, any> = {}, Emi
|
|
|
25634
25588
|
* @deprecated only used for JSX to detect props types.
|
|
25635
25589
|
*/
|
|
25636
25590
|
$props: Props;
|
|
25637
|
-
constructor(comp: VaporComponent, rawProps?: RawProps | null, rawSlots?: LooseRawSlots | null, appContext?: GenericAppContext, once?: boolean);
|
|
25591
|
+
constructor(comp: VaporComponent, rawProps?: RawProps | null, rawSlots?: LooseRawSlots | null, appContext?: GenericAppContext, once?: boolean, ce?: (instance: VaporComponentInstance) => void);
|
|
25638
25592
|
/**
|
|
25639
25593
|
* Expose `getKeysFromRawProps` on the instance so it can be used in code
|
|
25640
25594
|
* paths where it's needed, e.g. `useModel`
|
|
@@ -25671,6 +25625,9 @@ type VaporDirective = (node: Element | VaporComponentInstance, value?: () => any
|
|
|
25671
25625
|
type VaporDirectiveArguments = Array<[VaporDirective | undefined] | [VaporDirective | undefined, () => any] | [VaporDirective | undefined, (() => any) | undefined, argument: string] | [VaporDirective | undefined, value: (() => any) | undefined, argument: string | undefined, modifiers: DirectiveModifiers]>;
|
|
25672
25626
|
declare function withVaporDirectives(node: Element | VaporComponentInstance, dirs: VaporDirectiveArguments): void;
|
|
25673
25627
|
//#endregion
|
|
25628
|
+
//#region packages/runtime-vapor/src/components/Teleport.d.ts
|
|
25629
|
+
declare const VaporTeleport: DefineVaporSetupFnComponent<TeleportProps>;
|
|
25630
|
+
//#endregion
|
|
25674
25631
|
//#region packages/runtime-vapor/src/components/KeepAlive.d.ts
|
|
25675
25632
|
declare const VaporKeepAlive: DefineVaporComponent<{}, string, KeepAliveProps>;
|
|
25676
25633
|
//#endregion
|
|
@@ -25851,7 +25808,7 @@ interface ForSelector {
|
|
|
25851
25808
|
declare function createSelector(source: () => any): ForSelector;
|
|
25852
25809
|
declare function createForSlots(rawSource: Source, getSlot: (item: any, key: any, index?: number) => DynamicSlot): DynamicSlot[];
|
|
25853
25810
|
declare function getRestElement(val: any, keys: string[]): any;
|
|
25854
|
-
declare function getDefaultValue(val: any,
|
|
25811
|
+
declare function getDefaultValue(val: any, getDefaultVal: () => any): any;
|
|
25855
25812
|
//#endregion
|
|
25856
25813
|
//#region packages/runtime-vapor/src/helpers/useCssVars.d.ts
|
|
25857
25814
|
declare function useVaporCssVars(getter: () => Record<string, string>): void;
|
|
@@ -25862,7 +25819,7 @@ declare function setBlockKey(block: (Block$1 & {
|
|
|
25862
25819
|
}) | null | undefined, key: any): void;
|
|
25863
25820
|
//#endregion
|
|
25864
25821
|
//#region packages/runtime-vapor/src/apiCreateDynamicComponent.d.ts
|
|
25865
|
-
declare function createDynamicComponent(getter: () => any, rawProps?: RawProps | null, rawSlots?: LooseRawSlots | null,
|
|
25822
|
+
declare function createDynamicComponent(getter: () => any, rawProps?: RawProps | null, rawSlots?: LooseRawSlots | null, flags?: number): VaporFragment;
|
|
25866
25823
|
//#endregion
|
|
25867
25824
|
//#region packages/runtime-vapor/src/apiSetupHelpers.d.ts
|
|
25868
25825
|
declare function withAsyncContext(getAwaitable: () => any): [any, () => void];
|
|
@@ -25884,7 +25841,7 @@ declare const VaporTransition: FunctionalVaporComponent<TransitionProps>;
|
|
|
25884
25841
|
//#region packages/runtime-vapor/src/components/TransitionGroup.d.ts
|
|
25885
25842
|
declare const VaporTransitionGroup: DefineVaporComponent<{}, string, TransitionGroupProps>;
|
|
25886
25843
|
declare namespace index_d_exports {
|
|
25887
|
-
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,
|
|
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 };
|
|
25888
25845
|
}
|
|
25889
25846
|
//#endregion
|
|
25890
25847
|
//#region temp/packages/compiler-vapor/src/ir/component.d.ts
|
|
@@ -26011,6 +25968,7 @@ export interface IfIRNode extends BaseIRNode, EffectBoundary {
|
|
|
26011
25968
|
positive: BlockIRNode;
|
|
26012
25969
|
negative?: BlockIRNode | IfIRNode;
|
|
26013
25970
|
once?: boolean;
|
|
25971
|
+
slotRoot?: boolean;
|
|
26014
25972
|
index?: number;
|
|
26015
25973
|
parent?: number;
|
|
26016
25974
|
anchor?: number;
|
|
@@ -26029,6 +25987,7 @@ export interface ForIRNode extends BaseIRNode, IRFor, EffectBoundary {
|
|
|
26029
25987
|
keyProp?: SimpleExpressionNode;
|
|
26030
25988
|
render: BlockIRNode;
|
|
26031
25989
|
once: boolean;
|
|
25990
|
+
slotRoot?: boolean;
|
|
26032
25991
|
component: boolean;
|
|
26033
25992
|
onlyChild: boolean;
|
|
26034
25993
|
parent?: number;
|
|
@@ -26133,6 +26092,7 @@ export interface CreateComponentIRNode extends BaseIRNode, EffectBoundary {
|
|
|
26133
26092
|
asset: boolean;
|
|
26134
26093
|
root: boolean;
|
|
26135
26094
|
once: boolean;
|
|
26095
|
+
slotRoot?: boolean;
|
|
26136
26096
|
dynamic?: SimpleExpressionNode;
|
|
26137
26097
|
useCreateElement: boolean;
|
|
26138
26098
|
parent?: number;
|
|
@@ -26215,7 +26175,7 @@ interface ImportItem {
|
|
|
26215
26175
|
//#region packages/compiler-core/src/transforms/transformElement.d.ts
|
|
26216
26176
|
type PropsExpression = ObjectExpression | CallExpression | ExpressionNode;
|
|
26217
26177
|
//#endregion
|
|
26218
|
-
//#region node_modules/.pnpm/@babel+types@7.29.
|
|
26178
|
+
//#region node_modules/.pnpm/@babel+types@7.29.7/node_modules/@babel/types/lib/index-legacy.d.ts
|
|
26219
26179
|
// NOTE: This file is autogenerated. Do not modify.
|
|
26220
26180
|
// See packages/babel-types/scripts/generators/typescript-legacy.ts for script used.
|
|
26221
26181
|
interface BaseComment {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-vapor v3.6.0-beta.15
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -16248,7 +16248,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
16248
16248
|
}
|
|
16249
16249
|
},
|
|
16250
16250
|
oncdata(start, end) {
|
|
16251
|
-
if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
|
|
16251
|
+
if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
|
|
16252
16252
|
else emitError(1, start - 9);
|
|
16253
16253
|
},
|
|
16254
16254
|
onprocessinginstruction(start) {
|
|
@@ -19134,6 +19134,13 @@ function getLiteralExpressionValue(exp, excludeNumber) {
|
|
|
19134
19134
|
}
|
|
19135
19135
|
return exp.isStatic ? exp.content : null;
|
|
19136
19136
|
}
|
|
19137
|
+
function isInTransition(context) {
|
|
19138
|
+
const parentNode = context.parent && context.parent.node;
|
|
19139
|
+
return !!(parentNode && isTransitionNode(parentNode));
|
|
19140
|
+
}
|
|
19141
|
+
function isTransitionNode(node) {
|
|
19142
|
+
return node.type === 1 && isTransitionTag(node.tag);
|
|
19143
|
+
}
|
|
19137
19144
|
function isTransitionTag(tag) {
|
|
19138
19145
|
tag = tag.toLowerCase();
|
|
19139
19146
|
return tag === "transition" || tag === "vaportransition";
|
|
@@ -19365,6 +19372,7 @@ const defaultOptions = {
|
|
|
19365
19372
|
bindingMetadata: EMPTY_OBJ,
|
|
19366
19373
|
inline: false,
|
|
19367
19374
|
isTS: false,
|
|
19375
|
+
eventDelegation: true,
|
|
19368
19376
|
onError: defaultOnError,
|
|
19369
19377
|
onWarn: defaultOnWarn
|
|
19370
19378
|
};
|
|
@@ -20142,7 +20150,7 @@ function isConstantBinding(value, context) {
|
|
|
20142
20150
|
//#region packages/compiler-vapor/src/generators/for.ts
|
|
20143
20151
|
function genFor(oper, context) {
|
|
20144
20152
|
const { helper } = context;
|
|
20145
|
-
const { source, value, key, index, render, keyProp, once, id, component, onlyChild } = oper;
|
|
20153
|
+
const { source, value, key, index, render, keyProp, once, id, component, onlyChild, slotRoot } = oper;
|
|
20146
20154
|
const rawValue = value && value.content;
|
|
20147
20155
|
const rawKey = key && key.content;
|
|
20148
20156
|
const rawIndex = index && index.content;
|
|
@@ -20201,6 +20209,7 @@ function genFor(oper, context) {
|
|
|
20201
20209
|
if (isFragmentBlock(render)) flags |= 16;
|
|
20202
20210
|
if (!component && isSingleNodeBlock(render)) flags |= 8;
|
|
20203
20211
|
if (once) flags |= 4;
|
|
20212
|
+
if (slotRoot) flags |= 32;
|
|
20204
20213
|
const onResetCalls = [];
|
|
20205
20214
|
for (let i = 0; i < selectorPatterns.length; i++) onResetCalls.push(NEWLINE, `n${id}.onReset(${selectorName(i)}.reset)`);
|
|
20206
20215
|
return [
|
|
@@ -20282,7 +20291,7 @@ function parseValueDestructure(value, context) {
|
|
|
20282
20291
|
if (child.type === "AssignmentPattern" && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
|
|
20283
20292
|
isDynamic = true;
|
|
20284
20293
|
helper = context.helper("getDefaultValue");
|
|
20285
|
-
helperArgs = rawValue.slice(child.right.start - 1, child.right.end - 1)
|
|
20294
|
+
helperArgs = `() => (${rawValue.slice(child.right.start - 1, child.right.end - 1)})`;
|
|
20286
20295
|
}
|
|
20287
20296
|
}
|
|
20288
20297
|
map.set(id.name, {
|
|
@@ -20430,9 +20439,9 @@ function genSetHtml(oper, context) {
|
|
|
20430
20439
|
//#region packages/compiler-vapor/src/generators/if.ts
|
|
20431
20440
|
function genIf(oper, context, isNested = false) {
|
|
20432
20441
|
const { helper } = context;
|
|
20433
|
-
const { condition, positive, negative, once, index, blockShape } = oper;
|
|
20442
|
+
const { condition, positive, negative, once, slotRoot, index, blockShape } = oper;
|
|
20434
20443
|
const [frag, push] = buildCodeFragment();
|
|
20435
|
-
const flags = genIfFlags(blockShape, once, negative ? index : void 0);
|
|
20444
|
+
const flags = genIfFlags(blockShape, once, slotRoot, negative ? index : void 0);
|
|
20436
20445
|
const conditionExpr = [
|
|
20437
20446
|
"() => (",
|
|
20438
20447
|
...genExpression(condition, context),
|
|
@@ -20446,19 +20455,21 @@ function genIf(oper, context, isNested = false) {
|
|
|
20446
20455
|
push(...genCall(helper("createIf"), conditionExpr, positiveArg, negativeArg, flags));
|
|
20447
20456
|
return frag;
|
|
20448
20457
|
}
|
|
20449
|
-
function genIfFlags(blockShape, once, index) {
|
|
20458
|
+
function genIfFlags(blockShape, once, slotRoot, index) {
|
|
20450
20459
|
let flags = blockShape;
|
|
20460
|
+
if (slotRoot) flags |= 128;
|
|
20451
20461
|
if (once) flags |= 16;
|
|
20452
|
-
else if (index !== void 0) flags |= index + 1 <<
|
|
20462
|
+
else if (index !== void 0) flags |= index + 1 << 8;
|
|
20453
20463
|
if (flags === 1) return false;
|
|
20454
|
-
return `${flags} /* ${genIfFlagNames(once, index, blockShape)} */`;
|
|
20464
|
+
return `${flags} /* ${genIfFlagNames(once, slotRoot, index, blockShape)} */`;
|
|
20455
20465
|
}
|
|
20456
|
-
function genIfFlagNames(once, index, blockShape) {
|
|
20466
|
+
function genIfFlagNames(once, slotRoot, index, blockShape) {
|
|
20457
20467
|
const names = ["BLOCK_SHAPE"];
|
|
20458
20468
|
if (blockShape & 32) names.push("TRUE_NO_SCOPE");
|
|
20459
20469
|
if (blockShape & 64) names.push("FALSE_NO_SCOPE");
|
|
20460
20470
|
if (once) names.push("ONCE");
|
|
20461
|
-
|
|
20471
|
+
if (slotRoot) names.push("SLOT_ROOT");
|
|
20472
|
+
if (!once && index !== void 0) names.push("INDEX_SHIFT");
|
|
20462
20473
|
return names.join(", ");
|
|
20463
20474
|
}
|
|
20464
20475
|
//#endregion
|
|
@@ -20804,7 +20815,9 @@ function genCreateComponent(operation, context) {
|
|
|
20804
20815
|
const useAssetComponentHelper = operation.asset && !operation.dynamic && context.block === context.ir.block && !!singleUseAssetComponentNames && singleUseAssetComponentNames.has(operation.tag);
|
|
20805
20816
|
const maybeSelfReference = useAssetComponentHelper && operation.tag.endsWith("__self");
|
|
20806
20817
|
const tag = genTag();
|
|
20807
|
-
const { root, props, slots, once } = operation;
|
|
20818
|
+
const { root, props, slots, once, slotRoot } = operation;
|
|
20819
|
+
const isRuntimeDynamicComponent = !!(operation.dynamic && !operation.dynamic.isStatic);
|
|
20820
|
+
const dynamicComponentFlags = isRuntimeDynamicComponent ? (root ? 1 : 0) | (once ? 2 : 0) | (slotRoot ? 4 : 0) : 0;
|
|
20808
20821
|
const rawSlots = genRawSlots(slots, context);
|
|
20809
20822
|
const [ids, handlers] = processInlineHandlers(props, context);
|
|
20810
20823
|
const rawProps = context.withId(() => genRawProps(props, context, true), ids);
|
|
@@ -20820,7 +20833,7 @@ function genCreateComponent(operation, context) {
|
|
|
20820
20833
|
];
|
|
20821
20834
|
}, []),
|
|
20822
20835
|
`const n${operation.id} = `,
|
|
20823
|
-
...genCall(
|
|
20836
|
+
...genCall(isRuntimeDynamicComponent ? helper("createDynamicComponent") : operation.useCreateElement ? helper("createPlainElement") : useAssetComponentHelper ? helper("createAssetComponent") : operation.asset ? helper("createComponentWithFallback") : helper("createComponent"), tag, rawProps, rawSlots, isRuntimeDynamicComponent ? dynamicComponentFlags ? String(dynamicComponentFlags) : false : root ? "true" : false, isRuntimeDynamicComponent ? false : once && "true", isRuntimeDynamicComponent ? false : maybeSelfReference && "true"),
|
|
20824
20837
|
...genDirectivesForElement(operation.id, context)
|
|
20825
20838
|
];
|
|
20826
20839
|
function genTag() {
|
|
@@ -21097,23 +21110,12 @@ function genDynamicSlot(slot, context, withFunction = false) {
|
|
|
21097
21110
|
break;
|
|
21098
21111
|
}
|
|
21099
21112
|
if (!withFunction) return frag;
|
|
21100
|
-
return
|
|
21101
|
-
`${context.helper("withVaporCtx")}(() => (`,
|
|
21102
|
-
...frag,
|
|
21103
|
-
"))"
|
|
21104
|
-
] : [
|
|
21113
|
+
return [
|
|
21105
21114
|
"() => (",
|
|
21106
21115
|
...frag,
|
|
21107
21116
|
")"
|
|
21108
21117
|
];
|
|
21109
21118
|
}
|
|
21110
|
-
function needsDynamicSlotSourceCtx(slot) {
|
|
21111
|
-
switch (slot.slotType) {
|
|
21112
|
-
case 1: return needsVaporCtx(slot.fn);
|
|
21113
|
-
case 2: return needsVaporCtx(slot.fn);
|
|
21114
|
-
case 3: return needsDynamicSlotSourceCtx(slot.positive) || (slot.negative ? needsDynamicSlotSourceCtx(slot.negative) : false);
|
|
21115
|
-
}
|
|
21116
|
-
}
|
|
21117
21119
|
function genBasicDynamicSlot(slot, context) {
|
|
21118
21120
|
const { name, fn } = slot;
|
|
21119
21121
|
return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...genExpression(name, context)], ["fn: ", ...genSlotBlockWithProps(fn, context)]);
|
|
@@ -21158,7 +21160,7 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
21158
21160
|
let propsName;
|
|
21159
21161
|
let exitScope;
|
|
21160
21162
|
let depth;
|
|
21161
|
-
const { props
|
|
21163
|
+
const { props } = oper;
|
|
21162
21164
|
const idToPathMap = props ? parseValueDestructure(props, context) : /* @__PURE__ */ new Map();
|
|
21163
21165
|
if (props) if (props.ast) {
|
|
21164
21166
|
[depth, exitScope] = context.enterScope();
|
|
@@ -21167,64 +21169,12 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
21167
21169
|
const idMap = idToPathMap.size ? buildDestructureIdMap(idToPathMap, propsName || "", context.options.expressionPlugins) : {};
|
|
21168
21170
|
if (propsName) idMap[propsName] = null;
|
|
21169
21171
|
const exitSlotBlock = context.enterSlotBlock();
|
|
21172
|
+
markSlotRootOperations(oper);
|
|
21170
21173
|
let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
|
|
21171
21174
|
exitSlotBlock();
|
|
21172
21175
|
exitScope && exitScope();
|
|
21173
|
-
if (node.type === 1) {
|
|
21174
|
-
if (needsVaporCtx(oper)) blockFn = [
|
|
21175
|
-
`${context.helper("withVaporCtx")}(`,
|
|
21176
|
-
...blockFn,
|
|
21177
|
-
`)`
|
|
21178
|
-
];
|
|
21179
|
-
}
|
|
21180
21176
|
return blockFn;
|
|
21181
21177
|
}
|
|
21182
|
-
/**
|
|
21183
|
-
* Check if a slot block needs withVaporCtx wrapper.
|
|
21184
|
-
* Returns true if the block contains:
|
|
21185
|
-
* - Component creation (needs scopeId inheritance)
|
|
21186
|
-
* - Slot outlet (needs rawSlots from slot owner)
|
|
21187
|
-
*/
|
|
21188
|
-
function needsVaporCtx(block) {
|
|
21189
|
-
return hasComponentOrSlotInBlock(block);
|
|
21190
|
-
}
|
|
21191
|
-
function hasComponentOrSlotInBlock(block) {
|
|
21192
|
-
if (hasComponentOrSlotInOperations(block.operation)) return true;
|
|
21193
|
-
return hasComponentOrSlotInDynamic(block.dynamic);
|
|
21194
|
-
}
|
|
21195
|
-
function hasComponentOrSlotInDynamic(dynamic) {
|
|
21196
|
-
if (dynamic.operation) {
|
|
21197
|
-
const type = dynamic.operation.type;
|
|
21198
|
-
if (type === 12 || type === 13) return true;
|
|
21199
|
-
if (type === 15) {
|
|
21200
|
-
if (hasComponentOrSlotInIf(dynamic.operation)) return true;
|
|
21201
|
-
}
|
|
21202
|
-
if (type === 16) {
|
|
21203
|
-
if (hasComponentOrSlotInBlock(dynamic.operation.render)) return true;
|
|
21204
|
-
}
|
|
21205
|
-
}
|
|
21206
|
-
for (const child of dynamic.children) if (hasComponentOrSlotInDynamic(child)) return true;
|
|
21207
|
-
return false;
|
|
21208
|
-
}
|
|
21209
|
-
function hasComponentOrSlotInOperations(operations) {
|
|
21210
|
-
for (const op of operations) switch (op.type) {
|
|
21211
|
-
case 12:
|
|
21212
|
-
case 13: return true;
|
|
21213
|
-
case 15:
|
|
21214
|
-
if (hasComponentOrSlotInIf(op)) return true;
|
|
21215
|
-
break;
|
|
21216
|
-
case 16:
|
|
21217
|
-
if (hasComponentOrSlotInBlock(op.render)) return true;
|
|
21218
|
-
break;
|
|
21219
|
-
}
|
|
21220
|
-
return false;
|
|
21221
|
-
}
|
|
21222
|
-
function hasComponentOrSlotInIf(node) {
|
|
21223
|
-
if (hasComponentOrSlotInBlock(node.positive)) return true;
|
|
21224
|
-
if (node.negative) if ("positive" in node.negative) return hasComponentOrSlotInIf(node.negative);
|
|
21225
|
-
else return hasComponentOrSlotInBlock(node.negative);
|
|
21226
|
-
return false;
|
|
21227
|
-
}
|
|
21228
21178
|
//#endregion
|
|
21229
21179
|
//#region packages/compiler-vapor/src/generators/slotOutlet.ts
|
|
21230
21180
|
function genSlotOutlet(oper, context) {
|
|
@@ -21232,7 +21182,10 @@ function genSlotOutlet(oper, context) {
|
|
|
21232
21182
|
const { id, name, fallback, flags } = oper;
|
|
21233
21183
|
const [frag, push] = buildCodeFragment();
|
|
21234
21184
|
let fallbackArg;
|
|
21235
|
-
if (fallback)
|
|
21185
|
+
if (fallback) {
|
|
21186
|
+
markSlotRootOperations(fallback);
|
|
21187
|
+
fallbackArg = genBlock(fallback, context);
|
|
21188
|
+
}
|
|
21236
21189
|
const createSlot = helper("createSlot");
|
|
21237
21190
|
const rawPropsArg = genRawProps(oper.props, context, true);
|
|
21238
21191
|
const nameArg = name.isStatic && name.content === "default" && !rawPropsArg && !fallbackArg && !flags ? void 0 : name.isStatic ? genExpression(name, context) : [
|
|
@@ -21566,6 +21519,42 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
|
21566
21519
|
for (const name of context.ir[kind]) push(NEWLINE, `const ${toValidAssetId(name, kind)} = `, ...genCall(context.helper(helper), JSON.stringify(name)));
|
|
21567
21520
|
}
|
|
21568
21521
|
}
|
|
21522
|
+
function markSlotRootOperations(block) {
|
|
21523
|
+
for (let i = 0; i < block.returns.length; i++) {
|
|
21524
|
+
const child = findReturnedDynamic$1(block, block.returns[i]);
|
|
21525
|
+
const operation = child && child.operation;
|
|
21526
|
+
if (!operation) continue;
|
|
21527
|
+
if (operation.type === 15) markSlotRootIf(operation);
|
|
21528
|
+
else if (operation.type === 16) markSlotRootFor(operation);
|
|
21529
|
+
else if (operation.type === 13) markSlotRootSlotOutlet(operation);
|
|
21530
|
+
else if (operation.type === 12) markSlotRootComponent(operation);
|
|
21531
|
+
}
|
|
21532
|
+
}
|
|
21533
|
+
function markSlotRootIf(operation) {
|
|
21534
|
+
if (!operation.once) operation.slotRoot = true;
|
|
21535
|
+
markSlotRootOperations(operation.positive);
|
|
21536
|
+
const negative = operation.negative;
|
|
21537
|
+
if (!negative) return;
|
|
21538
|
+
if (negative.type === 15) markSlotRootIf(negative);
|
|
21539
|
+
else markSlotRootOperations(negative);
|
|
21540
|
+
}
|
|
21541
|
+
function markSlotRootFor(operation) {
|
|
21542
|
+
if (!operation.once) operation.slotRoot = true;
|
|
21543
|
+
markSlotRootOperations(operation.render);
|
|
21544
|
+
}
|
|
21545
|
+
function markSlotRootSlotOutlet(operation) {
|
|
21546
|
+
operation.flags |= 4;
|
|
21547
|
+
if (operation.fallback) markSlotRootOperations(operation.fallback);
|
|
21548
|
+
}
|
|
21549
|
+
function markSlotRootComponent(operation) {
|
|
21550
|
+
if (!operation.once && operation.dynamic && !operation.dynamic.isStatic) operation.slotRoot = true;
|
|
21551
|
+
}
|
|
21552
|
+
function findReturnedDynamic$1(block, id) {
|
|
21553
|
+
for (let i = 0; i < block.dynamic.children.length; i++) {
|
|
21554
|
+
const child = block.dynamic.children[i];
|
|
21555
|
+
if (child.id === id) return child;
|
|
21556
|
+
}
|
|
21557
|
+
}
|
|
21569
21558
|
function collectSingleUseAssetComponents(block) {
|
|
21570
21559
|
const usageMap = /* @__PURE__ */ new Map();
|
|
21571
21560
|
const seenOperations = /* @__PURE__ */ new Set();
|
|
@@ -21996,7 +21985,6 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
21996
21985
|
let template = "";
|
|
21997
21986
|
template += `<${tag}`;
|
|
21998
21987
|
if (scopeId) template += ` ${scopeId}`;
|
|
21999
|
-
const dynamicProps = [];
|
|
22000
21988
|
if (propsResult[0]) {
|
|
22001
21989
|
const [, dynamicArgs, expressions] = propsResult;
|
|
22002
21990
|
context.registerEffect(expressions, {
|
|
@@ -22017,54 +22005,24 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
22017
22005
|
};
|
|
22018
22006
|
for (const prop of propsResult[1]) {
|
|
22019
22007
|
const { key, values } = prop;
|
|
22008
|
+
let foldedValue;
|
|
22020
22009
|
if (context.imports.some((imported) => values[0].content.includes(imported.exp.content))) {
|
|
22021
22010
|
if (!prevWasQuoted) template += ` `;
|
|
22022
22011
|
template += `${key.content}="${IMPORT_EXP_START}${values[0].content}${IMPORT_EXP_END}"`;
|
|
22023
22012
|
prevWasQuoted = true;
|
|
22024
|
-
} else if (key.isStatic && !prop.modifier && isBooleanAttr(key.content)) if (values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
|
|
22025
|
-
const value = values[0].content === "''" ? "" : values[0].content;
|
|
22026
|
-
appendTemplateProp(key.content, value);
|
|
22027
|
-
} else {
|
|
22028
|
-
const include = foldBooleanAttrValue(values);
|
|
22029
|
-
if (include != null) {
|
|
22030
|
-
if (include) appendTemplateProp(key.content);
|
|
22031
|
-
} else {
|
|
22032
|
-
dynamicProps.push(key.content);
|
|
22033
|
-
context.registerEffect(values, {
|
|
22034
|
-
type: 3,
|
|
22035
|
-
element: context.reference(),
|
|
22036
|
-
prop,
|
|
22037
|
-
tag
|
|
22038
|
-
}, getEffectIndex);
|
|
22039
|
-
}
|
|
22040
|
-
}
|
|
22041
|
-
else if (key.isStatic && !prop.modifier && hasBoundValue(values)) {
|
|
22042
|
-
let foldedValue;
|
|
22043
|
-
if (key.content === "class") foldedValue = foldClassValues(values);
|
|
22044
|
-
else if (key.content === "style") foldedValue = foldStyleValues(values);
|
|
22045
|
-
if (foldedValue != null) {
|
|
22046
|
-
if (foldedValue) appendTemplateProp(key.content, foldedValue, true);
|
|
22047
|
-
} else {
|
|
22048
|
-
dynamicProps.push(key.content);
|
|
22049
|
-
context.registerEffect(values, {
|
|
22050
|
-
type: 3,
|
|
22051
|
-
element: context.reference(),
|
|
22052
|
-
prop,
|
|
22053
|
-
tag
|
|
22054
|
-
}, getEffectIndex);
|
|
22055
|
-
}
|
|
22056
22013
|
} else if (key.isStatic && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
|
|
22057
22014
|
const value = values[0].content === "''" ? "" : values[0].content;
|
|
22058
22015
|
appendTemplateProp(key.content, value);
|
|
22059
|
-
} else {
|
|
22060
|
-
|
|
22061
|
-
|
|
22062
|
-
|
|
22063
|
-
|
|
22064
|
-
|
|
22065
|
-
|
|
22066
|
-
|
|
22067
|
-
|
|
22016
|
+
} else if (key.isStatic && !prop.modifier && isBooleanAttr(key.content) && (foldedValue = foldBooleanAttrValue(values)) != null) {
|
|
22017
|
+
if (foldedValue) appendTemplateProp(key.content);
|
|
22018
|
+
} else if (key.isStatic && !prop.modifier && hasBoundValue(values) && (foldedValue = key.content === "class" ? foldClassValues(values) : key.content === "style" ? foldStyleValues(values) : void 0) != null) {
|
|
22019
|
+
if (foldedValue) appendTemplateProp(key.content, foldedValue, true);
|
|
22020
|
+
} else context.registerEffect(values, {
|
|
22021
|
+
type: 3,
|
|
22022
|
+
element: context.reference(),
|
|
22023
|
+
prop,
|
|
22024
|
+
tag
|
|
22025
|
+
}, getEffectIndex);
|
|
22068
22026
|
}
|
|
22069
22027
|
}
|
|
22070
22028
|
template += `>` + context.childrenTemplate.join("");
|
|
@@ -22793,12 +22751,10 @@ const transformVOn = (dir, node, context) => {
|
|
|
22793
22751
|
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(arg.isStatic ? `on${arg.content}` : arg, modifiers, null, loc);
|
|
22794
22752
|
let keyOverride;
|
|
22795
22753
|
const isStaticClick = arg.isStatic && arg.content.toLowerCase() === "click";
|
|
22796
|
-
if (nonKeyModifiers.includes("middle")) {
|
|
22797
|
-
if (keyOverride) {}
|
|
22798
|
-
if (!isStaticClick && !arg.isStatic) keyOverride = ["click", "mouseup"];
|
|
22799
|
-
}
|
|
22800
22754
|
if (nonKeyModifiers.includes("right")) {
|
|
22801
22755
|
if (!isStaticClick && !arg.isStatic) keyOverride = ["click", "contextmenu"];
|
|
22756
|
+
} else if (nonKeyModifiers.includes("middle")) {
|
|
22757
|
+
if (!isStaticClick && !arg.isStatic) keyOverride = ["click", "mouseup"];
|
|
22802
22758
|
}
|
|
22803
22759
|
arg = normalizeStaticEventArg(arg, nonKeyModifiers);
|
|
22804
22760
|
if (keyModifiers.length && isStaticExp(arg) && !isKeyboardEvent(`on${arg.content.toLowerCase()}`)) keyModifiers.length = 0;
|
|
@@ -22812,7 +22768,7 @@ const transformVOn = (dir, node, context) => {
|
|
|
22812
22768
|
options: eventOptionModifiers
|
|
22813
22769
|
}
|
|
22814
22770
|
};
|
|
22815
|
-
const delegate = arg.isStatic && !eventOptionModifiers.length && !hasStopHandlerForStaticEvent(node, arg.content) && delegatedEvents(arg.content);
|
|
22771
|
+
const delegate = context.options.eventDelegation && arg.isStatic && !eventOptionModifiers.length && !hasStopHandlerForStaticEvent(node, arg.content) && delegatedEvents(arg.content);
|
|
22816
22772
|
const operation = {
|
|
22817
22773
|
type: 6,
|
|
22818
22774
|
element: context.reference(),
|
|
@@ -22833,8 +22789,8 @@ function normalizeStaticEventArg(arg, nonKeyModifiers) {
|
|
|
22833
22789
|
if (!arg.isStatic) return arg;
|
|
22834
22790
|
let normalized = arg;
|
|
22835
22791
|
const isStaticClick = arg.content.toLowerCase() === "click";
|
|
22836
|
-
if (nonKeyModifiers.includes("middle") && isStaticClick) normalized = extend({}, normalized, { content: "mouseup" });
|
|
22837
22792
|
if (nonKeyModifiers.includes("right") && isStaticClick) normalized = extend({}, normalized, { content: "contextmenu" });
|
|
22793
|
+
else if (nonKeyModifiers.includes("middle") && isStaticClick) normalized = extend({}, normalized, { content: "mouseup" });
|
|
22838
22794
|
return normalized;
|
|
22839
22795
|
}
|
|
22840
22796
|
function hasStopHandlerForStaticEvent(node, eventName) {
|
|
@@ -23034,11 +22990,14 @@ function processIf(node, dir, context) {
|
|
|
23034
22990
|
}
|
|
23035
22991
|
while (lastIfNode.negative && lastIfNode.negative.type === 15) lastIfNode = lastIfNode.negative;
|
|
23036
22992
|
if (dir.name === "else-if" && lastIfNode.negative) context.options.onError(createCompilerError(30, node.loc));
|
|
23037
|
-
|
|
23038
|
-
|
|
23039
|
-
|
|
22993
|
+
const comments = context.comment;
|
|
22994
|
+
if (comments.length) {
|
|
22995
|
+
if (!isInTransition(context)) {
|
|
22996
|
+
node = wrapTemplate(node, ["else-if", "else"]);
|
|
22997
|
+
context.node = node = extend({}, node, { children: [...comments, ...node.children] });
|
|
22998
|
+
}
|
|
22999
|
+
comments.length = 0;
|
|
23040
23000
|
}
|
|
23041
|
-
context.root.comment = [];
|
|
23042
23001
|
const [branch, onExit] = createIfBranch(node, context);
|
|
23043
23002
|
if (dir.name === "else") lastIfNode.negative = branch;
|
|
23044
23003
|
else lastIfNode.negative = {
|
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.15",
|
|
4
4
|
"description": "@vue/compiler-vapor",
|
|
5
5
|
"main": "dist/compiler-vapor.cjs.js",
|
|
6
6
|
"module": "dist/compiler-vapor.esm-browser.js",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-vapor#readme",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@babel/parser": "^7.29.
|
|
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/shared": "3.6.0-beta.15",
|
|
49
|
+
"@vue/compiler-dom": "3.6.0-beta.15"
|
|
50
50
|
}
|
|
51
51
|
}
|