@jsenv/navi 0.29.383 → 0.29.384

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.
@@ -61403,10 +61403,12 @@ let releaseLiftInProgress = null;
61403
61403
  // cancelled with the movement so a finished one cannot go on applying its
61404
61404
  // last values to the next movement's picture.
61405
61405
  let boxAnimationInProgress = null;
61406
- // The page held still for the length of the movement. Its picture is frozen
61407
- // anyway, and the browser keeps following the live anchor: a scroll would
61408
- // carry the arriving box along under a page that does not move, and past the
61409
- // clip to the room between the bars, computed where the boxes stood.
61406
+ // The page held still from the first read about it to the end of the
61407
+ // movement. Its picture is frozen anyway, and the browser keeps following the
61408
+ // live anchor: a scroll would carry the arriving box along under a page that
61409
+ // does not move, and past the clip to the room between the bars, computed
61410
+ // where the boxes stood — and read once, before the opening waits for its
61411
+ // target (see liftPopupFromAnchor).
61410
61412
  let releaseScrollHold = null;
61411
61413
 
61412
61414
  /**
@@ -61432,11 +61434,20 @@ const liftPopupFromAnchor = (
61432
61434
  releaseLiftInProgress?.();
61433
61435
 
61434
61436
  const elementLeaving = opened ? resolveAnchor() : resolveLiftTarget(popupEl);
61435
- // Read before the first write: the read brings the style up to date, and a
61436
- // write before it would make it bring it up to date once more.
61437
+ // Everything read about the leaving side, before the first write. A read
61438
+ // brings the style up to date, and the writes below land on the root — an
61439
+ // attribute or an unregistered custom property there invalidates the
61440
+ // computed style of every element — so a read placed after any of them is
61441
+ // the whole document's style over again. Nothing on the leaving side moves
61442
+ // before the movement, the page being held from here on.
61443
+ releaseScrollHold = trapScrollInside(popupEl, { backdrop: true });
61437
61444
  const duration = getComputedStyle(popupEl)
61438
61445
  .getPropertyValue("--popup-animation-duration")
61439
61446
  .trim();
61447
+ const cornersLeaving = readCorners(elementLeaving);
61448
+ const room = measureRoomBetweenBars();
61449
+ const boxLeaving = elementLeaving.getBoundingClientRect();
61450
+ const paintLeaving = opened ? null : readBoxPaint(elementLeaving);
61440
61451
  const giveBackNameLeaving = wearLiftName(elementLeaving);
61441
61452
  const root = document.documentElement;
61442
61453
  root.setAttribute(ROOT_ATTRIBUTE, opened ? "opening" : "closing");
@@ -61447,11 +61458,10 @@ const liftPopupFromAnchor = (
61447
61458
  // browser's own pace.
61448
61459
  root.style.setProperty(DURATION_PROPERTY, duration);
61449
61460
  }
61450
- if (!opened) {
61451
- publishBoxPaint(elementLeaving);
61452
- }
61453
- const cornersLeaving = readCorners(elementLeaving);
61454
61461
  root.style.setProperty(BORDER_RADIUS_PROPERTY, cornersLeaving);
61462
+ if (paintLeaving) {
61463
+ publishBoxPaint(paintLeaving);
61464
+ }
61455
61465
 
61456
61466
  let giveBackNameArriving = null;
61457
61467
  let stopWaitingForTarget = null;
@@ -61483,10 +61493,6 @@ const liftPopupFromAnchor = (
61483
61493
  releaseLiftInProgress = release;
61484
61494
 
61485
61495
  const startMovement = (change, resolveElementArriving) => {
61486
- releaseScrollHold?.();
61487
- releaseScrollHold = trapScrollInside(popupEl, { backdrop: true });
61488
- const room = measureRoomBetweenBars();
61489
- const boxLeaving = elementLeaving.getBoundingClientRect();
61490
61496
  let boxArriving = null;
61491
61497
  let cornersArriving = null;
61492
61498
  const viewTransition = startViewTransition(async () => {
@@ -61567,7 +61573,9 @@ const liftPopupFromAnchor = (
61567
61573
  if (lift === "box") {
61568
61574
  warnDrawingLiftedAsBox(target);
61569
61575
  }
61570
- publishBoxPaint(target);
61576
+ // The last write before the transition: nothing reads between it and the
61577
+ // style pass the browser makes on its own to take the first picture.
61578
+ publishBoxPaint(readBoxPaint(target));
61571
61579
  startMovement(reveal, () => target);
61572
61580
  };
61573
61581
  const targetNow = findLiftTarget(popupEl);
@@ -61608,10 +61616,16 @@ const warnDrawingLiftedAsBox = (liftedElement) => {
61608
61616
  }
61609
61617
  };
61610
61618
 
61611
- const publishBoxPaint = (liftedElement) => {
61619
+ // Read and published apart, so that a closing can read the paint with the
61620
+ // rest of what it reads and write it with the rest of what it writes.
61621
+ const readBoxPaint = (liftedElement) => {
61612
61622
  const { backgroundColor, backgroundImage } = getComputedStyle(
61613
61623
  findPaintedBox(liftedElement),
61614
61624
  );
61625
+ return { backgroundColor, backgroundImage };
61626
+ };
61627
+
61628
+ const publishBoxPaint = ({ backgroundColor, backgroundImage }) => {
61615
61629
  const root = document.documentElement;
61616
61630
  root.style.setProperty(BACKGROUND_COLOR_PROPERTY, backgroundColor);
61617
61631
  root.style.setProperty(BACKGROUND_IMAGE_PROPERTY, backgroundImage);