@jsenv/navi 0.29.504 → 0.29.506

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.
@@ -37852,18 +37852,18 @@ const useContentKeepingLeavingPages = (branch, readShownBranch, parentPage) => {
37852
37852
  }
37853
37853
  entry.hidden = true;
37854
37854
  entry.page.leavingSignal.value = true;
37855
- hideNodesBetween(start, end);
37856
37855
  // The page renders on its own while kept (a component reading a signal
37857
37856
  // the address moved), never through this container: a top node it
37858
- // replaces lands between the markers unmarked. Its mutation is heard
37859
- // before the next frame.
37857
+ // replaces lands between the markers unmarked, a text it writes shows
37858
+ // again. Both are heard before the next frame.
37860
37859
  const observer = new MutationObserver(() => {
37861
37860
  if (entry.hold.released) {
37862
37861
  observer.disconnect();
37863
37862
  return;
37864
37863
  }
37865
- hideNodesBetween(start, end);
37864
+ hideNodesBetween(start, end, observer);
37866
37865
  });
37866
+ hideNodesBetween(start, end, observer);
37867
37867
  observer.observe(start.parentNode, {
37868
37868
  childList: true
37869
37869
  });
@@ -37907,18 +37907,28 @@ const useContentKeepingLeavingPages = (branch, readShownBranch, parentPage) => {
37907
37907
  };
37908
37908
  };
37909
37909
  const countRenders = count => count + 1;
37910
- const hideNodesBetween = (start, end) => {
37910
+ const hideNodesBetween = (start, end, observer) => {
37911
37911
  const focusedElement = document.activeElement;
37912
37912
  let node = start.nextSibling;
37913
37913
  while (node && node !== end) {
37914
- if (node.nodeType === Node.ELEMENT_NODE && !node.hasAttribute(LEAVING_ATTRIBUTE)) {
37915
- node.setAttribute(LEAVING_ATTRIBUTE, "");
37916
- // What the keyboard held in it goes where the page's removal would
37917
- // have sent it: a hidden element keeps the focus, and would go on
37918
- // receiving the keys pressed during the movement.
37919
- if (node.contains(focusedElement)) {
37920
- focusedElement.blur();
37921
- }
37914
+ if (node.nodeType === Node.ELEMENT_NODE) {
37915
+ if (!node.hasAttribute(LEAVING_ATTRIBUTE)) {
37916
+ node.setAttribute(LEAVING_ATTRIBUTE, "");
37917
+ // What the keyboard held in it goes where the page's removal would
37918
+ // have sent it: a hidden element keeps the focus, and would go on
37919
+ // receiving the keys pressed during the movement.
37920
+ if (node.contains(focusedElement)) {
37921
+ focusedElement.blur();
37922
+ }
37923
+ }
37924
+ } else if (node.nodeType === Node.TEXT_NODE && node.data !== "") {
37925
+ // No CSS reaches a text node, and it stays where it is: Preact inserts
37926
+ // next to it. Emptied for good, since the page is taken down without
37927
+ // being shown again, and Preact only writes it when its text changes.
37928
+ node.data = "";
37929
+ observer.observe(node, {
37930
+ characterData: true
37931
+ });
37922
37932
  }
37923
37933
  node = node.nextSibling;
37924
37934
  }
@@ -84723,7 +84733,8 @@ const SelectableInput = SelectableInputProxy;
84723
84733
  * The `highlight` argument of `useSearchHighlight` (a row's `matchInfo.matchRanges`) can be:
84724
84734
  * - an array of [start, end] pairs — applied to all text nodes under the root element
84725
84735
  * - an object { [domSelector]: [[start, end], …] } — applied to each sub-element
84726
- * matched by the selector (the format produced by createSearch)
84736
+ * matched by the selector (the format produced by createSearch); a selector
84737
+ * matching nothing under the root element marks nothing
84727
84738
  */
84728
84739
 
84729
84740
  // Module-level shared Highlight instance — created lazily once.
@@ -84769,10 +84780,12 @@ const applySearchHighlight = (el, highlight) => {
84769
84780
  ? highlight.length === 0
84770
84781
  ? []
84771
84782
  : [{ root: el, ranges: highlight }]
84772
- : Object.entries(highlight).map(([selector, ranges]) => ({
84773
- root: el.querySelector(selector) ?? el,
84774
- ranges,
84775
- }));
84783
+ : Object.entries(highlight).flatMap(([selector, ranges]) => {
84784
+ // The ranges are offsets into the selected element's text: an item
84785
+ // that doesn't render it has nothing to mark.
84786
+ const root = el.querySelector(selector);
84787
+ return root ? [{ root, ranges }] : [];
84788
+ });
84776
84789
 
84777
84790
  if (entries.length === 0) {
84778
84791
  return undefined;
@@ -98848,7 +98861,12 @@ const mergeRanges = (ranges) => {
98848
98861
  *
98849
98862
  * Each field config:
98850
98863
  * - getter(item): string — extracts the text to search
98851
- * - domSelector: string — CSS selector used by ListItem to find the target element
98864
+ * - domSelector?: string — CSS selector used by ListItem to find the target element.
98865
+ * Without it, the field is searched and scored but highlights
98866
+ * nothing: text the item doesn't write (an alias, a civil name
98867
+ * under a nickname, tags). One field per selector: the ranges
98868
+ * of two fields sharing one are offsets into two different
98869
+ * strings, so the last field wins.
98852
98870
  * - priority?: number — multiplier applied to the field's score (default 1)
98853
98871
  * - matchFn?: function — custom match function (searchText, fieldValue) => { match, matchScore, matchRanges }
98854
98872
  * defaults to applySearch
@@ -98868,7 +98886,9 @@ const createSearch = (fields) => {
98868
98886
  const result = matchFn(searchText, fieldValue);
98869
98887
  if (result.match && result.matchRanges.length > 0) {
98870
98888
  totalScore += result.matchScore * priority;
98871
- matchRanges[domSelector] = result.matchRanges;
98889
+ if (domSelector) {
98890
+ matchRanges[domSelector] = result.matchRanges;
98891
+ }
98872
98892
  }
98873
98893
  }
98874
98894
  if (totalScore === 0) {