@jsenv/navi 0.29.326 → 0.29.328

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.
@@ -7325,6 +7325,16 @@ const positionCallout = (
7325
7325
  }
7326
7326
  return;
7327
7327
  }
7328
+ if (!calloutElement.isConnected) {
7329
+ // The callout is drawn inside the anchor's subtree (calloutContainer),
7330
+ // so it leaves the document with it — a Suspense boundary parking
7331
+ // the screen while an action re-runs keeps the subtree mounted, refs
7332
+ // intact, but detached. showPopover() throws on a detached element,
7333
+ // and leaving the document already took it out of the top layer, so
7334
+ // there is nothing to hide either: same as ancestorClosed, wait for
7335
+ // the next check, which shows it again once the subtree is back.
7336
+ return;
7337
+ }
7328
7338
  if (!calloutElement.matches(":popover-open")) {
7329
7339
  if (debug) {
7330
7340
  debug(event, "showing callout because anchor is visible again");
@@ -11288,9 +11298,11 @@ const swipeTypeOf = (axis, pulled) => {
11288
11298
  * copy is captured where it lands rather than where it was let go of.
11289
11299
  *
11290
11300
  * And the promise matters in both cases: the gesture holds its copy until the
11291
- * answer settles. Returning the transition is what makes a landing continuous; a
11292
- * `toss` that rejects brings the copy back, because the thing still exists and the
11293
- * screen has to say so.
11301
+ * answer settles. Returning the transition is what makes a landing continuous;
11302
+ * rejecting brings the copy back over the original, because the thing still
11303
+ * exists and the screen has to say so. That holds for every outcome that carries
11304
+ * a copy — `land` and `reorder` as much as `toss` and `leave` — so a place can be
11305
+ * asked about rather than taken: refuse, and the board is as it was.
11294
11306
  *
11295
11307
  * Starting a document transition is the application's call and not navi's: a
11296
11308
  * `view-transition-name` must be unique per document, so only the application can
@@ -27186,20 +27198,28 @@ const setupBrowserIntegrationViaHistory = ({
27186
27198
  // traversal to another document is a full page load, which no press on a
27187
27199
  // link asked for — the entries that are ours are recorded as they are
27188
27200
  // created, starting with the one this document was loaded into.
27201
+ //
27202
+ // The presence of window.navigation says nothing about the entry: the spec
27203
+ // makes currentEntry null in a document that is not fully active, and iOS
27204
+ // Safari answers null in a document that plainly is (a booted app, minutes
27205
+ // into a session). Nothing can be done about it; an entry that cannot be
27206
+ // read is treated as a browser without the API, which only costs the
27207
+ // adjacency.
27189
27208
  const sameDocumentEntryKeys = new Set();
27190
27209
  const rememberEntryIsOfThisDocument = () => {
27191
- if (window.navigation) {
27192
- sameDocumentEntryKeys.add(window.navigation.currentEntry.key);
27210
+ const currentEntry = window.navigation?.currentEntry;
27211
+ if (currentEntry) {
27212
+ sameDocumentEntryKeys.add(currentEntry.key);
27193
27213
  }
27194
27214
  };
27195
27215
  rememberEntryIsOfThisDocument();
27196
27216
  const adjacentEntryDelta = (url) => {
27197
- const { navigation } = window;
27198
- if (!navigation) {
27217
+ const currentEntry = window.navigation?.currentEntry;
27218
+ if (!currentEntry) {
27199
27219
  return 0;
27200
27220
  }
27201
- const entries = navigation.entries();
27202
- const index = navigation.currentEntry.index;
27221
+ const entries = window.navigation.entries();
27222
+ const index = currentEntry.index;
27203
27223
  // Behind first: when the same page stands on both sides (A, B, A and one
27204
27224
  // is on B), a link to it reads as going back.
27205
27225
  for (const delta of [-1, 1]) {