@jsenv/navi 0.29.378 → 0.29.379

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.
@@ -61281,6 +61281,10 @@ const ROOT_ATTRIBUTE = "data-navi-popup-lift";
61281
61281
  // What the two boxes are to each other (Dialog's `lift`: "box" | "scene"),
61282
61282
  // worn by the root too — it decides how each picture sits in the moving box.
61283
61283
  const KIND_ATTRIBUTE = "data-navi-popup-lift-kind";
61284
+ // Worn by the root when the two pictures fit the moving box the whole way
61285
+ // (see picturesFitTheBox): the box's edge then has nothing to cut but the
61286
+ // pictures' own ink — a halo, a shadow — and the CSS lets it through.
61287
+ const FIT_ATTRIBUTE = "data-navi-popup-lift-fit";
61284
61288
  // The one node that IS the anchor once in front: the popup itself, or a node
61285
61289
  // inside it.
61286
61290
  const TARGET_SELECTOR = "[data-lift]";
@@ -61400,6 +61404,7 @@ const liftPopupFromAnchor = (
61400
61404
  giveBackNameArriving?.();
61401
61405
  root.removeAttribute(ROOT_ATTRIBUTE);
61402
61406
  root.removeAttribute(KIND_ATTRIBUTE);
61407
+ root.removeAttribute(FIT_ATTRIBUTE);
61403
61408
  root.style.removeProperty(DURATION_PROPERTY);
61404
61409
  root.style.removeProperty(BORDER_RADIUS_PROPERTY);
61405
61410
  root.style.removeProperty(BACKGROUND_COLOR_PROPERTY);
@@ -61411,7 +61416,7 @@ const liftPopupFromAnchor = (
61411
61416
  releaseScrollHold?.();
61412
61417
  releaseScrollHold = trapScrollInside(popupEl, { backdrop: true });
61413
61418
  const room = measureRoomBetweenBars();
61414
- const boxLeaving = room ? elementLeaving.getBoundingClientRect() : null;
61419
+ const boxLeaving = elementLeaving.getBoundingClientRect();
61415
61420
  let boxArriving = null;
61416
61421
  let cornersArriving = null;
61417
61422
  const viewTransition = startViewTransition(async () => {
@@ -61429,8 +61434,9 @@ const liftPopupFromAnchor = (
61429
61434
  if (elementArriving) {
61430
61435
  giveBackNameArriving = wearLiftName(elementArriving);
61431
61436
  cornersArriving = readCorners(elementArriving);
61432
- if (room) {
61433
- boxArriving = elementArriving.getBoundingClientRect();
61437
+ boxArriving = elementArriving.getBoundingClientRect();
61438
+ if (picturesFitTheBox(lift, boxLeaving, boxArriving)) {
61439
+ root.setAttribute(FIT_ATTRIBUTE, "");
61434
61440
  }
61435
61441
  }
61436
61442
  });
@@ -61734,6 +61740,30 @@ const animateMovingBox = ({ cornersFrom, cornersTo, room, boxFrom, boxTo }) => {
61734
61740
  });
61735
61741
  };
61736
61742
 
61743
+ // Whether both pictures fit the moving box from one end to the other. The
61744
+ // box's clip (dialog.jsx) is its edge for a picture larger than the box: what
61745
+ // a card gaining room uncovers, what a scene shows past the band cut from it.
61746
+ // Under "box" each picture keeps its own size, so both fit only when the two
61747
+ // boxes are the same size; under "scene" both are drawn as wide as the box
61748
+ // and centred, so they fit when the two boxes have the same aspect ratio —
61749
+ // each picture, drawn at the other box's width, is then that box's height.
61750
+ // A picture's ink past its own box (a halo, a shadow) is not content the clip
61751
+ // is there to cut, so when they fit, the clip is lifted.
61752
+ const picturesFitTheBox = (lift, boxFrom, boxTo) => {
61753
+ if (lift === "scene") {
61754
+ const heightFromAtWidthTo = (boxTo.width * boxFrom.height) / boxFrom.width;
61755
+ const heightToAtWidthFrom = (boxFrom.width * boxTo.height) / boxTo.width;
61756
+ return (
61757
+ Math.abs(heightFromAtWidthTo - boxTo.height) < 1 &&
61758
+ Math.abs(heightToAtWidthFrom - boxFrom.height) < 1
61759
+ );
61760
+ }
61761
+ return (
61762
+ Math.abs(boxFrom.width - boxTo.width) < 1 &&
61763
+ Math.abs(boxFrom.height - boxTo.height) < 1
61764
+ );
61765
+ };
61766
+
61737
61767
  const insetToRoom = (room, box) =>
61738
61768
  `inset(${room.top - box.top}px ${box.right - room.right}px ${box.bottom - room.bottom}px ${room.left - box.left}px)`;
61739
61769
 
@@ -62382,6 +62412,12 @@ const css$E = /* css */`
62382
62412
  the box, and a change of width would read as the same card zooming
62383
62413
  then swapping.
62384
62414
 
62415
+ A picture holds the element's ink past its own box too — a halo, a
62416
+ shadow — and the clip cuts that along with the content, at the box's
62417
+ corners. When both pictures fit the box the whole way (popup_lift.js,
62418
+ picturesFitTheBox) there is no content to uncover, only ink to lose:
62419
+ the clip is lifted and the box carries its ink along.
62420
+
62385
62421
  The box paints what the lifted card paints behind its content
62386
62422
  (published by popup_lift.js): where it has grown past the picture it
62387
62423
  carries, it is the card that has grown. Its corners are those of the
@@ -62399,6 +62435,9 @@ const css$E = /* css */`
62399
62435
  block-size: auto;
62400
62436
  inline-size: auto;
62401
62437
  }
62438
+ &[data-navi-popup-lift-fit]::view-transition-image-pair(navi-popup-lift) {
62439
+ overflow: visible;
62440
+ }
62402
62441
 
62403
62442
  /* The card leaves as itself and arrives as what it became: the picture
62404
62443
  being left stays whole for most of the way, the arriving one only shows