@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.
@@ -60190,10 +60190,12 @@ let releaseLiftInProgress = null;
60190
60190
  // cancelled with the movement so a finished one cannot go on applying its
60191
60191
  // last values to the next movement's picture.
60192
60192
  let boxAnimationInProgress = null;
60193
- // The page held still for the length of the movement. Its picture is frozen
60194
- // anyway, and the browser keeps following the live anchor: a scroll would
60195
- // carry the arriving box along under a page that does not move, and past the
60196
- // clip to the room between the bars, computed where the boxes stood.
60193
+ // The page held still from the first read about it to the end of the
60194
+ // movement. Its picture is frozen anyway, and the browser keeps following the
60195
+ // live anchor: a scroll would carry the arriving box along under a page that
60196
+ // does not move, and past the clip to the room between the bars, computed
60197
+ // where the boxes stood — and read once, before the opening waits for its
60198
+ // target (see liftPopupFromAnchor).
60197
60199
  let releaseScrollHold = null;
60198
60200
 
60199
60201
  /**
@@ -60219,11 +60221,20 @@ const liftPopupFromAnchor = (
60219
60221
  releaseLiftInProgress?.();
60220
60222
 
60221
60223
  const elementLeaving = opened ? resolveAnchor() : resolveLiftTarget(popupEl);
60222
- // Read before the first write: the read brings the style up to date, and a
60223
- // write before it would make it bring it up to date once more.
60224
+ // Everything read about the leaving side, before the first write. A read
60225
+ // brings the style up to date, and the writes below land on the root — an
60226
+ // attribute or an unregistered custom property there invalidates the
60227
+ // computed style of every element — so a read placed after any of them is
60228
+ // the whole document's style over again. Nothing on the leaving side moves
60229
+ // before the movement, the page being held from here on.
60230
+ releaseScrollHold = trapScrollInside(popupEl, { backdrop: true });
60224
60231
  const duration = getComputedStyle(popupEl)
60225
60232
  .getPropertyValue("--popup-animation-duration")
60226
60233
  .trim();
60234
+ const cornersLeaving = readCorners(elementLeaving);
60235
+ const room = measureRoomBetweenBars();
60236
+ const boxLeaving = elementLeaving.getBoundingClientRect();
60237
+ const paintLeaving = opened ? null : readBoxPaint(elementLeaving);
60227
60238
  const giveBackNameLeaving = wearLiftName(elementLeaving);
60228
60239
  const root = document.documentElement;
60229
60240
  root.setAttribute(ROOT_ATTRIBUTE, opened ? "opening" : "closing");
@@ -60234,11 +60245,10 @@ const liftPopupFromAnchor = (
60234
60245
  // browser's own pace.
60235
60246
  root.style.setProperty(DURATION_PROPERTY, duration);
60236
60247
  }
60237
- if (!opened) {
60238
- publishBoxPaint(elementLeaving);
60239
- }
60240
- const cornersLeaving = readCorners(elementLeaving);
60241
60248
  root.style.setProperty(BORDER_RADIUS_PROPERTY, cornersLeaving);
60249
+ if (paintLeaving) {
60250
+ publishBoxPaint(paintLeaving);
60251
+ }
60242
60252
 
60243
60253
  let giveBackNameArriving = null;
60244
60254
  let stopWaitingForTarget = null;
@@ -60270,10 +60280,6 @@ const liftPopupFromAnchor = (
60270
60280
  releaseLiftInProgress = release;
60271
60281
 
60272
60282
  const startMovement = (change, resolveElementArriving) => {
60273
- releaseScrollHold?.();
60274
- releaseScrollHold = trapScrollInside(popupEl, { backdrop: true });
60275
- const room = measureRoomBetweenBars();
60276
- const boxLeaving = elementLeaving.getBoundingClientRect();
60277
60283
  let boxArriving = null;
60278
60284
  let cornersArriving = null;
60279
60285
  const viewTransition = startViewTransition(async () => {
@@ -60342,7 +60348,9 @@ const liftPopupFromAnchor = (
60342
60348
  popupEl.removeAttribute(ARRIVING_ATTRIBUTE);
60343
60349
  };
60344
60350
  const liftTarget = (target) => {
60345
- publishBoxPaint(target);
60351
+ // The last write before the transition: nothing reads between it and the
60352
+ // style pass the browser makes on its own to take the first picture.
60353
+ publishBoxPaint(readBoxPaint(target));
60346
60354
  startMovement(reveal, () => target);
60347
60355
  };
60348
60356
  const targetNow = findLiftTarget(popupEl);
@@ -60360,10 +60368,16 @@ const liftPopupFromAnchor = (
60360
60368
  });
60361
60369
  };
60362
60370
 
60363
- const publishBoxPaint = (liftedElement) => {
60371
+ // Read and published apart, so that a closing can read the paint with the
60372
+ // rest of what it reads and write it with the rest of what it writes.
60373
+ const readBoxPaint = (liftedElement) => {
60364
60374
  const { backgroundColor, backgroundImage } = getComputedStyle(
60365
60375
  findPaintedBox(liftedElement),
60366
60376
  );
60377
+ return { backgroundColor, backgroundImage };
60378
+ };
60379
+
60380
+ const publishBoxPaint = ({ backgroundColor, backgroundImage }) => {
60367
60381
  const root = document.documentElement;
60368
60382
  root.style.setProperty(BACKGROUND_COLOR_PROPERTY, backgroundColor);
60369
60383
  root.style.setProperty(BACKGROUND_IMAGE_PROPERTY, backgroundImage);