@lvce-editor/text-search-worker 3.43.0 → 3.45.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 +89 -22
- package/package.json +1 -1
|
@@ -473,6 +473,7 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
473
473
|
}
|
|
474
474
|
return promise;
|
|
475
475
|
};
|
|
476
|
+
const Message$1 = 3;
|
|
476
477
|
const create$5$1 = async ({
|
|
477
478
|
messagePort,
|
|
478
479
|
isMessagePortOpen
|
|
@@ -480,9 +481,24 @@ const create$5$1 = async ({
|
|
|
480
481
|
if (!isMessagePort(messagePort)) {
|
|
481
482
|
throw new IpcError('port must be of type MessagePort');
|
|
482
483
|
}
|
|
483
|
-
{
|
|
484
|
+
if (isMessagePortOpen) {
|
|
484
485
|
return messagePort;
|
|
485
486
|
}
|
|
487
|
+
const eventPromise = getFirstEvent(messagePort, {
|
|
488
|
+
message: Message$1
|
|
489
|
+
});
|
|
490
|
+
messagePort.start();
|
|
491
|
+
const {
|
|
492
|
+
type,
|
|
493
|
+
event
|
|
494
|
+
} = await eventPromise;
|
|
495
|
+
if (type !== Message$1) {
|
|
496
|
+
throw new IpcError('Failed to wait for ipc message');
|
|
497
|
+
}
|
|
498
|
+
if (event.data !== readyMessage) {
|
|
499
|
+
throw new IpcError('unexpected first message');
|
|
500
|
+
}
|
|
501
|
+
return messagePort;
|
|
486
502
|
};
|
|
487
503
|
const signal$1 = messagePort => {
|
|
488
504
|
messagePort.start();
|
|
@@ -811,7 +827,7 @@ const getErrorResponse = (message, error, preparePrettyError, logError) => {
|
|
|
811
827
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
812
828
|
return create$1$2(message, errorProperty);
|
|
813
829
|
};
|
|
814
|
-
const create$
|
|
830
|
+
const create$5 = (message, result) => {
|
|
815
831
|
return {
|
|
816
832
|
jsonrpc: Two,
|
|
817
833
|
id: message.id,
|
|
@@ -820,7 +836,7 @@ const create$6 = (message, result) => {
|
|
|
820
836
|
};
|
|
821
837
|
const getSuccessResponse = (message, result) => {
|
|
822
838
|
const resultProperty = result ?? null;
|
|
823
|
-
return create$
|
|
839
|
+
return create$5(message, resultProperty);
|
|
824
840
|
};
|
|
825
841
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
826
842
|
try {
|
|
@@ -984,7 +1000,7 @@ const listen$1 = async (module, options) => {
|
|
|
984
1000
|
const ipc = module.wrap(rawIpc);
|
|
985
1001
|
return ipc;
|
|
986
1002
|
};
|
|
987
|
-
const create$
|
|
1003
|
+
const create$6 = async ({
|
|
988
1004
|
commandMap,
|
|
989
1005
|
messagePort,
|
|
990
1006
|
isMessagePortOpen
|
|
@@ -1002,7 +1018,7 @@ const create$5 = async ({
|
|
|
1002
1018
|
};
|
|
1003
1019
|
const MessagePortRpcParent = {
|
|
1004
1020
|
__proto__: null,
|
|
1005
|
-
create: create$
|
|
1021
|
+
create: create$6
|
|
1006
1022
|
};
|
|
1007
1023
|
const create$1$1 = async ({
|
|
1008
1024
|
commandMap,
|
|
@@ -1703,6 +1719,7 @@ const TreeItemActive = 'TreeItemActive';
|
|
|
1703
1719
|
const TreeItems$1 = 'TreeItems';
|
|
1704
1720
|
const Viewlet = 'Viewlet';
|
|
1705
1721
|
const ViewletSearchMessage = 'ViewletSearchMessage';
|
|
1722
|
+
const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
|
|
1706
1723
|
|
|
1707
1724
|
const Button$2 = 1;
|
|
1708
1725
|
|
|
@@ -2042,10 +2059,16 @@ const text = data => {
|
|
|
2042
2059
|
};
|
|
2043
2060
|
};
|
|
2044
2061
|
|
|
2045
|
-
const
|
|
2062
|
+
const getClassName = indented => {
|
|
2063
|
+
if (indented) {
|
|
2064
|
+
return mergeClassNames(ViewletSearchMessage, ViewletSearchMessageIndented);
|
|
2065
|
+
}
|
|
2066
|
+
return ViewletSearchMessage;
|
|
2067
|
+
};
|
|
2068
|
+
const getSearchMessageVirtualDom = (message, indented) => {
|
|
2046
2069
|
return [{
|
|
2047
2070
|
type: Div$1,
|
|
2048
|
-
className:
|
|
2071
|
+
className: getClassName(indented),
|
|
2049
2072
|
role: Status,
|
|
2050
2073
|
tabIndex: 0,
|
|
2051
2074
|
childCount: 1
|
|
@@ -2057,7 +2080,7 @@ const getSearchHeaderDetailsCollapsedVirtualDom = message => {
|
|
|
2057
2080
|
type: Div$1,
|
|
2058
2081
|
className: SearchHeaderDetails,
|
|
2059
2082
|
childCount: 2
|
|
2060
|
-
}, ...getSearchMessageVirtualDom(message), ...getSearchDetailsToggleVirtualDom()];
|
|
2083
|
+
}, ...getSearchMessageVirtualDom(message, true), ...getSearchDetailsToggleVirtualDom()];
|
|
2061
2084
|
};
|
|
2062
2085
|
|
|
2063
2086
|
const CheckBoxEnabled = 1;
|
|
@@ -2223,7 +2246,7 @@ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
|
|
|
2223
2246
|
type: H4$1,
|
|
2224
2247
|
className: SearchHeaderDetailsHeading,
|
|
2225
2248
|
childCount: 1
|
|
2226
|
-
}, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, 'Exclude', HandleExcludeInput, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message)];
|
|
2249
|
+
}, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, 'Exclude', HandleExcludeInput, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message, false)];
|
|
2227
2250
|
};
|
|
2228
2251
|
|
|
2229
2252
|
const getSearchHeaderDetailsVirtualDom = (flags, message) => {
|
|
@@ -2313,15 +2336,16 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
2313
2336
|
return dom;
|
|
2314
2337
|
};
|
|
2315
2338
|
|
|
2339
|
+
const parentNode = {
|
|
2340
|
+
type: Div$1,
|
|
2341
|
+
className: SearchHeader,
|
|
2342
|
+
role: None$1,
|
|
2343
|
+
childCount: 2,
|
|
2344
|
+
onClick: HandleHeaderClick2,
|
|
2345
|
+
onFocusIn: HandleHeaderFocusIn
|
|
2346
|
+
};
|
|
2316
2347
|
const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matchCount) => {
|
|
2317
|
-
const dom = [
|
|
2318
|
-
type: Div$1,
|
|
2319
|
-
className: SearchHeader,
|
|
2320
|
-
role: None$1,
|
|
2321
|
-
childCount: 2,
|
|
2322
|
-
onClick: HandleHeaderClick2,
|
|
2323
|
-
onFocusIn: HandleHeaderFocusIn
|
|
2324
|
-
}, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage, matchCount), ...getSearchHeaderDetailsVirtualDom(flags, message)];
|
|
2348
|
+
const dom = [parentNode, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage, matchCount), ...getSearchHeaderDetailsVirtualDom(flags, message)];
|
|
2325
2349
|
return dom;
|
|
2326
2350
|
};
|
|
2327
2351
|
|
|
@@ -3682,14 +3706,55 @@ const RenderReplaceValue = 4;
|
|
|
3682
3706
|
const RenderIncludeValue = 5;
|
|
3683
3707
|
const RenderExcludeValue = 6;
|
|
3684
3708
|
|
|
3709
|
+
const createViewModel = state => {
|
|
3710
|
+
const {
|
|
3711
|
+
listItems,
|
|
3712
|
+
itemHeight,
|
|
3713
|
+
fileCount,
|
|
3714
|
+
value,
|
|
3715
|
+
minLineY,
|
|
3716
|
+
maxLineY,
|
|
3717
|
+
replacement,
|
|
3718
|
+
icons,
|
|
3719
|
+
listFocusedIndex,
|
|
3720
|
+
collapsedPaths,
|
|
3721
|
+
items,
|
|
3722
|
+
listFocused,
|
|
3723
|
+
deltaY,
|
|
3724
|
+
finalDeltaY,
|
|
3725
|
+
height,
|
|
3726
|
+
headerHeight,
|
|
3727
|
+
flags,
|
|
3728
|
+
message,
|
|
3729
|
+
searchInputErrorMessage,
|
|
3730
|
+
scrollBarHeight,
|
|
3731
|
+
matchCount
|
|
3732
|
+
} = state;
|
|
3733
|
+
const displayResults = getDisplayResults(listItems, itemHeight, fileCount, value, minLineY, maxLineY, replacement, icons, listFocusedIndex, collapsedPaths, items);
|
|
3734
|
+
const focusOutline = listFocused && listFocusedIndex === -1;
|
|
3735
|
+
const scrollBarValue = deltaY / finalDeltaY * 100;
|
|
3736
|
+
const scrollBarY = getScrollBarY(deltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
|
|
3737
|
+
return {
|
|
3738
|
+
displayResults,
|
|
3739
|
+
flags,
|
|
3740
|
+
message,
|
|
3741
|
+
focusOutline,
|
|
3742
|
+
searchInputErrorMessage,
|
|
3743
|
+
scrollBarHeight,
|
|
3744
|
+
scrollBarY,
|
|
3745
|
+
scrollBarValue,
|
|
3746
|
+
deltaY,
|
|
3747
|
+
itemHeight,
|
|
3748
|
+
matchCount
|
|
3749
|
+
};
|
|
3750
|
+
};
|
|
3751
|
+
|
|
3685
3752
|
const renderItems = (oldState, newState) => {
|
|
3686
|
-
const
|
|
3687
|
-
const
|
|
3688
|
-
const scrollBarValue = newState.deltaY / newState.finalDeltaY * 100;
|
|
3689
|
-
const scrollBarY = getScrollBarY(newState.deltaY, newState.finalDeltaY, newState.height - newState.headerHeight, newState.scrollBarHeight);
|
|
3690
|
-
const dom = getSearchVirtualDom(displayResults, newState.flags, newState.message, focusOutline, newState.searchInputErrorMessage, newState.scrollBarHeight, scrollBarY, scrollBarValue, newState.deltaY, newState.itemHeight, newState.matchCount);
|
|
3753
|
+
const viewModel = createViewModel(newState);
|
|
3754
|
+
const dom = getSearchVirtualDom(viewModel.displayResults, viewModel.flags, viewModel.message, viewModel.focusOutline, viewModel.searchInputErrorMessage, viewModel.scrollBarHeight, viewModel.scrollBarY, viewModel.scrollBarValue, viewModel.deltaY, viewModel.itemHeight, viewModel.matchCount);
|
|
3691
3755
|
return ['Viewlet.setDom2', newState.uid, dom];
|
|
3692
3756
|
};
|
|
3757
|
+
|
|
3693
3758
|
const renderFocus = (oldState, newState) => {
|
|
3694
3759
|
return oldState.focus === newState.focus || newState.focusSource === User;
|
|
3695
3760
|
};
|
|
@@ -3800,6 +3865,7 @@ const DiffValue = {
|
|
|
3800
3865
|
};
|
|
3801
3866
|
|
|
3802
3867
|
const modules = [DiffItems, DiffFocus, DiffIncludeValue, DiffExcludeValue, DiffReplaceValue, DiffValue];
|
|
3868
|
+
|
|
3803
3869
|
const diff$1 = (oldState, newState) => {
|
|
3804
3870
|
const diffResult = [];
|
|
3805
3871
|
for (const module of modules) {
|
|
@@ -4507,6 +4573,7 @@ const commandMap = {
|
|
|
4507
4573
|
'TextSearch.render': doRender,
|
|
4508
4574
|
'TextSearch.renderEventListeners': renderEventListeners,
|
|
4509
4575
|
'TextSearch.renderIncremental': renderIncremental,
|
|
4576
|
+
'TextSearch.restoreState': restoreState,
|
|
4510
4577
|
'TextSearch.saveState': saveState,
|
|
4511
4578
|
'TextSearch.terminate': terminate,
|
|
4512
4579
|
// TODO needed?
|