@jsenv/navi 0.29.505 → 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.
- package/dist/dev/jsenv_navi.js +17 -7
- package/dist/dev/jsenv_navi.js.map +3 -3
- package/dist/jsenv_navi.js +18 -8
- package/dist/jsenv_navi.js.map +3 -3
- package/package.json +4 -4
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -84733,7 +84733,8 @@ const SelectableInput = SelectableInputProxy;
|
|
|
84733
84733
|
* The `highlight` argument of `useSearchHighlight` (a row's `matchInfo.matchRanges`) can be:
|
|
84734
84734
|
* - an array of [start, end] pairs — applied to all text nodes under the root element
|
|
84735
84735
|
* - an object { [domSelector]: [[start, end], …] } — applied to each sub-element
|
|
84736
|
-
* 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
|
|
84737
84738
|
*/
|
|
84738
84739
|
|
|
84739
84740
|
// Module-level shared Highlight instance — created lazily once.
|
|
@@ -84779,10 +84780,12 @@ const applySearchHighlight = (el, highlight) => {
|
|
|
84779
84780
|
? highlight.length === 0
|
|
84780
84781
|
? []
|
|
84781
84782
|
: [{ root: el, ranges: highlight }]
|
|
84782
|
-
: Object.entries(highlight).
|
|
84783
|
-
|
|
84784
|
-
|
|
84785
|
-
|
|
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
|
+
});
|
|
84786
84789
|
|
|
84787
84790
|
if (entries.length === 0) {
|
|
84788
84791
|
return undefined;
|
|
@@ -98858,7 +98861,12 @@ const mergeRanges = (ranges) => {
|
|
|
98858
98861
|
*
|
|
98859
98862
|
* Each field config:
|
|
98860
98863
|
* - getter(item): string — extracts the text to search
|
|
98861
|
-
* - domSelector
|
|
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.
|
|
98862
98870
|
* - priority?: number — multiplier applied to the field's score (default 1)
|
|
98863
98871
|
* - matchFn?: function — custom match function (searchText, fieldValue) => { match, matchScore, matchRanges }
|
|
98864
98872
|
* defaults to applySearch
|
|
@@ -98878,7 +98886,9 @@ const createSearch = (fields) => {
|
|
|
98878
98886
|
const result = matchFn(searchText, fieldValue);
|
|
98879
98887
|
if (result.match && result.matchRanges.length > 0) {
|
|
98880
98888
|
totalScore += result.matchScore * priority;
|
|
98881
|
-
|
|
98889
|
+
if (domSelector) {
|
|
98890
|
+
matchRanges[domSelector] = result.matchRanges;
|
|
98891
|
+
}
|
|
98882
98892
|
}
|
|
98883
98893
|
}
|
|
98884
98894
|
if (totalScore === 0) {
|