@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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.6.0-rc.11
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
  **/
@@ -398,7 +398,7 @@ function patchStyle(el, prev, next) {
398
398
  else el.removeAttribute("style");
399
399
  }
400
400
  if (vShowOriginalDisplay in el) {
401
- el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
401
+ if (!isCssString || prev !== next) el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
402
402
  if (el[vShowHidden]) style.display = "none";
403
403
  }
404
404
  }
@@ -703,7 +703,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
703
703
  this._resolveProps(def);
704
704
  if (this.shadowRoot) this._applyStyles(styles);
705
705
  else if (styles) (0, _vue_runtime_core.warn)("Custom element style injection is not supported when using shadowRoot: false");
706
- this._mountComponent(def);
706
+ if (this._connected) this._mountComponent(def);
707
707
  };
708
708
  const asyncDef = this._def.__asyncLoader;
709
709
  if (asyncDef) {
@@ -1021,6 +1021,7 @@ const positionMap = /* @__PURE__ */ new WeakMap();
1021
1021
  const newPositionMap = /* @__PURE__ */ new WeakMap();
1022
1022
  const moveCbKey = Symbol("_moveCb");
1023
1023
  const enterCbKey = Symbol("_enterCb");
1024
+ const pendingGroups = /* @__PURE__ */ new WeakMap();
1024
1025
  /**
1025
1026
  * Wrap logic that modifies TransitionGroup properties in a function
1026
1027
  * so that it can be annotated as pure
@@ -1029,7 +1030,7 @@ const decorate = (t) => {
1029
1030
  delete t.props.mode;
1030
1031
  return t;
1031
1032
  };
1032
- const TransitionGroup = /* @__PURE__ */ decorate({
1033
+ const TransitionGroupImpl = /*@__PURE__*/ decorate({
1033
1034
  name: "TransitionGroup",
1034
1035
  props: /*@__PURE__*/ (0, _vue_shared.extend)({}, TransitionPropsValidators, {
1035
1036
  tag: String,
@@ -1038,17 +1039,31 @@ const TransitionGroup = /* @__PURE__ */ decorate({
1038
1039
  setup(props, { slots }) {
1039
1040
  const instance = (0, _vue_runtime_core.getCurrentInstance)();
1040
1041
  const state = (0, _vue_runtime_core.useTransitionState)();
1042
+ const group = {
1043
+ props: {},
1044
+ state,
1045
+ instance
1046
+ };
1041
1047
  let prevChildren;
1042
1048
  let children;
1049
+ let origins;
1050
+ let moves;
1051
+ const willMove = () => {
1052
+ if (moves === void 0) moves = prevChildren.length > 0 && hasCSSTransform(prevChildren[0].el, instance.vnode.el, resolveMoveClass(props));
1053
+ return moves;
1054
+ };
1043
1055
  (0, _vue_runtime_core.onUpdated)(() => {
1044
- if (!prevChildren.length) return;
1045
- const moveClass = props.moveClass || `${props.name || "v"}-move`;
1046
- if (!hasCSSTransform(prevChildren[0].el, instance.vnode.el, moveClass)) {
1056
+ pendingGroups.delete(instance);
1057
+ if (!willMove()) {
1047
1058
  prevChildren = [];
1059
+ origins = void 0;
1048
1060
  return;
1049
1061
  }
1062
+ const moveClass = resolveMoveClass(props);
1050
1063
  prevChildren.forEach((vnode) => callPendingCbs(vnode.el));
1051
- prevChildren.forEach(recordPosition);
1064
+ const shift = origins && getOriginShift(origins, instance.vnode.el);
1065
+ origins = void 0;
1066
+ prevChildren.forEach((c) => recordPosition(c, shift));
1052
1067
  const movedChildren = prevChildren.filter(applyTranslation);
1053
1068
  forceReflow(instance.vnode.el);
1054
1069
  movedChildren.forEach((c) => {
@@ -1059,33 +1074,51 @@ const TransitionGroup = /* @__PURE__ */ decorate({
1059
1074
  });
1060
1075
  return () => {
1061
1076
  const rawProps = (0, _vue_runtime_core.toRaw)(props);
1062
- const cssTransitionProps = resolveTransitionProps(rawProps);
1077
+ const cssTransitionProps = group.props = resolveTransitionProps(rawProps);
1063
1078
  let tag = rawProps.tag || _vue_runtime_core.Fragment;
1064
1079
  prevChildren = [];
1080
+ moves = void 0;
1065
1081
  if (children) for (let i = 0; i < children.length; i++) {
1066
1082
  const child = children[i];
1067
1083
  if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
1068
1084
  prevChildren.push(child);
1069
1085
  (0, _vue_runtime_core.setTransitionHooks)(child, (0, _vue_runtime_core.resolveTransitionHooks)(child, cssTransitionProps, state, instance));
1070
1086
  positionMap.set(child, getPosition(child.el));
1071
- }
1087
+ } else if (_vue_runtime_core.isVaporInteropEnabled && child.vs && child.vb) instance.appContext.vapor.forEachGroupChild(child, (el) => {
1088
+ const row = { el };
1089
+ prevChildren.push(row);
1090
+ positionMap.set(row, getPosition(el));
1091
+ });
1072
1092
  }
1073
1093
  children = slots.default ? (0, _vue_runtime_core.getTransitionRawChildren)(slots.default()) : [];
1074
1094
  for (let i = 0; i < children.length; i++) {
1075
1095
  const child = children[i];
1076
- if (child.key != null) (0, _vue_runtime_core.setTransitionHooks)(child, (0, _vue_runtime_core.resolveTransitionHooks)(child, cssTransitionProps, state, instance));
1096
+ if (_vue_runtime_core.isVaporInteropEnabled && child.vs) child.vs.group = group;
1097
+ else if (child.key != null) (0, _vue_runtime_core.setTransitionHooks)(child, (0, _vue_runtime_core.resolveTransitionHooks)(child, cssTransitionProps, state, instance));
1077
1098
  else if (child.type !== _vue_runtime_core.Text) (0, _vue_runtime_core.warn)(`<TransitionGroup> children must be keyed.`);
1078
1099
  }
1100
+ if (prevChildren.length) {
1101
+ const root = instance.vnode.el;
1102
+ origins = getOrigins(instance, root);
1103
+ pendingGroups.set(instance, {
1104
+ root,
1105
+ willMove
1106
+ });
1107
+ }
1079
1108
  return (0, _vue_runtime_core.createVNode)(tag, null, children);
1080
1109
  };
1081
1110
  }
1082
1111
  });
1112
+ const TransitionGroup = /*@__PURE__*/ (0, _vue_runtime_core.withTransitionEnabled)(TransitionGroupImpl);
1083
1113
  function callPendingCbs(el) {
1084
1114
  if (el[moveCbKey]) el[moveCbKey]();
1085
1115
  if (el[enterCbKey]) el[enterCbKey]();
1086
1116
  }
1087
- function recordPosition(c) {
1088
- newPositionMap.set(c, getPosition(c.el));
1117
+ function resolveMoveClass(props) {
1118
+ return props.moveClass || `${props.name || "v"}-move`;
1119
+ }
1120
+ function recordPosition(c, shift) {
1121
+ newPositionMap.set(c, getPosition(c.el, shift));
1089
1122
  }
1090
1123
  function applyTranslation(c) {
1091
1124
  if (baseApplyTranslation(positionMap.get(c), newPositionMap.get(c), c.el)) return c;
@@ -1110,13 +1143,36 @@ function baseApplyTranslation(oldPos, newPos, el) {
1110
1143
  }
1111
1144
  return false;
1112
1145
  }
1113
- function getPosition(el) {
1146
+ function getPosition(el, shift) {
1114
1147
  const rect = el.getBoundingClientRect();
1115
1148
  return {
1116
- left: rect.left,
1117
- top: rect.top
1149
+ left: rect.left - (shift ? shift.left : 0),
1150
+ top: rect.top - (shift ? shift.top : 0)
1118
1151
  };
1119
1152
  }
1153
+ function getOrigins(instance, root) {
1154
+ let origins;
1155
+ for (let group = instance.parent; group; group = group.parent) {
1156
+ const pending = pendingGroups.get(group);
1157
+ if (pending) {
1158
+ const item = findItem(pending.root, root);
1159
+ if (item) (origins || (origins = [])).push((0, _vue_shared.extend)(getPosition(item), {
1160
+ item,
1161
+ willMove: pending.willMove
1162
+ }));
1163
+ }
1164
+ }
1165
+ return origins;
1166
+ }
1167
+ function findItem(root, node) {
1168
+ const container = root.nodeType === 1 ? root : root.parentNode;
1169
+ while (node && node.parentNode !== container) node = node.parentNode;
1170
+ if (node && node.nodeType === 1) return node;
1171
+ }
1172
+ function getOriginShift(origins, root) {
1173
+ const origin = origins.find((o) => o.willMove() && o.item.contains(root));
1174
+ return origin && getPosition(origin.item, origin);
1175
+ }
1120
1176
  function hasCSSTransform(el, root, moveClass) {
1121
1177
  const clone = el.cloneNode();
1122
1178
  const _vtc = el[vtcKey];
@@ -1197,7 +1253,7 @@ const vModelTextInit = (el, trim, number, lazy, set) => {
1197
1253
  if (e.target.composing) return;
1198
1254
  (set || el[assignKey])(castValue(el.value, trim, number || el.type === "number"));
1199
1255
  });
1200
- if (trim || number) addEventListener(el, "change", () => {
1256
+ if (trim || number || el.type === "number") addEventListener(el, "change", () => {
1201
1257
  el.value = castValue(el.value, trim, number || el.type === "number");
1202
1258
  });
1203
1259
  if (!lazy) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.6.0-rc.11
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
  **/
@@ -394,7 +394,7 @@ function patchStyle(el, prev, next) {
394
394
  else el.removeAttribute("style");
395
395
  }
396
396
  if (vShowOriginalDisplay in el) {
397
- el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
397
+ if (!isCssString || prev !== next) el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
398
398
  if (el[vShowHidden]) style.display = "none";
399
399
  }
400
400
  }
@@ -689,7 +689,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
689
689
  this._numberProps = numberProps;
690
690
  this._resolveProps(def);
691
691
  if (this.shadowRoot) this._applyStyles(styles);
692
- this._mountComponent(def);
692
+ if (this._connected) this._mountComponent(def);
693
693
  };
694
694
  const asyncDef = this._def.__asyncLoader;
695
695
  if (asyncDef) {
@@ -962,6 +962,7 @@ const positionMap = /* @__PURE__ */ new WeakMap();
962
962
  const newPositionMap = /* @__PURE__ */ new WeakMap();
963
963
  const moveCbKey = Symbol("_moveCb");
964
964
  const enterCbKey = Symbol("_enterCb");
965
+ const pendingGroups = /* @__PURE__ */ new WeakMap();
965
966
  /**
966
967
  * Wrap logic that modifies TransitionGroup properties in a function
967
968
  * so that it can be annotated as pure
@@ -970,7 +971,7 @@ const decorate = (t) => {
970
971
  delete t.props.mode;
971
972
  return t;
972
973
  };
973
- const TransitionGroup = /* @__PURE__ */ decorate({
974
+ const TransitionGroupImpl = /*@__PURE__*/ decorate({
974
975
  name: "TransitionGroup",
975
976
  props: /*@__PURE__*/ (0, _vue_shared.extend)({}, TransitionPropsValidators, {
976
977
  tag: String,
@@ -979,17 +980,31 @@ const TransitionGroup = /* @__PURE__ */ decorate({
979
980
  setup(props, { slots }) {
980
981
  const instance = (0, _vue_runtime_core.getCurrentInstance)();
981
982
  const state = (0, _vue_runtime_core.useTransitionState)();
983
+ const group = {
984
+ props: {},
985
+ state,
986
+ instance
987
+ };
982
988
  let prevChildren;
983
989
  let children;
990
+ let origins;
991
+ let moves;
992
+ const willMove = () => {
993
+ if (moves === void 0) moves = prevChildren.length > 0 && hasCSSTransform(prevChildren[0].el, instance.vnode.el, resolveMoveClass(props));
994
+ return moves;
995
+ };
984
996
  (0, _vue_runtime_core.onUpdated)(() => {
985
- if (!prevChildren.length) return;
986
- const moveClass = props.moveClass || `${props.name || "v"}-move`;
987
- if (!hasCSSTransform(prevChildren[0].el, instance.vnode.el, moveClass)) {
997
+ pendingGroups.delete(instance);
998
+ if (!willMove()) {
988
999
  prevChildren = [];
1000
+ origins = void 0;
989
1001
  return;
990
1002
  }
1003
+ const moveClass = resolveMoveClass(props);
991
1004
  prevChildren.forEach((vnode) => callPendingCbs(vnode.el));
992
- prevChildren.forEach(recordPosition);
1005
+ const shift = origins && getOriginShift(origins, instance.vnode.el);
1006
+ origins = void 0;
1007
+ prevChildren.forEach((c) => recordPosition(c, shift));
993
1008
  const movedChildren = prevChildren.filter(applyTranslation);
994
1009
  forceReflow(instance.vnode.el);
995
1010
  movedChildren.forEach((c) => {
@@ -1000,32 +1015,50 @@ const TransitionGroup = /* @__PURE__ */ decorate({
1000
1015
  });
1001
1016
  return () => {
1002
1017
  const rawProps = (0, _vue_runtime_core.toRaw)(props);
1003
- const cssTransitionProps = resolveTransitionProps(rawProps);
1018
+ const cssTransitionProps = group.props = resolveTransitionProps(rawProps);
1004
1019
  let tag = rawProps.tag || _vue_runtime_core.Fragment;
1005
1020
  prevChildren = [];
1021
+ moves = void 0;
1006
1022
  if (children) for (let i = 0; i < children.length; i++) {
1007
1023
  const child = children[i];
1008
1024
  if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
1009
1025
  prevChildren.push(child);
1010
1026
  (0, _vue_runtime_core.setTransitionHooks)(child, (0, _vue_runtime_core.resolveTransitionHooks)(child, cssTransitionProps, state, instance));
1011
1027
  positionMap.set(child, getPosition(child.el));
1012
- }
1028
+ } else if (_vue_runtime_core.isVaporInteropEnabled && child.vs && child.vb) instance.appContext.vapor.forEachGroupChild(child, (el) => {
1029
+ const row = { el };
1030
+ prevChildren.push(row);
1031
+ positionMap.set(row, getPosition(el));
1032
+ });
1013
1033
  }
1014
1034
  children = slots.default ? (0, _vue_runtime_core.getTransitionRawChildren)(slots.default()) : [];
1015
1035
  for (let i = 0; i < children.length; i++) {
1016
1036
  const child = children[i];
1017
- if (child.key != null) (0, _vue_runtime_core.setTransitionHooks)(child, (0, _vue_runtime_core.resolveTransitionHooks)(child, cssTransitionProps, state, instance));
1037
+ if (_vue_runtime_core.isVaporInteropEnabled && child.vs) child.vs.group = group;
1038
+ else if (child.key != null) (0, _vue_runtime_core.setTransitionHooks)(child, (0, _vue_runtime_core.resolveTransitionHooks)(child, cssTransitionProps, state, instance));
1039
+ }
1040
+ if (prevChildren.length) {
1041
+ const root = instance.vnode.el;
1042
+ origins = getOrigins(instance, root);
1043
+ pendingGroups.set(instance, {
1044
+ root,
1045
+ willMove
1046
+ });
1018
1047
  }
1019
1048
  return (0, _vue_runtime_core.createVNode)(tag, null, children);
1020
1049
  };
1021
1050
  }
1022
1051
  });
1052
+ const TransitionGroup = /*@__PURE__*/ (0, _vue_runtime_core.withTransitionEnabled)(TransitionGroupImpl);
1023
1053
  function callPendingCbs(el) {
1024
1054
  if (el[moveCbKey]) el[moveCbKey]();
1025
1055
  if (el[enterCbKey]) el[enterCbKey]();
1026
1056
  }
1027
- function recordPosition(c) {
1028
- newPositionMap.set(c, getPosition(c.el));
1057
+ function resolveMoveClass(props) {
1058
+ return props.moveClass || `${props.name || "v"}-move`;
1059
+ }
1060
+ function recordPosition(c, shift) {
1061
+ newPositionMap.set(c, getPosition(c.el, shift));
1029
1062
  }
1030
1063
  function applyTranslation(c) {
1031
1064
  if (baseApplyTranslation(positionMap.get(c), newPositionMap.get(c), c.el)) return c;
@@ -1050,13 +1083,36 @@ function baseApplyTranslation(oldPos, newPos, el) {
1050
1083
  }
1051
1084
  return false;
1052
1085
  }
1053
- function getPosition(el) {
1086
+ function getPosition(el, shift) {
1054
1087
  const rect = el.getBoundingClientRect();
1055
1088
  return {
1056
- left: rect.left,
1057
- top: rect.top
1089
+ left: rect.left - (shift ? shift.left : 0),
1090
+ top: rect.top - (shift ? shift.top : 0)
1058
1091
  };
1059
1092
  }
1093
+ function getOrigins(instance, root) {
1094
+ let origins;
1095
+ for (let group = instance.parent; group; group = group.parent) {
1096
+ const pending = pendingGroups.get(group);
1097
+ if (pending) {
1098
+ const item = findItem(pending.root, root);
1099
+ if (item) (origins || (origins = [])).push((0, _vue_shared.extend)(getPosition(item), {
1100
+ item,
1101
+ willMove: pending.willMove
1102
+ }));
1103
+ }
1104
+ }
1105
+ return origins;
1106
+ }
1107
+ function findItem(root, node) {
1108
+ const container = root.nodeType === 1 ? root : root.parentNode;
1109
+ while (node && node.parentNode !== container) node = node.parentNode;
1110
+ if (node && node.nodeType === 1) return node;
1111
+ }
1112
+ function getOriginShift(origins, root) {
1113
+ const origin = origins.find((o) => o.willMove() && o.item.contains(root));
1114
+ return origin && getPosition(origin.item, origin);
1115
+ }
1060
1116
  function hasCSSTransform(el, root, moveClass) {
1061
1117
  const clone = el.cloneNode();
1062
1118
  const _vtc = el[vtcKey];
@@ -1137,7 +1193,7 @@ const vModelTextInit = (el, trim, number, lazy, set) => {
1137
1193
  if (e.target.composing) return;
1138
1194
  (set || el[assignKey])(castValue(el.value, trim, number || el.type === "number"));
1139
1195
  });
1140
- if (trim || number) addEventListener(el, "change", () => {
1196
+ if (trim || number || el.type === "number") addEventListener(el, "change", () => {
1141
1197
  el.value = castValue(el.value, trim, number || el.type === "number");
1142
1198
  });
1143
1199
  if (!lazy) {