@vue/runtime-dom 3.5.43 → 3.5.44

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.44
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -496,7 +496,9 @@ function patchStyle(el, prev, next) {
496
496
  }
497
497
  }
498
498
  if (vShowOriginalDisplay in el) {
499
- el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
499
+ if (!isCssString || prev !== next) {
500
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
501
+ }
500
502
  if (el[vShowHidden]) {
501
503
  style.display = "none";
502
504
  }
@@ -978,7 +980,9 @@ class VueElement extends BaseClass {
978
980
  "Custom element style injection is not supported when using shadowRoot: false"
979
981
  );
980
982
  }
981
- this._mount(def);
983
+ if (this._connected) {
984
+ this._mount(def);
985
+ }
982
986
  };
983
987
  const asyncDef = this._def.__asyncLoader;
984
988
  if (asyncDef) {
@@ -1348,6 +1352,7 @@ const positionMap = /* @__PURE__ */ new WeakMap();
1348
1352
  const newPositionMap = /* @__PURE__ */ new WeakMap();
1349
1353
  const moveCbKey = /* @__PURE__ */ Symbol("_moveCb");
1350
1354
  const enterCbKey = /* @__PURE__ */ Symbol("_enterCb");
1355
+ const pendingGroups = /* @__PURE__ */ new WeakMap();
1351
1356
  const decorate = (t) => {
1352
1357
  delete t.props.mode;
1353
1358
  return t;
@@ -1363,21 +1368,30 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1363
1368
  const state = runtimeCore.useTransitionState();
1364
1369
  let prevChildren;
1365
1370
  let children;
1366
- runtimeCore.onUpdated(() => {
1367
- if (!prevChildren.length) {
1368
- return;
1371
+ let origins;
1372
+ let moves;
1373
+ const willMove = () => {
1374
+ if (moves === void 0) {
1375
+ moves = prevChildren.length > 0 && hasCSSTransform(
1376
+ prevChildren[0].el,
1377
+ instance.vnode.el,
1378
+ resolveMoveClass(props)
1379
+ );
1369
1380
  }
1370
- const moveClass = props.moveClass || `${props.name || "v"}-move`;
1371
- if (!hasCSSTransform(
1372
- prevChildren[0].el,
1373
- instance.vnode.el,
1374
- moveClass
1375
- )) {
1381
+ return moves;
1382
+ };
1383
+ runtimeCore.onUpdated(() => {
1384
+ pendingGroups.delete(instance);
1385
+ if (!willMove()) {
1376
1386
  prevChildren = [];
1387
+ origins = void 0;
1377
1388
  return;
1378
1389
  }
1390
+ const moveClass = resolveMoveClass(props);
1379
1391
  prevChildren.forEach(callPendingCbs);
1380
- prevChildren.forEach(recordPosition);
1392
+ const shift = origins && getOriginShift(origins, instance.vnode.el);
1393
+ origins = void 0;
1394
+ prevChildren.forEach((c) => recordPosition(c, shift));
1381
1395
  const movedChildren = prevChildren.filter(applyTranslation);
1382
1396
  forceReflow(instance.vnode.el);
1383
1397
  movedChildren.forEach((c) => {
@@ -1404,6 +1418,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1404
1418
  const cssTransitionProps = resolveTransitionProps(rawProps);
1405
1419
  let tag = rawProps.tag || runtimeCore.Fragment;
1406
1420
  prevChildren = [];
1421
+ moves = void 0;
1407
1422
  if (children) {
1408
1423
  for (let i = 0; i < children.length; i++) {
1409
1424
  const child = children[i];
@@ -1435,6 +1450,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1435
1450
  runtimeCore.warn(`<TransitionGroup> children must be keyed.`);
1436
1451
  }
1437
1452
  }
1453
+ if (prevChildren.length) {
1454
+ origins = getOrigins(instance);
1455
+ pendingGroups.set(instance, willMove);
1456
+ }
1438
1457
  return runtimeCore.createVNode(tag, null, children);
1439
1458
  };
1440
1459
  }
@@ -1449,8 +1468,11 @@ function callPendingCbs(c) {
1449
1468
  el[enterCbKey]();
1450
1469
  }
1451
1470
  }
1452
- function recordPosition(c) {
1453
- newPositionMap.set(c, getPosition(c.el));
1471
+ function resolveMoveClass(props) {
1472
+ return props.moveClass || `${props.name || "v"}-move`;
1473
+ }
1474
+ function recordPosition(c, shift) {
1475
+ newPositionMap.set(c, getPosition(c.el, shift));
1454
1476
  }
1455
1477
  function applyTranslation(c) {
1456
1478
  const oldPos = positionMap.get(c);
@@ -1474,13 +1496,41 @@ function applyTranslation(c) {
1474
1496
  return c;
1475
1497
  }
1476
1498
  }
1477
- function getPosition(el) {
1499
+ function getPosition(el, shift) {
1478
1500
  const rect = el.getBoundingClientRect();
1479
1501
  return {
1480
- left: rect.left,
1481
- top: rect.top
1502
+ left: rect.left - (shift ? shift.left : 0),
1503
+ top: rect.top - (shift ? shift.top : 0)
1482
1504
  };
1483
1505
  }
1506
+ function getOrigins(instance) {
1507
+ let origins;
1508
+ for (let group = instance.parent; group; group = group.parent) {
1509
+ const willMove = pendingGroups.get(group);
1510
+ if (willMove) {
1511
+ const item = findItem(group.vnode.el, instance.vnode.el);
1512
+ if (item) {
1513
+ (origins || (origins = [])).push(
1514
+ shared.extend(getPosition(item), { item, willMove })
1515
+ );
1516
+ }
1517
+ }
1518
+ }
1519
+ return origins;
1520
+ }
1521
+ function findItem(root, node) {
1522
+ const container = root.nodeType === 1 ? root : root.parentNode;
1523
+ while (node && node.parentNode !== container) {
1524
+ node = node.parentNode;
1525
+ }
1526
+ if (node && node.nodeType === 1) {
1527
+ return node;
1528
+ }
1529
+ }
1530
+ function getOriginShift(origins, root) {
1531
+ const origin = origins.find((o) => o.willMove() && o.item.contains(root));
1532
+ return origin && getPosition(origin.item, origin);
1533
+ }
1484
1534
  function hasCSSTransform(el, root, moveClass) {
1485
1535
  const clone = el.cloneNode();
1486
1536
  const _vtc = el[vtcKey];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.43
2
+ * @vue/runtime-dom v3.5.44
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -492,7 +492,9 @@ function patchStyle(el, prev, next) {
492
492
  }
493
493
  }
494
494
  if (vShowOriginalDisplay in el) {
495
- el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
495
+ if (!isCssString || prev !== next) {
496
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
497
+ }
496
498
  if (el[vShowHidden]) {
497
499
  style.display = "none";
498
500
  }
@@ -941,7 +943,9 @@ class VueElement extends BaseClass {
941
943
  if (this.shadowRoot) {
942
944
  this._applyStyles(styles);
943
945
  }
944
- this._mount(def);
946
+ if (this._connected) {
947
+ this._mount(def);
948
+ }
945
949
  };
946
950
  const asyncDef = this._def.__asyncLoader;
947
951
  if (asyncDef) {
@@ -1251,6 +1255,7 @@ const positionMap = /* @__PURE__ */ new WeakMap();
1251
1255
  const newPositionMap = /* @__PURE__ */ new WeakMap();
1252
1256
  const moveCbKey = /* @__PURE__ */ Symbol("_moveCb");
1253
1257
  const enterCbKey = /* @__PURE__ */ Symbol("_enterCb");
1258
+ const pendingGroups = /* @__PURE__ */ new WeakMap();
1254
1259
  const decorate = (t) => {
1255
1260
  delete t.props.mode;
1256
1261
  return t;
@@ -1266,21 +1271,30 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1266
1271
  const state = runtimeCore.useTransitionState();
1267
1272
  let prevChildren;
1268
1273
  let children;
1269
- runtimeCore.onUpdated(() => {
1270
- if (!prevChildren.length) {
1271
- return;
1274
+ let origins;
1275
+ let moves;
1276
+ const willMove = () => {
1277
+ if (moves === void 0) {
1278
+ moves = prevChildren.length > 0 && hasCSSTransform(
1279
+ prevChildren[0].el,
1280
+ instance.vnode.el,
1281
+ resolveMoveClass(props)
1282
+ );
1272
1283
  }
1273
- const moveClass = props.moveClass || `${props.name || "v"}-move`;
1274
- if (!hasCSSTransform(
1275
- prevChildren[0].el,
1276
- instance.vnode.el,
1277
- moveClass
1278
- )) {
1284
+ return moves;
1285
+ };
1286
+ runtimeCore.onUpdated(() => {
1287
+ pendingGroups.delete(instance);
1288
+ if (!willMove()) {
1279
1289
  prevChildren = [];
1290
+ origins = void 0;
1280
1291
  return;
1281
1292
  }
1293
+ const moveClass = resolveMoveClass(props);
1282
1294
  prevChildren.forEach(callPendingCbs);
1283
- prevChildren.forEach(recordPosition);
1295
+ const shift = origins && getOriginShift(origins, instance.vnode.el);
1296
+ origins = void 0;
1297
+ prevChildren.forEach((c) => recordPosition(c, shift));
1284
1298
  const movedChildren = prevChildren.filter(applyTranslation);
1285
1299
  forceReflow(instance.vnode.el);
1286
1300
  movedChildren.forEach((c) => {
@@ -1307,6 +1321,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1307
1321
  const cssTransitionProps = resolveTransitionProps(rawProps);
1308
1322
  let tag = rawProps.tag || runtimeCore.Fragment;
1309
1323
  prevChildren = [];
1324
+ moves = void 0;
1310
1325
  if (children) {
1311
1326
  for (let i = 0; i < children.length; i++) {
1312
1327
  const child = children[i];
@@ -1336,6 +1351,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1336
1351
  );
1337
1352
  }
1338
1353
  }
1354
+ if (prevChildren.length) {
1355
+ origins = getOrigins(instance);
1356
+ pendingGroups.set(instance, willMove);
1357
+ }
1339
1358
  return runtimeCore.createVNode(tag, null, children);
1340
1359
  };
1341
1360
  }
@@ -1350,8 +1369,11 @@ function callPendingCbs(c) {
1350
1369
  el[enterCbKey]();
1351
1370
  }
1352
1371
  }
1353
- function recordPosition(c) {
1354
- newPositionMap.set(c, getPosition(c.el));
1372
+ function resolveMoveClass(props) {
1373
+ return props.moveClass || `${props.name || "v"}-move`;
1374
+ }
1375
+ function recordPosition(c, shift) {
1376
+ newPositionMap.set(c, getPosition(c.el, shift));
1355
1377
  }
1356
1378
  function applyTranslation(c) {
1357
1379
  const oldPos = positionMap.get(c);
@@ -1375,13 +1397,41 @@ function applyTranslation(c) {
1375
1397
  return c;
1376
1398
  }
1377
1399
  }
1378
- function getPosition(el) {
1400
+ function getPosition(el, shift) {
1379
1401
  const rect = el.getBoundingClientRect();
1380
1402
  return {
1381
- left: rect.left,
1382
- top: rect.top
1403
+ left: rect.left - (shift ? shift.left : 0),
1404
+ top: rect.top - (shift ? shift.top : 0)
1383
1405
  };
1384
1406
  }
1407
+ function getOrigins(instance) {
1408
+ let origins;
1409
+ for (let group = instance.parent; group; group = group.parent) {
1410
+ const willMove = pendingGroups.get(group);
1411
+ if (willMove) {
1412
+ const item = findItem(group.vnode.el, instance.vnode.el);
1413
+ if (item) {
1414
+ (origins || (origins = [])).push(
1415
+ shared.extend(getPosition(item), { item, willMove })
1416
+ );
1417
+ }
1418
+ }
1419
+ }
1420
+ return origins;
1421
+ }
1422
+ function findItem(root, node) {
1423
+ const container = root.nodeType === 1 ? root : root.parentNode;
1424
+ while (node && node.parentNode !== container) {
1425
+ node = node.parentNode;
1426
+ }
1427
+ if (node && node.nodeType === 1) {
1428
+ return node;
1429
+ }
1430
+ }
1431
+ function getOriginShift(origins, root) {
1432
+ const origin = origins.find((o) => o.willMove() && o.item.contains(root));
1433
+ return origin && getPosition(origin.item, origin);
1434
+ }
1385
1435
  function hasCSSTransform(el, root, moveClass) {
1386
1436
  const clone = el.cloneNode();
1387
1437
  const _vtc = el[vtcKey];