@vue/runtime-dom 3.6.0-rc.11 → 3.6.0-rc.13
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-dom.cjs.js +73 -17
- package/dist/runtime-dom.cjs.prod.js +73 -17
- package/dist/runtime-dom.esm-browser.js +321 -113
- package/dist/runtime-dom.esm-browser.prod.js +4 -4
- package/dist/runtime-dom.esm-bundler.js +77 -22
- package/dist/runtime-dom.global.js +348 -112
- package/dist/runtime-dom.global.prod.js +4 -4
- package/package.json +4 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.6.0-rc.
|
|
2
|
+
* @vue/runtime-dom v3.6.0-rc.13
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { BaseTransition, BaseTransitionPropsValidators, Fragment, Static, Text, assertNumber, callWithAsyncErrorHandling, camelize, createHydrationRenderer, createRenderer, createVNode, defineComponent, getCurrentInstance, getTransitionRawChildren, h, isRuntimeOnly, nextTick, onBeforeUpdate, onMounted, onUnmounted, onUpdated, queuePostFlushCb, resolveTransitionHooks, setIsHydratingEnabled, setTransitionHooks, toRaw, unref, useInstanceOption, useTransitionState, warn, watch } from "@vue/runtime-core";
|
|
6
|
+
import { BaseTransition, BaseTransitionPropsValidators, Fragment, Static, Text, assertNumber, callWithAsyncErrorHandling, camelize, createHydrationRenderer, createRenderer, createVNode, defineComponent, getCurrentInstance, getTransitionRawChildren, h, isRuntimeOnly, isVaporInteropEnabled, nextTick, onBeforeUpdate, onMounted, onUnmounted, onUpdated, queuePostFlushCb, resolveTransitionHooks, setIsHydratingEnabled, setTransitionHooks, toRaw, unref, useInstanceOption, useTransitionState, warn, watch, withTransitionEnabled } from "@vue/runtime-core";
|
|
7
7
|
import { EMPTY_OBJ, NOOP, camelize as camelize$1, canSetValueDirectly, capitalize, extend, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isFunction, isHTMLTag, isMathMLTag, isModelListener, isNativeOn, isObject, isOn, isPlainObject, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, looseEqual, looseIndexOf, looseToNumber, normalizeCssVarValue, shouldSetAsAttr, toNumber } from "@vue/shared";
|
|
8
8
|
export * from "@vue/runtime-core";
|
|
9
9
|
//#region packages/runtime-dom/src/nodeOps.ts
|
|
@@ -400,14 +400,14 @@ function setVarsOnVNode(vnode, vars) {
|
|
|
400
400
|
}
|
|
401
401
|
while (vnode.component) {
|
|
402
402
|
const component = vnode.component;
|
|
403
|
-
if (component.vapor) {
|
|
403
|
+
if (isVaporInteropEnabled && component.vapor) {
|
|
404
404
|
component.appContext.vapor.applyCssVars(vnode, vars);
|
|
405
405
|
return;
|
|
406
406
|
}
|
|
407
407
|
vnode = vnode.component.subTree;
|
|
408
408
|
}
|
|
409
409
|
if (vnode.shapeFlag & 1 && vnode.el) setVarsOnNode(vnode.el, vars);
|
|
410
|
-
else if (vnode.vb) vnode.ctx.appContext.vapor.applyCssVars(vnode, vars);
|
|
410
|
+
else if (isVaporInteropEnabled && vnode.vb) vnode.ctx.appContext.vapor.applyCssVars(vnode, vars);
|
|
411
411
|
else if (vnode.type === Fragment) vnode.children.forEach((c) => setVarsOnVNode(c, vars));
|
|
412
412
|
else if (vnode.type === Static) {
|
|
413
413
|
let { el, anchor } = vnode;
|
|
@@ -470,7 +470,7 @@ function patchStyle(el, prev, next) {
|
|
|
470
470
|
else el.removeAttribute("style");
|
|
471
471
|
}
|
|
472
472
|
if (vShowOriginalDisplay in el) {
|
|
473
|
-
el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
|
|
473
|
+
if (!isCssString || prev !== next) el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
|
|
474
474
|
if (el[vShowHidden]) style.display = "none";
|
|
475
475
|
}
|
|
476
476
|
}
|
|
@@ -777,7 +777,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
777
777
|
this._resolveProps(def);
|
|
778
778
|
if (this.shadowRoot) this._applyStyles(styles);
|
|
779
779
|
else if (!!(process.env.NODE_ENV !== "production") && styles) warn("Custom element style injection is not supported when using shadowRoot: false");
|
|
780
|
-
this._mountComponent(def);
|
|
780
|
+
if (this._connected) this._mountComponent(def);
|
|
781
781
|
};
|
|
782
782
|
const asyncDef = this._def.__asyncLoader;
|
|
783
783
|
if (asyncDef) {
|
|
@@ -1101,6 +1101,7 @@ const positionMap = /* @__PURE__ */ new WeakMap();
|
|
|
1101
1101
|
const newPositionMap = /* @__PURE__ */ new WeakMap();
|
|
1102
1102
|
const moveCbKey = Symbol("_moveCb");
|
|
1103
1103
|
const enterCbKey = Symbol("_enterCb");
|
|
1104
|
+
const pendingGroups = /* @__PURE__ */ new WeakMap();
|
|
1104
1105
|
/**
|
|
1105
1106
|
* Wrap logic that modifies TransitionGroup properties in a function
|
|
1106
1107
|
* so that it can be annotated as pure
|
|
@@ -1109,7 +1110,7 @@ const decorate = (t) => {
|
|
|
1109
1110
|
delete t.props.mode;
|
|
1110
1111
|
return t;
|
|
1111
1112
|
};
|
|
1112
|
-
const TransitionGroup = /* @__PURE__ */ decorate({
|
|
1113
|
+
const TransitionGroup = /*@__PURE__*/ withTransitionEnabled(/* @__PURE__ */ decorate({
|
|
1113
1114
|
name: "TransitionGroup",
|
|
1114
1115
|
props: /*@__PURE__*/ extend({}, TransitionPropsValidators, {
|
|
1115
1116
|
tag: String,
|
|
@@ -1118,17 +1119,31 @@ const TransitionGroup = /* @__PURE__ */ decorate({
|
|
|
1118
1119
|
setup(props, { slots }) {
|
|
1119
1120
|
const instance = getCurrentInstance();
|
|
1120
1121
|
const state = useTransitionState();
|
|
1122
|
+
const group = {
|
|
1123
|
+
props: {},
|
|
1124
|
+
state,
|
|
1125
|
+
instance
|
|
1126
|
+
};
|
|
1121
1127
|
let prevChildren;
|
|
1122
1128
|
let children;
|
|
1129
|
+
let origins;
|
|
1130
|
+
let moves;
|
|
1131
|
+
const willMove = () => {
|
|
1132
|
+
if (moves === void 0) moves = prevChildren.length > 0 && hasCSSTransform(prevChildren[0].el, instance.vnode.el, resolveMoveClass(props));
|
|
1133
|
+
return moves;
|
|
1134
|
+
};
|
|
1123
1135
|
onUpdated(() => {
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
if (!hasCSSTransform(prevChildren[0].el, instance.vnode.el, moveClass)) {
|
|
1136
|
+
pendingGroups.delete(instance);
|
|
1137
|
+
if (!willMove()) {
|
|
1127
1138
|
prevChildren = [];
|
|
1139
|
+
origins = void 0;
|
|
1128
1140
|
return;
|
|
1129
1141
|
}
|
|
1142
|
+
const moveClass = resolveMoveClass(props);
|
|
1130
1143
|
prevChildren.forEach((vnode) => callPendingCbs(vnode.el));
|
|
1131
|
-
|
|
1144
|
+
const shift = origins && getOriginShift(origins, instance.vnode.el);
|
|
1145
|
+
origins = void 0;
|
|
1146
|
+
prevChildren.forEach((c) => recordPosition(c, shift));
|
|
1132
1147
|
const movedChildren = prevChildren.filter(applyTranslation);
|
|
1133
1148
|
forceReflow(instance.vnode.el);
|
|
1134
1149
|
movedChildren.forEach((c) => {
|
|
@@ -1139,33 +1154,50 @@ const TransitionGroup = /* @__PURE__ */ decorate({
|
|
|
1139
1154
|
});
|
|
1140
1155
|
return () => {
|
|
1141
1156
|
const rawProps = toRaw(props);
|
|
1142
|
-
const cssTransitionProps = resolveTransitionProps(rawProps);
|
|
1157
|
+
const cssTransitionProps = group.props = resolveTransitionProps(rawProps);
|
|
1143
1158
|
let tag = rawProps.tag || Fragment;
|
|
1144
1159
|
prevChildren = [];
|
|
1160
|
+
moves = void 0;
|
|
1145
1161
|
if (children) for (let i = 0; i < children.length; i++) {
|
|
1146
1162
|
const child = children[i];
|
|
1147
1163
|
if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
|
|
1148
1164
|
prevChildren.push(child);
|
|
1149
1165
|
setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
|
|
1150
1166
|
positionMap.set(child, getPosition(child.el));
|
|
1151
|
-
}
|
|
1167
|
+
} else if (isVaporInteropEnabled && child.vs && child.vb) instance.appContext.vapor.forEachGroupChild(child, (el) => {
|
|
1168
|
+
const row = { el };
|
|
1169
|
+
prevChildren.push(row);
|
|
1170
|
+
positionMap.set(row, getPosition(el));
|
|
1171
|
+
});
|
|
1152
1172
|
}
|
|
1153
1173
|
children = slots.default ? getTransitionRawChildren(slots.default()) : [];
|
|
1154
1174
|
for (let i = 0; i < children.length; i++) {
|
|
1155
1175
|
const child = children[i];
|
|
1156
|
-
if (child.
|
|
1176
|
+
if (isVaporInteropEnabled && child.vs) child.vs.group = group;
|
|
1177
|
+
else if (child.key != null) setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
|
|
1157
1178
|
else if (!!(process.env.NODE_ENV !== "production") && child.type !== Text) warn(`<TransitionGroup> children must be keyed.`);
|
|
1158
1179
|
}
|
|
1180
|
+
if (prevChildren.length) {
|
|
1181
|
+
const root = instance.vnode.el;
|
|
1182
|
+
origins = getOrigins(instance, root);
|
|
1183
|
+
pendingGroups.set(instance, {
|
|
1184
|
+
root,
|
|
1185
|
+
willMove
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1159
1188
|
return createVNode(tag, null, children);
|
|
1160
1189
|
};
|
|
1161
1190
|
}
|
|
1162
|
-
});
|
|
1191
|
+
}));
|
|
1163
1192
|
function callPendingCbs(el) {
|
|
1164
1193
|
if (el[moveCbKey]) el[moveCbKey]();
|
|
1165
1194
|
if (el[enterCbKey]) el[enterCbKey]();
|
|
1166
1195
|
}
|
|
1167
|
-
function
|
|
1168
|
-
|
|
1196
|
+
function resolveMoveClass(props) {
|
|
1197
|
+
return props.moveClass || `${props.name || "v"}-move`;
|
|
1198
|
+
}
|
|
1199
|
+
function recordPosition(c, shift) {
|
|
1200
|
+
newPositionMap.set(c, getPosition(c.el, shift));
|
|
1169
1201
|
}
|
|
1170
1202
|
function applyTranslation(c) {
|
|
1171
1203
|
if (baseApplyTranslation(positionMap.get(c), newPositionMap.get(c), c.el)) return c;
|
|
@@ -1190,13 +1222,36 @@ function baseApplyTranslation(oldPos, newPos, el) {
|
|
|
1190
1222
|
}
|
|
1191
1223
|
return false;
|
|
1192
1224
|
}
|
|
1193
|
-
function getPosition(el) {
|
|
1225
|
+
function getPosition(el, shift) {
|
|
1194
1226
|
const rect = el.getBoundingClientRect();
|
|
1195
1227
|
return {
|
|
1196
|
-
left: rect.left,
|
|
1197
|
-
top: rect.top
|
|
1228
|
+
left: rect.left - (shift ? shift.left : 0),
|
|
1229
|
+
top: rect.top - (shift ? shift.top : 0)
|
|
1198
1230
|
};
|
|
1199
1231
|
}
|
|
1232
|
+
function getOrigins(instance, root) {
|
|
1233
|
+
let origins;
|
|
1234
|
+
for (let group = instance.parent; group; group = group.parent) {
|
|
1235
|
+
const pending = pendingGroups.get(group);
|
|
1236
|
+
if (pending) {
|
|
1237
|
+
const item = findItem(pending.root, root);
|
|
1238
|
+
if (item) (origins || (origins = [])).push(extend(getPosition(item), {
|
|
1239
|
+
item,
|
|
1240
|
+
willMove: pending.willMove
|
|
1241
|
+
}));
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
return origins;
|
|
1245
|
+
}
|
|
1246
|
+
function findItem(root, node) {
|
|
1247
|
+
const container = root.nodeType === 1 ? root : root.parentNode;
|
|
1248
|
+
while (node && node.parentNode !== container) node = node.parentNode;
|
|
1249
|
+
if (node && node.nodeType === 1) return node;
|
|
1250
|
+
}
|
|
1251
|
+
function getOriginShift(origins, root) {
|
|
1252
|
+
const origin = origins.find((o) => o.willMove() && o.item.contains(root));
|
|
1253
|
+
return origin && getPosition(origin.item, origin);
|
|
1254
|
+
}
|
|
1200
1255
|
function hasCSSTransform(el, root, moveClass) {
|
|
1201
1256
|
const clone = el.cloneNode();
|
|
1202
1257
|
const _vtc = el[vtcKey];
|
|
@@ -1277,7 +1332,7 @@ const vModelTextInit = (el, trim, number, lazy, set) => {
|
|
|
1277
1332
|
if (e.target.composing) return;
|
|
1278
1333
|
(set || el[assignKey])(castValue(el.value, trim, number || el.type === "number"));
|
|
1279
1334
|
});
|
|
1280
|
-
if (trim || number) addEventListener(el, "change", () => {
|
|
1335
|
+
if (trim || number || el.type === "number") addEventListener(el, "change", () => {
|
|
1281
1336
|
el.value = castValue(el.value, trim, number || el.type === "number");
|
|
1282
1337
|
});
|
|
1283
1338
|
if (!lazy) {
|
|
@@ -1677,4 +1732,4 @@ const initDirectivesForSSR = () => {
|
|
|
1677
1732
|
}
|
|
1678
1733
|
};
|
|
1679
1734
|
//#endregion
|
|
1680
|
-
export { Transition, TransitionGroup, TransitionPropsValidators, VueElement, VueElementBase, baseApplyTranslation, callPendingCbs, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, ensureHydrationRenderer, ensureRenderer, forceReflow, handleMovedChildren, hasCSSTransform, hydrate, initDirectivesForSSR, nodeOps, normalizeContainer, parseEventName, patchClass, patchProp, patchStyle, render, resolveTransitionProps, setVarsOnNode, shouldSetAsProp, shouldSetAsPropForVueCE, svgNS, unsafeToTrustedHTML, useCssModule, useCssVars, useHost, useShadowRoot, vModelCheckbox, vModelCheckboxInit, vModelCheckboxUpdate, vModelDynamic, getValue as vModelGetValue, vModelRadio, vModelSelect, vModelSelectInit, vModelSetSelected, vModelText, vModelTextInit, vModelTextUpdate, vShow, vShowHidden, vShowOriginalDisplay, withKeys, withModifiers, xlinkNS };
|
|
1735
|
+
export { Transition, TransitionGroup, TransitionPropsValidators, VueElement, VueElementBase, baseApplyTranslation, callPendingCbs, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, ensureHydrationRenderer, ensureRenderer, forceReflow, getOrigins as getTransitionGroupOrigins, getPosition as getTransitionGroupPosition, getOriginShift as getTransitionGroupShift, handleMovedChildren, hasCSSTransform, hydrate, initDirectivesForSSR, nodeOps, normalizeContainer, parseEventName, patchClass, patchProp, patchStyle, pendingGroups as pendingTransitionGroups, render, resolveTransitionProps, setVarsOnNode, shouldSetAsProp, shouldSetAsPropForVueCE, svgNS, unsafeToTrustedHTML, useCssModule, useCssVars, useHost, useShadowRoot, vModelCheckbox, vModelCheckboxInit, vModelCheckboxUpdate, vModelDynamic, getValue as vModelGetValue, vModelRadio, vModelSelect, vModelSelectInit, vModelSetSelected, vModelText, vModelTextInit, vModelTextUpdate, vShow, vShowHidden, vShowOriginalDisplay, withKeys, withModifiers, xlinkNS };
|