@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.
@@ -60068,6 +60068,10 @@ const ROOT_ATTRIBUTE = "data-navi-popup-lift";
60068
60068
  // What the two boxes are to each other (Dialog's `lift`: "box" | "scene"),
60069
60069
  // worn by the root too — it decides how each picture sits in the moving box.
60070
60070
  const KIND_ATTRIBUTE = "data-navi-popup-lift-kind";
60071
+ // Worn by the root when the two pictures fit the moving box the whole way
60072
+ // (see picturesFitTheBox): the box's edge then has nothing to cut but the
60073
+ // pictures' own ink — a halo, a shadow — and the CSS lets it through.
60074
+ const FIT_ATTRIBUTE = "data-navi-popup-lift-fit";
60071
60075
  // The one node that IS the anchor once in front: the popup itself, or a node
60072
60076
  // inside it.
60073
60077
  const TARGET_SELECTOR = "[data-lift]";
@@ -60187,6 +60191,7 @@ const liftPopupFromAnchor = (
60187
60191
  giveBackNameArriving?.();
60188
60192
  root.removeAttribute(ROOT_ATTRIBUTE);
60189
60193
  root.removeAttribute(KIND_ATTRIBUTE);
60194
+ root.removeAttribute(FIT_ATTRIBUTE);
60190
60195
  root.style.removeProperty(DURATION_PROPERTY);
60191
60196
  root.style.removeProperty(BORDER_RADIUS_PROPERTY);
60192
60197
  root.style.removeProperty(BACKGROUND_COLOR_PROPERTY);
@@ -60198,7 +60203,7 @@ const liftPopupFromAnchor = (
60198
60203
  releaseScrollHold?.();
60199
60204
  releaseScrollHold = trapScrollInside(popupEl, { backdrop: true });
60200
60205
  const room = measureRoomBetweenBars();
60201
- const boxLeaving = room ? elementLeaving.getBoundingClientRect() : null;
60206
+ const boxLeaving = elementLeaving.getBoundingClientRect();
60202
60207
  let boxArriving = null;
60203
60208
  let cornersArriving = null;
60204
60209
  const viewTransition = startViewTransition(async () => {
@@ -60216,8 +60221,9 @@ const liftPopupFromAnchor = (
60216
60221
  if (elementArriving) {
60217
60222
  giveBackNameArriving = wearLiftName(elementArriving);
60218
60223
  cornersArriving = readCorners(elementArriving);
60219
- if (room) {
60220
- boxArriving = elementArriving.getBoundingClientRect();
60224
+ boxArriving = elementArriving.getBoundingClientRect();
60225
+ if (picturesFitTheBox(lift, boxLeaving, boxArriving)) {
60226
+ root.setAttribute(FIT_ATTRIBUTE, "");
60221
60227
  }
60222
60228
  }
60223
60229
  });
@@ -60486,6 +60492,30 @@ const animateMovingBox = ({ cornersFrom, cornersTo, room, boxFrom, boxTo }) => {
60486
60492
  });
60487
60493
  };
60488
60494
 
60495
+ // Whether both pictures fit the moving box from one end to the other. The
60496
+ // box's clip (dialog.jsx) is its edge for a picture larger than the box: what
60497
+ // a card gaining room uncovers, what a scene shows past the band cut from it.
60498
+ // Under "box" each picture keeps its own size, so both fit only when the two
60499
+ // boxes are the same size; under "scene" both are drawn as wide as the box
60500
+ // and centred, so they fit when the two boxes have the same aspect ratio —
60501
+ // each picture, drawn at the other box's width, is then that box's height.
60502
+ // A picture's ink past its own box (a halo, a shadow) is not content the clip
60503
+ // is there to cut, so when they fit, the clip is lifted.
60504
+ const picturesFitTheBox = (lift, boxFrom, boxTo) => {
60505
+ if (lift === "scene") {
60506
+ const heightFromAtWidthTo = (boxTo.width * boxFrom.height) / boxFrom.width;
60507
+ const heightToAtWidthFrom = (boxFrom.width * boxTo.height) / boxTo.width;
60508
+ return (
60509
+ Math.abs(heightFromAtWidthTo - boxTo.height) < 1 &&
60510
+ Math.abs(heightToAtWidthFrom - boxFrom.height) < 1
60511
+ );
60512
+ }
60513
+ return (
60514
+ Math.abs(boxFrom.width - boxTo.width) < 1 &&
60515
+ Math.abs(boxFrom.height - boxTo.height) < 1
60516
+ );
60517
+ };
60518
+
60489
60519
  const insetToRoom = (room, box) =>
60490
60520
  `inset(${room.top - box.top}px ${box.right - room.right}px ${box.bottom - room.bottom}px ${room.left - box.left}px)`;
60491
60521
 
@@ -61134,6 +61164,12 @@ const css$E = /* css */`
61134
61164
  the box, and a change of width would read as the same card zooming
61135
61165
  then swapping.
61136
61166
 
61167
+ A picture holds the element's ink past its own box too — a halo, a
61168
+ shadow — and the clip cuts that along with the content, at the box's
61169
+ corners. When both pictures fit the box the whole way (popup_lift.js,
61170
+ picturesFitTheBox) there is no content to uncover, only ink to lose:
61171
+ the clip is lifted and the box carries its ink along.
61172
+
61137
61173
  The box paints what the lifted card paints behind its content
61138
61174
  (published by popup_lift.js): where it has grown past the picture it
61139
61175
  carries, it is the card that has grown. Its corners are those of the
@@ -61151,6 +61187,9 @@ const css$E = /* css */`
61151
61187
  block-size: auto;
61152
61188
  inline-size: auto;
61153
61189
  }
61190
+ &[data-navi-popup-lift-fit]::view-transition-image-pair(navi-popup-lift) {
61191
+ overflow: visible;
61192
+ }
61154
61193
 
61155
61194
  /* The card leaves as itself and arrives as what it became: the picture
61156
61195
  being left stays whole for most of the way, the arriving one only shows