@lvce-editor/text-search-worker 3.29.0 → 3.30.0
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/textSearchWorkerMain.js +34 -10
- package/package.json +1 -1
|
@@ -1670,13 +1670,16 @@ const FileIcon = 'FileIcon';
|
|
|
1670
1670
|
const FocusOutline = 'FocusOutline';
|
|
1671
1671
|
const Grow = 'Grow';
|
|
1672
1672
|
const Highlight = 'Highlight';
|
|
1673
|
+
const ScrollBarThumb = 'ScrollBarThumb';
|
|
1673
1674
|
const HighlightDeleted = 'HighlightDeleted';
|
|
1675
|
+
const ScrollBar = 'ScrollBar';
|
|
1674
1676
|
const HighlightInserted = 'HighlightInserted';
|
|
1675
1677
|
const IconButton = 'IconButton';
|
|
1676
1678
|
const Label = 'Label';
|
|
1677
1679
|
const List = 'List';
|
|
1678
1680
|
const MaskIcon = 'MaskIcon';
|
|
1679
1681
|
const MaskIconBook = 'MaskIconBook';
|
|
1682
|
+
const ScrollBarVertical = 'ScrollBarVertical';
|
|
1680
1683
|
const MaskIconCaseSensitive = 'MaskIconCaseSensitive';
|
|
1681
1684
|
const MaskIconChevronDown = 'MaskIconChevronDown';
|
|
1682
1685
|
const MaskIconChevronRight = 'MaskIconChevronRight';
|
|
@@ -1973,13 +1976,14 @@ const getDisplayResults = (results, itemHeight, resultCount, searchTerm, minLine
|
|
|
1973
1976
|
};
|
|
1974
1977
|
|
|
1975
1978
|
const HandleClick = 'handleClick';
|
|
1979
|
+
const HandleExcludeInput = 'handleExcludeInput';
|
|
1976
1980
|
const HandleHeaderClick = 'handleHeaderClick';
|
|
1977
1981
|
const HandleHeaderFocusIn = 'handleHeaderFocusIn';
|
|
1978
|
-
const
|
|
1982
|
+
const HandleIncludeInput = 'handleIncludeInput';
|
|
1979
1983
|
const HandleInput = 'handleInput';
|
|
1984
|
+
const HandleListBlur = 'handleListBlur';
|
|
1980
1985
|
const HandleReplaceInput = 'handleReplaceInput';
|
|
1981
|
-
const
|
|
1982
|
-
const HandleExcludeInput = 'handleExcludeInput';
|
|
1986
|
+
const HandleWheel = 'handleWheel';
|
|
1983
1987
|
|
|
1984
1988
|
const FilesToExclude = 'FilesToExclude';
|
|
1985
1989
|
const FilesToInclude = 'FilesToInclude';
|
|
@@ -2272,6 +2276,23 @@ const getSearchInputErrorVirtualDom = errorMessage => {
|
|
|
2272
2276
|
}, text(errorMessage)];
|
|
2273
2277
|
};
|
|
2274
2278
|
|
|
2279
|
+
const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY) => {
|
|
2280
|
+
if (scrollBarHeight === 0) {
|
|
2281
|
+
return [];
|
|
2282
|
+
}
|
|
2283
|
+
return [{
|
|
2284
|
+
type: Div,
|
|
2285
|
+
className: mergeClassNames(ScrollBar, ScrollBarVertical),
|
|
2286
|
+
childCount: 1
|
|
2287
|
+
}, {
|
|
2288
|
+
type: Div,
|
|
2289
|
+
className: ScrollBarThumb,
|
|
2290
|
+
height: scrollBarHeight,
|
|
2291
|
+
translate: `0 ${scrollBarY}px`,
|
|
2292
|
+
childCount: 0
|
|
2293
|
+
}];
|
|
2294
|
+
};
|
|
2295
|
+
|
|
2275
2296
|
// TODO instead of setting string, support enum in virtual dom and send enum to renderer process
|
|
2276
2297
|
// which converts it to a boolean
|
|
2277
2298
|
const getAriaExpanded = expanded => {
|
|
@@ -2427,26 +2448,28 @@ const getSearchResultVirtualDom = rowInfo => {
|
|
|
2427
2448
|
return dom;
|
|
2428
2449
|
};
|
|
2429
2450
|
|
|
2430
|
-
const getSearchResultsVirtualDom = (visibleItems, focusOutline) => {
|
|
2451
|
+
const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight, scrollBarY) => {
|
|
2452
|
+
const scrollBarDomNodes = scrollbarHeight === 0 ? 0 : 1;
|
|
2431
2453
|
return [{
|
|
2432
2454
|
type: Div,
|
|
2433
2455
|
className: mergeClassNames(Viewlet, List, focusOutline ? FocusOutline : Empty),
|
|
2434
2456
|
role: Tree,
|
|
2435
2457
|
tabIndex: 0,
|
|
2436
|
-
childCount: visibleItems.length,
|
|
2458
|
+
childCount: visibleItems.length + scrollBarDomNodes,
|
|
2437
2459
|
onClick: HandleClick,
|
|
2438
|
-
onBlur: HandleListBlur
|
|
2439
|
-
|
|
2460
|
+
onBlur: HandleListBlur,
|
|
2461
|
+
onWheel: HandleWheel
|
|
2462
|
+
}, ...visibleItems.flatMap(getSearchResultVirtualDom), ...getScrollBarVirtualDom(scrollbarHeight, scrollBarY)];
|
|
2440
2463
|
};
|
|
2441
2464
|
|
|
2442
|
-
const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchInputErrorMessage) => {
|
|
2465
|
+
const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchInputErrorMessage, scrollBarHeight, scrollBarY) => {
|
|
2443
2466
|
const errorDom = getSearchInputErrorVirtualDom(searchInputErrorMessage);
|
|
2444
2467
|
const childCount = 2 + (errorDom.length > 0 ? 1 : 0);
|
|
2445
2468
|
return [{
|
|
2446
2469
|
type: Div,
|
|
2447
2470
|
className: mergeClassNames(Viewlet, Search$1),
|
|
2448
2471
|
childCount
|
|
2449
|
-
}, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline)];
|
|
2472
|
+
}, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY)];
|
|
2450
2473
|
};
|
|
2451
2474
|
|
|
2452
2475
|
const handleError = error => {
|
|
@@ -3618,7 +3641,8 @@ const renderItems = {
|
|
|
3618
3641
|
apply(oldState, newState) {
|
|
3619
3642
|
const displayResults = getDisplayResults(newState.listItems, newState.itemHeight, newState.fileCount, newState.value, newState.minLineY, newState.maxLineY, newState.replacement, newState.icons, newState.listFocusedIndex, newState.collapsedPaths);
|
|
3620
3643
|
const focusOutline = newState.listFocused && newState.listFocusedIndex === -1;
|
|
3621
|
-
const
|
|
3644
|
+
const scrollBarY = getScrollBarY(newState.deltaY, newState.finalDeltaY, newState.height - newState.headerHeight, newState.scrollBarHeight);
|
|
3645
|
+
const dom = getSearchVirtualDom(displayResults, newState.flags, newState.message, focusOutline, newState.searchInputErrorMessage, newState.scrollBarHeight, scrollBarY);
|
|
3622
3646
|
return ['Viewlet.setDom2', newState.uid, dom];
|
|
3623
3647
|
}
|
|
3624
3648
|
};
|