@vue/runtime-dom 3.5.43 → 3.5.45

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.43
2
+ * @vue/runtime-dom v3.5.45
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -561,7 +561,9 @@ function patchStyle(el, prev, next) {
561
561
  }
562
562
  }
563
563
  if (vShowOriginalDisplay in el) {
564
- el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
564
+ if (!isCssString || prev !== next) {
565
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
566
+ }
565
567
  if (el[vShowHidden]) {
566
568
  style.display = "none";
567
569
  }
@@ -1043,7 +1045,9 @@ class VueElement extends BaseClass {
1043
1045
  "Custom element style injection is not supported when using shadowRoot: false"
1044
1046
  );
1045
1047
  }
1046
- this._mount(def);
1048
+ if (this._connected) {
1049
+ this._mount(def);
1050
+ }
1047
1051
  };
1048
1052
  const asyncDef = this._def.__asyncLoader;
1049
1053
  if (asyncDef) {
@@ -1413,6 +1417,7 @@ const positionMap = /* @__PURE__ */ new WeakMap();
1413
1417
  const newPositionMap = /* @__PURE__ */ new WeakMap();
1414
1418
  const moveCbKey = /* @__PURE__ */ Symbol("_moveCb");
1415
1419
  const enterCbKey = /* @__PURE__ */ Symbol("_enterCb");
1420
+ const pendingGroups = /* @__PURE__ */ new WeakMap();
1416
1421
  const decorate = (t) => {
1417
1422
  delete t.props.mode;
1418
1423
  return t;
@@ -1428,21 +1433,30 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1428
1433
  const state = useTransitionState();
1429
1434
  let prevChildren;
1430
1435
  let children;
1431
- onUpdated(() => {
1432
- if (!prevChildren.length) {
1433
- return;
1436
+ let origins;
1437
+ let moves;
1438
+ const willMove = () => {
1439
+ if (moves === void 0) {
1440
+ moves = prevChildren.length > 0 && hasCSSTransform(
1441
+ prevChildren[0].el,
1442
+ instance.vnode.el,
1443
+ resolveMoveClass(props)
1444
+ );
1434
1445
  }
1435
- const moveClass = props.moveClass || `${props.name || "v"}-move`;
1436
- if (!hasCSSTransform(
1437
- prevChildren[0].el,
1438
- instance.vnode.el,
1439
- moveClass
1440
- )) {
1446
+ return moves;
1447
+ };
1448
+ onUpdated(() => {
1449
+ pendingGroups.delete(instance);
1450
+ if (!willMove()) {
1441
1451
  prevChildren = [];
1452
+ origins = void 0;
1442
1453
  return;
1443
1454
  }
1455
+ const moveClass = resolveMoveClass(props);
1444
1456
  prevChildren.forEach(callPendingCbs);
1445
- prevChildren.forEach(recordPosition);
1457
+ const shift = origins && getOriginShift(origins, instance.vnode.el);
1458
+ origins = void 0;
1459
+ prevChildren.forEach((c) => recordPosition(c, shift));
1446
1460
  const movedChildren = prevChildren.filter(applyTranslation);
1447
1461
  forceReflow(instance.vnode.el);
1448
1462
  movedChildren.forEach((c) => {
@@ -1469,6 +1483,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1469
1483
  const cssTransitionProps = resolveTransitionProps(rawProps);
1470
1484
  let tag = rawProps.tag || Fragment;
1471
1485
  prevChildren = [];
1486
+ moves = void 0;
1472
1487
  if (children) {
1473
1488
  for (let i = 0; i < children.length; i++) {
1474
1489
  const child = children[i];
@@ -1500,6 +1515,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1500
1515
  warn(`<TransitionGroup> children must be keyed.`);
1501
1516
  }
1502
1517
  }
1518
+ if (prevChildren.length) {
1519
+ origins = getOrigins(instance);
1520
+ pendingGroups.set(instance, willMove);
1521
+ }
1503
1522
  return createVNode(tag, null, children);
1504
1523
  };
1505
1524
  }
@@ -1514,8 +1533,11 @@ function callPendingCbs(c) {
1514
1533
  el[enterCbKey]();
1515
1534
  }
1516
1535
  }
1517
- function recordPosition(c) {
1518
- newPositionMap.set(c, getPosition(c.el));
1536
+ function resolveMoveClass(props) {
1537
+ return props.moveClass || `${props.name || "v"}-move`;
1538
+ }
1539
+ function recordPosition(c, shift) {
1540
+ newPositionMap.set(c, getPosition(c.el, shift));
1519
1541
  }
1520
1542
  function applyTranslation(c) {
1521
1543
  const oldPos = positionMap.get(c);
@@ -1539,13 +1561,41 @@ function applyTranslation(c) {
1539
1561
  return c;
1540
1562
  }
1541
1563
  }
1542
- function getPosition(el) {
1564
+ function getPosition(el, shift) {
1543
1565
  const rect = el.getBoundingClientRect();
1544
1566
  return {
1545
- left: rect.left,
1546
- top: rect.top
1567
+ left: rect.left - (shift ? shift.left : 0),
1568
+ top: rect.top - (shift ? shift.top : 0)
1547
1569
  };
1548
1570
  }
1571
+ function getOrigins(instance) {
1572
+ let origins;
1573
+ for (let group = instance.parent; group; group = group.parent) {
1574
+ const willMove = pendingGroups.get(group);
1575
+ if (willMove) {
1576
+ const item = findItem(group.vnode.el, instance.vnode.el);
1577
+ if (item) {
1578
+ (origins || (origins = [])).push(
1579
+ extend(getPosition(item), { item, willMove })
1580
+ );
1581
+ }
1582
+ }
1583
+ }
1584
+ return origins;
1585
+ }
1586
+ function findItem(root, node) {
1587
+ const container = root.nodeType === 1 ? root : root.parentNode;
1588
+ while (node && node.parentNode !== container) {
1589
+ node = node.parentNode;
1590
+ }
1591
+ if (node && node.nodeType === 1) {
1592
+ return node;
1593
+ }
1594
+ }
1595
+ function getOriginShift(origins, root) {
1596
+ const origin = origins.find((o) => o.willMove() && o.item.contains(root));
1597
+ return origin && getPosition(origin.item, origin);
1598
+ }
1549
1599
  function hasCSSTransform(el, root, moveClass) {
1550
1600
  const clone = el.cloneNode();
1551
1601
  const _vtc = el[vtcKey];
@@ -1740,18 +1790,18 @@ const vModelSelect = {
1740
1790
  },
1741
1791
  // set value in mounted & updated because <select> relies on its children
1742
1792
  // <option>s.
1743
- mounted(el, { value }) {
1744
- setSelected(el, value);
1793
+ mounted(el, { value, modifiers: { number } }) {
1794
+ setSelected(el, value, number);
1745
1795
  },
1746
1796
  beforeUpdate(el, { value }, vnode) {
1747
1797
  el._modelValue = value;
1748
1798
  el[assignKey] = getModelAssigner(vnode);
1749
1799
  },
1750
- updated(el, { value }) {
1800
+ updated(el, { value, modifiers: { number } }) {
1751
1801
  const pending = el._pendingValue;
1752
1802
  el._pendingValue = void 0;
1753
1803
  if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
1754
- setSelected(el, value);
1804
+ setSelected(el, value, number);
1755
1805
  }
1756
1806
  }
1757
1807
  };
@@ -1767,7 +1817,7 @@ function isSameSelectValue(value, assignedValue, multiple) {
1767
1817
  }
1768
1818
  return false;
1769
1819
  }
1770
- function setSelected(el, value) {
1820
+ function setSelected(el, value, number = false) {
1771
1821
  const isMultiple = el.multiple;
1772
1822
  const isArrayValue = isArray(value);
1773
1823
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -1788,7 +1838,7 @@ function setSelected(el, value) {
1788
1838
  option.selected = looseIndexOf(value, optionValue) > -1;
1789
1839
  }
1790
1840
  } else {
1791
- option.selected = value.has(optionValue);
1841
+ option.selected = value.has(optionValue) || number && typeof optionValue === "string" && value.has(looseToNumber(optionValue));
1792
1842
  }
1793
1843
  } else if (looseEqual(getValue(option), value)) {
1794
1844
  if (el.selectedIndex !== i) el.selectedIndex = i;