@jsenv/navi 0.29.503 → 0.29.505
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.
- package/dist/dev/jsenv_navi.js +44 -14
- package/dist/dev/jsenv_navi.js.map +2 -2
- package/dist/jsenv_navi.js +44 -14
- package/dist/jsenv_navi.js.map +2 -2
- package/docs/route_transitions.md +2 -1
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -36560,7 +36560,8 @@ const useContentKeepingLeavingPages = (branch, readShownBranch, parentPage) => {
|
|
|
36560
36560
|
hold: leavingPagesHold,
|
|
36561
36561
|
startRef: createRef(),
|
|
36562
36562
|
endRef: createRef(),
|
|
36563
|
-
hidden: false
|
|
36563
|
+
hidden: false,
|
|
36564
|
+
observer: null
|
|
36564
36565
|
});
|
|
36565
36566
|
leavingPagesHold.containers.add(rerender);
|
|
36566
36567
|
// Keyed apart from the page it takes the place of, which is still there.
|
|
@@ -36600,20 +36601,22 @@ const useContentKeepingLeavingPages = (branch, readShownBranch, parentPage) => {
|
|
|
36600
36601
|
}
|
|
36601
36602
|
entry.hidden = true;
|
|
36602
36603
|
entry.page.leavingSignal.value = true;
|
|
36603
|
-
|
|
36604
|
-
|
|
36605
|
-
|
|
36606
|
-
|
|
36607
|
-
|
|
36608
|
-
|
|
36609
|
-
|
|
36610
|
-
|
|
36611
|
-
if (node.contains(focusedElement)) {
|
|
36612
|
-
focusedElement.blur();
|
|
36613
|
-
}
|
|
36604
|
+
// The page renders on its own while kept (a component reading a signal
|
|
36605
|
+
// the address moved), never through this container: a top node it
|
|
36606
|
+
// replaces lands between the markers unmarked, a text it writes shows
|
|
36607
|
+
// again. Both are heard before the next frame.
|
|
36608
|
+
const observer = new MutationObserver(() => {
|
|
36609
|
+
if (entry.hold.released) {
|
|
36610
|
+
observer.disconnect();
|
|
36611
|
+
return;
|
|
36614
36612
|
}
|
|
36615
|
-
|
|
36616
|
-
}
|
|
36613
|
+
hideNodesBetween(start, end, observer);
|
|
36614
|
+
});
|
|
36615
|
+
hideNodesBetween(start, end, observer);
|
|
36616
|
+
observer.observe(start.parentNode, {
|
|
36617
|
+
childList: true
|
|
36618
|
+
});
|
|
36619
|
+
entry.observer = observer;
|
|
36617
36620
|
}
|
|
36618
36621
|
});
|
|
36619
36622
|
// Also run when a Suspense boundary above parks this container — a page
|
|
@@ -36625,6 +36628,7 @@ const useContentKeepingLeavingPages = (branch, readShownBranch, parentPage) => {
|
|
|
36625
36628
|
return () => {
|
|
36626
36629
|
for (const entry of leavingRef.current) {
|
|
36627
36630
|
entry.hold.containers.delete(rerender);
|
|
36631
|
+
entry.observer?.disconnect();
|
|
36628
36632
|
}
|
|
36629
36633
|
leavingRef.current = [];
|
|
36630
36634
|
};
|
|
@@ -36652,6 +36656,32 @@ const useContentKeepingLeavingPages = (branch, readShownBranch, parentPage) => {
|
|
|
36652
36656
|
};
|
|
36653
36657
|
};
|
|
36654
36658
|
const countRenders = count => count + 1;
|
|
36659
|
+
const hideNodesBetween = (start, end, observer) => {
|
|
36660
|
+
const focusedElement = document.activeElement;
|
|
36661
|
+
let node = start.nextSibling;
|
|
36662
|
+
while (node && node !== end) {
|
|
36663
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
36664
|
+
if (!node.hasAttribute(LEAVING_ATTRIBUTE)) {
|
|
36665
|
+
node.setAttribute(LEAVING_ATTRIBUTE, "");
|
|
36666
|
+
// What the keyboard held in it goes where the page's removal would
|
|
36667
|
+
// have sent it: a hidden element keeps the focus, and would go on
|
|
36668
|
+
// receiving the keys pressed during the movement.
|
|
36669
|
+
if (node.contains(focusedElement)) {
|
|
36670
|
+
focusedElement.blur();
|
|
36671
|
+
}
|
|
36672
|
+
}
|
|
36673
|
+
} else if (node.nodeType === Node.TEXT_NODE && node.data !== "") {
|
|
36674
|
+
// No CSS reaches a text node, and it stays where it is: Preact inserts
|
|
36675
|
+
// next to it. Emptied for good, since the page is taken down without
|
|
36676
|
+
// being shown again, and Preact only writes it when its text changes.
|
|
36677
|
+
node.data = "";
|
|
36678
|
+
observer.observe(node, {
|
|
36679
|
+
characterData: true
|
|
36680
|
+
});
|
|
36681
|
+
}
|
|
36682
|
+
node = node.nextSibling;
|
|
36683
|
+
}
|
|
36684
|
+
};
|
|
36655
36685
|
// The page a container renders, as RoutePageContext hands it over (see
|
|
36656
36686
|
// route_page_context.js). Shown while the container would pick its branch, or
|
|
36657
36687
|
// a branch rendering the same element (it is then carried over), and while the
|