@vue/runtime-dom 3.5.21 → 3.5.23

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.5.21
2
+ * @vue/runtime-dom v3.5.23
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -214,11 +214,11 @@ function resolveTransitionProps(rawProps) {
214
214
  const resolve = () => finishLeave(el, done);
215
215
  addTransitionClass(el, leaveFromClass);
216
216
  if (!el._enterCancelled) {
217
- forceReflow();
217
+ forceReflow(el);
218
218
  addTransitionClass(el, leaveActiveClass);
219
219
  } else {
220
220
  addTransitionClass(el, leaveActiveClass);
221
- forceReflow();
221
+ forceReflow(el);
222
222
  }
223
223
  nextFrame(() => {
224
224
  if (!el._isLeaving) {
@@ -364,8 +364,9 @@ function toMs(s) {
364
364
  if (s === "auto") return 0;
365
365
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
366
366
  }
367
- function forceReflow() {
368
- return document.body.offsetHeight;
367
+ function forceReflow(el) {
368
+ const targetDocument = el ? el.ownerDocument : document;
369
+ return targetDocument.body.offsetHeight;
369
370
  }
370
371
 
371
372
  function patchClass(el, value, isSVG) {
@@ -806,6 +807,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
806
807
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
807
808
  return false;
808
809
  }
810
+ if (key === "sandbox" && el.tagName === "IFRAME") {
811
+ return false;
812
+ }
809
813
  if (key === "form") {
810
814
  return false;
811
815
  }
@@ -866,6 +870,8 @@ class VueElement extends BaseClass {
866
870
  this._nonce = this._def.nonce;
867
871
  this._connected = false;
868
872
  this._resolved = false;
873
+ this._patching = false;
874
+ this._dirty = false;
869
875
  this._numberProps = null;
870
876
  this._styleChildren = /* @__PURE__ */ new WeakSet();
871
877
  this._ob = null;
@@ -878,7 +884,11 @@ class VueElement extends BaseClass {
878
884
  );
879
885
  }
880
886
  if (_def.shadowRoot !== false) {
881
- this.attachShadow({ mode: "open" });
887
+ this.attachShadow(
888
+ extend({}, _def.shadowRootOptions, {
889
+ mode: "open"
890
+ })
891
+ );
882
892
  this._root = this.shadowRoot;
883
893
  } else {
884
894
  this._root = this;
@@ -938,9 +948,18 @@ class VueElement extends BaseClass {
938
948
  this._app && this._app.unmount();
939
949
  if (this._instance) this._instance.ce = void 0;
940
950
  this._app = this._instance = null;
951
+ if (this._teleportTargets) {
952
+ this._teleportTargets.clear();
953
+ this._teleportTargets = void 0;
954
+ }
941
955
  }
942
956
  });
943
957
  }
958
+ _processMutations(mutations) {
959
+ for (const m of mutations) {
960
+ this._setAttr(m.attributeName);
961
+ }
962
+ }
944
963
  /**
945
964
  * resolve inner component definition (handle possible async component)
946
965
  */
@@ -951,11 +970,7 @@ class VueElement extends BaseClass {
951
970
  for (let i = 0; i < this.attributes.length; i++) {
952
971
  this._setAttr(this.attributes[i].name);
953
972
  }
954
- this._ob = new MutationObserver((mutations) => {
955
- for (const m of mutations) {
956
- this._setAttr(m.attributeName);
957
- }
958
- });
973
+ this._ob = new MutationObserver(this._processMutations.bind(this));
959
974
  this._ob.observe(this, { attributes: true });
960
975
  const resolve = (def, isAsync = false) => {
961
976
  this._resolved = true;
@@ -1032,7 +1047,7 @@ class VueElement extends BaseClass {
1032
1047
  return this._getProp(key);
1033
1048
  },
1034
1049
  set(val) {
1035
- this._setProp(key, val, true, true);
1050
+ this._setProp(key, val, true, !this._patching);
1036
1051
  }
1037
1052
  });
1038
1053
  }
@@ -1058,6 +1073,7 @@ class VueElement extends BaseClass {
1058
1073
  */
1059
1074
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
1060
1075
  if (val !== this._props[key]) {
1076
+ this._dirty = true;
1061
1077
  if (val === REMOVAL) {
1062
1078
  delete this._props[key];
1063
1079
  } else {
@@ -1071,7 +1087,10 @@ class VueElement extends BaseClass {
1071
1087
  }
1072
1088
  if (shouldReflect) {
1073
1089
  const ob = this._ob;
1074
- ob && ob.disconnect();
1090
+ if (ob) {
1091
+ this._processMutations(ob.takeRecords());
1092
+ ob.disconnect();
1093
+ }
1075
1094
  if (val === true) {
1076
1095
  this.setAttribute(hyphenate(key), "");
1077
1096
  } else if (typeof val === "string" || typeof val === "number") {
@@ -1175,7 +1194,7 @@ class VueElement extends BaseClass {
1175
1194
  * Only called when shadowRoot is false
1176
1195
  */
1177
1196
  _renderSlots() {
1178
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
1197
+ const outlets = this._getSlots();
1179
1198
  const scopeId = this._instance.type.__scopeId;
1180
1199
  for (let i = 0; i < outlets.length; i++) {
1181
1200
  const o = outlets[i];
@@ -1201,12 +1220,45 @@ class VueElement extends BaseClass {
1201
1220
  parent.removeChild(o);
1202
1221
  }
1203
1222
  }
1223
+ /**
1224
+ * @internal
1225
+ */
1226
+ _getSlots() {
1227
+ const roots = [this];
1228
+ if (this._teleportTargets) {
1229
+ roots.push(...this._teleportTargets);
1230
+ }
1231
+ const slots = /* @__PURE__ */ new Set();
1232
+ for (const root of roots) {
1233
+ const found = root.querySelectorAll("slot");
1234
+ for (let i = 0; i < found.length; i++) {
1235
+ slots.add(found[i]);
1236
+ }
1237
+ }
1238
+ return Array.from(slots);
1239
+ }
1204
1240
  /**
1205
1241
  * @internal
1206
1242
  */
1207
1243
  _injectChildStyle(comp) {
1208
1244
  this._applyStyles(comp.styles, comp);
1209
1245
  }
1246
+ /**
1247
+ * @internal
1248
+ */
1249
+ _beginPatch() {
1250
+ this._patching = true;
1251
+ this._dirty = false;
1252
+ }
1253
+ /**
1254
+ * @internal
1255
+ */
1256
+ _endPatch() {
1257
+ this._patching = false;
1258
+ if (this._dirty && this._instance) {
1259
+ this._update();
1260
+ }
1261
+ }
1210
1262
  /**
1211
1263
  * @internal
1212
1264
  */
@@ -1302,7 +1354,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1302
1354
  prevChildren.forEach(callPendingCbs);
1303
1355
  prevChildren.forEach(recordPosition);
1304
1356
  const movedChildren = prevChildren.filter(applyTranslation);
1305
- forceReflow();
1357
+ forceReflow(instance.vnode.el);
1306
1358
  movedChildren.forEach((c) => {
1307
1359
  const el = c.el;
1308
1360
  const style = el.style;
@@ -1341,10 +1393,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1341
1393
  instance
1342
1394
  )
1343
1395
  );
1344
- positionMap.set(
1345
- child,
1346
- child.el.getBoundingClientRect()
1347
- );
1396
+ positionMap.set(child, {
1397
+ left: child.el.offsetLeft,
1398
+ top: child.el.offsetTop
1399
+ });
1348
1400
  }
1349
1401
  }
1350
1402
  }
@@ -1375,7 +1427,10 @@ function callPendingCbs(c) {
1375
1427
  }
1376
1428
  }
1377
1429
  function recordPosition(c) {
1378
- newPositionMap.set(c, c.el.getBoundingClientRect());
1430
+ newPositionMap.set(c, {
1431
+ left: c.el.offsetLeft,
1432
+ top: c.el.offsetTop
1433
+ });
1379
1434
  }
1380
1435
  function applyTranslation(c) {
1381
1436
  const oldPos = positionMap.get(c);
@@ -1421,24 +1476,22 @@ function onCompositionEnd(e) {
1421
1476
  }
1422
1477
  }
1423
1478
  const assignKey = Symbol("_assign");
1479
+ function castValue(value, trim, number) {
1480
+ if (trim) value = value.trim();
1481
+ if (number) value = looseToNumber(value);
1482
+ return value;
1483
+ }
1424
1484
  const vModelText = {
1425
1485
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
1426
1486
  el[assignKey] = getModelAssigner(vnode);
1427
1487
  const castToNumber = number || vnode.props && vnode.props.type === "number";
1428
1488
  addEventListener(el, lazy ? "change" : "input", (e) => {
1429
1489
  if (e.target.composing) return;
1430
- let domValue = el.value;
1431
- if (trim) {
1432
- domValue = domValue.trim();
1433
- }
1434
- if (castToNumber) {
1435
- domValue = looseToNumber(domValue);
1436
- }
1437
- el[assignKey](domValue);
1490
+ el[assignKey](castValue(el.value, trim, castToNumber));
1438
1491
  });
1439
- if (trim) {
1492
+ if (trim || castToNumber) {
1440
1493
  addEventListener(el, "change", () => {
1441
- el.value = el.value.trim();
1494
+ el.value = castValue(el.value, trim, castToNumber);
1442
1495
  });
1443
1496
  }
1444
1497
  if (!lazy) {