@vue/runtime-vapor 3.6.0-beta.2 → 3.6.0-beta.3
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 +6 -4
- package/dist/runtime-vapor.esm-bundler.js +210 -89
- package/package.json +4 -4
package/dist/runtime-vapor.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { VNode, GenericComponentInstance, TransitionHooks, TransitionState, TransitionProps, Plugin, SchedulerJob, EmitsOptions, ComponentObjectPropsOptions, ExtractPropTypes, ReservedProps, AllowedComponentProps, ComponentCustomProps, EmitsToProps, ExtractDefaultPropTypes, EmitFn, ComponentTypeEmits, TypeEmitsToOptions, GenericAppContext, EffectScope as EffectScope$1, ShallowUnwrapRef, SuspenseBoundary, LifecycleHook, NormalizedPropsOptions, ObjectEmitsOptions, ComponentInternalOptions, AsyncComponentInternalOptions, ComponentPropsOptions, CreateAppFunction, AsyncComponentLoader, AsyncComponentOptions, DirectiveModifiers, CustomElementOptions, VueElementBase } from '@vue/runtime-dom';
|
|
1
|
+
import { VNode, GenericComponentInstance, TransitionHooks, TransitionState, TransitionProps, Plugin, SchedulerJob, EmitsOptions, ComponentObjectPropsOptions, ExtractPropTypes, ReservedProps, AllowedComponentProps, ComponentCustomProps, EmitsToProps, ExtractDefaultPropTypes, EmitFn, ComponentTypeEmits, TypeEmitsToOptions, GenericAppContext, EffectScope as EffectScope$1, ShallowUnwrapRef, SuspenseBoundary, LifecycleHook, NormalizedPropsOptions, ObjectEmitsOptions, ComponentInternalOptions, AsyncComponentInternalOptions, ComponentPropsOptions, NULL_DYNAMIC_COMPONENT, CreateAppFunction, AsyncComponentLoader, AsyncComponentOptions, DirectiveModifiers, CustomElementOptions, VueElementBase } from '@vue/runtime-dom';
|
|
2
2
|
import { Ref, EffectScope, ReactiveEffect, ShallowRef } from '@vue/reactivity';
|
|
3
3
|
import { Prettify, IsKeyValues, Namespace, NormalizedStyle } from '@vue/shared';
|
|
4
4
|
|
|
5
5
|
type NodeRef = string | Ref | ((ref: Element | VaporComponentInstance, refs: Record<string, any>) => void);
|
|
6
6
|
type RefEl = Element | VaporComponentInstance;
|
|
7
|
-
type setRefFn = (el: RefEl, ref: NodeRef,
|
|
7
|
+
type setRefFn = (el: RefEl, ref: NodeRef, refFor?: boolean, refKey?: string) => NodeRef | undefined;
|
|
8
8
|
export declare function createTemplateRefSetter(): setRefFn;
|
|
9
9
|
|
|
10
10
|
export declare class VaporFragment<T extends Block = Block> implements TransitionOptions {
|
|
@@ -35,13 +35,14 @@ declare class DynamicFragment extends VaporFragment {
|
|
|
35
35
|
};
|
|
36
36
|
fallback?: BlockFn;
|
|
37
37
|
anchorLabel?: string;
|
|
38
|
+
keyed?: boolean;
|
|
38
39
|
attrs?: Record<string, any>;
|
|
39
40
|
setAsyncRef?: (instance: VaporComponentInstance) => void;
|
|
40
41
|
getScope?: (key: any) => EffectScope | undefined;
|
|
41
42
|
onBeforeTeardown?: ((oldKey: any, nodes: Block, scope: EffectScope) => boolean)[];
|
|
42
43
|
onBeforeMount?: ((newKey: any, nodes: Block, scope: EffectScope) => void)[];
|
|
43
44
|
slotOwner: VaporComponentInstance | null;
|
|
44
|
-
constructor(anchorLabel?: string);
|
|
45
|
+
constructor(anchorLabel?: string, keyed?: boolean);
|
|
45
46
|
update(render?: BlockFn, key?: any): void;
|
|
46
47
|
renderBranch(render: BlockFn | undefined, transition: VaporTransitionHooks | undefined, parent: ParentNode | null, instance: GenericComponentInstance | null): void;
|
|
47
48
|
hydrate: (isEmpty?: boolean) => void;
|
|
@@ -130,6 +131,7 @@ declare class TeleportFragment extends VaporFragment {
|
|
|
130
131
|
constructor(props: LooseRawProps, slots: LooseRawSlots);
|
|
131
132
|
get parent(): ParentNode | null;
|
|
132
133
|
private initChildren;
|
|
134
|
+
private registerUpdateCssVars;
|
|
133
135
|
private handleChildrenUpdate;
|
|
134
136
|
private mount;
|
|
135
137
|
private mountToTarget;
|
|
@@ -313,7 +315,7 @@ export declare function isVaporComponent(value: unknown): value is VaporComponen
|
|
|
313
315
|
* and needs rely on runtime resolution - where it might fallback to a plain
|
|
314
316
|
* element if the resolution fails.
|
|
315
317
|
*/
|
|
316
|
-
export declare function createComponentWithFallback(comp: VaporComponent | string, rawProps?: LooseRawProps | null, rawSlots?: LooseRawSlots | null, isSingleRoot?: boolean, once?: boolean, appContext?: GenericAppContext): HTMLElement | VaporComponentInstance;
|
|
318
|
+
export declare function createComponentWithFallback(comp: VaporComponent | typeof NULL_DYNAMIC_COMPONENT | string, rawProps?: LooseRawProps | null, rawSlots?: LooseRawSlots | null, isSingleRoot?: boolean, once?: boolean, appContext?: GenericAppContext): HTMLElement | VaporComponentInstance;
|
|
317
319
|
export declare function createPlainElement(comp: string, rawProps?: LooseRawProps | null, rawSlots?: LooseRawSlots | null, isSingleRoot?: boolean, once?: boolean): HTMLElement;
|
|
318
320
|
|
|
319
321
|
export declare const createVaporApp: CreateAppFunction<ParentNode, VaporComponent>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/runtime-vapor v3.6.0-beta.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { queuePostFlushCb, isMismatchAllowed, warn, callWithAsyncErrorHandling, currentInstance, unsafeToTrustedHTML, patchStyle, xlinkNS, mergeProps, shouldSetAsProp, toClassSet, isSetEqual, warnPropMismatch, toStyleMap, vShowHidden, isMapEqual, isValidHtmlOrSvgAttribute, getAttributeMismatch, TransitionPropsValidators, isAsyncWrapper, getComponentName, isTemplateNode, checkTransitionMode, resolveTransitionProps, useTransitionState, baseResolveTransitionHooks, leaveCbKey, watch, onMounted, onUpdated, onBeforeUnmount, matches, devtoolsComponentAdded, resetShapeFlag,
|
|
6
|
+
import { queuePostFlushCb, isMismatchAllowed, warn, callWithAsyncErrorHandling, currentInstance, unsafeToTrustedHTML, patchStyle, xlinkNS, mergeProps, shouldSetAsProp, toClassSet, isSetEqual, warnPropMismatch, toStyleMap, vShowHidden, isMapEqual, isValidHtmlOrSvgAttribute, getAttributeMismatch, TransitionPropsValidators, isAsyncWrapper, getComponentName, isTemplateNode, checkTransitionMode, resolveTransitionProps, useTransitionState, baseResolveTransitionHooks, leaveCbKey, watch, onMounted, onUpdated, onBeforeUnmount, matches, devtoolsComponentAdded, resetShapeFlag, ensureRenderer, shallowRef, simpleSetCurrentInstance, isKeepAlive, onScopeDispose, activate as activate$1, setTransitionHooks as setTransitionHooks$1, renderSlot, ensureVaporSlotFallback, createVNode, shallowReactive, createInternalObject, isEmitListener, normalizeRef, setRef as setRef$1, ensureHydrationRenderer, deactivate as deactivate$1, isVNode, baseEmit, baseNormalizePropsOptions, pushWarningContext, validateProps, popWarningContext, setCurrentInstance, resolvePropValue, isRef, startMeasure, queueJob, warnExtraneousAttributes, resolveTeleportTarget, isTeleportDisabled, isTeleportDeferred, performTransitionEnter, performTransitionLeave, getInheritedScopeIds, registerHMR, endMeasure, NULL_DYNAMIC_COMPONENT, unregisterHMR, nextUid, EffectScope as EffectScope$1, expose, callWithErrorHandling, markAsyncBoundary, getFunctionalFallthrough, createAppAPI, initFeatureFlags, setDevtoolsHook, flushOnAppMount, normalizeContainer, createAsyncComponentContext, useAsyncComponentState, performAsyncHydrate, handleError, VueElementBase, createCanSetSetupRefChecker, baseUseCssVars, setVarsOnNode, resolveDynamicComponent, vShowOriginalDisplay, vModelTextInit, vModelCheckboxInit, vModelSelectInit, vModelTextUpdate, vModelCheckboxUpdate, vModelGetValue, vModelSetSelected, onBeforeUpdate, hasCSSTransform, callPendingCbs, forceReflow, handleMovedChildren, baseApplyTranslation } from '@vue/runtime-dom';
|
|
7
7
|
import { isArray, normalizeClass, normalizeStyle, includeBooleanAttr, toDisplayString, isString, parseStringStyle, isOn, canSetValueDirectly, camelize, stringifyStyle, normalizeCssVarValue, getEscapedCssVarName, isFunction, extend, invokeArrayFns, isReservedProp, EMPTY_OBJ, hasOwn, EMPTY_ARR, NO, YES, isPromise, getGlobalThis, isPlainObject, isObject, remove as remove$1, NOOP, looseEqual } from '@vue/shared';
|
|
8
8
|
import { onEffectCleanup, computed, onScopeDispose as onScopeDispose$1, pauseTracking, resetTracking, ReactiveEffect, setActiveSub, EffectScope, markRaw, unref, proxyRefs, toRaw, watch as watch$1, isReactive, isShallow, shallowReadArray, isReadonly, toReadonly, toReactive, shallowRef as shallowRef$1, isRef as isRef$1, traverse } from '@vue/reactivity';
|
|
9
9
|
|
|
@@ -1161,17 +1161,26 @@ const KeepAliveImpl = defineVaporComponent({
|
|
|
1161
1161
|
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
1162
1162
|
keepAliveInstance.__v_cache = cache;
|
|
1163
1163
|
}
|
|
1164
|
-
keepAliveInstance.
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1164
|
+
keepAliveInstance.ctx = {
|
|
1165
|
+
getStorageContainer: () => storageContainer,
|
|
1166
|
+
getCachedComponent: (comp) => cache.get(comp),
|
|
1167
|
+
activate: (instance, parentNode, anchor) => {
|
|
1168
|
+
current = instance;
|
|
1169
|
+
activate(instance, parentNode, anchor);
|
|
1170
|
+
},
|
|
1171
|
+
deactivate: (instance) => {
|
|
1172
|
+
current = void 0;
|
|
1173
|
+
deactivate(instance, storageContainer);
|
|
1174
|
+
},
|
|
1175
|
+
// called when async component resolves to evaluate caching
|
|
1176
|
+
onAsyncResolve: (asyncWrapper) => {
|
|
1177
|
+
if (shouldCache(asyncWrapper, props, false)) {
|
|
1178
|
+
asyncWrapper.shapeFlag |= 256;
|
|
1179
|
+
innerCacheBlock(asyncWrapper.type, asyncWrapper);
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1173
1182
|
};
|
|
1174
|
-
const innerCacheBlock = (key,
|
|
1183
|
+
const innerCacheBlock = (key, block) => {
|
|
1175
1184
|
const { max } = props;
|
|
1176
1185
|
if (cache.has(key)) {
|
|
1177
1186
|
keys.delete(key);
|
|
@@ -1182,8 +1191,8 @@ const KeepAliveImpl = defineVaporComponent({
|
|
|
1182
1191
|
pruneCacheEntry(keys.values().next().value);
|
|
1183
1192
|
}
|
|
1184
1193
|
}
|
|
1185
|
-
cache.set(key,
|
|
1186
|
-
current =
|
|
1194
|
+
cache.set(key, block);
|
|
1195
|
+
current = block;
|
|
1187
1196
|
};
|
|
1188
1197
|
const cacheBlock = () => {
|
|
1189
1198
|
const block = keepAliveInstance.block;
|
|
@@ -1210,19 +1219,6 @@ const KeepAliveImpl = defineVaporComponent({
|
|
|
1210
1219
|
}
|
|
1211
1220
|
return true;
|
|
1212
1221
|
};
|
|
1213
|
-
const cacheFragment = (fragment) => {
|
|
1214
|
-
const [innerBlock, interop] = getInnerBlock(fragment.nodes);
|
|
1215
|
-
if (!innerBlock || !shouldCache(innerBlock, props, interop)) return;
|
|
1216
|
-
let key;
|
|
1217
|
-
if (interop) {
|
|
1218
|
-
innerBlock.vnode.shapeFlag |= 256;
|
|
1219
|
-
key = innerBlock.vnode.type;
|
|
1220
|
-
} else {
|
|
1221
|
-
innerBlock.shapeFlag |= 256;
|
|
1222
|
-
key = innerBlock.type;
|
|
1223
|
-
}
|
|
1224
|
-
innerCacheBlock(key, innerBlock);
|
|
1225
|
-
};
|
|
1226
1222
|
const pruneCache = (filter) => {
|
|
1227
1223
|
cache.forEach((cached, key) => {
|
|
1228
1224
|
const instance = getInstanceFromCache(cached);
|
|
@@ -1293,7 +1289,7 @@ const KeepAliveImpl = defineVaporComponent({
|
|
|
1293
1289
|
}
|
|
1294
1290
|
);
|
|
1295
1291
|
(frag.onBeforeMount || (frag.onBeforeMount = [])).push(
|
|
1296
|
-
() =>
|
|
1292
|
+
() => processFragment(frag)
|
|
1297
1293
|
);
|
|
1298
1294
|
frag.getScope = (key) => {
|
|
1299
1295
|
const scope = keptAliveScopes.get(key);
|
|
@@ -1325,7 +1321,7 @@ const shouldCache = (block, props, interop = false) => {
|
|
|
1325
1321
|
const isAsync = !interop && isAsyncWrapper(block);
|
|
1326
1322
|
const type = interop ? block.vnode.type : block.type;
|
|
1327
1323
|
if (isAsync && !type.__asyncResolved) {
|
|
1328
|
-
return
|
|
1324
|
+
return false;
|
|
1329
1325
|
}
|
|
1330
1326
|
const { include, exclude } = props;
|
|
1331
1327
|
const name = getComponentName(isAsync ? type.__asyncResolved : type);
|
|
@@ -1377,16 +1373,6 @@ function deactivate(instance, container) {
|
|
|
1377
1373
|
devtoolsComponentAdded(instance);
|
|
1378
1374
|
}
|
|
1379
1375
|
}
|
|
1380
|
-
function findParentKeepAlive(instance) {
|
|
1381
|
-
let parent = instance;
|
|
1382
|
-
while (parent) {
|
|
1383
|
-
if (isKeepAlive(parent)) {
|
|
1384
|
-
return parent;
|
|
1385
|
-
}
|
|
1386
|
-
parent = parent.parent;
|
|
1387
|
-
}
|
|
1388
|
-
return null;
|
|
1389
|
-
}
|
|
1390
1376
|
|
|
1391
1377
|
let parentSuspense = null;
|
|
1392
1378
|
function setParentSuspense(suspense) {
|
|
@@ -1400,10 +1386,11 @@ function setParentSuspense(suspense) {
|
|
|
1400
1386
|
const interopKey = /* @__PURE__ */ Symbol(`interop`);
|
|
1401
1387
|
const vaporInteropImpl = {
|
|
1402
1388
|
mount(vnode, container, anchor, parentComponent, parentSuspense) {
|
|
1403
|
-
let selfAnchor = vnode.
|
|
1389
|
+
let selfAnchor = vnode.anchor = createTextNode();
|
|
1404
1390
|
if (isHydrating) {
|
|
1405
1391
|
queuePostFlushCb(() => container.insertBefore(selfAnchor, anchor));
|
|
1406
1392
|
} else {
|
|
1393
|
+
vnode.el = selfAnchor;
|
|
1407
1394
|
container.insertBefore(selfAnchor, anchor);
|
|
1408
1395
|
}
|
|
1409
1396
|
const prev = currentInstance;
|
|
@@ -1522,7 +1509,7 @@ const vaporInteropImpl = {
|
|
|
1522
1509
|
);
|
|
1523
1510
|
}
|
|
1524
1511
|
});
|
|
1525
|
-
return
|
|
1512
|
+
return vnode.anchor;
|
|
1526
1513
|
},
|
|
1527
1514
|
setTransitionHooks(component, hooks) {
|
|
1528
1515
|
setTransitionHooks(component, hooks);
|
|
@@ -1558,12 +1545,102 @@ const vaporSlotsProxyHandler = {
|
|
|
1558
1545
|
const slot = target[key];
|
|
1559
1546
|
if (isFunction(slot)) {
|
|
1560
1547
|
slot.__vapor = true;
|
|
1548
|
+
const wrapped = (props) => [
|
|
1549
|
+
renderSlot({ [key]: slot }, key, props)
|
|
1550
|
+
];
|
|
1551
|
+
wrapped.__vs = slot;
|
|
1552
|
+
return wrapped;
|
|
1561
1553
|
}
|
|
1562
1554
|
return slot;
|
|
1563
1555
|
}
|
|
1564
1556
|
};
|
|
1565
1557
|
let vdomHydrateNode;
|
|
1566
|
-
function
|
|
1558
|
+
function mountVNode(internals, vnode, parentComponent) {
|
|
1559
|
+
const frag = new VaporFragment([]);
|
|
1560
|
+
frag.vnode = vnode;
|
|
1561
|
+
let isMounted = false;
|
|
1562
|
+
const unmount = (parentNode, transition) => {
|
|
1563
|
+
if (transition) setTransitionHooks$1(vnode, transition);
|
|
1564
|
+
if (vnode.shapeFlag & 256) {
|
|
1565
|
+
if (vnode.type.__vapor) {
|
|
1566
|
+
deactivate(
|
|
1567
|
+
vnode.component,
|
|
1568
|
+
parentComponent.ctx.getStorageContainer()
|
|
1569
|
+
);
|
|
1570
|
+
} else {
|
|
1571
|
+
deactivate$1(
|
|
1572
|
+
vnode,
|
|
1573
|
+
parentComponent.ctx.getStorageContainer(),
|
|
1574
|
+
internals,
|
|
1575
|
+
parentComponent,
|
|
1576
|
+
null
|
|
1577
|
+
);
|
|
1578
|
+
}
|
|
1579
|
+
} else {
|
|
1580
|
+
internals.um(vnode, parentComponent, null, !!parentNode);
|
|
1581
|
+
}
|
|
1582
|
+
};
|
|
1583
|
+
frag.hydrate = () => {
|
|
1584
|
+
hydrateVNode(vnode, parentComponent);
|
|
1585
|
+
onScopeDispose(unmount, true);
|
|
1586
|
+
isMounted = true;
|
|
1587
|
+
frag.nodes = vnode.el;
|
|
1588
|
+
};
|
|
1589
|
+
frag.insert = (parentNode, anchor, transition) => {
|
|
1590
|
+
if (isHydrating) return;
|
|
1591
|
+
if (vnode.shapeFlag & 512) {
|
|
1592
|
+
if (vnode.type.__vapor) {
|
|
1593
|
+
activate(vnode.component, parentNode, anchor);
|
|
1594
|
+
} else {
|
|
1595
|
+
activate$1(
|
|
1596
|
+
vnode,
|
|
1597
|
+
parentNode,
|
|
1598
|
+
anchor,
|
|
1599
|
+
internals,
|
|
1600
|
+
parentComponent,
|
|
1601
|
+
null,
|
|
1602
|
+
void 0,
|
|
1603
|
+
false
|
|
1604
|
+
);
|
|
1605
|
+
}
|
|
1606
|
+
return;
|
|
1607
|
+
} else {
|
|
1608
|
+
const prev = currentInstance;
|
|
1609
|
+
simpleSetCurrentInstance(parentComponent);
|
|
1610
|
+
if (!isMounted) {
|
|
1611
|
+
if (transition) setTransitionHooks$1(vnode, transition);
|
|
1612
|
+
internals.p(
|
|
1613
|
+
null,
|
|
1614
|
+
vnode,
|
|
1615
|
+
parentNode,
|
|
1616
|
+
anchor,
|
|
1617
|
+
parentComponent,
|
|
1618
|
+
null,
|
|
1619
|
+
// parentSuspense
|
|
1620
|
+
void 0,
|
|
1621
|
+
// namespace
|
|
1622
|
+
vnode.slotScopeIds
|
|
1623
|
+
);
|
|
1624
|
+
onScopeDispose(unmount, true);
|
|
1625
|
+
isMounted = true;
|
|
1626
|
+
} else {
|
|
1627
|
+
internals.m(
|
|
1628
|
+
vnode,
|
|
1629
|
+
parentNode,
|
|
1630
|
+
anchor,
|
|
1631
|
+
2,
|
|
1632
|
+
parentComponent
|
|
1633
|
+
);
|
|
1634
|
+
}
|
|
1635
|
+
simpleSetCurrentInstance(prev);
|
|
1636
|
+
}
|
|
1637
|
+
frag.nodes = vnode.el;
|
|
1638
|
+
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
1639
|
+
};
|
|
1640
|
+
frag.remove = unmount;
|
|
1641
|
+
return frag;
|
|
1642
|
+
}
|
|
1643
|
+
function createVDOMComponent(internals, component, parentComponent, rawProps, rawSlots, isSingleRoot) {
|
|
1567
1644
|
const frag = new VaporFragment([]);
|
|
1568
1645
|
const vnode = frag.vnode = createVNode(
|
|
1569
1646
|
component,
|
|
@@ -1594,7 +1671,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1594
1671
|
if (vnode.shapeFlag & 256) {
|
|
1595
1672
|
deactivate$1(
|
|
1596
1673
|
vnode,
|
|
1597
|
-
|
|
1674
|
+
parentComponent.ctx.getStorageContainer(),
|
|
1598
1675
|
internals,
|
|
1599
1676
|
parentComponent,
|
|
1600
1677
|
null
|
|
@@ -1604,7 +1681,13 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1604
1681
|
internals.umt(vnode.component, null, !!parentNode);
|
|
1605
1682
|
};
|
|
1606
1683
|
frag.hydrate = () => {
|
|
1607
|
-
hydrateVNode(
|
|
1684
|
+
hydrateVNode(
|
|
1685
|
+
vnode,
|
|
1686
|
+
parentComponent,
|
|
1687
|
+
// skip fragment start anchor for multi-root component
|
|
1688
|
+
// to avoid mismatch
|
|
1689
|
+
!isSingleRoot
|
|
1690
|
+
);
|
|
1608
1691
|
onScopeDispose(unmount, true);
|
|
1609
1692
|
isMounted = true;
|
|
1610
1693
|
frag.nodes = vnode.el;
|
|
@@ -1774,7 +1857,8 @@ const vaporInteropPlugin = (app) => {
|
|
|
1774
1857
|
app._context.vapor = extend(vaporInteropImpl, {
|
|
1775
1858
|
vdomMount: createVDOMComponent.bind(null, internals),
|
|
1776
1859
|
vdomUnmount: internals.umt,
|
|
1777
|
-
vdomSlot: renderVDOMSlot.bind(null, internals)
|
|
1860
|
+
vdomSlot: renderVDOMSlot.bind(null, internals),
|
|
1861
|
+
vdomMountVNode: mountVNode.bind(null, internals)
|
|
1778
1862
|
});
|
|
1779
1863
|
const mount = app.mount;
|
|
1780
1864
|
app.mount = ((...args) => {
|
|
@@ -1782,18 +1866,15 @@ const vaporInteropPlugin = (app) => {
|
|
|
1782
1866
|
return mount(...args);
|
|
1783
1867
|
});
|
|
1784
1868
|
};
|
|
1785
|
-
function hydrateVNode(vnode, parentComponent) {
|
|
1869
|
+
function hydrateVNode(vnode, parentComponent, skipFragmentAnchor = false) {
|
|
1786
1870
|
locateHydrationNode();
|
|
1787
1871
|
let node = currentHydrationNode;
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
!(isVaporComponent(parentComponent) && isRef(parentComponent.rawSlots._))) {
|
|
1791
|
-
node = node.nextSibling;
|
|
1872
|
+
if (skipFragmentAnchor && isComment(node, "[")) {
|
|
1873
|
+
setCurrentHydrationNode(node = node.nextSibling);
|
|
1792
1874
|
}
|
|
1793
|
-
if (currentHydrationNode !== node) setCurrentHydrationNode(node);
|
|
1794
1875
|
if (!vdomHydrateNode) vdomHydrateNode = ensureHydrationRenderer().hydrateNode;
|
|
1795
1876
|
const nextNode = vdomHydrateNode(
|
|
1796
|
-
|
|
1877
|
+
node,
|
|
1797
1878
|
vnode,
|
|
1798
1879
|
parentComponent,
|
|
1799
1880
|
null,
|
|
@@ -1852,7 +1933,7 @@ function propGetter(rawProps, key) {
|
|
|
1852
1933
|
while (i--) {
|
|
1853
1934
|
const source = resolveSource(dynamicSources[i]);
|
|
1854
1935
|
if (hasOwn(source, key))
|
|
1855
|
-
return dynamicSources[interopKey] ? source[key] : resolveSource(source[key]);
|
|
1936
|
+
return dynamicSources[interopKey] || isOn(key) ? source[key] : resolveSource(source[key]);
|
|
1856
1937
|
}
|
|
1857
1938
|
}
|
|
1858
1939
|
return rawProps[key] && resolveSource(rawProps[key]);
|
|
@@ -2442,11 +2523,12 @@ class ForFragment extends VaporFragment {
|
|
|
2442
2523
|
}
|
|
2443
2524
|
}
|
|
2444
2525
|
class DynamicFragment extends VaporFragment {
|
|
2445
|
-
constructor(anchorLabel) {
|
|
2526
|
+
constructor(anchorLabel, keyed = false) {
|
|
2446
2527
|
super([]);
|
|
2447
2528
|
this.hydrate = (isEmpty = false) => {
|
|
2448
2529
|
hydrateDynamicFragment(this, isEmpty);
|
|
2449
2530
|
};
|
|
2531
|
+
this.keyed = keyed;
|
|
2450
2532
|
this.slotOwner = currentSlotOwner;
|
|
2451
2533
|
if (isHydrating) {
|
|
2452
2534
|
this.anchorLabel = anchorLabel;
|
|
@@ -2551,6 +2633,7 @@ class DynamicFragment extends VaporFragment {
|
|
|
2551
2633
|
this.nodes = this.scope.run(render) || [];
|
|
2552
2634
|
if (prev !== void 0) setCurrentInstance(...prev);
|
|
2553
2635
|
setCurrentSlotOwner(prevOwner);
|
|
2636
|
+
if (this.keyed) setKey(this.nodes, this.current);
|
|
2554
2637
|
if (transition) {
|
|
2555
2638
|
this.$transition = applyTransitionHooks(this.nodes, transition);
|
|
2556
2639
|
}
|
|
@@ -2615,6 +2698,19 @@ function isFragment(val) {
|
|
|
2615
2698
|
function isDynamicFragment(val) {
|
|
2616
2699
|
return val instanceof DynamicFragment;
|
|
2617
2700
|
}
|
|
2701
|
+
function setKey(block, key) {
|
|
2702
|
+
if (block instanceof Node) {
|
|
2703
|
+
block.$key = key;
|
|
2704
|
+
} else if (isVaporComponent(block)) {
|
|
2705
|
+
setKey(block.block, key);
|
|
2706
|
+
} else if (isArray(block)) {
|
|
2707
|
+
for (const b of block) {
|
|
2708
|
+
setKey(b, key);
|
|
2709
|
+
}
|
|
2710
|
+
} else {
|
|
2711
|
+
setKey(block.nodes, key);
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2618
2714
|
|
|
2619
2715
|
const VaporTeleportImpl = {
|
|
2620
2716
|
name: "VaporTeleport",
|
|
@@ -2732,19 +2828,7 @@ class TeleportFragment extends VaporFragment {
|
|
|
2732
2828
|
});
|
|
2733
2829
|
const nodes = this.nodes;
|
|
2734
2830
|
if (this.parentComponent && this.parentComponent.ut) {
|
|
2735
|
-
|
|
2736
|
-
(nodes.onUpdated || (nodes.onUpdated = [])).push(
|
|
2737
|
-
() => updateCssVars(this)
|
|
2738
|
-
);
|
|
2739
|
-
} else if (isArray(nodes)) {
|
|
2740
|
-
nodes.forEach((node) => {
|
|
2741
|
-
if (isFragment(node)) {
|
|
2742
|
-
(node.onUpdated || (node.onUpdated = [])).push(
|
|
2743
|
-
() => updateCssVars(this)
|
|
2744
|
-
);
|
|
2745
|
-
}
|
|
2746
|
-
});
|
|
2747
|
-
}
|
|
2831
|
+
this.registerUpdateCssVars(nodes);
|
|
2748
2832
|
}
|
|
2749
2833
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2750
2834
|
if (isVaporComponent(nodes)) {
|
|
@@ -2756,6 +2840,18 @@ class TeleportFragment extends VaporFragment {
|
|
|
2756
2840
|
}
|
|
2757
2841
|
}
|
|
2758
2842
|
}
|
|
2843
|
+
registerUpdateCssVars(block) {
|
|
2844
|
+
if (isFragment(block)) {
|
|
2845
|
+
(block.onUpdated || (block.onUpdated = [])).push(
|
|
2846
|
+
() => updateCssVars(this)
|
|
2847
|
+
);
|
|
2848
|
+
this.registerUpdateCssVars(block.nodes);
|
|
2849
|
+
} else if (isVaporComponent(block)) {
|
|
2850
|
+
this.registerUpdateCssVars(block.block);
|
|
2851
|
+
} else if (isArray(block)) {
|
|
2852
|
+
block.forEach((node) => this.registerUpdateCssVars(node));
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2759
2855
|
handleChildrenUpdate(children) {
|
|
2760
2856
|
if (!this.parent || isHydrating) {
|
|
2761
2857
|
this.nodes = children;
|
|
@@ -3230,9 +3326,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3230
3326
|
}
|
|
3231
3327
|
}
|
|
3232
3328
|
if (currentInstance && currentInstance.vapor && isKeepAlive(currentInstance)) {
|
|
3233
|
-
const cached = currentInstance.getCachedComponent(
|
|
3234
|
-
component
|
|
3235
|
-
);
|
|
3329
|
+
const cached = currentInstance.ctx.getCachedComponent(component);
|
|
3236
3330
|
if (cached) return cached;
|
|
3237
3331
|
}
|
|
3238
3332
|
if (appContext.vapor && !component.__vapor) {
|
|
@@ -3240,7 +3334,8 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3240
3334
|
component,
|
|
3241
3335
|
currentInstance,
|
|
3242
3336
|
rawProps,
|
|
3243
|
-
rawSlots
|
|
3337
|
+
rawSlots,
|
|
3338
|
+
isSingleRoot
|
|
3244
3339
|
);
|
|
3245
3340
|
if (!isHydrating) {
|
|
3246
3341
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
@@ -3487,6 +3582,9 @@ function isVaporComponent(value) {
|
|
|
3487
3582
|
return value instanceof VaporComponentInstance;
|
|
3488
3583
|
}
|
|
3489
3584
|
function createComponentWithFallback(comp, rawProps, rawSlots, isSingleRoot, once, appContext) {
|
|
3585
|
+
if (comp === NULL_DYNAMIC_COMPONENT) {
|
|
3586
|
+
return !!(process.env.NODE_ENV !== "production") ? createComment("ndc") : createTextNode("");
|
|
3587
|
+
}
|
|
3490
3588
|
if (!isString(comp)) {
|
|
3491
3589
|
return createComponent(
|
|
3492
3590
|
comp,
|
|
@@ -3558,7 +3656,11 @@ function mountComponent(instance, parent, anchor) {
|
|
|
3558
3656
|
return;
|
|
3559
3657
|
}
|
|
3560
3658
|
if (instance.shapeFlag & 512) {
|
|
3561
|
-
|
|
3659
|
+
instance.parent.ctx.activate(
|
|
3660
|
+
instance,
|
|
3661
|
+
parent,
|
|
3662
|
+
anchor
|
|
3663
|
+
);
|
|
3562
3664
|
return;
|
|
3563
3665
|
}
|
|
3564
3666
|
const { root, type } = instance;
|
|
@@ -3585,7 +3687,7 @@ function mountComponent(instance, parent, anchor) {
|
|
|
3585
3687
|
}
|
|
3586
3688
|
function unmountComponent(instance, parentNode) {
|
|
3587
3689
|
if (parentNode && instance.parent && instance.parent.vapor && instance.shapeFlag & 256) {
|
|
3588
|
-
|
|
3690
|
+
instance.parent.ctx.deactivate(instance);
|
|
3589
3691
|
return;
|
|
3590
3692
|
}
|
|
3591
3693
|
if (instance.isMounted && !instance.isUnmounted) {
|
|
@@ -3875,6 +3977,9 @@ function defineVaporAsyncComponent(source) {
|
|
|
3875
3977
|
);
|
|
3876
3978
|
load().then(() => {
|
|
3877
3979
|
loaded.value = true;
|
|
3980
|
+
if (instance.parent && isKeepAlive(instance.parent)) {
|
|
3981
|
+
instance.parent.ctx.onAsyncResolve(instance);
|
|
3982
|
+
}
|
|
3878
3983
|
}).catch((err) => {
|
|
3879
3984
|
onError(err);
|
|
3880
3985
|
error.value = err;
|
|
@@ -4090,7 +4195,7 @@ function createKeyedFragment(key, render) {
|
|
|
4090
4195
|
const _insertionAnchor = insertionAnchor;
|
|
4091
4196
|
const _isLastInsertion = isLastInsertion;
|
|
4092
4197
|
if (!isHydrating) resetInsertionState();
|
|
4093
|
-
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("keyed") : new DynamicFragment();
|
|
4198
|
+
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("keyed", true) : new DynamicFragment(void 0, true);
|
|
4094
4199
|
renderEffect(() => frag.update(render, key()));
|
|
4095
4200
|
if (!isHydrating) {
|
|
4096
4201
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
@@ -4583,7 +4688,12 @@ function ensureCleanup(el) {
|
|
|
4583
4688
|
}
|
|
4584
4689
|
function createTemplateRefSetter() {
|
|
4585
4690
|
const instance = currentInstance;
|
|
4586
|
-
|
|
4691
|
+
const oldRefMap = /* @__PURE__ */ new WeakMap();
|
|
4692
|
+
return (el, ref, refFor, refKey) => {
|
|
4693
|
+
const oldRef = setRef(instance, el, ref, oldRefMap.get(el), refFor, refKey);
|
|
4694
|
+
oldRefMap.set(el, oldRef);
|
|
4695
|
+
return oldRef;
|
|
4696
|
+
};
|
|
4587
4697
|
}
|
|
4588
4698
|
function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
4589
4699
|
if (!instance || instance.isUnmounted) return;
|
|
@@ -4736,20 +4846,31 @@ function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once)
|
|
|
4736
4846
|
const renderFn = () => {
|
|
4737
4847
|
const value = getter();
|
|
4738
4848
|
const appContext = currentInstance && currentInstance.appContext || emptyContext;
|
|
4739
|
-
frag.update(
|
|
4740
|
-
()
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4849
|
+
frag.update(() => {
|
|
4850
|
+
if (isBlock(value)) return value;
|
|
4851
|
+
if (appContext.vapor && isVNode(value)) {
|
|
4852
|
+
if (isKeepAlive(currentInstance)) {
|
|
4853
|
+
const frag3 = currentInstance.ctx.getCachedComponent(value.type);
|
|
4854
|
+
if (frag3) return frag3;
|
|
4855
|
+
}
|
|
4856
|
+
const frag2 = appContext.vapor.vdomMountVNode(value, currentInstance);
|
|
4857
|
+
if (isHydrating) {
|
|
4858
|
+
frag2.hydrate();
|
|
4859
|
+
if (_isLastInsertion) {
|
|
4860
|
+
advanceHydrationNode(_insertionParent);
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4863
|
+
return frag2;
|
|
4864
|
+
}
|
|
4865
|
+
return createComponentWithFallback(
|
|
4866
|
+
resolveDynamicComponent(value),
|
|
4867
|
+
rawProps,
|
|
4868
|
+
rawSlots,
|
|
4869
|
+
isSingleRoot,
|
|
4870
|
+
once,
|
|
4871
|
+
appContext
|
|
4872
|
+
);
|
|
4873
|
+
}, value);
|
|
4753
4874
|
};
|
|
4754
4875
|
if (once) renderFn();
|
|
4755
4876
|
else renderEffect(renderFn);
|
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.3",
|
|
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.3",
|
|
42
|
+
"@vue/reactivity": "3.6.0-beta.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@vue/runtime-dom": "3.6.0-beta.
|
|
45
|
+
"@vue/runtime-dom": "3.6.0-beta.3"
|
|
46
46
|
}
|
|
47
47
|
}
|