@lvce-editor/text-search-worker 3.50.0 → 3.52.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 +115 -72
- package/package.json +1 -1
|
@@ -609,11 +609,11 @@ const remove$1 = id => {
|
|
|
609
609
|
delete callbacks[id];
|
|
610
610
|
};
|
|
611
611
|
let id = 0;
|
|
612
|
-
const create$3 = () => {
|
|
612
|
+
const create$3$1 = () => {
|
|
613
613
|
return ++id;
|
|
614
614
|
};
|
|
615
615
|
const registerPromise = () => {
|
|
616
|
-
const id = create$3();
|
|
616
|
+
const id = create$3$1();
|
|
617
617
|
const {
|
|
618
618
|
resolve,
|
|
619
619
|
promise
|
|
@@ -1038,7 +1038,7 @@ const WebSocketRpcParent = {
|
|
|
1038
1038
|
__proto__: null,
|
|
1039
1039
|
create: create$1$1
|
|
1040
1040
|
};
|
|
1041
|
-
const create$
|
|
1041
|
+
const create$3 = async ({
|
|
1042
1042
|
commandMap
|
|
1043
1043
|
}) => {
|
|
1044
1044
|
// TODO create a commandMap per rpc instance
|
|
@@ -1050,7 +1050,7 @@ const create$2 = async ({
|
|
|
1050
1050
|
};
|
|
1051
1051
|
const WebWorkerRpcClient = {
|
|
1052
1052
|
__proto__: null,
|
|
1053
|
-
create: create$
|
|
1053
|
+
create: create$3
|
|
1054
1054
|
};
|
|
1055
1055
|
|
|
1056
1056
|
const User = 1;
|
|
@@ -1146,17 +1146,33 @@ const copy = async state => {
|
|
|
1146
1146
|
|
|
1147
1147
|
const minimumSliderSize = 20;
|
|
1148
1148
|
|
|
1149
|
-
const
|
|
1150
|
-
const
|
|
1151
|
-
return
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
oldState,
|
|
1156
|
-
|
|
1149
|
+
const create$2 = () => {
|
|
1150
|
+
const states = Object.create(null);
|
|
1151
|
+
return {
|
|
1152
|
+
get(uid) {
|
|
1153
|
+
return states[uid];
|
|
1154
|
+
},
|
|
1155
|
+
set(uid, oldState, newState) {
|
|
1156
|
+
states[uid] = {
|
|
1157
|
+
oldState,
|
|
1158
|
+
newState
|
|
1159
|
+
};
|
|
1160
|
+
},
|
|
1161
|
+
dispose(uid) {
|
|
1162
|
+
delete states[uid];
|
|
1163
|
+
},
|
|
1164
|
+
getKeys() {
|
|
1165
|
+
return Object.keys(states).map(key => {
|
|
1166
|
+
return Number.parseInt(key);
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1157
1169
|
};
|
|
1158
1170
|
};
|
|
1159
1171
|
|
|
1172
|
+
const {
|
|
1173
|
+
get,
|
|
1174
|
+
set} = create$2();
|
|
1175
|
+
|
|
1160
1176
|
const create$1 = ({
|
|
1161
1177
|
itemHeight,
|
|
1162
1178
|
headerHeight = 0,
|
|
@@ -1228,6 +1244,66 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
|
|
|
1228
1244
|
return state;
|
|
1229
1245
|
};
|
|
1230
1246
|
|
|
1247
|
+
const RenderItems = 1;
|
|
1248
|
+
const RenderFocus = 2;
|
|
1249
|
+
const RenderValue = 3;
|
|
1250
|
+
const RenderReplaceValue = 4;
|
|
1251
|
+
const RenderIncludeValue = 5;
|
|
1252
|
+
const RenderExcludeValue = 6;
|
|
1253
|
+
|
|
1254
|
+
const diffType$5 = RenderExcludeValue;
|
|
1255
|
+
const isEqual$5 = (oldState, newState) => {
|
|
1256
|
+
return oldState.excludeValue === newState.excludeValue || newState.inputSource === User;
|
|
1257
|
+
};
|
|
1258
|
+
|
|
1259
|
+
const diffType$4 = RenderFocus;
|
|
1260
|
+
const isEqual$4 = (oldState, newState) => {
|
|
1261
|
+
return oldState.focus === newState.focus || newState.focusSource === User;
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1264
|
+
const diffType$3 = RenderIncludeValue;
|
|
1265
|
+
const isEqual$3 = (oldState, newState) => {
|
|
1266
|
+
return oldState.includeValue === newState.includeValue || newState.inputSource === User;
|
|
1267
|
+
};
|
|
1268
|
+
|
|
1269
|
+
const diffType$2 = RenderItems;
|
|
1270
|
+
const isEqual$2 = (oldState, newState) => {
|
|
1271
|
+
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.replacement === newState.replacement && oldState.flags === newState.flags && oldState.message === newState.message && oldState.loaded === newState.loaded && oldState.collapsedPaths === newState.collapsedPaths && oldState.listFocusedIndex === newState.listFocusedIndex && oldState.listFocused === newState.listFocused && oldState.icons === newState.icons && oldState.searchInputErrorMessage === newState.searchInputErrorMessage && oldState.deltaY === newState.deltaY;
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1274
|
+
const diffType$1 = RenderReplaceValue;
|
|
1275
|
+
const isEqual$1 = (oldState, newState) => {
|
|
1276
|
+
return oldState.replacement === newState.replacement || newState.inputSource === User;
|
|
1277
|
+
};
|
|
1278
|
+
|
|
1279
|
+
const diffType = RenderValue;
|
|
1280
|
+
const isEqual = (oldState, newState) => {
|
|
1281
|
+
return oldState.value === newState.value || newState.inputSource === User;
|
|
1282
|
+
};
|
|
1283
|
+
|
|
1284
|
+
const modules = [isEqual$2, isEqual$4, isEqual$3, isEqual$5, isEqual$1, isEqual];
|
|
1285
|
+
const numbers = [diffType$2, diffType$4, diffType$3, diffType$5, diffType$1, diffType];
|
|
1286
|
+
|
|
1287
|
+
const diff$1 = (oldState, newState) => {
|
|
1288
|
+
const diffResult = [];
|
|
1289
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1290
|
+
const fn = modules[i];
|
|
1291
|
+
if (!fn(oldState, newState)) {
|
|
1292
|
+
diffResult.push(numbers[i]);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
return diffResult;
|
|
1296
|
+
};
|
|
1297
|
+
|
|
1298
|
+
const diff2 = uid => {
|
|
1299
|
+
const {
|
|
1300
|
+
oldState,
|
|
1301
|
+
newState
|
|
1302
|
+
} = get(uid);
|
|
1303
|
+
const diffResult = diff$1(oldState, newState);
|
|
1304
|
+
return diffResult;
|
|
1305
|
+
};
|
|
1306
|
+
|
|
1231
1307
|
// based on https://github.com/microsoft/vscode/blob/c0769274fa136b45799edeccc0d0a2f645b75caf/src/vs/base/common/arrays.ts#L625 (License MIT)
|
|
1232
1308
|
|
|
1233
1309
|
const isLastIndex = (array, index) => {
|
|
@@ -1927,7 +2003,7 @@ var getTotalChildCount = (nodes, index) => {
|
|
|
1927
2003
|
};
|
|
1928
2004
|
|
|
1929
2005
|
// src/parts/VirtualDomDiff/VirtualDomDiff.ts
|
|
1930
|
-
var diff
|
|
2006
|
+
var diff = (oldNodes, newNodes) => {
|
|
1931
2007
|
const patches = [];
|
|
1932
2008
|
const pendingPatches = [];
|
|
1933
2009
|
let i = 0;
|
|
@@ -2145,7 +2221,7 @@ const getActionsVirtualDom = actions => {
|
|
|
2145
2221
|
}, ...actions.flatMap(getActionVirtualDom)];
|
|
2146
2222
|
};
|
|
2147
2223
|
|
|
2148
|
-
const commandIds = ['clearSearchResults', 'collapseDetails', 'copy', 'dismissItem', 'expandDetails', 'focusFirst', 'focusIndex', 'focusLast', 'focusMatchCase', 'focusMatchCasePrevious', 'focusMatchWholeWord', 'focusNext', 'focusNextInput', 'focusNextPage', 'focusPreserveCasePrevious', 'focusPrevious', 'focusPreviousInput', 'focusPreviousPage', 'focusRegex', 'focusRegexNext', 'focusReplaceAll', 'focusReplaceValue', 'focusReplaceValueNext', 'focusReplaceValuePrevious', 'focusSearchValue', 'focusSearchValueNext', 'handleClick', 'handleClickAt', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleContextMenuMouseAt', 'handleExcludeInput', 'handleFocusIn', 'handleHeaderClick', 'handleIconThemeChange', 'handleIconThemeChange', 'handleIncludeInput', 'handleInput', 'handleListBlur', 'handleListFocus', 'handleReplaceInput', 'handleScrollBarCaptureLost', 'handleScrollBarClick', 'handleScrollBarMove', 'handleScrollBarThumbPointerMove', 'handleTouchEnd', 'handleTouchMove', 'handleTouchStart', 'handleUpdate', 'handleWheel', 'refresh', 'replaceAll', 'scrollDown', 'selectIndex', 'submit', 'toggleMatchCase', 'toggleMatchWholeWord', 'togglePreserveCase', 'toggleReplace', 'toggleSearchDetails', 'toggleUseRegularExpression'];
|
|
2224
|
+
const commandIds = ['clearSearchResults', 'collapseDetails', 'copy', 'dismissItem', 'expandDetails', 'focusFirst', 'focusIndex', 'focusLast', 'focusMatchCase', 'focusMatchCasePrevious', 'focusMatchWholeWord', 'focusNext', 'focusNextInput', 'focusNextPage', 'focusPreserveCasePrevious', 'focusPrevious', 'focusPreviousInput', 'focusPreviousPage', 'focusRegex', 'focusRegexNext', 'focusReplaceAll', 'focusReplaceValue', 'focusReplaceValueNext', 'focusReplaceValuePrevious', 'focusSearchValue', 'focusSearchValueNext', 'handleClick', 'handleClickAt', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleContextMenuMouseAt', 'handleExcludeInput', 'handleFocusIn', 'handleHeaderClick', 'handleHeaderFocusIn', 'handleIconThemeChange', 'handleIconThemeChange', 'handleIncludeInput', 'handleInput', 'handleListBlur', 'handleListFocus', 'handleReplaceInput', 'handleScrollBarCaptureLost', 'handleScrollBarClick', 'handleScrollBarMove', 'handleScrollBarThumbPointerMove', 'handleTouchEnd', 'handleTouchMove', 'handleTouchStart', 'handleUpdate', 'handleWheel', 'refresh', 'replaceAll', 'scrollDown', 'selectIndex', 'submit', 'toggleMatchCase', 'toggleMatchWholeWord', 'togglePreserveCase', 'toggleReplace', 'toggleSearchDetails', 'toggleUseRegularExpression'];
|
|
2149
2225
|
|
|
2150
2226
|
const getCommandIds = () => {
|
|
2151
2227
|
return commandIds;
|
|
@@ -3521,6 +3597,10 @@ const handleHeaderClick = async (state, name) => {
|
|
|
3521
3597
|
return fn(state);
|
|
3522
3598
|
};
|
|
3523
3599
|
|
|
3600
|
+
const handleHeaderFocusIn = state => {
|
|
3601
|
+
return state;
|
|
3602
|
+
};
|
|
3603
|
+
|
|
3524
3604
|
const handleIconThemeChange = async state => {
|
|
3525
3605
|
const {
|
|
3526
3606
|
items,
|
|
@@ -4050,13 +4130,6 @@ const refresh = state => {
|
|
|
4050
4130
|
return handleUpdate(state, {});
|
|
4051
4131
|
};
|
|
4052
4132
|
|
|
4053
|
-
const RenderItems = 1;
|
|
4054
|
-
const RenderFocus = 2;
|
|
4055
|
-
const RenderValue = 3;
|
|
4056
|
-
const RenderReplaceValue = 4;
|
|
4057
|
-
const RenderIncludeValue = 5;
|
|
4058
|
-
const RenderExcludeValue = 6;
|
|
4059
|
-
|
|
4060
4133
|
const getFocusSelector = focusKey => {
|
|
4061
4134
|
switch (focusKey) {
|
|
4062
4135
|
case FocusSearchInput:
|
|
@@ -4185,48 +4258,14 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
4185
4258
|
return commands;
|
|
4186
4259
|
};
|
|
4187
4260
|
|
|
4188
|
-
const
|
|
4189
|
-
const
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
const
|
|
4195
|
-
return
|
|
4196
|
-
};
|
|
4197
|
-
|
|
4198
|
-
const diffType$3 = RenderIncludeValue;
|
|
4199
|
-
const isEqual$3 = (oldState, newState) => {
|
|
4200
|
-
return oldState.includeValue === newState.includeValue || newState.inputSource === User;
|
|
4201
|
-
};
|
|
4202
|
-
|
|
4203
|
-
const diffType$2 = RenderItems;
|
|
4204
|
-
const isEqual$2 = (oldState, newState) => {
|
|
4205
|
-
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.replacement === newState.replacement && oldState.flags === newState.flags && oldState.message === newState.message && oldState.loaded === newState.loaded && oldState.collapsedPaths === newState.collapsedPaths && oldState.listFocusedIndex === newState.listFocusedIndex && oldState.listFocused === newState.listFocused && oldState.icons === newState.icons && oldState.searchInputErrorMessage === newState.searchInputErrorMessage && oldState.deltaY === newState.deltaY;
|
|
4206
|
-
};
|
|
4207
|
-
|
|
4208
|
-
const diffType$1 = RenderReplaceValue;
|
|
4209
|
-
const isEqual$1 = (oldState, newState) => {
|
|
4210
|
-
return oldState.replacement === newState.replacement || newState.inputSource === User;
|
|
4211
|
-
};
|
|
4212
|
-
|
|
4213
|
-
const diffType = RenderValue;
|
|
4214
|
-
const isEqual = (oldState, newState) => {
|
|
4215
|
-
return oldState.value === newState.value || newState.inputSource === User;
|
|
4216
|
-
};
|
|
4217
|
-
|
|
4218
|
-
const modules = [isEqual$2, isEqual$4, isEqual$3, isEqual$5, isEqual$1, isEqual];
|
|
4219
|
-
const numbers = [diffType$2, diffType$4, diffType$3, diffType$5, diffType$1, diffType];
|
|
4220
|
-
|
|
4221
|
-
const diff = (oldState, newState) => {
|
|
4222
|
-
const diffResult = [];
|
|
4223
|
-
for (let i = 0; i < modules.length; i++) {
|
|
4224
|
-
const fn = modules[i];
|
|
4225
|
-
if (!fn(oldState, newState)) {
|
|
4226
|
-
diffResult.push(numbers[i]);
|
|
4227
|
-
}
|
|
4228
|
-
}
|
|
4229
|
-
return diffResult;
|
|
4261
|
+
const render2 = (uid, diffResult) => {
|
|
4262
|
+
const {
|
|
4263
|
+
oldState,
|
|
4264
|
+
newState
|
|
4265
|
+
} = get(uid);
|
|
4266
|
+
set(uid, newState, newState);
|
|
4267
|
+
const commands = applyRender(oldState, newState, diffResult);
|
|
4268
|
+
return commands;
|
|
4230
4269
|
};
|
|
4231
4270
|
|
|
4232
4271
|
const doRender = uid => {
|
|
@@ -4234,7 +4273,7 @@ const doRender = uid => {
|
|
|
4234
4273
|
oldState,
|
|
4235
4274
|
newState
|
|
4236
4275
|
} = get(uid);
|
|
4237
|
-
const diffResult = diff(oldState, newState);
|
|
4276
|
+
const diffResult = diff$1(oldState, newState);
|
|
4238
4277
|
const commands = applyRender(oldState, newState, diffResult);
|
|
4239
4278
|
return commands;
|
|
4240
4279
|
};
|
|
@@ -4314,7 +4353,7 @@ const renderIncremental = uid => {
|
|
|
4314
4353
|
} = get(uid);
|
|
4315
4354
|
const oldDom = getDom(oldState);
|
|
4316
4355
|
const newDom = getDom(newState);
|
|
4317
|
-
const patches = diff
|
|
4356
|
+
const patches = diff(oldDom, newDom);
|
|
4318
4357
|
return patches;
|
|
4319
4358
|
};
|
|
4320
4359
|
|
|
@@ -4538,11 +4577,12 @@ const wrapCommand = fn => {
|
|
|
4538
4577
|
|
|
4539
4578
|
const commandMap = {
|
|
4540
4579
|
'TextSearch.clearSearchResults': wrapCommand(clearSearchResults$1),
|
|
4580
|
+
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
4541
4581
|
'TextSearch.copy': wrapCommand(copy),
|
|
4582
|
+
'TextSearch.diff2': diff2,
|
|
4542
4583
|
'TextSearch.dismissItem': wrapCommand(dismissItem),
|
|
4543
|
-
'TextSearch.focusFirst': wrapCommand(focusFirst),
|
|
4544
|
-
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
4545
4584
|
'TextSearch.expandDetails': wrapCommand(expandDetails),
|
|
4585
|
+
'TextSearch.focusFirst': wrapCommand(focusFirst),
|
|
4546
4586
|
'TextSearch.focusIndex': wrapCommand(focusIndex),
|
|
4547
4587
|
'TextSearch.focusLast': wrapCommand(focusLast),
|
|
4548
4588
|
'TextSearch.focusMatchCase': wrapCommand(focusMatchCase$1),
|
|
@@ -4563,11 +4603,10 @@ const commandMap = {
|
|
|
4563
4603
|
'TextSearch.focusReplaceValueNext': wrapCommand(focusReplaceValueNext),
|
|
4564
4604
|
'TextSearch.focusReplaceValuePrevious': wrapCommand(focusReplaceValuePrevious),
|
|
4565
4605
|
'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
|
|
4566
|
-
'TextSearch.getCommandIds': getCommandIds,
|
|
4567
|
-
'TextSearch.renderActions': wrapCommand(renderActions),
|
|
4568
4606
|
'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
|
|
4569
4607
|
'TextSearch.getActions': wrapCommand(getActions),
|
|
4570
4608
|
'TextSearch.getActionsVirtualDom': wrapCommand(getActionsVirtualDom),
|
|
4609
|
+
'TextSearch.getCommandIds': getCommandIds,
|
|
4571
4610
|
'TextSearch.getSearchDisplayResults': wrapCommand(getDisplayResults),
|
|
4572
4611
|
'TextSearch.getVirtualDom': wrapCommand(getSearchVirtualDom),
|
|
4573
4612
|
'TextSearch.handleClickAt': wrapCommand(handleClickAt),
|
|
@@ -4575,6 +4614,7 @@ const commandMap = {
|
|
|
4575
4614
|
'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
|
|
4576
4615
|
'TextSearch.handleFocusIn': wrapCommand(handleFocusIn),
|
|
4577
4616
|
'TextSearch.handleHeaderClick': wrapCommand(handleHeaderClick),
|
|
4617
|
+
'TextSearch.handleHeaderFocusIn': wrapCommand(handleHeaderFocusIn),
|
|
4578
4618
|
'TextSearch.handleIconThemeChange': wrapCommand(handleIconThemeChange),
|
|
4579
4619
|
'TextSearch.handleIncludeInput': wrapCommand(handleIncludeInput),
|
|
4580
4620
|
'TextSearch.handleInput': wrapCommand(handleInput),
|
|
@@ -4588,6 +4628,7 @@ const commandMap = {
|
|
|
4588
4628
|
'TextSearch.launchSearchProcess': wrapCommand(launchSearchProcess),
|
|
4589
4629
|
'TextSearch.loadContent': wrapCommand(loadContent),
|
|
4590
4630
|
'TextSearch.refresh': wrapCommand(refresh),
|
|
4631
|
+
'TextSearch.renderActions': wrapCommand(renderActions),
|
|
4591
4632
|
'TextSearch.replaceAll': wrapCommand(replaceAll),
|
|
4592
4633
|
'TextSearch.replaceAllAndPrompt': wrapCommand(replaceAllAndPrompt),
|
|
4593
4634
|
'TextSearch.selectIndex': wrapCommand(selectIndex),
|
|
@@ -4602,15 +4643,17 @@ const commandMap = {
|
|
|
4602
4643
|
'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
4603
4644
|
// not wrapped
|
|
4604
4645
|
'TextSearch.create': create,
|
|
4605
|
-
'TextSearch.getFlags': getFlags,
|
|
4606
|
-
'TextSearch.getFocus': getFocus,
|
|
4607
4646
|
'TextSearch.getKeyBindings': getKeyBindings,
|
|
4608
|
-
'TextSearch.
|
|
4647
|
+
'TextSearch.render2': render2,
|
|
4609
4648
|
'TextSearch.renderEventListeners': renderEventListeners,
|
|
4610
4649
|
'TextSearch.renderIncremental': renderIncremental,
|
|
4611
4650
|
'TextSearch.restoreState': restoreState,
|
|
4612
4651
|
'TextSearch.saveState': saveState,
|
|
4613
4652
|
'TextSearch.terminate': terminate,
|
|
4653
|
+
// deprecated
|
|
4654
|
+
'TextSearch.getFlags': getFlags,
|
|
4655
|
+
'TextSearch.getFocus': getFocus,
|
|
4656
|
+
'TextSearch.render': doRender,
|
|
4614
4657
|
// TODO needed?
|
|
4615
4658
|
'TextSearch.textSearch': textSearch
|
|
4616
4659
|
};
|