@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/jsenv_navi.js
CHANGED
|
@@ -50092,7 +50092,7 @@ const useControlProps = (props, {
|
|
|
50092
50092
|
}
|
|
50093
50093
|
const domProps = toDomProps(newUIState);
|
|
50094
50094
|
Object.assign(el, domProps);
|
|
50095
|
-
debugUIState(e, `syncDomState: updated to ${getElementSignature(el)}
|
|
50095
|
+
debugUIState(e, `syncDomState: updated to ${getElementSignature(el)}`);
|
|
50096
50096
|
};
|
|
50097
50097
|
const controlInfo = createControlInfo(props, {
|
|
50098
50098
|
controlType
|
|
@@ -82942,7 +82942,8 @@ const SelectableInput = SelectableInputProxy;
|
|
|
82942
82942
|
* The `highlight` argument of `useSearchHighlight` (a row's `matchInfo.matchRanges`) can be:
|
|
82943
82943
|
* - an array of [start, end] pairs — applied to all text nodes under the root element
|
|
82944
82944
|
* - an object { [domSelector]: [[start, end], …] } — applied to each sub-element
|
|
82945
|
-
* 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
|
|
82946
82947
|
*/
|
|
82947
82948
|
|
|
82948
82949
|
// Module-level shared Highlight instance — created lazily once.
|
|
@@ -82988,10 +82989,12 @@ const applySearchHighlight = (el, highlight) => {
|
|
|
82988
82989
|
? highlight.length === 0
|
|
82989
82990
|
? []
|
|
82990
82991
|
: [{ root: el, ranges: highlight }]
|
|
82991
|
-
: Object.entries(highlight).
|
|
82992
|
-
|
|
82993
|
-
|
|
82994
|
-
|
|
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
|
+
});
|
|
82995
82998
|
|
|
82996
82999
|
if (entries.length === 0) {
|
|
82997
83000
|
return undefined;
|
|
@@ -96738,7 +96741,12 @@ const mergeRanges = (ranges) => {
|
|
|
96738
96741
|
*
|
|
96739
96742
|
* Each field config:
|
|
96740
96743
|
* - getter(item): string — extracts the text to search
|
|
96741
|
-
* - domSelector
|
|
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.
|
|
96742
96750
|
* - priority?: number — multiplier applied to the field's score (default 1)
|
|
96743
96751
|
* - matchFn?: function — custom match function (searchText, fieldValue) => { match, matchScore, matchRanges }
|
|
96744
96752
|
* defaults to applySearch
|
|
@@ -96758,7 +96766,9 @@ const createSearch = (fields) => {
|
|
|
96758
96766
|
const result = matchFn(searchText, fieldValue);
|
|
96759
96767
|
if (result.match && result.matchRanges.length > 0) {
|
|
96760
96768
|
totalScore += result.matchScore * priority;
|
|
96761
|
-
|
|
96769
|
+
if (domSelector) {
|
|
96770
|
+
matchRanges[domSelector] = result.matchRanges;
|
|
96771
|
+
}
|
|
96762
96772
|
}
|
|
96763
96773
|
}
|
|
96764
96774
|
if (totalScore === 0) {
|