@vue/compiler-vapor 3.6.0-beta.13 → 3.6.0-beta.14
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 +60 -79
- package/dist/compiler-vapor.d.ts +22 -71
- package/dist/compiler-vapor.esm-browser.js +60 -79
- 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.14
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1142,7 +1142,7 @@ function isConstantBinding(value, context) {
|
|
|
1142
1142
|
//#region packages/compiler-vapor/src/generators/for.ts
|
|
1143
1143
|
function genFor(oper, context) {
|
|
1144
1144
|
const { helper } = context;
|
|
1145
|
-
const { source, value, key, index, render, keyProp, once, id, component, onlyChild } = oper;
|
|
1145
|
+
const { source, value, key, index, render, keyProp, once, id, component, onlyChild, slotRoot } = oper;
|
|
1146
1146
|
const rawValue = value && value.content;
|
|
1147
1147
|
const rawKey = key && key.content;
|
|
1148
1148
|
const rawIndex = index && index.content;
|
|
@@ -1201,6 +1201,7 @@ function genFor(oper, context) {
|
|
|
1201
1201
|
if (isFragmentBlock(render)) flags |= 16;
|
|
1202
1202
|
if (!component && isSingleNodeBlock(render)) flags |= 8;
|
|
1203
1203
|
if (once) flags |= 4;
|
|
1204
|
+
if (slotRoot) flags |= 32;
|
|
1204
1205
|
const onResetCalls = [];
|
|
1205
1206
|
for (let i = 0; i < selectorPatterns.length; i++) onResetCalls.push(NEWLINE, `n${id}.onReset(${selectorName(i)}.reset)`);
|
|
1206
1207
|
return [
|
|
@@ -1282,7 +1283,7 @@ function parseValueDestructure(value, context) {
|
|
|
1282
1283
|
if (child.type === "AssignmentPattern" && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
|
|
1283
1284
|
isDynamic = true;
|
|
1284
1285
|
helper = context.helper("getDefaultValue");
|
|
1285
|
-
helperArgs = rawValue.slice(child.right.start - 1, child.right.end - 1)
|
|
1286
|
+
helperArgs = `() => (${rawValue.slice(child.right.start - 1, child.right.end - 1)})`;
|
|
1286
1287
|
}
|
|
1287
1288
|
}
|
|
1288
1289
|
map.set(id.name, {
|
|
@@ -1430,9 +1431,9 @@ function genSetHtml(oper, context) {
|
|
|
1430
1431
|
//#region packages/compiler-vapor/src/generators/if.ts
|
|
1431
1432
|
function genIf(oper, context, isNested = false) {
|
|
1432
1433
|
const { helper } = context;
|
|
1433
|
-
const { condition, positive, negative, once, index, blockShape } = oper;
|
|
1434
|
+
const { condition, positive, negative, once, slotRoot, index, blockShape } = oper;
|
|
1434
1435
|
const [frag, push] = buildCodeFragment();
|
|
1435
|
-
const flags = genIfFlags(blockShape, once, negative ? index : void 0);
|
|
1436
|
+
const flags = genIfFlags(blockShape, once, slotRoot, negative ? index : void 0);
|
|
1436
1437
|
const conditionExpr = [
|
|
1437
1438
|
"() => (",
|
|
1438
1439
|
...genExpression(condition, context),
|
|
@@ -1446,19 +1447,21 @@ function genIf(oper, context, isNested = false) {
|
|
|
1446
1447
|
push(...genCall(helper("createIf"), conditionExpr, positiveArg, negativeArg, flags));
|
|
1447
1448
|
return frag;
|
|
1448
1449
|
}
|
|
1449
|
-
function genIfFlags(blockShape, once, index) {
|
|
1450
|
+
function genIfFlags(blockShape, once, slotRoot, index) {
|
|
1450
1451
|
let flags = blockShape;
|
|
1452
|
+
if (slotRoot) flags |= 128;
|
|
1451
1453
|
if (once) flags |= 16;
|
|
1452
|
-
else if (index !== void 0) flags |= index + 1 <<
|
|
1454
|
+
else if (index !== void 0) flags |= index + 1 << 8;
|
|
1453
1455
|
if (flags === 1) return false;
|
|
1454
|
-
return `${flags} /* ${genIfFlagNames(once, index, blockShape)} */`;
|
|
1456
|
+
return `${flags} /* ${genIfFlagNames(once, slotRoot, index, blockShape)} */`;
|
|
1455
1457
|
}
|
|
1456
|
-
function genIfFlagNames(once, index, blockShape) {
|
|
1458
|
+
function genIfFlagNames(once, slotRoot, index, blockShape) {
|
|
1457
1459
|
const names = ["BLOCK_SHAPE"];
|
|
1458
1460
|
if (blockShape & 32) names.push("TRUE_NO_SCOPE");
|
|
1459
1461
|
if (blockShape & 64) names.push("FALSE_NO_SCOPE");
|
|
1460
1462
|
if (once) names.push("ONCE");
|
|
1461
|
-
|
|
1463
|
+
if (slotRoot) names.push("SLOT_ROOT");
|
|
1464
|
+
if (!once && index !== void 0) names.push("INDEX_SHIFT");
|
|
1462
1465
|
return names.join(", ");
|
|
1463
1466
|
}
|
|
1464
1467
|
//#endregion
|
|
@@ -1804,7 +1807,9 @@ function genCreateComponent(operation, context) {
|
|
|
1804
1807
|
const useAssetComponentHelper = operation.asset && !operation.dynamic && context.block === context.ir.block && !!singleUseAssetComponentNames && singleUseAssetComponentNames.has(operation.tag);
|
|
1805
1808
|
const maybeSelfReference = useAssetComponentHelper && operation.tag.endsWith("__self");
|
|
1806
1809
|
const tag = genTag();
|
|
1807
|
-
const { root, props, slots, once } = operation;
|
|
1810
|
+
const { root, props, slots, once, slotRoot } = operation;
|
|
1811
|
+
const isRuntimeDynamicComponent = !!(operation.dynamic && !operation.dynamic.isStatic);
|
|
1812
|
+
const dynamicComponentFlags = isRuntimeDynamicComponent ? (root ? 1 : 0) | (once ? 2 : 0) | (slotRoot ? 4 : 0) : 0;
|
|
1808
1813
|
const rawSlots = genRawSlots(slots, context);
|
|
1809
1814
|
const [ids, handlers] = processInlineHandlers(props, context);
|
|
1810
1815
|
const rawProps = context.withId(() => genRawProps(props, context, true), ids);
|
|
@@ -1820,7 +1825,7 @@ function genCreateComponent(operation, context) {
|
|
|
1820
1825
|
];
|
|
1821
1826
|
}, []),
|
|
1822
1827
|
`const n${operation.id} = `,
|
|
1823
|
-
...genCall(
|
|
1828
|
+
...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
1829
|
...genDirectivesForElement(operation.id, context)
|
|
1825
1830
|
];
|
|
1826
1831
|
function genTag() {
|
|
@@ -2097,23 +2102,12 @@ function genDynamicSlot(slot, context, withFunction = false) {
|
|
|
2097
2102
|
break;
|
|
2098
2103
|
}
|
|
2099
2104
|
if (!withFunction) return frag;
|
|
2100
|
-
return
|
|
2101
|
-
`${context.helper("withVaporCtx")}(() => (`,
|
|
2102
|
-
...frag,
|
|
2103
|
-
"))"
|
|
2104
|
-
] : [
|
|
2105
|
+
return [
|
|
2105
2106
|
"() => (",
|
|
2106
2107
|
...frag,
|
|
2107
2108
|
")"
|
|
2108
2109
|
];
|
|
2109
2110
|
}
|
|
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
2111
|
function genBasicDynamicSlot(slot, context) {
|
|
2118
2112
|
const { name, fn } = slot;
|
|
2119
2113
|
return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...genExpression(name, context)], ["fn: ", ...genSlotBlockWithProps(fn, context)]);
|
|
@@ -2158,7 +2152,7 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
2158
2152
|
let propsName;
|
|
2159
2153
|
let exitScope;
|
|
2160
2154
|
let depth;
|
|
2161
|
-
const { props
|
|
2155
|
+
const { props } = oper;
|
|
2162
2156
|
const idToPathMap = props ? parseValueDestructure(props, context) : /* @__PURE__ */ new Map();
|
|
2163
2157
|
if (props) if (props.ast) {
|
|
2164
2158
|
[depth, exitScope] = context.enterScope();
|
|
@@ -2167,64 +2161,12 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
2167
2161
|
const idMap = idToPathMap.size ? buildDestructureIdMap(idToPathMap, propsName || "", context.options.expressionPlugins) : {};
|
|
2168
2162
|
if (propsName) idMap[propsName] = null;
|
|
2169
2163
|
const exitSlotBlock = context.enterSlotBlock();
|
|
2164
|
+
markSlotRootOperations(oper);
|
|
2170
2165
|
let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
|
|
2171
2166
|
exitSlotBlock();
|
|
2172
2167
|
exitScope && exitScope();
|
|
2173
|
-
if (node.type === 1) {
|
|
2174
|
-
if (needsVaporCtx(oper)) blockFn = [
|
|
2175
|
-
`${context.helper("withVaporCtx")}(`,
|
|
2176
|
-
...blockFn,
|
|
2177
|
-
`)`
|
|
2178
|
-
];
|
|
2179
|
-
}
|
|
2180
2168
|
return blockFn;
|
|
2181
2169
|
}
|
|
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
2170
|
//#endregion
|
|
2229
2171
|
//#region packages/compiler-vapor/src/generators/slotOutlet.ts
|
|
2230
2172
|
function genSlotOutlet(oper, context) {
|
|
@@ -2232,7 +2174,10 @@ function genSlotOutlet(oper, context) {
|
|
|
2232
2174
|
const { id, name, fallback, flags } = oper;
|
|
2233
2175
|
const [frag, push] = buildCodeFragment();
|
|
2234
2176
|
let fallbackArg;
|
|
2235
|
-
if (fallback)
|
|
2177
|
+
if (fallback) {
|
|
2178
|
+
markSlotRootOperations(fallback);
|
|
2179
|
+
fallbackArg = genBlock(fallback, context);
|
|
2180
|
+
}
|
|
2236
2181
|
const createSlot = helper("createSlot");
|
|
2237
2182
|
const rawPropsArg = genRawProps(oper.props, context, true);
|
|
2238
2183
|
const nameArg = name.isStatic && name.content === "default" && !rawPropsArg && !fallbackArg && !flags ? void 0 : name.isStatic ? genExpression(name, context) : [
|
|
@@ -2566,6 +2511,42 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
|
2566
2511
|
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
2512
|
}
|
|
2568
2513
|
}
|
|
2514
|
+
function markSlotRootOperations(block) {
|
|
2515
|
+
for (let i = 0; i < block.returns.length; i++) {
|
|
2516
|
+
const child = findReturnedDynamic$1(block, block.returns[i]);
|
|
2517
|
+
const operation = child && child.operation;
|
|
2518
|
+
if (!operation) continue;
|
|
2519
|
+
if (operation.type === 15) markSlotRootIf(operation);
|
|
2520
|
+
else if (operation.type === 16) markSlotRootFor(operation);
|
|
2521
|
+
else if (operation.type === 13) markSlotRootSlotOutlet(operation);
|
|
2522
|
+
else if (operation.type === 12) markSlotRootComponent(operation);
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
function markSlotRootIf(operation) {
|
|
2526
|
+
if (!operation.once) operation.slotRoot = true;
|
|
2527
|
+
markSlotRootOperations(operation.positive);
|
|
2528
|
+
const negative = operation.negative;
|
|
2529
|
+
if (!negative) return;
|
|
2530
|
+
if (negative.type === 15) markSlotRootIf(negative);
|
|
2531
|
+
else markSlotRootOperations(negative);
|
|
2532
|
+
}
|
|
2533
|
+
function markSlotRootFor(operation) {
|
|
2534
|
+
if (!operation.once) operation.slotRoot = true;
|
|
2535
|
+
markSlotRootOperations(operation.render);
|
|
2536
|
+
}
|
|
2537
|
+
function markSlotRootSlotOutlet(operation) {
|
|
2538
|
+
operation.flags |= 4;
|
|
2539
|
+
if (operation.fallback) markSlotRootOperations(operation.fallback);
|
|
2540
|
+
}
|
|
2541
|
+
function markSlotRootComponent(operation) {
|
|
2542
|
+
if (!operation.once && operation.dynamic && !operation.dynamic.isStatic) operation.slotRoot = true;
|
|
2543
|
+
}
|
|
2544
|
+
function findReturnedDynamic$1(block, id) {
|
|
2545
|
+
for (let i = 0; i < block.dynamic.children.length; i++) {
|
|
2546
|
+
const child = block.dynamic.children[i];
|
|
2547
|
+
if (child.id === id) return child;
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2569
2550
|
function collectSingleUseAssetComponents(block) {
|
|
2570
2551
|
const usageMap = /* @__PURE__ */ new Map();
|
|
2571
2552
|
const seenOperations = /* @__PURE__ */ new Set();
|
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
|
/**
|
|
@@ -25308,6 +25308,7 @@ declare class VaporFragment<T extends Block$1 = Block$1> implements TransitionOp
|
|
|
25308
25308
|
anchor?: Node;
|
|
25309
25309
|
parentComponent?: GenericComponentInstance | null;
|
|
25310
25310
|
validityPending?: boolean;
|
|
25311
|
+
isBlockValid?: () => boolean;
|
|
25311
25312
|
insert?: (parent: ParentNode, anchor: Node | null, transitionHooks?: TransitionHooks) => void;
|
|
25312
25313
|
remove?: (parent?: ParentNode, transitionHooks?: TransitionHooks) => void;
|
|
25313
25314
|
hydrate?(...args: any[]): void;
|
|
@@ -25325,7 +25326,7 @@ declare class VaporFragment<T extends Block$1 = Block$1> implements TransitionOp
|
|
|
25325
25326
|
}
|
|
25326
25327
|
declare class ForFragment extends VaporFragment<Block$1[]> {
|
|
25327
25328
|
resetListeners?: (() => void)[];
|
|
25328
|
-
constructor(nodes: Block$1[]);
|
|
25329
|
+
constructor(nodes: Block$1[], trackSlotBoundary: boolean);
|
|
25329
25330
|
onReset(fn: () => void): void;
|
|
25330
25331
|
}
|
|
25331
25332
|
declare class DynamicFragment extends VaporFragment {
|
|
@@ -25339,12 +25340,13 @@ declare class DynamicFragment extends VaporFragment {
|
|
|
25339
25340
|
};
|
|
25340
25341
|
anchorLabel?: string;
|
|
25341
25342
|
keyed?: boolean;
|
|
25343
|
+
isSlot?: boolean;
|
|
25342
25344
|
inTransition?: boolean;
|
|
25343
25345
|
hasFallthroughAttrs?: true;
|
|
25344
25346
|
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
|
|
25347
|
+
update(render?: BlockFn, key?: any, noScope?: boolean, shouldInsert?: boolean): void;
|
|
25348
|
+
renderBranch(render: BlockFn | undefined, transition: VaporTransitionHooks | undefined, parent: ParentNode | null, key: any, noScope?: boolean, notifyUpdated?: boolean): void;
|
|
25349
|
+
hydrate(isEmpty?: boolean): void;
|
|
25348
25350
|
}
|
|
25349
25351
|
interface SlotBoundaryContext {
|
|
25350
25352
|
parent: SlotBoundaryContext | null;
|
|
@@ -25402,6 +25404,9 @@ declare function renderEffect(fn: () => void, noLifecycle?: boolean): void;
|
|
|
25402
25404
|
type RawSlots = Record<string, VaporSlot> & {
|
|
25403
25405
|
$?: DynamicSlotSource[];
|
|
25404
25406
|
};
|
|
25407
|
+
type LooseRawSlots = VaporSlot | (Record<string, VaporSlot | DynamicSlotSource[]> & {
|
|
25408
|
+
$?: DynamicSlotSource[];
|
|
25409
|
+
});
|
|
25405
25410
|
type StaticSlots = Record<string, VaporSlot>;
|
|
25406
25411
|
type VaporSlot = BlockFn;
|
|
25407
25412
|
type DynamicSlot = {
|
|
@@ -25410,14 +25415,6 @@ type DynamicSlot = {
|
|
|
25410
25415
|
};
|
|
25411
25416
|
type DynamicSlotFn = () => DynamicSlot | DynamicSlot[];
|
|
25412
25417
|
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
25418
|
declare function createSlot(name?: string | (() => string), rawProps?: LooseRawProps | null, fallback?: VaporSlot, flags?: number): Block$1;
|
|
25422
25419
|
//#endregion
|
|
25423
25420
|
//#region packages/runtime-vapor/src/apiDefineComponent.d.ts
|
|
@@ -25463,50 +25460,6 @@ declare function defineVaporComponent<TypeProps, RuntimePropsOptions extends Com
|
|
|
25463
25460
|
__typeEl?: TypeBlock;
|
|
25464
25461
|
} & 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
25462
|
//#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
25463
|
//#region packages/runtime-vapor/src/component.d.ts
|
|
25511
25464
|
type VaporComponent = FunctionalVaporComponent<any> | VaporComponentOptions | DefineVaporComponent;
|
|
25512
25465
|
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 +25485,6 @@ interface VaporComponentOptions<Props = {}, Emits extends EmitsOptions = {}, Run
|
|
|
25532
25485
|
name?: string;
|
|
25533
25486
|
vapor?: boolean;
|
|
25534
25487
|
components?: Record<string, VaporComponent>;
|
|
25535
|
-
/**
|
|
25536
|
-
* @internal custom element interception hook
|
|
25537
|
-
*/
|
|
25538
|
-
ce?: (instance: VaporComponentInstance) => void;
|
|
25539
25488
|
}
|
|
25540
25489
|
interface SharedInternalOptions {
|
|
25541
25490
|
/**
|
|
@@ -25556,10 +25505,7 @@ interface SharedInternalOptions {
|
|
|
25556
25505
|
type LooseRawProps = Record<string, unknown> & {
|
|
25557
25506
|
$?: DynamicPropsSource[];
|
|
25558
25507
|
};
|
|
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;
|
|
25508
|
+
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
25509
|
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
25510
|
vapor: true;
|
|
25565
25511
|
uid: number;
|
|
@@ -25592,7 +25538,6 @@ declare class VaporComponentInstance<Props extends Record<string, any> = {}, Emi
|
|
|
25592
25538
|
asyncResolved: boolean;
|
|
25593
25539
|
restoreAsyncContext?: () => void | (() => void);
|
|
25594
25540
|
deferredHydrationBoundary?: () => void;
|
|
25595
|
-
renderEffects?: RenderEffect[];
|
|
25596
25541
|
hasFallthrough: boolean;
|
|
25597
25542
|
shapeFlag?: number;
|
|
25598
25543
|
$key?: any;
|
|
@@ -25620,10 +25565,10 @@ declare class VaporComponentInstance<Props extends Record<string, any> = {}, Emi
|
|
|
25620
25565
|
devtoolsRawSetupState?: any;
|
|
25621
25566
|
hmrRerender?: () => void;
|
|
25622
25567
|
hmrReload?: (newComp: VaporComponent) => void;
|
|
25623
|
-
parentTeleport?: TeleportFragment | null;
|
|
25624
25568
|
propsOptions?: NormalizedPropsOptions;
|
|
25625
25569
|
emitsOptions?: ObjectEmitsOptions | null;
|
|
25626
25570
|
isSingleRoot?: boolean;
|
|
25571
|
+
renderEffects?: RenderEffect[];
|
|
25627
25572
|
/**
|
|
25628
25573
|
* dev only flag to track whether $attrs was used during render.
|
|
25629
25574
|
* If $attrs was used during render then the warning for failed attrs
|
|
@@ -25634,7 +25579,7 @@ declare class VaporComponentInstance<Props extends Record<string, any> = {}, Emi
|
|
|
25634
25579
|
* @deprecated only used for JSX to detect props types.
|
|
25635
25580
|
*/
|
|
25636
25581
|
$props: Props;
|
|
25637
|
-
constructor(comp: VaporComponent, rawProps?: RawProps | null, rawSlots?: LooseRawSlots | null, appContext?: GenericAppContext, once?: boolean);
|
|
25582
|
+
constructor(comp: VaporComponent, rawProps?: RawProps | null, rawSlots?: LooseRawSlots | null, appContext?: GenericAppContext, once?: boolean, ce?: (instance: VaporComponentInstance) => void);
|
|
25638
25583
|
/**
|
|
25639
25584
|
* Expose `getKeysFromRawProps` on the instance so it can be used in code
|
|
25640
25585
|
* paths where it's needed, e.g. `useModel`
|
|
@@ -25671,6 +25616,9 @@ type VaporDirective = (node: Element | VaporComponentInstance, value?: () => any
|
|
|
25671
25616
|
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
25617
|
declare function withVaporDirectives(node: Element | VaporComponentInstance, dirs: VaporDirectiveArguments): void;
|
|
25673
25618
|
//#endregion
|
|
25619
|
+
//#region packages/runtime-vapor/src/components/Teleport.d.ts
|
|
25620
|
+
declare const VaporTeleport: DefineVaporSetupFnComponent<TeleportProps>;
|
|
25621
|
+
//#endregion
|
|
25674
25622
|
//#region packages/runtime-vapor/src/components/KeepAlive.d.ts
|
|
25675
25623
|
declare const VaporKeepAlive: DefineVaporComponent<{}, string, KeepAliveProps>;
|
|
25676
25624
|
//#endregion
|
|
@@ -25851,7 +25799,7 @@ interface ForSelector {
|
|
|
25851
25799
|
declare function createSelector(source: () => any): ForSelector;
|
|
25852
25800
|
declare function createForSlots(rawSource: Source, getSlot: (item: any, key: any, index?: number) => DynamicSlot): DynamicSlot[];
|
|
25853
25801
|
declare function getRestElement(val: any, keys: string[]): any;
|
|
25854
|
-
declare function getDefaultValue(val: any,
|
|
25802
|
+
declare function getDefaultValue(val: any, getDefaultVal: () => any): any;
|
|
25855
25803
|
//#endregion
|
|
25856
25804
|
//#region packages/runtime-vapor/src/helpers/useCssVars.d.ts
|
|
25857
25805
|
declare function useVaporCssVars(getter: () => Record<string, string>): void;
|
|
@@ -25862,7 +25810,7 @@ declare function setBlockKey(block: (Block$1 & {
|
|
|
25862
25810
|
}) | null | undefined, key: any): void;
|
|
25863
25811
|
//#endregion
|
|
25864
25812
|
//#region packages/runtime-vapor/src/apiCreateDynamicComponent.d.ts
|
|
25865
|
-
declare function createDynamicComponent(getter: () => any, rawProps?: RawProps | null, rawSlots?: LooseRawSlots | null,
|
|
25813
|
+
declare function createDynamicComponent(getter: () => any, rawProps?: RawProps | null, rawSlots?: LooseRawSlots | null, flags?: number): VaporFragment;
|
|
25866
25814
|
//#endregion
|
|
25867
25815
|
//#region packages/runtime-vapor/src/apiSetupHelpers.d.ts
|
|
25868
25816
|
declare function withAsyncContext(getAwaitable: () => any): [any, () => void];
|
|
@@ -25884,7 +25832,7 @@ declare const VaporTransition: FunctionalVaporComponent<TransitionProps>;
|
|
|
25884
25832
|
//#region packages/runtime-vapor/src/components/TransitionGroup.d.ts
|
|
25885
25833
|
declare const VaporTransitionGroup: DefineVaporComponent<{}, string, TransitionGroupProps>;
|
|
25886
25834
|
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,
|
|
25835
|
+
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
25836
|
}
|
|
25889
25837
|
//#endregion
|
|
25890
25838
|
//#region temp/packages/compiler-vapor/src/ir/component.d.ts
|
|
@@ -26011,6 +25959,7 @@ export interface IfIRNode extends BaseIRNode, EffectBoundary {
|
|
|
26011
25959
|
positive: BlockIRNode;
|
|
26012
25960
|
negative?: BlockIRNode | IfIRNode;
|
|
26013
25961
|
once?: boolean;
|
|
25962
|
+
slotRoot?: boolean;
|
|
26014
25963
|
index?: number;
|
|
26015
25964
|
parent?: number;
|
|
26016
25965
|
anchor?: number;
|
|
@@ -26029,6 +25978,7 @@ export interface ForIRNode extends BaseIRNode, IRFor, EffectBoundary {
|
|
|
26029
25978
|
keyProp?: SimpleExpressionNode;
|
|
26030
25979
|
render: BlockIRNode;
|
|
26031
25980
|
once: boolean;
|
|
25981
|
+
slotRoot?: boolean;
|
|
26032
25982
|
component: boolean;
|
|
26033
25983
|
onlyChild: boolean;
|
|
26034
25984
|
parent?: number;
|
|
@@ -26133,6 +26083,7 @@ export interface CreateComponentIRNode extends BaseIRNode, EffectBoundary {
|
|
|
26133
26083
|
asset: boolean;
|
|
26134
26084
|
root: boolean;
|
|
26135
26085
|
once: boolean;
|
|
26086
|
+
slotRoot?: boolean;
|
|
26136
26087
|
dynamic?: SimpleExpressionNode;
|
|
26137
26088
|
useCreateElement: boolean;
|
|
26138
26089
|
parent?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-vapor v3.6.0-beta.14
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -20142,7 +20142,7 @@ function isConstantBinding(value, context) {
|
|
|
20142
20142
|
//#region packages/compiler-vapor/src/generators/for.ts
|
|
20143
20143
|
function genFor(oper, context) {
|
|
20144
20144
|
const { helper } = context;
|
|
20145
|
-
const { source, value, key, index, render, keyProp, once, id, component, onlyChild } = oper;
|
|
20145
|
+
const { source, value, key, index, render, keyProp, once, id, component, onlyChild, slotRoot } = oper;
|
|
20146
20146
|
const rawValue = value && value.content;
|
|
20147
20147
|
const rawKey = key && key.content;
|
|
20148
20148
|
const rawIndex = index && index.content;
|
|
@@ -20201,6 +20201,7 @@ function genFor(oper, context) {
|
|
|
20201
20201
|
if (isFragmentBlock(render)) flags |= 16;
|
|
20202
20202
|
if (!component && isSingleNodeBlock(render)) flags |= 8;
|
|
20203
20203
|
if (once) flags |= 4;
|
|
20204
|
+
if (slotRoot) flags |= 32;
|
|
20204
20205
|
const onResetCalls = [];
|
|
20205
20206
|
for (let i = 0; i < selectorPatterns.length; i++) onResetCalls.push(NEWLINE, `n${id}.onReset(${selectorName(i)}.reset)`);
|
|
20206
20207
|
return [
|
|
@@ -20282,7 +20283,7 @@ function parseValueDestructure(value, context) {
|
|
|
20282
20283
|
if (child.type === "AssignmentPattern" && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
|
|
20283
20284
|
isDynamic = true;
|
|
20284
20285
|
helper = context.helper("getDefaultValue");
|
|
20285
|
-
helperArgs = rawValue.slice(child.right.start - 1, child.right.end - 1)
|
|
20286
|
+
helperArgs = `() => (${rawValue.slice(child.right.start - 1, child.right.end - 1)})`;
|
|
20286
20287
|
}
|
|
20287
20288
|
}
|
|
20288
20289
|
map.set(id.name, {
|
|
@@ -20430,9 +20431,9 @@ function genSetHtml(oper, context) {
|
|
|
20430
20431
|
//#region packages/compiler-vapor/src/generators/if.ts
|
|
20431
20432
|
function genIf(oper, context, isNested = false) {
|
|
20432
20433
|
const { helper } = context;
|
|
20433
|
-
const { condition, positive, negative, once, index, blockShape } = oper;
|
|
20434
|
+
const { condition, positive, negative, once, slotRoot, index, blockShape } = oper;
|
|
20434
20435
|
const [frag, push] = buildCodeFragment();
|
|
20435
|
-
const flags = genIfFlags(blockShape, once, negative ? index : void 0);
|
|
20436
|
+
const flags = genIfFlags(blockShape, once, slotRoot, negative ? index : void 0);
|
|
20436
20437
|
const conditionExpr = [
|
|
20437
20438
|
"() => (",
|
|
20438
20439
|
...genExpression(condition, context),
|
|
@@ -20446,19 +20447,21 @@ function genIf(oper, context, isNested = false) {
|
|
|
20446
20447
|
push(...genCall(helper("createIf"), conditionExpr, positiveArg, negativeArg, flags));
|
|
20447
20448
|
return frag;
|
|
20448
20449
|
}
|
|
20449
|
-
function genIfFlags(blockShape, once, index) {
|
|
20450
|
+
function genIfFlags(blockShape, once, slotRoot, index) {
|
|
20450
20451
|
let flags = blockShape;
|
|
20452
|
+
if (slotRoot) flags |= 128;
|
|
20451
20453
|
if (once) flags |= 16;
|
|
20452
|
-
else if (index !== void 0) flags |= index + 1 <<
|
|
20454
|
+
else if (index !== void 0) flags |= index + 1 << 8;
|
|
20453
20455
|
if (flags === 1) return false;
|
|
20454
|
-
return `${flags} /* ${genIfFlagNames(once, index, blockShape)} */`;
|
|
20456
|
+
return `${flags} /* ${genIfFlagNames(once, slotRoot, index, blockShape)} */`;
|
|
20455
20457
|
}
|
|
20456
|
-
function genIfFlagNames(once, index, blockShape) {
|
|
20458
|
+
function genIfFlagNames(once, slotRoot, index, blockShape) {
|
|
20457
20459
|
const names = ["BLOCK_SHAPE"];
|
|
20458
20460
|
if (blockShape & 32) names.push("TRUE_NO_SCOPE");
|
|
20459
20461
|
if (blockShape & 64) names.push("FALSE_NO_SCOPE");
|
|
20460
20462
|
if (once) names.push("ONCE");
|
|
20461
|
-
|
|
20463
|
+
if (slotRoot) names.push("SLOT_ROOT");
|
|
20464
|
+
if (!once && index !== void 0) names.push("INDEX_SHIFT");
|
|
20462
20465
|
return names.join(", ");
|
|
20463
20466
|
}
|
|
20464
20467
|
//#endregion
|
|
@@ -20804,7 +20807,9 @@ function genCreateComponent(operation, context) {
|
|
|
20804
20807
|
const useAssetComponentHelper = operation.asset && !operation.dynamic && context.block === context.ir.block && !!singleUseAssetComponentNames && singleUseAssetComponentNames.has(operation.tag);
|
|
20805
20808
|
const maybeSelfReference = useAssetComponentHelper && operation.tag.endsWith("__self");
|
|
20806
20809
|
const tag = genTag();
|
|
20807
|
-
const { root, props, slots, once } = operation;
|
|
20810
|
+
const { root, props, slots, once, slotRoot } = operation;
|
|
20811
|
+
const isRuntimeDynamicComponent = !!(operation.dynamic && !operation.dynamic.isStatic);
|
|
20812
|
+
const dynamicComponentFlags = isRuntimeDynamicComponent ? (root ? 1 : 0) | (once ? 2 : 0) | (slotRoot ? 4 : 0) : 0;
|
|
20808
20813
|
const rawSlots = genRawSlots(slots, context);
|
|
20809
20814
|
const [ids, handlers] = processInlineHandlers(props, context);
|
|
20810
20815
|
const rawProps = context.withId(() => genRawProps(props, context, true), ids);
|
|
@@ -20820,7 +20825,7 @@ function genCreateComponent(operation, context) {
|
|
|
20820
20825
|
];
|
|
20821
20826
|
}, []),
|
|
20822
20827
|
`const n${operation.id} = `,
|
|
20823
|
-
...genCall(
|
|
20828
|
+
...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
20829
|
...genDirectivesForElement(operation.id, context)
|
|
20825
20830
|
];
|
|
20826
20831
|
function genTag() {
|
|
@@ -21097,23 +21102,12 @@ function genDynamicSlot(slot, context, withFunction = false) {
|
|
|
21097
21102
|
break;
|
|
21098
21103
|
}
|
|
21099
21104
|
if (!withFunction) return frag;
|
|
21100
|
-
return
|
|
21101
|
-
`${context.helper("withVaporCtx")}(() => (`,
|
|
21102
|
-
...frag,
|
|
21103
|
-
"))"
|
|
21104
|
-
] : [
|
|
21105
|
+
return [
|
|
21105
21106
|
"() => (",
|
|
21106
21107
|
...frag,
|
|
21107
21108
|
")"
|
|
21108
21109
|
];
|
|
21109
21110
|
}
|
|
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
21111
|
function genBasicDynamicSlot(slot, context) {
|
|
21118
21112
|
const { name, fn } = slot;
|
|
21119
21113
|
return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...genExpression(name, context)], ["fn: ", ...genSlotBlockWithProps(fn, context)]);
|
|
@@ -21158,7 +21152,7 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
21158
21152
|
let propsName;
|
|
21159
21153
|
let exitScope;
|
|
21160
21154
|
let depth;
|
|
21161
|
-
const { props
|
|
21155
|
+
const { props } = oper;
|
|
21162
21156
|
const idToPathMap = props ? parseValueDestructure(props, context) : /* @__PURE__ */ new Map();
|
|
21163
21157
|
if (props) if (props.ast) {
|
|
21164
21158
|
[depth, exitScope] = context.enterScope();
|
|
@@ -21167,64 +21161,12 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
21167
21161
|
const idMap = idToPathMap.size ? buildDestructureIdMap(idToPathMap, propsName || "", context.options.expressionPlugins) : {};
|
|
21168
21162
|
if (propsName) idMap[propsName] = null;
|
|
21169
21163
|
const exitSlotBlock = context.enterSlotBlock();
|
|
21164
|
+
markSlotRootOperations(oper);
|
|
21170
21165
|
let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
|
|
21171
21166
|
exitSlotBlock();
|
|
21172
21167
|
exitScope && exitScope();
|
|
21173
|
-
if (node.type === 1) {
|
|
21174
|
-
if (needsVaporCtx(oper)) blockFn = [
|
|
21175
|
-
`${context.helper("withVaporCtx")}(`,
|
|
21176
|
-
...blockFn,
|
|
21177
|
-
`)`
|
|
21178
|
-
];
|
|
21179
|
-
}
|
|
21180
21168
|
return blockFn;
|
|
21181
21169
|
}
|
|
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
21170
|
//#endregion
|
|
21229
21171
|
//#region packages/compiler-vapor/src/generators/slotOutlet.ts
|
|
21230
21172
|
function genSlotOutlet(oper, context) {
|
|
@@ -21232,7 +21174,10 @@ function genSlotOutlet(oper, context) {
|
|
|
21232
21174
|
const { id, name, fallback, flags } = oper;
|
|
21233
21175
|
const [frag, push] = buildCodeFragment();
|
|
21234
21176
|
let fallbackArg;
|
|
21235
|
-
if (fallback)
|
|
21177
|
+
if (fallback) {
|
|
21178
|
+
markSlotRootOperations(fallback);
|
|
21179
|
+
fallbackArg = genBlock(fallback, context);
|
|
21180
|
+
}
|
|
21236
21181
|
const createSlot = helper("createSlot");
|
|
21237
21182
|
const rawPropsArg = genRawProps(oper.props, context, true);
|
|
21238
21183
|
const nameArg = name.isStatic && name.content === "default" && !rawPropsArg && !fallbackArg && !flags ? void 0 : name.isStatic ? genExpression(name, context) : [
|
|
@@ -21566,6 +21511,42 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
|
21566
21511
|
for (const name of context.ir[kind]) push(NEWLINE, `const ${toValidAssetId(name, kind)} = `, ...genCall(context.helper(helper), JSON.stringify(name)));
|
|
21567
21512
|
}
|
|
21568
21513
|
}
|
|
21514
|
+
function markSlotRootOperations(block) {
|
|
21515
|
+
for (let i = 0; i < block.returns.length; i++) {
|
|
21516
|
+
const child = findReturnedDynamic$1(block, block.returns[i]);
|
|
21517
|
+
const operation = child && child.operation;
|
|
21518
|
+
if (!operation) continue;
|
|
21519
|
+
if (operation.type === 15) markSlotRootIf(operation);
|
|
21520
|
+
else if (operation.type === 16) markSlotRootFor(operation);
|
|
21521
|
+
else if (operation.type === 13) markSlotRootSlotOutlet(operation);
|
|
21522
|
+
else if (operation.type === 12) markSlotRootComponent(operation);
|
|
21523
|
+
}
|
|
21524
|
+
}
|
|
21525
|
+
function markSlotRootIf(operation) {
|
|
21526
|
+
if (!operation.once) operation.slotRoot = true;
|
|
21527
|
+
markSlotRootOperations(operation.positive);
|
|
21528
|
+
const negative = operation.negative;
|
|
21529
|
+
if (!negative) return;
|
|
21530
|
+
if (negative.type === 15) markSlotRootIf(negative);
|
|
21531
|
+
else markSlotRootOperations(negative);
|
|
21532
|
+
}
|
|
21533
|
+
function markSlotRootFor(operation) {
|
|
21534
|
+
if (!operation.once) operation.slotRoot = true;
|
|
21535
|
+
markSlotRootOperations(operation.render);
|
|
21536
|
+
}
|
|
21537
|
+
function markSlotRootSlotOutlet(operation) {
|
|
21538
|
+
operation.flags |= 4;
|
|
21539
|
+
if (operation.fallback) markSlotRootOperations(operation.fallback);
|
|
21540
|
+
}
|
|
21541
|
+
function markSlotRootComponent(operation) {
|
|
21542
|
+
if (!operation.once && operation.dynamic && !operation.dynamic.isStatic) operation.slotRoot = true;
|
|
21543
|
+
}
|
|
21544
|
+
function findReturnedDynamic$1(block, id) {
|
|
21545
|
+
for (let i = 0; i < block.dynamic.children.length; i++) {
|
|
21546
|
+
const child = block.dynamic.children[i];
|
|
21547
|
+
if (child.id === id) return child;
|
|
21548
|
+
}
|
|
21549
|
+
}
|
|
21569
21550
|
function collectSingleUseAssetComponents(block) {
|
|
21570
21551
|
const usageMap = /* @__PURE__ */ new Map();
|
|
21571
21552
|
const seenOperations = /* @__PURE__ */ new Set();
|
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.14",
|
|
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.3",
|
|
46
46
|
"estree-walker": "^2.0.2",
|
|
47
47
|
"source-map-js": "^1.2.1",
|
|
48
|
-
"@vue/compiler-dom": "3.6.0-beta.
|
|
49
|
-
"@vue/shared": "3.6.0-beta.
|
|
48
|
+
"@vue/compiler-dom": "3.6.0-beta.14",
|
|
49
|
+
"@vue/shared": "3.6.0-beta.14"
|
|
50
50
|
}
|
|
51
51
|
}
|