@lvce-editor/text-search-worker 3.51.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 +110 -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;
|
|
@@ -4054,13 +4130,6 @@ const refresh = state => {
|
|
|
4054
4130
|
return handleUpdate(state, {});
|
|
4055
4131
|
};
|
|
4056
4132
|
|
|
4057
|
-
const RenderItems = 1;
|
|
4058
|
-
const RenderFocus = 2;
|
|
4059
|
-
const RenderValue = 3;
|
|
4060
|
-
const RenderReplaceValue = 4;
|
|
4061
|
-
const RenderIncludeValue = 5;
|
|
4062
|
-
const RenderExcludeValue = 6;
|
|
4063
|
-
|
|
4064
4133
|
const getFocusSelector = focusKey => {
|
|
4065
4134
|
switch (focusKey) {
|
|
4066
4135
|
case FocusSearchInput:
|
|
@@ -4189,48 +4258,14 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
4189
4258
|
return commands;
|
|
4190
4259
|
};
|
|
4191
4260
|
|
|
4192
|
-
const
|
|
4193
|
-
const
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
const
|
|
4199
|
-
return
|
|
4200
|
-
};
|
|
4201
|
-
|
|
4202
|
-
const diffType$3 = RenderIncludeValue;
|
|
4203
|
-
const isEqual$3 = (oldState, newState) => {
|
|
4204
|
-
return oldState.includeValue === newState.includeValue || newState.inputSource === User;
|
|
4205
|
-
};
|
|
4206
|
-
|
|
4207
|
-
const diffType$2 = RenderItems;
|
|
4208
|
-
const isEqual$2 = (oldState, newState) => {
|
|
4209
|
-
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;
|
|
4210
|
-
};
|
|
4211
|
-
|
|
4212
|
-
const diffType$1 = RenderReplaceValue;
|
|
4213
|
-
const isEqual$1 = (oldState, newState) => {
|
|
4214
|
-
return oldState.replacement === newState.replacement || newState.inputSource === User;
|
|
4215
|
-
};
|
|
4216
|
-
|
|
4217
|
-
const diffType = RenderValue;
|
|
4218
|
-
const isEqual = (oldState, newState) => {
|
|
4219
|
-
return oldState.value === newState.value || newState.inputSource === User;
|
|
4220
|
-
};
|
|
4221
|
-
|
|
4222
|
-
const modules = [isEqual$2, isEqual$4, isEqual$3, isEqual$5, isEqual$1, isEqual];
|
|
4223
|
-
const numbers = [diffType$2, diffType$4, diffType$3, diffType$5, diffType$1, diffType];
|
|
4224
|
-
|
|
4225
|
-
const diff = (oldState, newState) => {
|
|
4226
|
-
const diffResult = [];
|
|
4227
|
-
for (let i = 0; i < modules.length; i++) {
|
|
4228
|
-
const fn = modules[i];
|
|
4229
|
-
if (!fn(oldState, newState)) {
|
|
4230
|
-
diffResult.push(numbers[i]);
|
|
4231
|
-
}
|
|
4232
|
-
}
|
|
4233
|
-
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;
|
|
4234
4269
|
};
|
|
4235
4270
|
|
|
4236
4271
|
const doRender = uid => {
|
|
@@ -4238,7 +4273,7 @@ const doRender = uid => {
|
|
|
4238
4273
|
oldState,
|
|
4239
4274
|
newState
|
|
4240
4275
|
} = get(uid);
|
|
4241
|
-
const diffResult = diff(oldState, newState);
|
|
4276
|
+
const diffResult = diff$1(oldState, newState);
|
|
4242
4277
|
const commands = applyRender(oldState, newState, diffResult);
|
|
4243
4278
|
return commands;
|
|
4244
4279
|
};
|
|
@@ -4318,7 +4353,7 @@ const renderIncremental = uid => {
|
|
|
4318
4353
|
} = get(uid);
|
|
4319
4354
|
const oldDom = getDom(oldState);
|
|
4320
4355
|
const newDom = getDom(newState);
|
|
4321
|
-
const patches = diff
|
|
4356
|
+
const patches = diff(oldDom, newDom);
|
|
4322
4357
|
return patches;
|
|
4323
4358
|
};
|
|
4324
4359
|
|
|
@@ -4542,12 +4577,12 @@ const wrapCommand = fn => {
|
|
|
4542
4577
|
|
|
4543
4578
|
const commandMap = {
|
|
4544
4579
|
'TextSearch.clearSearchResults': wrapCommand(clearSearchResults$1),
|
|
4580
|
+
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
4545
4581
|
'TextSearch.copy': wrapCommand(copy),
|
|
4582
|
+
'TextSearch.diff2': diff2,
|
|
4546
4583
|
'TextSearch.dismissItem': wrapCommand(dismissItem),
|
|
4547
|
-
'TextSearch.handleHeaderFocusIn': wrapCommand(handleHeaderFocusIn),
|
|
4548
|
-
'TextSearch.focusFirst': wrapCommand(focusFirst),
|
|
4549
|
-
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
4550
4584
|
'TextSearch.expandDetails': wrapCommand(expandDetails),
|
|
4585
|
+
'TextSearch.focusFirst': wrapCommand(focusFirst),
|
|
4551
4586
|
'TextSearch.focusIndex': wrapCommand(focusIndex),
|
|
4552
4587
|
'TextSearch.focusLast': wrapCommand(focusLast),
|
|
4553
4588
|
'TextSearch.focusMatchCase': wrapCommand(focusMatchCase$1),
|
|
@@ -4568,11 +4603,10 @@ const commandMap = {
|
|
|
4568
4603
|
'TextSearch.focusReplaceValueNext': wrapCommand(focusReplaceValueNext),
|
|
4569
4604
|
'TextSearch.focusReplaceValuePrevious': wrapCommand(focusReplaceValuePrevious),
|
|
4570
4605
|
'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
|
|
4571
|
-
'TextSearch.getCommandIds': getCommandIds,
|
|
4572
|
-
'TextSearch.renderActions': wrapCommand(renderActions),
|
|
4573
4606
|
'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
|
|
4574
4607
|
'TextSearch.getActions': wrapCommand(getActions),
|
|
4575
4608
|
'TextSearch.getActionsVirtualDom': wrapCommand(getActionsVirtualDom),
|
|
4609
|
+
'TextSearch.getCommandIds': getCommandIds,
|
|
4576
4610
|
'TextSearch.getSearchDisplayResults': wrapCommand(getDisplayResults),
|
|
4577
4611
|
'TextSearch.getVirtualDom': wrapCommand(getSearchVirtualDom),
|
|
4578
4612
|
'TextSearch.handleClickAt': wrapCommand(handleClickAt),
|
|
@@ -4580,6 +4614,7 @@ const commandMap = {
|
|
|
4580
4614
|
'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
|
|
4581
4615
|
'TextSearch.handleFocusIn': wrapCommand(handleFocusIn),
|
|
4582
4616
|
'TextSearch.handleHeaderClick': wrapCommand(handleHeaderClick),
|
|
4617
|
+
'TextSearch.handleHeaderFocusIn': wrapCommand(handleHeaderFocusIn),
|
|
4583
4618
|
'TextSearch.handleIconThemeChange': wrapCommand(handleIconThemeChange),
|
|
4584
4619
|
'TextSearch.handleIncludeInput': wrapCommand(handleIncludeInput),
|
|
4585
4620
|
'TextSearch.handleInput': wrapCommand(handleInput),
|
|
@@ -4593,6 +4628,7 @@ const commandMap = {
|
|
|
4593
4628
|
'TextSearch.launchSearchProcess': wrapCommand(launchSearchProcess),
|
|
4594
4629
|
'TextSearch.loadContent': wrapCommand(loadContent),
|
|
4595
4630
|
'TextSearch.refresh': wrapCommand(refresh),
|
|
4631
|
+
'TextSearch.renderActions': wrapCommand(renderActions),
|
|
4596
4632
|
'TextSearch.replaceAll': wrapCommand(replaceAll),
|
|
4597
4633
|
'TextSearch.replaceAllAndPrompt': wrapCommand(replaceAllAndPrompt),
|
|
4598
4634
|
'TextSearch.selectIndex': wrapCommand(selectIndex),
|
|
@@ -4607,15 +4643,17 @@ const commandMap = {
|
|
|
4607
4643
|
'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
4608
4644
|
// not wrapped
|
|
4609
4645
|
'TextSearch.create': create,
|
|
4610
|
-
'TextSearch.getFlags': getFlags,
|
|
4611
|
-
'TextSearch.getFocus': getFocus,
|
|
4612
4646
|
'TextSearch.getKeyBindings': getKeyBindings,
|
|
4613
|
-
'TextSearch.
|
|
4647
|
+
'TextSearch.render2': render2,
|
|
4614
4648
|
'TextSearch.renderEventListeners': renderEventListeners,
|
|
4615
4649
|
'TextSearch.renderIncremental': renderIncremental,
|
|
4616
4650
|
'TextSearch.restoreState': restoreState,
|
|
4617
4651
|
'TextSearch.saveState': saveState,
|
|
4618
4652
|
'TextSearch.terminate': terminate,
|
|
4653
|
+
// deprecated
|
|
4654
|
+
'TextSearch.getFlags': getFlags,
|
|
4655
|
+
'TextSearch.getFocus': getFocus,
|
|
4656
|
+
'TextSearch.render': doRender,
|
|
4619
4657
|
// TODO needed?
|
|
4620
4658
|
'TextSearch.textSearch': textSearch
|
|
4621
4659
|
};
|