@vue/runtime-vapor 3.6.0-beta.6 → 3.6.0-beta.7
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/runtime-vapor.d.ts +5 -6
- package/dist/runtime-vapor.esm-bundler.js +106 -42
- package/package.json +4 -4
package/dist/runtime-vapor.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { IsKeyValues, Namespace, NormalizedStyle, Prettify } from "@vue/shared";
|
|
|
4
4
|
|
|
5
5
|
//#region temp/packages/runtime-vapor/src/apiTemplateRef.d.ts
|
|
6
6
|
type NodeRef = string | Ref | ((ref: Element | VaporComponentInstance, refs: Record<string, any>) => void);
|
|
7
|
-
type RefEl = Element | VaporComponentInstance;
|
|
7
|
+
type RefEl = Element | VaporComponentInstance | DynamicFragment | VaporFragment;
|
|
8
8
|
type setRefFn = (el: RefEl, ref: NodeRef, refFor?: boolean, refKey?: string) => NodeRef | undefined;
|
|
9
9
|
export declare function createTemplateRefSetter(): setRefFn;
|
|
10
10
|
//#endregion
|
|
@@ -24,8 +24,8 @@ type DynamicSlotSource = StaticSlots | DynamicSlotFn;
|
|
|
24
24
|
* Wrap a slot function to track the slot owner.
|
|
25
25
|
*
|
|
26
26
|
* This ensures:
|
|
27
|
-
* 1. createSlot gets rawSlots from the correct
|
|
28
|
-
* 2.
|
|
27
|
+
* 1. createSlot gets rawSlots from the correct instance (slot owner)
|
|
28
|
+
* 2. elements inherit the slot owner's scopeId
|
|
29
29
|
*/
|
|
30
30
|
export declare function withVaporCtx(fn: Function): BlockFn;
|
|
31
31
|
export declare function createSlot(name: string | (() => string), rawProps?: LooseRawProps | null, fallback?: VaporSlot, noSlotted?: boolean, once?: boolean): Block;
|
|
@@ -113,7 +113,6 @@ export declare class DynamicFragment extends VaporFragment {
|
|
|
113
113
|
anchorLabel?: string;
|
|
114
114
|
keyed?: boolean;
|
|
115
115
|
attrs?: Record<string, any>;
|
|
116
|
-
setAsyncRef?: (instance: VaporComponentInstance) => void;
|
|
117
116
|
keepAliveCtx: VaporKeepAliveContext | null;
|
|
118
117
|
slotOwner: VaporComponentInstance | null;
|
|
119
118
|
constructor(anchorLabel?: string, keyed?: boolean);
|
|
@@ -197,8 +196,8 @@ declare class TeleportFragment extends VaporFragment {
|
|
|
197
196
|
export declare const VaporTeleport: DefineVaporSetupFnComponent<TeleportProps>;
|
|
198
197
|
//#endregion
|
|
199
198
|
//#region temp/packages/runtime-vapor/src/component.d.ts
|
|
200
|
-
export type VaporComponent = FunctionalVaporComponent | VaporComponentOptions | DefineVaporComponent;
|
|
201
|
-
export type FunctionalVaporComponent<Props = {}, Emits extends EmitsOptions = {}, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>> = ((props:
|
|
199
|
+
export type VaporComponent = FunctionalVaporComponent<any> | VaporComponentOptions | DefineVaporComponent;
|
|
200
|
+
export type FunctionalVaporComponent<Props = {}, Emits extends EmitsOptions = {}, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>> = ((props: Props & EmitsToProps<Emits>, ctx: {
|
|
202
201
|
emit: EmitFn<Emits>;
|
|
203
202
|
slots: Slots;
|
|
204
203
|
attrs: Record<string, any>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/runtime-vapor v3.6.0-beta.7
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { EffectScope, NULL_DYNAMIC_COMPONENT, TransitionPropsValidators, VueElementBase, activate, baseApplyTranslation, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, baseUseCssVars, callPendingCbs, callWithAsyncErrorHandling, callWithErrorHandling, checkTransitionMode, createAppAPI, createAsyncComponentContext, createCanSetSetupRefChecker, createInternalObject, createVNode, currentInstance, currentInstance as currentInstance$1, deactivate, devtoolsComponentAdded, endMeasure, ensureHydrationRenderer, ensureRenderer, ensureVaporSlotFallback, expose, flushOnAppMount, forceReflow, getAttributeMismatch, getComponentName, getFunctionalFallthrough, getInheritedScopeIds, handleError, handleMovedChildren, hasCSSTransform, initFeatureFlags, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMismatchAllowed, isRef, isSetEqual, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, matches, mergeProps, nextUid, normalizeContainer, normalizeRef, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, patchStyle, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popWarningContext, pushWarningContext, queueJob, queuePostFlushCb, registerHMR, renderSlot, resetShapeFlag, resolveDynamicComponent, resolvePropValue, resolveTeleportTarget, resolveTransitionProps, setCurrentInstance, setDevtoolsHook, setRef, setTransitionHooks, setVarsOnNode, shallowReactive, shallowRef, shouldSetAsProp, simpleSetCurrentInstance, startMeasure, toClassSet, toStyleMap, unregisterHMR, unsafeToTrustedHTML, useAsyncComponentState, useTransitionState, vModelCheckboxInit, vModelCheckboxUpdate, vModelGetValue, vModelSelectInit, vModelSetSelected, vModelTextInit, vModelTextUpdate, vShowHidden, vShowOriginalDisplay, validateProps, warn, warnExtraneousAttributes, warnPropMismatch, watch, xlinkNS } from "@vue/runtime-dom";
|
|
6
|
+
import { EffectScope, NULL_DYNAMIC_COMPONENT, TransitionPropsValidators, VueElementBase, activate, baseApplyTranslation, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, baseUseCssVars, callPendingCbs, callWithAsyncErrorHandling, callWithErrorHandling, checkTransitionMode, createAppAPI, createAsyncComponentContext, createCanSetSetupRefChecker, createInternalObject, createVNode, currentInstance, currentInstance as currentInstance$1, deactivate, devtoolsComponentAdded, endMeasure, ensureHydrationRenderer, ensureRenderer, ensureVaporSlotFallback, expose, flushOnAppMount, forceReflow, getAttributeMismatch, getComponentName, getFunctionalFallthrough, getInheritedScopeIds, handleError, handleMovedChildren, hasCSSTransform, initFeatureFlags, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMismatchAllowed, isRef, isSetEqual, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, matches, mergeProps, nextUid, normalizeContainer, normalizeRef, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, patchStyle, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popWarningContext, pushWarningContext, queueJob, queuePostFlushCb, registerHMR, renderSlot, resetShapeFlag, resolveDynamicComponent, resolvePropValue, resolveTeleportTarget, resolveTransitionProps, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setRef, setTransitionHooks, setVarsOnNode, shallowReactive, shallowRef, shouldSetAsProp, simpleSetCurrentInstance, startMeasure, toClassSet, toStyleMap, unregisterHMR, unsafeToTrustedHTML, useAsyncComponentState, useTransitionState, vModelCheckboxInit, vModelCheckboxUpdate, vModelGetValue, vModelSelectInit, vModelSetSelected, vModelTextInit, vModelTextUpdate, vShowHidden, vShowOriginalDisplay, validateProps, warn, warnExtraneousAttributes, warnPropMismatch, watch, xlinkNS } from "@vue/runtime-dom";
|
|
7
7
|
import { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, camelize, canSetValueDirectly, extend, getEscapedCssVarName, getGlobalThis, hasOwn, includeBooleanAttr, invokeArrayFns, isArray, isFunction, isObject, isOn, isPlainObject, isPromise, isReservedProp, isString, looseEqual, normalizeClass, normalizeCssVarValue, normalizeStyle, parseStringStyle, remove as remove$1, stringifyStyle, toDisplayString } from "@vue/shared";
|
|
8
8
|
import { EffectScope as EffectScope$1, ReactiveEffect, computed, isReactive, isReadonly, isRef as isRef$1, isShallow, markRaw, onEffectCleanup, onScopeDispose as onScopeDispose$1, pauseTracking, proxyRefs, resetTracking, setActiveSub, shallowReadArray, shallowRef as shallowRef$1, toRaw, toReactive, toReadonly, traverse, unref, watch as watch$1 } from "@vue/reactivity";
|
|
9
9
|
|
|
@@ -720,7 +720,8 @@ const decorate$1 = (t) => {
|
|
|
720
720
|
t.__vapor = true;
|
|
721
721
|
return t;
|
|
722
722
|
};
|
|
723
|
-
const VaporTransition = /* @__PURE__ */ decorate$1((props, { slots }) => {
|
|
723
|
+
const VaporTransition = /* @__PURE__ */ decorate$1((props, { slots, expose }) => {
|
|
724
|
+
expose();
|
|
724
725
|
ensureTransitionHooksRegistered();
|
|
725
726
|
const performAppear = isHydrating$1 ? hydrateTransitionImpl() : void 0;
|
|
726
727
|
const children = slots.default && slots.default();
|
|
@@ -743,6 +744,7 @@ const VaporTransition = /* @__PURE__ */ decorate$1((props, { slots }) => {
|
|
|
743
744
|
const getTransitionHooksContext = (key, props, state, instance, postClone) => {
|
|
744
745
|
const { leavingNodes } = state;
|
|
745
746
|
return {
|
|
747
|
+
isLeaving: () => leavingNodes.has(key),
|
|
746
748
|
setLeavingNodeCache: (el) => {
|
|
747
749
|
leavingNodes.set(key, el);
|
|
748
750
|
},
|
|
@@ -863,7 +865,7 @@ function setTransitionHooks$1(block, hooks) {
|
|
|
863
865
|
}
|
|
864
866
|
|
|
865
867
|
//#endregion
|
|
866
|
-
//#region packages/runtime-vapor/src/
|
|
868
|
+
//#region packages/runtime-vapor/src/vdomInteropState.ts
|
|
867
869
|
let isInteropEnabled = false;
|
|
868
870
|
function setInteropEnabled() {
|
|
869
871
|
isInteropEnabled = true;
|
|
@@ -925,7 +927,9 @@ const VaporKeepAliveImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
925
927
|
],
|
|
926
928
|
max: [String, Number]
|
|
927
929
|
},
|
|
928
|
-
setup(props, { slots }) {
|
|
930
|
+
setup(props, { slots, expose }) {
|
|
931
|
+
let exposed;
|
|
932
|
+
expose(exposed);
|
|
929
933
|
if (!slots.default) return;
|
|
930
934
|
const keepAliveInstance = currentInstance;
|
|
931
935
|
const cache = /* @__PURE__ */ new Map();
|
|
@@ -938,6 +942,7 @@ const VaporKeepAliveImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
938
942
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
939
943
|
const rerender = keepAliveInstance.hmrRerender;
|
|
940
944
|
keepAliveInstance.hmrRerender = () => {
|
|
945
|
+
keepAliveInstance.exposed = null;
|
|
941
946
|
cache.forEach((cached) => resetCachedShapeFlag(cached));
|
|
942
947
|
cache.clear();
|
|
943
948
|
keys.clear();
|
|
@@ -1202,10 +1207,12 @@ const vaporInteropImpl = {
|
|
|
1202
1207
|
} else if (vnode.vb) remove(vnode.vb, container);
|
|
1203
1208
|
remove(vnode.anchor, container);
|
|
1204
1209
|
},
|
|
1205
|
-
slot(n1, n2, container, anchor, parentComponent) {
|
|
1210
|
+
slot(n1, n2, container, anchor, parentComponent, parentSuspense) {
|
|
1206
1211
|
if (!n1) {
|
|
1207
1212
|
const prev = currentInstance;
|
|
1213
|
+
let prevSuspense = null;
|
|
1208
1214
|
simpleSetCurrentInstance(parentComponent);
|
|
1215
|
+
if (parentSuspense) prevSuspense = setParentSuspense(parentSuspense);
|
|
1209
1216
|
let selfAnchor;
|
|
1210
1217
|
const { slot, fallback } = n2.vs;
|
|
1211
1218
|
const propsRef = n2.vs.ref = shallowRef(n2.props);
|
|
@@ -1216,6 +1223,7 @@ const vaporInteropImpl = {
|
|
|
1216
1223
|
if (!isValidBlock(slotBlock)) slotBlock = renderSlotFallback(slotBlock, vaporFallback, emptyFrag);
|
|
1217
1224
|
}
|
|
1218
1225
|
if (isFragment(slotBlock)) selfAnchor = slotBlock.anchor;
|
|
1226
|
+
if (parentSuspense) setParentSuspense(prevSuspense);
|
|
1219
1227
|
simpleSetCurrentInstance(prev);
|
|
1220
1228
|
if (!selfAnchor) selfAnchor = /* @__PURE__ */ createTextNode();
|
|
1221
1229
|
insert(n2.el = n2.anchor = selfAnchor, container, anchor);
|
|
@@ -1288,6 +1296,7 @@ let vdomHydrateNode;
|
|
|
1288
1296
|
* Mount VNode in vapor
|
|
1289
1297
|
*/
|
|
1290
1298
|
function mountVNode(internals, vnode, parentComponent) {
|
|
1299
|
+
const suspense = parentSuspense || parentComponent && parentComponent.suspense;
|
|
1291
1300
|
const frag = new VaporFragment([]);
|
|
1292
1301
|
frag.vnode = vnode;
|
|
1293
1302
|
let isMounted = false;
|
|
@@ -1315,7 +1324,7 @@ function mountVNode(internals, vnode, parentComponent) {
|
|
|
1315
1324
|
simpleSetCurrentInstance(parentComponent);
|
|
1316
1325
|
if (!isMounted) {
|
|
1317
1326
|
if (transition) setTransitionHooks(vnode, transition);
|
|
1318
|
-
internals.p(null, vnode, parentNode, anchor, parentComponent,
|
|
1327
|
+
internals.p(null, vnode, parentNode, anchor, parentComponent, suspense, void 0, vnode.slotScopeIds);
|
|
1319
1328
|
onScopeDispose(unmount, true);
|
|
1320
1329
|
isMounted = true;
|
|
1321
1330
|
} else internals.m(vnode, parentNode, anchor, 2, parentComponent);
|
|
@@ -1331,13 +1340,16 @@ function mountVNode(internals, vnode, parentComponent) {
|
|
|
1331
1340
|
* Mount vdom component in vapor
|
|
1332
1341
|
*/
|
|
1333
1342
|
function createVDOMComponent(internals, component, parentComponent, rawProps, rawSlots, isSingleRoot) {
|
|
1343
|
+
const suspense = parentSuspense || parentComponent && parentComponent.suspense;
|
|
1344
|
+
const useBridge = shouldUseRendererBridge(component);
|
|
1345
|
+
const comp = useBridge ? ensureRendererBridge(component) : component;
|
|
1334
1346
|
const frag = new VaporFragment([]);
|
|
1335
|
-
const vnode = frag.vnode = createVNode(
|
|
1347
|
+
const vnode = frag.vnode = createVNode(comp, rawProps && extend({}, new Proxy(rawProps, rawPropsProxyHandlers)));
|
|
1336
1348
|
if (currentKeepAliveCtx) {
|
|
1337
1349
|
currentKeepAliveCtx.processShapeFlag(frag);
|
|
1338
1350
|
setCurrentKeepAliveCtx(null);
|
|
1339
1351
|
}
|
|
1340
|
-
const wrapper = new VaporComponentInstance({ props: component.props }, rawProps, rawSlots, parentComponent ? parentComponent.appContext : void 0, void 0);
|
|
1352
|
+
const wrapper = new VaporComponentInstance(useBridge ? comp : { props: component.props }, rawProps, rawSlots, parentComponent ? parentComponent.appContext : void 0, void 0);
|
|
1341
1353
|
vnode.vi = (instance) => {
|
|
1342
1354
|
instance.props = shallowReactive(wrapper.props);
|
|
1343
1355
|
const attrs = instance.attrs = createInternalObject();
|
|
@@ -1372,7 +1384,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1372
1384
|
simpleSetCurrentInstance(parentComponent);
|
|
1373
1385
|
if (!isMounted) {
|
|
1374
1386
|
if (transition) setTransitionHooks(vnode, transition);
|
|
1375
|
-
internals.mt(vnode, parentNode, anchor, parentComponent,
|
|
1387
|
+
internals.mt(vnode, parentNode, anchor, parentComponent, suspense, void 0, false);
|
|
1376
1388
|
if (rawRef) setRef(rawRef, null, null, vnode);
|
|
1377
1389
|
onScopeDispose(unmount, true);
|
|
1378
1390
|
isMounted = true;
|
|
@@ -1393,10 +1405,27 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1393
1405
|
};
|
|
1394
1406
|
return frag;
|
|
1395
1407
|
}
|
|
1408
|
+
const rendererBridgeCache = /* @__PURE__ */ new WeakMap();
|
|
1409
|
+
/**
|
|
1410
|
+
* Teleport/Suspense are renderer primitives (`__isTeleport` / `__isSuspense`),
|
|
1411
|
+
* not regular components with their own render pipeline.
|
|
1412
|
+
*
|
|
1413
|
+
* We wrap them with a tiny functional bridge so they can pass through the
|
|
1414
|
+
* interop component mount path while preserving built-in vnode semantics.
|
|
1415
|
+
*/
|
|
1416
|
+
function shouldUseRendererBridge(component) {
|
|
1417
|
+
return !!(component.__isTeleport || component.__isSuspense);
|
|
1418
|
+
}
|
|
1419
|
+
function ensureRendererBridge(component) {
|
|
1420
|
+
let bridge = rendererBridgeCache.get(component);
|
|
1421
|
+
if (!bridge) rendererBridgeCache.set(component, bridge = (props, { slots }) => createVNode(component, props, slots));
|
|
1422
|
+
return bridge;
|
|
1423
|
+
}
|
|
1396
1424
|
/**
|
|
1397
1425
|
* Mount vdom slot in vapor
|
|
1398
1426
|
*/
|
|
1399
1427
|
function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallback) {
|
|
1428
|
+
const suspense = parentSuspense || parentComponent.suspense;
|
|
1400
1429
|
const frag = new VaporFragment([]);
|
|
1401
1430
|
if (fallback && !frag.fallback) frag.fallback = fallback;
|
|
1402
1431
|
let isMounted = false;
|
|
@@ -1458,7 +1487,7 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
1458
1487
|
remove(currentBlock, parentNode);
|
|
1459
1488
|
currentBlock = null;
|
|
1460
1489
|
}
|
|
1461
|
-
internals.p(currentVNode, resolved, parentNode, anchor, parentComponent,
|
|
1490
|
+
internals.p(currentVNode, resolved, parentNode, anchor, parentComponent, suspense, void 0, resolved.slotScopeIds);
|
|
1462
1491
|
currentVNode = resolved;
|
|
1463
1492
|
frag.nodes = resolved.el;
|
|
1464
1493
|
return;
|
|
@@ -1889,8 +1918,8 @@ function getScopeOwner() {
|
|
|
1889
1918
|
* Wrap a slot function to track the slot owner.
|
|
1890
1919
|
*
|
|
1891
1920
|
* This ensures:
|
|
1892
|
-
* 1. createSlot gets rawSlots from the correct
|
|
1893
|
-
* 2.
|
|
1921
|
+
* 1. createSlot gets rawSlots from the correct instance (slot owner)
|
|
1922
|
+
* 2. elements inherit the slot owner's scopeId
|
|
1894
1923
|
*/
|
|
1895
1924
|
function withVaporCtx(fn) {
|
|
1896
1925
|
const owner = getScopeOwner();
|
|
@@ -1996,6 +2025,8 @@ var RenderEffect = class extends ReactiveEffect {
|
|
|
1996
2025
|
}
|
|
1997
2026
|
this.job = job;
|
|
1998
2027
|
this.i = instance;
|
|
2028
|
+
this.flags |= 128;
|
|
2029
|
+
this.job.flags |= 2;
|
|
1999
2030
|
}
|
|
2000
2031
|
fn() {
|
|
2001
2032
|
const instance = this.i;
|
|
@@ -2131,16 +2162,19 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2131
2162
|
const scope = keepAliveCtx && keepAliveCtx.getScope(this.current);
|
|
2132
2163
|
if (scope) this.scope = scope;
|
|
2133
2164
|
else this.scope = new EffectScope$1();
|
|
2134
|
-
const
|
|
2135
|
-
const
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
const
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2165
|
+
const prevSlotOwner = setCurrentSlotOwner(this.slotOwner);
|
|
2166
|
+
const prevKeepAliveCtx = setCurrentKeepAliveCtx(keepAliveCtx);
|
|
2167
|
+
const needBranchKey = keepAliveCtx && this.keyed;
|
|
2168
|
+
const prevBranchKey = needBranchKey ? keepAliveCtx.setCurrentBranchKey(this.current) : void 0;
|
|
2169
|
+
const prevInstance = setCurrentInstance(instance);
|
|
2170
|
+
try {
|
|
2171
|
+
this.nodes = this.scope.run(render) || [];
|
|
2172
|
+
} finally {
|
|
2173
|
+
setCurrentInstance(...prevInstance);
|
|
2174
|
+
if (needBranchKey) keepAliveCtx.setCurrentBranchKey(prevBranchKey);
|
|
2175
|
+
setCurrentKeepAliveCtx(prevKeepAliveCtx);
|
|
2176
|
+
setCurrentSlotOwner(prevSlotOwner);
|
|
2177
|
+
}
|
|
2144
2178
|
if (this.keyed) setKey(this.nodes, this.current);
|
|
2145
2179
|
if (transition) this.$transition = applyTransitionHooks(this.nodes, transition);
|
|
2146
2180
|
if (keepAliveCtx) keepAliveCtx.processShapeFlag(this.nodes);
|
|
@@ -2357,7 +2391,7 @@ var TeleportFragment = class extends VaporFragment {
|
|
|
2357
2391
|
};
|
|
2358
2392
|
this.rawProps = props;
|
|
2359
2393
|
this.rawSlots = slots;
|
|
2360
|
-
this.parentComponent =
|
|
2394
|
+
this.parentComponent = getScopeOwner();
|
|
2361
2395
|
this.anchor = isHydrating$1 ? void 0 : !!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("teleport end") : /* @__PURE__ */ createTextNode();
|
|
2362
2396
|
renderEffect(() => {
|
|
2363
2397
|
const prevTo = this.resolvedProps && this.resolvedProps.to;
|
|
@@ -3187,9 +3221,7 @@ function defineVaporAsyncComponent(source) {
|
|
|
3187
3221
|
}
|
|
3188
3222
|
function createInnerComp(comp, parent, frag) {
|
|
3189
3223
|
const { rawProps, rawSlots, appContext } = parent;
|
|
3190
|
-
|
|
3191
|
-
frag && frag.setAsyncRef && frag.setAsyncRef(instance);
|
|
3192
|
-
return instance;
|
|
3224
|
+
return createComponent(comp, rawProps, rawSlots, void 0, void 0, appContext);
|
|
3193
3225
|
}
|
|
3194
3226
|
|
|
3195
3227
|
//#endregion
|
|
@@ -3385,7 +3417,7 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
3385
3417
|
const canUseFastRemove = !!(flags & 1);
|
|
3386
3418
|
const isComponent = !!(flags & 2);
|
|
3387
3419
|
const selectors = [];
|
|
3388
|
-
const
|
|
3420
|
+
const slotOwner = currentSlotOwner;
|
|
3389
3421
|
if (!!(process.env.NODE_ENV !== "production") && !instance) warn("createFor() can only be used inside setup()");
|
|
3390
3422
|
const renderList = () => {
|
|
3391
3423
|
const source = normalizeSource(src());
|
|
@@ -3409,7 +3441,6 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
3409
3441
|
}
|
|
3410
3442
|
}
|
|
3411
3443
|
} else {
|
|
3412
|
-
const prevOwner = setCurrentSlotOwner(scopeOwner);
|
|
3413
3444
|
parent = parent || parentAnchor.parentNode;
|
|
3414
3445
|
if (!oldLength) {
|
|
3415
3446
|
if (frag.fallback && frag.nodes[0].length > 0) remove(frag.nodes[0], parent);
|
|
@@ -3566,7 +3597,6 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
3566
3597
|
for (const block of newBlocks) block.prevAnchor = block.next = block.prev = void 0;
|
|
3567
3598
|
}
|
|
3568
3599
|
}
|
|
3569
|
-
setCurrentSlotOwner(prevOwner);
|
|
3570
3600
|
}
|
|
3571
3601
|
if (!isFallback) {
|
|
3572
3602
|
frag.nodes = [oldBlocks = newBlocks];
|
|
@@ -3606,7 +3636,15 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
3606
3636
|
};
|
|
3607
3637
|
if (setup) setup({ createSelector });
|
|
3608
3638
|
if (flags & 4) renderList();
|
|
3609
|
-
else renderEffect(
|
|
3639
|
+
else renderEffect(() => {
|
|
3640
|
+
if (!isMounted) return renderList();
|
|
3641
|
+
const prevOwner = setCurrentSlotOwner(slotOwner);
|
|
3642
|
+
try {
|
|
3643
|
+
renderList();
|
|
3644
|
+
} finally {
|
|
3645
|
+
setCurrentSlotOwner(prevOwner);
|
|
3646
|
+
}
|
|
3647
|
+
});
|
|
3610
3648
|
if (!isHydrating$1) {
|
|
3611
3649
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3612
3650
|
} else advanceHydrationNode(_isLastInsertion ? _insertionParent : parentAnchor);
|
|
@@ -3746,7 +3784,16 @@ function ensureCleanup(el) {
|
|
|
3746
3784
|
function createTemplateRefSetter() {
|
|
3747
3785
|
const instance = currentInstance$1;
|
|
3748
3786
|
const oldRefMap = /* @__PURE__ */ new WeakMap();
|
|
3787
|
+
const setRefMap = /* @__PURE__ */ new WeakMap();
|
|
3749
3788
|
return (el, ref, refFor, refKey) => {
|
|
3789
|
+
if (isDynamicFragment(el) || isVaporComponent(el) && isAsyncWrapper(el)) {
|
|
3790
|
+
const frag = isDynamicFragment(el) ? el : el.block;
|
|
3791
|
+
const doSet = () => oldRefMap.set(el, setRef$1(instance, el, ref, oldRefMap.get(el), refFor, refKey));
|
|
3792
|
+
const prevSet = setRefMap.get(frag);
|
|
3793
|
+
if (prevSet && frag.onUpdated) remove$1(frag.onUpdated, prevSet);
|
|
3794
|
+
(frag.onUpdated || (frag.onUpdated = [])).push(doSet);
|
|
3795
|
+
setRefMap.set(frag, doSet);
|
|
3796
|
+
}
|
|
3750
3797
|
const oldRef = setRef$1(instance, el, ref, oldRefMap.get(el), refFor, refKey);
|
|
3751
3798
|
oldRefMap.set(el, oldRef);
|
|
3752
3799
|
return oldRef;
|
|
@@ -3757,17 +3804,13 @@ function createTemplateRefSetter() {
|
|
|
3757
3804
|
*/
|
|
3758
3805
|
function setRef$1(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
3759
3806
|
if (!instance || instance.isUnmounted) return;
|
|
3760
|
-
if (isFragment(el) && el.setRef) {
|
|
3807
|
+
if (isInteropEnabled && isFragment(el) && el.setRef) {
|
|
3761
3808
|
el.setRef(instance, ref, refFor, refKey);
|
|
3762
3809
|
return;
|
|
3763
3810
|
}
|
|
3764
3811
|
if (isVaporComponent(el) && isAsyncWrapper(el)) {
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
frag.setAsyncRef = (i) => setRef$1(instance, i, ref, oldRef, refFor);
|
|
3768
|
-
return;
|
|
3769
|
-
}
|
|
3770
|
-
el = frag.nodes;
|
|
3812
|
+
if (!el.type.__asyncResolved) return;
|
|
3813
|
+
el = el.block.nodes;
|
|
3771
3814
|
}
|
|
3772
3815
|
const setupState = !!(process.env.NODE_ENV !== "production") ? instance.setupState || {} : null;
|
|
3773
3816
|
const refValue = getRefValue(el);
|
|
@@ -3784,11 +3827,17 @@ function setRef$1(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
3784
3827
|
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(oldRef)) setupState[oldRef] = null;
|
|
3785
3828
|
} else if (isRef$1(oldRef)) {
|
|
3786
3829
|
if (canSetRef(oldRef)) oldRef.value = null;
|
|
3830
|
+
} else if (isFunction(oldRef) && isDynamicFragment(el)) callWithErrorHandling(oldRef, instance, 12, [null, refs]);
|
|
3831
|
+
} else if (oldRef != null && isDynamicFragment(el)) {
|
|
3832
|
+
if (isFunction(oldRef)) callWithErrorHandling(oldRef, instance, 12, [null, refs]);
|
|
3833
|
+
else if (refFor) {
|
|
3834
|
+
const cleanup = refCleanups.get(el);
|
|
3835
|
+
if (cleanup) cleanup.fn();
|
|
3787
3836
|
}
|
|
3788
3837
|
}
|
|
3789
3838
|
if (isFunction(ref)) {
|
|
3790
3839
|
const invokeRefSetter = (value) => {
|
|
3791
|
-
callWithErrorHandling(ref,
|
|
3840
|
+
callWithErrorHandling(ref, instance, 12, [value, refs]);
|
|
3792
3841
|
};
|
|
3793
3842
|
invokeRefSetter(refValue);
|
|
3794
3843
|
ensureCleanup(el).fn = () => invokeRefSetter(null);
|
|
@@ -3840,7 +3889,11 @@ function setRef$1(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
3840
3889
|
}
|
|
3841
3890
|
const getRefValue = (el) => {
|
|
3842
3891
|
if (isVaporComponent(el)) return getExposed(el) || el;
|
|
3843
|
-
else if (el
|
|
3892
|
+
else if (isTeleportFragment(el)) return null;
|
|
3893
|
+
else if (isDynamicFragment(el)) {
|
|
3894
|
+
if (isArray(el.nodes)) return null;
|
|
3895
|
+
return getRefValue(el.nodes);
|
|
3896
|
+
}
|
|
3844
3897
|
return el;
|
|
3845
3898
|
};
|
|
3846
3899
|
|
|
@@ -3864,6 +3917,7 @@ function setVarsOnBlock(block, vars) {
|
|
|
3864
3917
|
if (block instanceof Node) setVarsOnNode(block, vars);
|
|
3865
3918
|
else if (isArray(block)) block.forEach((child) => setVarsOnBlock(child, vars));
|
|
3866
3919
|
else if (isVaporComponent(block)) setVarsOnBlock(block.block, vars);
|
|
3920
|
+
else if (isTeleportFragment(block)) return;
|
|
3867
3921
|
else setVarsOnBlock(block.nodes, vars);
|
|
3868
3922
|
}
|
|
3869
3923
|
|
|
@@ -3875,6 +3929,7 @@ function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once)
|
|
|
3875
3929
|
const _isLastInsertion = isLastInsertion;
|
|
3876
3930
|
if (!isHydrating$1) resetInsertionState();
|
|
3877
3931
|
const frag = isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("dynamic-component") : new DynamicFragment();
|
|
3932
|
+
const scopeOwner = getScopeOwner();
|
|
3878
3933
|
const renderFn = () => {
|
|
3879
3934
|
const value = getter();
|
|
3880
3935
|
const appContext = currentInstance && currentInstance.appContext || emptyContext;
|
|
@@ -3892,7 +3947,7 @@ function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once)
|
|
|
3892
3947
|
}
|
|
3893
3948
|
return frag;
|
|
3894
3949
|
}
|
|
3895
|
-
return createComponentWithFallback(resolveDynamicComponent(value), rawProps, rawSlots, isSingleRoot, once, appContext);
|
|
3950
|
+
return createComponentWithFallback(withScopeOwner(scopeOwner, () => resolveDynamicComponent(value)), rawProps, rawSlots, isSingleRoot, once, appContext);
|
|
3896
3951
|
}, value);
|
|
3897
3952
|
};
|
|
3898
3953
|
if (once) renderFn();
|
|
@@ -3902,6 +3957,14 @@ function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once)
|
|
|
3902
3957
|
} else if (_isLastInsertion) advanceHydrationNode(_insertionParent);
|
|
3903
3958
|
return frag;
|
|
3904
3959
|
}
|
|
3960
|
+
function withScopeOwner(owner, fn) {
|
|
3961
|
+
const prev = setCurrentRenderingInstance(owner);
|
|
3962
|
+
try {
|
|
3963
|
+
return fn();
|
|
3964
|
+
} finally {
|
|
3965
|
+
setCurrentRenderingInstance(prev);
|
|
3966
|
+
}
|
|
3967
|
+
}
|
|
3905
3968
|
|
|
3906
3969
|
//#endregion
|
|
3907
3970
|
//#region packages/runtime-vapor/src/directives/vShow.ts
|
|
@@ -4030,7 +4093,8 @@ const VaporTransitionGroupImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
4030
4093
|
tag: String,
|
|
4031
4094
|
moveClass: String
|
|
4032
4095
|
}),
|
|
4033
|
-
setup(props, { slots }) {
|
|
4096
|
+
setup(props, { slots, expose }) {
|
|
4097
|
+
expose();
|
|
4034
4098
|
ensureTransitionHooksRegistered();
|
|
4035
4099
|
const instance = currentInstance;
|
|
4036
4100
|
const state = useTransitionState();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/runtime-vapor",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.7",
|
|
4
4
|
"description": "@vue/runtime-vapor",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/runtime-vapor.esm-bundler.js",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/vuejs/core/tree/dev/packages/runtime-vapor#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@vue/shared": "3.6.0-beta.
|
|
42
|
-
"@vue/reactivity": "3.6.0-beta.
|
|
41
|
+
"@vue/shared": "3.6.0-beta.7",
|
|
42
|
+
"@vue/reactivity": "3.6.0-beta.7"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@vue/runtime-dom": "3.6.0-beta.
|
|
45
|
+
"@vue/runtime-dom": "3.6.0-beta.7"
|
|
46
46
|
}
|
|
47
47
|
}
|