@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.
@@ -36601,18 +36601,18 @@ const useContentKeepingLeavingPages = (branch, readShownBranch, parentPage) => {
36601
36601
  }
36602
36602
  entry.hidden = true;
36603
36603
  entry.page.leavingSignal.value = true;
36604
- hideNodesBetween(start, end);
36605
36604
  // The page renders on its own while kept (a component reading a signal
36606
36605
  // the address moved), never through this container: a top node it
36607
- // replaces lands between the markers unmarked. Its mutation is heard
36608
- // before the next frame.
36606
+ // replaces lands between the markers unmarked, a text it writes shows
36607
+ // again. Both are heard before the next frame.
36609
36608
  const observer = new MutationObserver(() => {
36610
36609
  if (entry.hold.released) {
36611
36610
  observer.disconnect();
36612
36611
  return;
36613
36612
  }
36614
- hideNodesBetween(start, end);
36613
+ hideNodesBetween(start, end, observer);
36615
36614
  });
36615
+ hideNodesBetween(start, end, observer);
36616
36616
  observer.observe(start.parentNode, {
36617
36617
  childList: true
36618
36618
  });
@@ -36656,18 +36656,28 @@ const useContentKeepingLeavingPages = (branch, readShownBranch, parentPage) => {
36656
36656
  };
36657
36657
  };
36658
36658
  const countRenders = count => count + 1;
36659
- const hideNodesBetween = (start, end) => {
36659
+ const hideNodesBetween = (start, end, observer) => {
36660
36660
  const focusedElement = document.activeElement;
36661
36661
  let node = start.nextSibling;
36662
36662
  while (node && node !== end) {
36663
- if (node.nodeType === Node.ELEMENT_NODE && !node.hasAttribute(LEAVING_ATTRIBUTE)) {
36664
- node.setAttribute(LEAVING_ATTRIBUTE, "");
36665
- // What the keyboard held in it goes where the page's removal would
36666
- // have sent it: a hidden element keeps the focus, and would go on
36667
- // receiving the keys pressed during the movement.
36668
- if (node.contains(focusedElement)) {
36669
- focusedElement.blur();
36670
- }
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
+ });
36671
36681
  }
36672
36682
  node = node.nextSibling;
36673
36683
  }
@@ -50082,7 +50092,7 @@ const useControlProps = (props, {
50082
50092
  }
50083
50093
  const domProps = toDomProps(newUIState);
50084
50094
  Object.assign(el, domProps);
50085
- debugUIState(e, `syncDomState: updated to ${getElementSignature(el)}`, domProps);
50095
+ debugUIState(e, `syncDomState: updated to ${getElementSignature(el)}`);
50086
50096
  };
50087
50097
  const controlInfo = createControlInfo(props, {
50088
50098
  controlType
@@ -82932,7 +82942,8 @@ const SelectableInput = SelectableInputProxy;
82932
82942
  * The `highlight` argument of `useSearchHighlight` (a row's `matchInfo.matchRanges`) can be:
82933
82943
  * - an array of [start, end] pairs — applied to all text nodes under the root element
82934
82944
  * - an object { [domSelector]: [[start, end], …] } — applied to each sub-element
82935
- * matched by the selector (the format produced by createSearch)
82945
+ * matched by the selector (the format produced by createSearch); a selector
82946
+ * matching nothing under the root element marks nothing
82936
82947
  */
82937
82948
 
82938
82949
  // Module-level shared Highlight instance — created lazily once.
@@ -82978,10 +82989,12 @@ const applySearchHighlight = (el, highlight) => {
82978
82989
  ? highlight.length === 0
82979
82990
  ? []
82980
82991
  : [{ root: el, ranges: highlight }]
82981
- : Object.entries(highlight).map(([selector, ranges]) => ({
82982
- root: el.querySelector(selector) ?? el,
82983
- ranges,
82984
- }));
82992
+ : Object.entries(highlight).flatMap(([selector, ranges]) => {
82993
+ // The ranges are offsets into the selected element's text: an item
82994
+ // that doesn't render it has nothing to mark.
82995
+ const root = el.querySelector(selector);
82996
+ return root ? [{ root, ranges }] : [];
82997
+ });
82985
82998
 
82986
82999
  if (entries.length === 0) {
82987
83000
  return undefined;
@@ -96728,7 +96741,12 @@ const mergeRanges = (ranges) => {
96728
96741
  *
96729
96742
  * Each field config:
96730
96743
  * - getter(item): string — extracts the text to search
96731
- * - domSelector: string — CSS selector used by ListItem to find the target element
96744
+ * - domSelector?: string — CSS selector used by ListItem to find the target element.
96745
+ * Without it, the field is searched and scored but highlights
96746
+ * nothing: text the item doesn't write (an alias, a civil name
96747
+ * under a nickname, tags). One field per selector: the ranges
96748
+ * of two fields sharing one are offsets into two different
96749
+ * strings, so the last field wins.
96732
96750
  * - priority?: number — multiplier applied to the field's score (default 1)
96733
96751
  * - matchFn?: function — custom match function (searchText, fieldValue) => { match, matchScore, matchRanges }
96734
96752
  * defaults to applySearch
@@ -96748,7 +96766,9 @@ const createSearch = (fields) => {
96748
96766
  const result = matchFn(searchText, fieldValue);
96749
96767
  if (result.match && result.matchRanges.length > 0) {
96750
96768
  totalScore += result.matchScore * priority;
96751
- matchRanges[domSelector] = result.matchRanges;
96769
+ if (domSelector) {
96770
+ matchRanges[domSelector] = result.matchRanges;
96771
+ }
96752
96772
  }
96753
96773
  }
96754
96774
  if (totalScore === 0) {