@lvce-editor/text-search-worker 5.1.0 → 5.2.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 +250 -224
- package/package.json +1 -1
|
@@ -60,49 +60,57 @@ class AssertionError extends Error {
|
|
|
60
60
|
this.name = 'AssertionError';
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
const Object$1 = 1;
|
|
64
|
+
const Number$1 = 2;
|
|
65
|
+
const Array$1 = 3;
|
|
66
|
+
const String = 4;
|
|
67
|
+
const Boolean$1 = 5;
|
|
68
|
+
const Function = 6;
|
|
69
|
+
const Null = 7;
|
|
70
|
+
const Unknown = 8;
|
|
63
71
|
const getType = value => {
|
|
64
72
|
switch (typeof value) {
|
|
65
73
|
case 'number':
|
|
66
|
-
return
|
|
74
|
+
return Number$1;
|
|
67
75
|
case 'function':
|
|
68
|
-
return
|
|
76
|
+
return Function;
|
|
69
77
|
case 'string':
|
|
70
|
-
return
|
|
78
|
+
return String;
|
|
71
79
|
case 'object':
|
|
72
80
|
if (value === null) {
|
|
73
|
-
return
|
|
81
|
+
return Null;
|
|
74
82
|
}
|
|
75
83
|
if (Array.isArray(value)) {
|
|
76
|
-
return
|
|
84
|
+
return Array$1;
|
|
77
85
|
}
|
|
78
|
-
return
|
|
86
|
+
return Object$1;
|
|
79
87
|
case 'boolean':
|
|
80
|
-
return
|
|
88
|
+
return Boolean$1;
|
|
81
89
|
default:
|
|
82
|
-
return
|
|
90
|
+
return Unknown;
|
|
83
91
|
}
|
|
84
92
|
};
|
|
85
93
|
const object = value => {
|
|
86
94
|
const type = getType(value);
|
|
87
|
-
if (type !==
|
|
95
|
+
if (type !== Object$1) {
|
|
88
96
|
throw new AssertionError('expected value to be of type object');
|
|
89
97
|
}
|
|
90
98
|
};
|
|
91
99
|
const number = value => {
|
|
92
100
|
const type = getType(value);
|
|
93
|
-
if (type !==
|
|
101
|
+
if (type !== Number$1) {
|
|
94
102
|
throw new AssertionError('expected value to be of type number');
|
|
95
103
|
}
|
|
96
104
|
};
|
|
97
105
|
const array = value => {
|
|
98
106
|
const type = getType(value);
|
|
99
|
-
if (type !==
|
|
107
|
+
if (type !== Array$1) {
|
|
100
108
|
throw new AssertionError('expected value to be of type array');
|
|
101
109
|
}
|
|
102
110
|
};
|
|
103
111
|
const string = value => {
|
|
104
112
|
const type = getType(value);
|
|
105
|
-
if (type !==
|
|
113
|
+
if (type !== String) {
|
|
106
114
|
throw new AssertionError('expected value to be of type string');
|
|
107
115
|
}
|
|
108
116
|
};
|
|
@@ -538,7 +546,7 @@ const waitForWebSocketToBeOpen = webSocket => {
|
|
|
538
546
|
error: Error$3
|
|
539
547
|
});
|
|
540
548
|
};
|
|
541
|
-
const create$
|
|
549
|
+
const create$7 = async ({
|
|
542
550
|
webSocket
|
|
543
551
|
}) => {
|
|
544
552
|
const firstWebSocketEvent = await waitForWebSocketToBeOpen(webSocket);
|
|
@@ -575,7 +583,7 @@ const wrap = webSocket => {
|
|
|
575
583
|
};
|
|
576
584
|
const IpcParentWithWebSocket$1 = {
|
|
577
585
|
__proto__: null,
|
|
578
|
-
create: create$
|
|
586
|
+
create: create$7,
|
|
579
587
|
wrap
|
|
580
588
|
};
|
|
581
589
|
|
|
@@ -588,7 +596,7 @@ const create$4$1 = (method, params) => {
|
|
|
588
596
|
};
|
|
589
597
|
};
|
|
590
598
|
const callbacks = Object.create(null);
|
|
591
|
-
const set$
|
|
599
|
+
const set$2 = (id, fn) => {
|
|
592
600
|
callbacks[id] = fn;
|
|
593
601
|
};
|
|
594
602
|
const get$3 = id => {
|
|
@@ -598,22 +606,22 @@ const remove$1 = id => {
|
|
|
598
606
|
delete callbacks[id];
|
|
599
607
|
};
|
|
600
608
|
let id = 0;
|
|
601
|
-
const create$3$
|
|
609
|
+
const create$3$2 = () => {
|
|
602
610
|
return ++id;
|
|
603
611
|
};
|
|
604
612
|
const registerPromise = () => {
|
|
605
|
-
const id = create$3$
|
|
613
|
+
const id = create$3$2();
|
|
606
614
|
const {
|
|
607
615
|
resolve,
|
|
608
616
|
promise
|
|
609
617
|
} = Promise.withResolvers();
|
|
610
|
-
set$
|
|
618
|
+
set$2(id, resolve);
|
|
611
619
|
return {
|
|
612
620
|
id,
|
|
613
621
|
promise
|
|
614
622
|
};
|
|
615
623
|
};
|
|
616
|
-
const create$2$
|
|
624
|
+
const create$2$2 = (method, params) => {
|
|
617
625
|
const {
|
|
618
626
|
id,
|
|
619
627
|
promise
|
|
@@ -821,7 +829,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
821
829
|
}
|
|
822
830
|
};
|
|
823
831
|
};
|
|
824
|
-
const create$1$
|
|
832
|
+
const create$1$1 = (id, error) => {
|
|
825
833
|
return {
|
|
826
834
|
jsonrpc: Two,
|
|
827
835
|
id,
|
|
@@ -832,9 +840,9 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
832
840
|
const prettyError = preparePrettyError(error);
|
|
833
841
|
logError(error, prettyError);
|
|
834
842
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
835
|
-
return create$1$
|
|
843
|
+
return create$1$1(id, errorProperty);
|
|
836
844
|
};
|
|
837
|
-
const create$
|
|
845
|
+
const create$6 = (message, result) => {
|
|
838
846
|
return {
|
|
839
847
|
jsonrpc: Two,
|
|
840
848
|
id: message.id,
|
|
@@ -843,7 +851,7 @@ const create$5 = (message, result) => {
|
|
|
843
851
|
};
|
|
844
852
|
const getSuccessResponse = (message, result) => {
|
|
845
853
|
const resultProperty = result ?? null;
|
|
846
|
-
return create$
|
|
854
|
+
return create$6(message, resultProperty);
|
|
847
855
|
};
|
|
848
856
|
const getErrorResponseSimple = (id, error) => {
|
|
849
857
|
return {
|
|
@@ -938,7 +946,7 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
|
938
946
|
const {
|
|
939
947
|
message,
|
|
940
948
|
promise
|
|
941
|
-
} = create$2$
|
|
949
|
+
} = create$2$2(method, params);
|
|
942
950
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
943
951
|
ipc.sendAndTransfer(message);
|
|
944
952
|
} else {
|
|
@@ -954,7 +962,7 @@ const send = (transport, method, ...params) => {
|
|
|
954
962
|
const invoke$2 = (ipc, method, ...params) => {
|
|
955
963
|
return invokeHelper(ipc, method, params, false);
|
|
956
964
|
};
|
|
957
|
-
const invokeAndTransfer
|
|
965
|
+
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
958
966
|
return invokeHelper(ipc, method, params, true);
|
|
959
967
|
};
|
|
960
968
|
|
|
@@ -987,7 +995,7 @@ const createRpc = ipc => {
|
|
|
987
995
|
return invoke$2(ipc, method, ...params);
|
|
988
996
|
},
|
|
989
997
|
invokeAndTransfer(method, ...params) {
|
|
990
|
-
return invokeAndTransfer
|
|
998
|
+
return invokeAndTransfer(ipc, method, ...params);
|
|
991
999
|
},
|
|
992
1000
|
async dispose() {
|
|
993
1001
|
await ipc?.dispose();
|
|
@@ -1025,27 +1033,41 @@ const listen$1 = async (module, options) => {
|
|
|
1025
1033
|
const ipc = module.wrap(rawIpc);
|
|
1026
1034
|
return ipc;
|
|
1027
1035
|
};
|
|
1028
|
-
const create$
|
|
1036
|
+
const create$5 = async ({
|
|
1029
1037
|
commandMap,
|
|
1030
|
-
messagePort
|
|
1031
|
-
isMessagePortOpen
|
|
1038
|
+
messagePort
|
|
1032
1039
|
}) => {
|
|
1033
1040
|
// TODO create a commandMap per rpc instance
|
|
1034
1041
|
register(commandMap);
|
|
1035
1042
|
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
1036
1043
|
messagePort,
|
|
1037
|
-
isMessagePortOpen
|
|
1044
|
+
isMessagePortOpen: true
|
|
1038
1045
|
});
|
|
1039
1046
|
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1040
1047
|
handleIpc(ipc);
|
|
1041
1048
|
const rpc = createRpc(ipc);
|
|
1049
|
+
messagePort.start();
|
|
1042
1050
|
return rpc;
|
|
1043
1051
|
};
|
|
1044
|
-
const
|
|
1052
|
+
const create$3$1 = async ({
|
|
1053
|
+
commandMap,
|
|
1054
|
+
send
|
|
1055
|
+
}) => {
|
|
1056
|
+
const {
|
|
1057
|
+
port1,
|
|
1058
|
+
port2
|
|
1059
|
+
} = new MessageChannel();
|
|
1060
|
+
await send(port1);
|
|
1061
|
+
return create$5({
|
|
1062
|
+
commandMap,
|
|
1063
|
+
messagePort: port2
|
|
1064
|
+
});
|
|
1065
|
+
};
|
|
1066
|
+
const TransferMessagePortRpcParent = {
|
|
1045
1067
|
__proto__: null,
|
|
1046
|
-
create: create$
|
|
1068
|
+
create: create$3$1
|
|
1047
1069
|
};
|
|
1048
|
-
const create$
|
|
1070
|
+
const create$2$1 = async ({
|
|
1049
1071
|
commandMap,
|
|
1050
1072
|
webSocket
|
|
1051
1073
|
}) => {
|
|
@@ -1061,7 +1083,7 @@ const create$1$1 = async ({
|
|
|
1061
1083
|
};
|
|
1062
1084
|
const WebSocketRpcParent = {
|
|
1063
1085
|
__proto__: null,
|
|
1064
|
-
create: create$
|
|
1086
|
+
create: create$2$1
|
|
1065
1087
|
};
|
|
1066
1088
|
const create$4 = async ({
|
|
1067
1089
|
commandMap
|
|
@@ -1078,6 +1100,68 @@ const WebWorkerRpcClient = {
|
|
|
1078
1100
|
create: create$4
|
|
1079
1101
|
};
|
|
1080
1102
|
|
|
1103
|
+
const create$3 = () => {
|
|
1104
|
+
const states = Object.create(null);
|
|
1105
|
+
return {
|
|
1106
|
+
get(uid) {
|
|
1107
|
+
return states[uid];
|
|
1108
|
+
},
|
|
1109
|
+
set(uid, oldState, newState) {
|
|
1110
|
+
states[uid] = {
|
|
1111
|
+
oldState,
|
|
1112
|
+
newState
|
|
1113
|
+
};
|
|
1114
|
+
},
|
|
1115
|
+
dispose(uid) {
|
|
1116
|
+
delete states[uid];
|
|
1117
|
+
},
|
|
1118
|
+
getKeys() {
|
|
1119
|
+
return Object.keys(states).map(key => {
|
|
1120
|
+
return Number.parseInt(key);
|
|
1121
|
+
});
|
|
1122
|
+
},
|
|
1123
|
+
clear() {
|
|
1124
|
+
for (const key of Object.keys(states)) {
|
|
1125
|
+
delete states[key];
|
|
1126
|
+
}
|
|
1127
|
+
},
|
|
1128
|
+
wrapCommand(fn) {
|
|
1129
|
+
const wrapped = async (uid, ...args) => {
|
|
1130
|
+
const {
|
|
1131
|
+
newState
|
|
1132
|
+
} = states[uid];
|
|
1133
|
+
const newerState = await fn(newState, ...args);
|
|
1134
|
+
if (newState === newerState) {
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
const latest = states[uid];
|
|
1138
|
+
states[uid] = {
|
|
1139
|
+
oldState: latest.oldState,
|
|
1140
|
+
newState: newerState
|
|
1141
|
+
};
|
|
1142
|
+
};
|
|
1143
|
+
return wrapped;
|
|
1144
|
+
},
|
|
1145
|
+
diff(uid, modules, numbers) {
|
|
1146
|
+
const {
|
|
1147
|
+
oldState,
|
|
1148
|
+
newState
|
|
1149
|
+
} = states[uid];
|
|
1150
|
+
const diffResult = [];
|
|
1151
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1152
|
+
const fn = modules[i];
|
|
1153
|
+
if (!fn(oldState, newState)) {
|
|
1154
|
+
diffResult.push(numbers[i]);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
return diffResult;
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
};
|
|
1161
|
+
const terminate = () => {
|
|
1162
|
+
globalThis.close();
|
|
1163
|
+
};
|
|
1164
|
+
|
|
1081
1165
|
const User = 1;
|
|
1082
1166
|
const Script = 2;
|
|
1083
1167
|
|
|
@@ -1150,7 +1234,7 @@ const get$2 = id => {
|
|
|
1150
1234
|
|
|
1151
1235
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1152
1236
|
|
|
1153
|
-
const create$
|
|
1237
|
+
const create$2 = rpcId => {
|
|
1154
1238
|
return {
|
|
1155
1239
|
// @ts-ignore
|
|
1156
1240
|
invoke(method, ...params) {
|
|
@@ -1179,26 +1263,68 @@ const RpcId = {
|
|
|
1179
1263
|
__proto__: null,
|
|
1180
1264
|
SearchProcess: SearchProcess$1};
|
|
1181
1265
|
const {
|
|
1182
|
-
invoke: invoke$
|
|
1266
|
+
invoke: invoke$3,
|
|
1183
1267
|
invokeAndTransfer: invokeAndTransfer$3,
|
|
1184
|
-
set: set$3} = create$
|
|
1268
|
+
set: set$3} = create$2(RendererWorker$1);
|
|
1269
|
+
const showContextMenu$1 = async (x, y, id, ...args) => {
|
|
1270
|
+
return invoke$3('ContextMenu.show', x, y, id, ...args);
|
|
1271
|
+
};
|
|
1272
|
+
const getFileIcon$2 = async options => {
|
|
1273
|
+
return invoke$3('IconTheme.getFileIcon', options);
|
|
1274
|
+
};
|
|
1275
|
+
const sendMessagePortToSearchProcess$1 = async port => {
|
|
1276
|
+
await invokeAndTransfer$3('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1277
|
+
};
|
|
1278
|
+
const writeClipBoardText$1 = async text => {
|
|
1279
|
+
await invoke$3('ClipBoard.writeText', /* text */text);
|
|
1280
|
+
};
|
|
1281
|
+
const openUri$2 = async (uri, focus, options) => {
|
|
1282
|
+
await invoke$3('Main.openUri', uri, focus, options);
|
|
1283
|
+
};
|
|
1185
1284
|
const RendererWorker = {
|
|
1186
1285
|
__proto__: null,
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1286
|
+
getFileIcon: getFileIcon$2,
|
|
1287
|
+
invoke: invoke$3,
|
|
1288
|
+
openUri: openUri$2,
|
|
1289
|
+
sendMessagePortToSearchProcess: sendMessagePortToSearchProcess$1,
|
|
1290
|
+
set: set$3,
|
|
1291
|
+
showContextMenu: showContextMenu$1,
|
|
1292
|
+
writeClipBoardText: writeClipBoardText$1
|
|
1190
1293
|
};
|
|
1191
|
-
const {
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1294
|
+
const createLazyRpc = rpcId => {
|
|
1295
|
+
let rpcPromise;
|
|
1296
|
+
let factory;
|
|
1297
|
+
const createRpc = async () => {
|
|
1298
|
+
const rpc = await factory();
|
|
1299
|
+
set$g(rpcId, rpc);
|
|
1300
|
+
};
|
|
1301
|
+
const ensureRpc = async () => {
|
|
1302
|
+
if (!rpcPromise) {
|
|
1303
|
+
rpcPromise = createRpc();
|
|
1304
|
+
}
|
|
1305
|
+
await rpcPromise;
|
|
1306
|
+
};
|
|
1307
|
+
return {
|
|
1308
|
+
setFactory(value) {
|
|
1309
|
+
factory = value;
|
|
1310
|
+
},
|
|
1311
|
+
async invoke(method, ...params) {
|
|
1312
|
+
await ensureRpc();
|
|
1313
|
+
const rpc = get$2(rpcId);
|
|
1314
|
+
return rpc.invoke(method, ...params);
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1196
1317
|
};
|
|
1197
1318
|
|
|
1198
1319
|
const {
|
|
1320
|
+
getFileIcon: getFileIcon$1,
|
|
1199
1321
|
invoke: invoke$1,
|
|
1200
|
-
|
|
1201
|
-
|
|
1322
|
+
openUri: openUri$1,
|
|
1323
|
+
sendMessagePortToSearchProcess,
|
|
1324
|
+
set: set$1,
|
|
1325
|
+
showContextMenu,
|
|
1326
|
+
writeClipBoardText
|
|
1327
|
+
} = RendererWorker;
|
|
1202
1328
|
|
|
1203
1329
|
const copy = async state => {
|
|
1204
1330
|
const {
|
|
@@ -1209,76 +1335,17 @@ const copy = async state => {
|
|
|
1209
1335
|
return state;
|
|
1210
1336
|
}
|
|
1211
1337
|
const item = items[listFocusedIndex];
|
|
1212
|
-
await
|
|
1338
|
+
await writeClipBoardText(item.text);
|
|
1213
1339
|
return state;
|
|
1214
1340
|
};
|
|
1215
1341
|
|
|
1216
1342
|
const minimumSliderSize = 20;
|
|
1217
1343
|
|
|
1218
|
-
const create$2 = () => {
|
|
1219
|
-
const states = Object.create(null);
|
|
1220
|
-
return {
|
|
1221
|
-
get(uid) {
|
|
1222
|
-
return states[uid];
|
|
1223
|
-
},
|
|
1224
|
-
set(uid, oldState, newState) {
|
|
1225
|
-
states[uid] = {
|
|
1226
|
-
oldState,
|
|
1227
|
-
newState
|
|
1228
|
-
};
|
|
1229
|
-
},
|
|
1230
|
-
dispose(uid) {
|
|
1231
|
-
delete states[uid];
|
|
1232
|
-
},
|
|
1233
|
-
getKeys() {
|
|
1234
|
-
return Object.keys(states).map(key => {
|
|
1235
|
-
return Number.parseInt(key);
|
|
1236
|
-
});
|
|
1237
|
-
},
|
|
1238
|
-
clear() {
|
|
1239
|
-
for (const key of Object.keys(states)) {
|
|
1240
|
-
delete states[key];
|
|
1241
|
-
}
|
|
1242
|
-
},
|
|
1243
|
-
wrapCommand(fn) {
|
|
1244
|
-
const wrapped = async (uid, ...args) => {
|
|
1245
|
-
const {
|
|
1246
|
-
newState
|
|
1247
|
-
} = states[uid];
|
|
1248
|
-
const newerState = await fn(newState, ...args);
|
|
1249
|
-
if (newState === newerState) {
|
|
1250
|
-
return;
|
|
1251
|
-
}
|
|
1252
|
-
const latest = states[uid];
|
|
1253
|
-
states[uid] = {
|
|
1254
|
-
oldState: latest.oldState,
|
|
1255
|
-
newState: newerState
|
|
1256
|
-
};
|
|
1257
|
-
};
|
|
1258
|
-
return wrapped;
|
|
1259
|
-
},
|
|
1260
|
-
diff(uid, modules, numbers) {
|
|
1261
|
-
const {
|
|
1262
|
-
oldState,
|
|
1263
|
-
newState
|
|
1264
|
-
} = states[uid];
|
|
1265
|
-
const diffResult = [];
|
|
1266
|
-
for (let i = 0; i < modules.length; i++) {
|
|
1267
|
-
const fn = modules[i];
|
|
1268
|
-
if (!fn(oldState, newState)) {
|
|
1269
|
-
diffResult.push(numbers[i]);
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
return diffResult;
|
|
1273
|
-
}
|
|
1274
|
-
};
|
|
1275
|
-
};
|
|
1276
|
-
|
|
1277
1344
|
const {
|
|
1278
1345
|
get: get$1,
|
|
1279
|
-
set
|
|
1346
|
+
set,
|
|
1280
1347
|
wrapCommand
|
|
1281
|
-
} = create$
|
|
1348
|
+
} = create$3();
|
|
1282
1349
|
|
|
1283
1350
|
const List$1 = 1;
|
|
1284
1351
|
|
|
@@ -1353,7 +1420,7 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
|
|
|
1353
1420
|
incrementalSearch: false,
|
|
1354
1421
|
searchId: ''
|
|
1355
1422
|
};
|
|
1356
|
-
set
|
|
1423
|
+
set(uid, state, state);
|
|
1357
1424
|
return state;
|
|
1358
1425
|
};
|
|
1359
1426
|
|
|
@@ -2010,7 +2077,7 @@ const handleUpdateError = async (state, update, error) => {
|
|
|
2010
2077
|
|
|
2011
2078
|
const getFileIcon = async result => {
|
|
2012
2079
|
if (result.type === File) {
|
|
2013
|
-
return
|
|
2080
|
+
return getFileIcon$1({
|
|
2014
2081
|
name: result.text
|
|
2015
2082
|
});
|
|
2016
2083
|
}
|
|
@@ -2185,33 +2252,6 @@ const getRipGrepArgs = ({
|
|
|
2185
2252
|
return ripGrepArgs;
|
|
2186
2253
|
};
|
|
2187
2254
|
|
|
2188
|
-
const createLazyRpc = rpcId => {
|
|
2189
|
-
let rpcPromise;
|
|
2190
|
-
let factory;
|
|
2191
|
-
const createRpc = async () => {
|
|
2192
|
-
const rpc = await factory();
|
|
2193
|
-
set$g(rpcId, rpc);
|
|
2194
|
-
};
|
|
2195
|
-
const ensureRpc = async () => {
|
|
2196
|
-
if (!rpcPromise) {
|
|
2197
|
-
rpcPromise = createRpc();
|
|
2198
|
-
}
|
|
2199
|
-
await rpcPromise;
|
|
2200
|
-
};
|
|
2201
|
-
return {
|
|
2202
|
-
setFactory(value) {
|
|
2203
|
-
factory = value;
|
|
2204
|
-
},
|
|
2205
|
-
async invoke(method, ...params) {
|
|
2206
|
-
await ensureRpc();
|
|
2207
|
-
const rpc = get$2(rpcId);
|
|
2208
|
-
return rpc.invoke(method, ...params);
|
|
2209
|
-
}
|
|
2210
|
-
};
|
|
2211
|
-
};
|
|
2212
|
-
|
|
2213
|
-
const {
|
|
2214
|
-
set} = SearchProcess;
|
|
2215
2255
|
const {
|
|
2216
2256
|
invoke,
|
|
2217
2257
|
setFactory
|
|
@@ -2260,7 +2300,7 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
2260
2300
|
minLineY: 0,
|
|
2261
2301
|
maxLineY: visible.length
|
|
2262
2302
|
};
|
|
2263
|
-
set
|
|
2303
|
+
set(uid, latest2.oldState, updatedState2);
|
|
2264
2304
|
// @ts-ignore
|
|
2265
2305
|
await invoke$1('Search.rerender');
|
|
2266
2306
|
await waitForNextFrame();
|
|
@@ -2292,7 +2332,7 @@ const handleUpdateIncremental = async (state, update) => {
|
|
|
2292
2332
|
...partialNewState,
|
|
2293
2333
|
searchId
|
|
2294
2334
|
};
|
|
2295
|
-
set
|
|
2335
|
+
set(uid, latest1.oldState, updatedState1);
|
|
2296
2336
|
|
|
2297
2337
|
// TODO await promise?
|
|
2298
2338
|
void textSearchIncremental(root, value, {
|
|
@@ -2642,31 +2682,11 @@ const handleSharedInput = (state, name, value, inputSource = Script) => {
|
|
|
2642
2682
|
return fn(state, value, inputSource);
|
|
2643
2683
|
};
|
|
2644
2684
|
|
|
2645
|
-
const getPortTuple = () => {
|
|
2646
|
-
const {
|
|
2647
|
-
port1,
|
|
2648
|
-
port2
|
|
2649
|
-
} = new MessageChannel();
|
|
2650
|
-
return {
|
|
2651
|
-
port1,
|
|
2652
|
-
port2
|
|
2653
|
-
};
|
|
2654
|
-
};
|
|
2655
|
-
|
|
2656
2685
|
const launchSearchProcessElectron = async () => {
|
|
2657
|
-
const {
|
|
2658
|
-
port1,
|
|
2659
|
-
port2
|
|
2660
|
-
} = getPortTuple();
|
|
2661
|
-
const rpcPromise = MessagePortRpcParent.create({
|
|
2662
|
-
messagePort: port2,
|
|
2686
|
+
const rpc = await TransferMessagePortRpcParent.create({
|
|
2663
2687
|
commandMap: {},
|
|
2664
|
-
|
|
2688
|
+
send: sendMessagePortToSearchProcess
|
|
2665
2689
|
});
|
|
2666
|
-
await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port1, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
2667
|
-
port2.start();
|
|
2668
|
-
const rpc = await rpcPromise;
|
|
2669
|
-
set(rpc);
|
|
2670
2690
|
return rpc;
|
|
2671
2691
|
};
|
|
2672
2692
|
|
|
@@ -3070,7 +3090,7 @@ const getFileIndex = (items, index) => {
|
|
|
3070
3090
|
};
|
|
3071
3091
|
|
|
3072
3092
|
const openUri = async (path, focus = true, props = {}) => {
|
|
3073
|
-
await
|
|
3093
|
+
await openUri$1(path, focus, props);
|
|
3074
3094
|
};
|
|
3075
3095
|
|
|
3076
3096
|
// TODO this should be in FileSystem module
|
|
@@ -3588,7 +3608,26 @@ const ClassNames = {
|
|
|
3588
3608
|
const mergeClassNames = (...classNames) => {
|
|
3589
3609
|
return classNames.filter(Boolean).join(' ');
|
|
3590
3610
|
};
|
|
3591
|
-
const
|
|
3611
|
+
const Button$2 = 1;
|
|
3612
|
+
const Div = 4;
|
|
3613
|
+
const Span = 8;
|
|
3614
|
+
const Text = 12;
|
|
3615
|
+
const Img = 17;
|
|
3616
|
+
const Ins = 20;
|
|
3617
|
+
const Del = 21;
|
|
3618
|
+
const H4 = 24;
|
|
3619
|
+
const TextArea = 62;
|
|
3620
|
+
const VirtualDomElements = {
|
|
3621
|
+
__proto__: null,
|
|
3622
|
+
Button: Button$2,
|
|
3623
|
+
Del,
|
|
3624
|
+
Div,
|
|
3625
|
+
H4,
|
|
3626
|
+
Img,
|
|
3627
|
+
Ins,
|
|
3628
|
+
Span,
|
|
3629
|
+
Text,
|
|
3630
|
+
TextArea};
|
|
3592
3631
|
const SetText = 1;
|
|
3593
3632
|
const SetAttribute = 3;
|
|
3594
3633
|
const RemoveAttribute = 4;
|
|
@@ -3678,7 +3717,7 @@ const diff = (oldNodes, newNodes) => {
|
|
|
3678
3717
|
j += newTotal;
|
|
3679
3718
|
continue;
|
|
3680
3719
|
}
|
|
3681
|
-
if (oldNode.type === Text
|
|
3720
|
+
if (oldNode.type === Text && newNode.type === Text) {
|
|
3682
3721
|
if (oldNode.text !== newNode.text) {
|
|
3683
3722
|
if (siblingOffset !== 0) {
|
|
3684
3723
|
pendingPatches.push(NavigateSibling, siblingOffset);
|
|
@@ -3801,7 +3840,7 @@ const diff = (oldNodes, newNodes) => {
|
|
|
3801
3840
|
};
|
|
3802
3841
|
|
|
3803
3842
|
const Alert = 'alert';
|
|
3804
|
-
const Button$
|
|
3843
|
+
const Button$1 = 'button';
|
|
3805
3844
|
const CheckBox = 'checkbox';
|
|
3806
3845
|
const None = 'none';
|
|
3807
3846
|
const ScrollBar = 'scrollbar';
|
|
@@ -3827,28 +3866,18 @@ const HandleScrollBarPointerDown = 'handleScrollBarPointerDown';
|
|
|
3827
3866
|
const HandleToggleButtonClick = 'handleToggleButtonClick';
|
|
3828
3867
|
const HandleWheel = 'handleWheel';
|
|
3829
3868
|
|
|
3830
|
-
const Button$1 = 1;
|
|
3831
|
-
const Del = 21;
|
|
3832
|
-
const Div = 4;
|
|
3833
|
-
const H4 = 24;
|
|
3834
|
-
const Img = 17;
|
|
3835
|
-
const Ins = 20;
|
|
3836
|
-
const Span = 8;
|
|
3837
|
-
const Text = 12;
|
|
3838
|
-
const TextArea = 62;
|
|
3839
|
-
|
|
3840
3869
|
const getSearchDetailsToggleVirtualDom = () => {
|
|
3841
3870
|
return [{
|
|
3842
|
-
type: Div,
|
|
3871
|
+
type: VirtualDomElements.Div,
|
|
3843
3872
|
className: ClassNames.ToggleDetails,
|
|
3844
|
-
role: Button$
|
|
3873
|
+
role: Button$1,
|
|
3845
3874
|
tabIndex: 0,
|
|
3846
3875
|
ariaLabel: toggleSearchDetails(),
|
|
3847
3876
|
title: toggleSearchDetails(),
|
|
3848
3877
|
name: ToggleSearchDetails,
|
|
3849
3878
|
childCount: 1
|
|
3850
3879
|
}, {
|
|
3851
|
-
type: Div,
|
|
3880
|
+
type: VirtualDomElements.Div,
|
|
3852
3881
|
className: mergeClassNames(ClassNames.MaskIcon, ClassNames.MaskIconEllipsis),
|
|
3853
3882
|
childCount: 0
|
|
3854
3883
|
}];
|
|
@@ -3856,7 +3885,7 @@ const getSearchDetailsToggleVirtualDom = () => {
|
|
|
3856
3885
|
|
|
3857
3886
|
const text = data => {
|
|
3858
3887
|
return {
|
|
3859
|
-
type: Text,
|
|
3888
|
+
type: VirtualDomElements.Text,
|
|
3860
3889
|
text: data,
|
|
3861
3890
|
childCount: 0
|
|
3862
3891
|
};
|
|
@@ -3870,7 +3899,7 @@ const getClassName = indented => {
|
|
|
3870
3899
|
};
|
|
3871
3900
|
const getSearchMessageVirtualDom = (message, indented) => {
|
|
3872
3901
|
return [{
|
|
3873
|
-
type: Div,
|
|
3902
|
+
type: VirtualDomElements.Div,
|
|
3874
3903
|
className: getClassName(indented),
|
|
3875
3904
|
role: Status,
|
|
3876
3905
|
tabIndex: 0,
|
|
@@ -3880,7 +3909,7 @@ const getSearchMessageVirtualDom = (message, indented) => {
|
|
|
3880
3909
|
|
|
3881
3910
|
const getSearchHeaderDetailsCollapsedVirtualDom = message => {
|
|
3882
3911
|
return [{
|
|
3883
|
-
type: Div,
|
|
3912
|
+
type: VirtualDomElements.Div,
|
|
3884
3913
|
className: ClassNames.SearchHeaderDetails,
|
|
3885
3914
|
childCount: 2
|
|
3886
3915
|
}, ...getSearchMessageVirtualDom(message, true), ...getSearchDetailsToggleVirtualDom()];
|
|
@@ -3966,7 +3995,7 @@ const getSearchFieldButtonVirtualDom = button => {
|
|
|
3966
3995
|
const role = getRole(flag);
|
|
3967
3996
|
const disabled = getDisabled(flag);
|
|
3968
3997
|
return [{
|
|
3969
|
-
type: Button
|
|
3998
|
+
type: VirtualDomElements.Button,
|
|
3970
3999
|
className: getSearchFieldButtonClassName(flag),
|
|
3971
4000
|
name,
|
|
3972
4001
|
title,
|
|
@@ -3976,7 +4005,7 @@ const getSearchFieldButtonVirtualDom = button => {
|
|
|
3976
4005
|
tabIndex: 0,
|
|
3977
4006
|
childCount: 1
|
|
3978
4007
|
}, {
|
|
3979
|
-
type: Span,
|
|
4008
|
+
type: VirtualDomElements.Span,
|
|
3980
4009
|
className: mergeClassNames(ClassNames.MaskIcon, icon),
|
|
3981
4010
|
childCount: 0
|
|
3982
4011
|
}];
|
|
@@ -3991,7 +4020,7 @@ const getOutSideButtonsDom = outsideButtons => {
|
|
|
3991
4020
|
}
|
|
3992
4021
|
return {
|
|
3993
4022
|
preNodes: [{
|
|
3994
|
-
type: Div,
|
|
4023
|
+
type: VirtualDomElements.Div,
|
|
3995
4024
|
className: ClassNames.SearchFieldContainer,
|
|
3996
4025
|
role: None,
|
|
3997
4026
|
childCount: 1 + outsideButtons.length
|
|
@@ -4007,12 +4036,12 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
4007
4036
|
} = getOutSideButtonsDom(outsideButtons);
|
|
4008
4037
|
const searchFieldClassName = hasError ? mergeClassNames(ClassNames.SearchField, ClassNames.SearchFieldError) : ClassNames.SearchField;
|
|
4009
4038
|
const dom = [...preNodes, {
|
|
4010
|
-
type: Div,
|
|
4039
|
+
type: VirtualDomElements.Div,
|
|
4011
4040
|
className: searchFieldClassName,
|
|
4012
4041
|
role: None,
|
|
4013
4042
|
childCount: 2
|
|
4014
4043
|
}, {
|
|
4015
|
-
type: TextArea,
|
|
4044
|
+
type: VirtualDomElements.TextArea,
|
|
4016
4045
|
className: ClassNames.MultilineInputBox,
|
|
4017
4046
|
spellcheck: false,
|
|
4018
4047
|
autocapitalize: 'off',
|
|
@@ -4023,7 +4052,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
4023
4052
|
onFocus,
|
|
4024
4053
|
childCount: 0
|
|
4025
4054
|
}, {
|
|
4026
|
-
type: Div,
|
|
4055
|
+
type: VirtualDomElements.Div,
|
|
4027
4056
|
className: ClassNames.SearchFieldButtons,
|
|
4028
4057
|
childCount: insideButtons.length
|
|
4029
4058
|
}, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom), ...postNodes];
|
|
@@ -4036,19 +4065,19 @@ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
|
|
|
4036
4065
|
const includePlaceholder = include();
|
|
4037
4066
|
const excludePlaceholder = exclude();
|
|
4038
4067
|
return [{
|
|
4039
|
-
type: Div,
|
|
4068
|
+
type: VirtualDomElements.Div,
|
|
4040
4069
|
className: ClassNames.SearchHeaderDetailsExpanded,
|
|
4041
4070
|
childCount: 5
|
|
4042
4071
|
}, {
|
|
4043
|
-
type: Div,
|
|
4072
|
+
type: VirtualDomElements.Div,
|
|
4044
4073
|
className: ClassNames.SearchHeaderDetailsExpandedTop,
|
|
4045
4074
|
childCount: 2
|
|
4046
4075
|
}, ...getSearchDetailsToggleVirtualDom(), {
|
|
4047
|
-
type: H4,
|
|
4076
|
+
type: VirtualDomElements.H4,
|
|
4048
4077
|
className: ClassNames.SearchHeaderDetailsHeading,
|
|
4049
4078
|
childCount: 1
|
|
4050
4079
|
}, text(filesToInclude()), ...getSearchFieldVirtualDom(FilesToInclude, includePlaceholder, HandleInput2, includeButtons.inside, includeButtons.outside), {
|
|
4051
|
-
type: H4,
|
|
4080
|
+
type: VirtualDomElements.H4,
|
|
4052
4081
|
className: ClassNames.SearchHeaderDetailsHeading,
|
|
4053
4082
|
childCount: 1
|
|
4054
4083
|
}, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, excludePlaceholder, HandleInput2, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message, false)];
|
|
@@ -4120,7 +4149,7 @@ const getSearchPlaceholder = focus => {
|
|
|
4120
4149
|
|
|
4121
4150
|
const getSearchToggleVirtualDom = replaceExpanded => {
|
|
4122
4151
|
return [{
|
|
4123
|
-
type: Button
|
|
4152
|
+
type: VirtualDomElements.Button,
|
|
4124
4153
|
className: mergeClassNames(ClassNames.IconButton, ClassNames.SearchToggleButton, replaceExpanded ? ClassNames.SearchToggleButtonExpanded : ''),
|
|
4125
4154
|
title: toggleReplace$1(),
|
|
4126
4155
|
ariaLabel: toggleReplace$1(),
|
|
@@ -4129,7 +4158,7 @@ const getSearchToggleVirtualDom = replaceExpanded => {
|
|
|
4129
4158
|
'data-command': 'toggleReplace',
|
|
4130
4159
|
name: ToggleReplace
|
|
4131
4160
|
}, {
|
|
4132
|
-
type: Div,
|
|
4161
|
+
type: VirtualDomElements.Div,
|
|
4133
4162
|
className: mergeClassNames(ClassNames.MaskIcon, replaceExpanded ? ClassNames.MaskIconChevronDown : ClassNames.MaskIconChevronRight),
|
|
4134
4163
|
childCount: 0
|
|
4135
4164
|
}];
|
|
@@ -4142,12 +4171,12 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
4142
4171
|
const replacePlaceholder = getReplacePlaceholder(focus);
|
|
4143
4172
|
const replaceExpanded = flags & ReplaceExpanded;
|
|
4144
4173
|
const dom = [{
|
|
4145
|
-
type: Div,
|
|
4174
|
+
type: VirtualDomElements.Div,
|
|
4146
4175
|
className: ClassNames.SearchHeaderTop,
|
|
4147
4176
|
role: None,
|
|
4148
4177
|
childCount: 2
|
|
4149
4178
|
}, ...getSearchToggleVirtualDom(replaceExpanded), {
|
|
4150
|
-
type: Div,
|
|
4179
|
+
type: VirtualDomElements.Div,
|
|
4151
4180
|
className: ClassNames.SearchHeaderTopRight,
|
|
4152
4181
|
role: None,
|
|
4153
4182
|
childCount: replaceExpanded ? 2 : 1
|
|
@@ -4159,7 +4188,7 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
4159
4188
|
};
|
|
4160
4189
|
|
|
4161
4190
|
const parentNode = {
|
|
4162
|
-
type: Div,
|
|
4191
|
+
type: VirtualDomElements.Div,
|
|
4163
4192
|
className: ClassNames.SearchHeader,
|
|
4164
4193
|
role: None,
|
|
4165
4194
|
childCount: 2,
|
|
@@ -4178,7 +4207,7 @@ const getSearchInputErrorVirtualDom = errorMessage => {
|
|
|
4178
4207
|
return [];
|
|
4179
4208
|
}
|
|
4180
4209
|
return [{
|
|
4181
|
-
type: Div,
|
|
4210
|
+
type: VirtualDomElements.Div,
|
|
4182
4211
|
className: ClassNames.SearchInputError,
|
|
4183
4212
|
role: Alert,
|
|
4184
4213
|
childCount: 1
|
|
@@ -4192,7 +4221,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
|
|
|
4192
4221
|
return [];
|
|
4193
4222
|
}
|
|
4194
4223
|
return [{
|
|
4195
|
-
type: Div,
|
|
4224
|
+
type: VirtualDomElements.Div,
|
|
4196
4225
|
className: mergeClassNames(ClassNames.ScrollBar, ClassNames.ScrollBarVertical),
|
|
4197
4226
|
childCount: 1,
|
|
4198
4227
|
onPointerDown: HandleScrollBarPointerDown,
|
|
@@ -4200,7 +4229,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
|
|
|
4200
4229
|
ariaControls: TreeItems,
|
|
4201
4230
|
ariaValueNow: scrollBarValue
|
|
4202
4231
|
}, {
|
|
4203
|
-
type: Div,
|
|
4232
|
+
type: VirtualDomElements.Div,
|
|
4204
4233
|
className: ClassNames.ScrollBarThumb,
|
|
4205
4234
|
height: scrollBarHeight,
|
|
4206
4235
|
translate: `0 ${scrollBarY}px`,
|
|
@@ -4226,26 +4255,26 @@ const getBadgeVirtualDom = (className, badgeText) => {
|
|
|
4226
4255
|
return [];
|
|
4227
4256
|
}
|
|
4228
4257
|
return [{
|
|
4229
|
-
type: Div,
|
|
4258
|
+
type: VirtualDomElements.Div,
|
|
4230
4259
|
className: mergeClassNames(ClassNames.Badge, className),
|
|
4231
4260
|
childCount: 1
|
|
4232
4261
|
}, text(badgeText)];
|
|
4233
4262
|
};
|
|
4234
4263
|
|
|
4235
4264
|
const chevronDownVirtualDom = {
|
|
4236
|
-
type: Div,
|
|
4265
|
+
type: VirtualDomElements.Div,
|
|
4237
4266
|
className: mergeClassNames(ClassNames.Chevron, ClassNames.MaskIconChevronDown),
|
|
4238
4267
|
childCount: 0
|
|
4239
4268
|
};
|
|
4240
4269
|
const chevronRightVirtualDom = {
|
|
4241
|
-
type: Div,
|
|
4270
|
+
type: VirtualDomElements.Div,
|
|
4242
4271
|
className: mergeClassNames(ClassNames.Chevron, ClassNames.MaskIconChevronRight),
|
|
4243
4272
|
childCount: 0
|
|
4244
4273
|
};
|
|
4245
4274
|
|
|
4246
4275
|
const getFileIconVirtualDom = icon => {
|
|
4247
4276
|
return {
|
|
4248
|
-
type: Img,
|
|
4277
|
+
type: VirtualDomElements.Img,
|
|
4249
4278
|
className: ClassNames.FileIcon,
|
|
4250
4279
|
src: icon,
|
|
4251
4280
|
role: None,
|
|
@@ -4265,22 +4294,22 @@ const getIconsVirtualDom = (expanded, icon) => {
|
|
|
4265
4294
|
};
|
|
4266
4295
|
|
|
4267
4296
|
const deleted = {
|
|
4268
|
-
type: Del,
|
|
4297
|
+
type: VirtualDomElements.Del,
|
|
4269
4298
|
className: ClassNames.HighlightDeleted,
|
|
4270
4299
|
childCount: 1
|
|
4271
4300
|
};
|
|
4272
4301
|
const inserted = {
|
|
4273
|
-
type: Ins,
|
|
4302
|
+
type: VirtualDomElements.Ins,
|
|
4274
4303
|
className: ClassNames.HighlightInserted,
|
|
4275
4304
|
childCount: 1
|
|
4276
4305
|
};
|
|
4277
4306
|
const highlighted = {
|
|
4278
|
-
type: Span,
|
|
4307
|
+
type: VirtualDomElements.Span,
|
|
4279
4308
|
className: ClassNames.Highlight,
|
|
4280
4309
|
childCount: 1
|
|
4281
4310
|
};
|
|
4282
4311
|
const label1 = {
|
|
4283
|
-
type: Div,
|
|
4312
|
+
type: VirtualDomElements.Div,
|
|
4284
4313
|
className: mergeClassNames(ClassNames.Label, ClassNames.Grow),
|
|
4285
4314
|
childCount: 1
|
|
4286
4315
|
};
|
|
@@ -4335,7 +4364,7 @@ const getSearchResultVirtualDom = rowInfo => {
|
|
|
4335
4364
|
badgeText
|
|
4336
4365
|
} = rowInfo;
|
|
4337
4366
|
const dom = [{
|
|
4338
|
-
type: Div,
|
|
4367
|
+
type: VirtualDomElements.Div,
|
|
4339
4368
|
role: TreeItem,
|
|
4340
4369
|
className: getSearchResultClassName(focused),
|
|
4341
4370
|
title,
|
|
@@ -4349,11 +4378,11 @@ const getSearchResultVirtualDom = rowInfo => {
|
|
|
4349
4378
|
paddingRight: PaddingRight,
|
|
4350
4379
|
ariaExpanded: getAriaExpanded(expanded)
|
|
4351
4380
|
}, ...getIconsVirtualDom(expanded, icon), ...getLabelVirtualDom(displayText, matchLength, matchStart, replacement), ...getBadgeVirtualDom(ClassNames.SourceControlBadge, badgeText), {
|
|
4352
|
-
type: Div,
|
|
4381
|
+
type: VirtualDomElements.Div,
|
|
4353
4382
|
className: ClassNames.SearchRemove,
|
|
4354
4383
|
childCount: 1
|
|
4355
4384
|
}, {
|
|
4356
|
-
type: Div,
|
|
4385
|
+
type: VirtualDomElements.Div,
|
|
4357
4386
|
className: ClassNames.CloseMaskIcon,
|
|
4358
4387
|
childCount: 0
|
|
4359
4388
|
}];
|
|
@@ -4363,7 +4392,7 @@ const getSearchResultVirtualDom = rowInfo => {
|
|
|
4363
4392
|
const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
|
|
4364
4393
|
const pixelOffset = deltaY % itemHeight;
|
|
4365
4394
|
return [{
|
|
4366
|
-
type: Div,
|
|
4395
|
+
type: VirtualDomElements.Div,
|
|
4367
4396
|
className: ClassNames.TreeItems,
|
|
4368
4397
|
childCount: visibleItems.length,
|
|
4369
4398
|
onClick: HandleClick,
|
|
@@ -4378,7 +4407,7 @@ const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
|
|
|
4378
4407
|
const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight) => {
|
|
4379
4408
|
const scrollBarDomNodes = scrollbarHeight === 0 ? 0 : 1;
|
|
4380
4409
|
return [{
|
|
4381
|
-
type: Div,
|
|
4410
|
+
type: VirtualDomElements.Div,
|
|
4382
4411
|
className: mergeClassNames(ClassNames.Viewlet, ClassNames.List, ClassNames.Tree, focusOutline ? ClassNames.FocusOutline : ClassNames.Empty),
|
|
4383
4412
|
role: Tree,
|
|
4384
4413
|
tabIndex: 0,
|
|
@@ -4390,7 +4419,7 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
|
|
|
4390
4419
|
const errorDom = getSearchInputErrorVirtualDom(searchInputErrorMessage);
|
|
4391
4420
|
const childCount = 2 + (errorDom.length > 0 ? 1 : 0);
|
|
4392
4421
|
return [{
|
|
4393
|
-
type: Div,
|
|
4422
|
+
type: VirtualDomElements.Div,
|
|
4394
4423
|
className: mergeClassNames(ClassNames.Viewlet, ClassNames.Search),
|
|
4395
4424
|
childCount
|
|
4396
4425
|
}, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
|
|
@@ -4450,14 +4479,14 @@ const render2 = (uid, diffResult) => {
|
|
|
4450
4479
|
oldState,
|
|
4451
4480
|
newState
|
|
4452
4481
|
} = get$1(uid);
|
|
4453
|
-
set
|
|
4482
|
+
set(uid, newState, newState);
|
|
4454
4483
|
const commands = applyRender(oldState, newState, diffResult);
|
|
4455
4484
|
return commands;
|
|
4456
4485
|
};
|
|
4457
4486
|
|
|
4458
4487
|
const Button = 1;
|
|
4459
4488
|
|
|
4460
|
-
const getIconVirtualDom = (icon, type = Div) => {
|
|
4489
|
+
const getIconVirtualDom = (icon, type = VirtualDomElements.Div) => {
|
|
4461
4490
|
return {
|
|
4462
4491
|
type,
|
|
4463
4492
|
className: mergeClassNames(ClassNames.MaskIcon, `MaskIcon${icon}`),
|
|
@@ -4473,7 +4502,7 @@ const getActionButtonVirtualDom = action => {
|
|
|
4473
4502
|
command
|
|
4474
4503
|
} = action;
|
|
4475
4504
|
return [{
|
|
4476
|
-
type: Button
|
|
4505
|
+
type: VirtualDomElements.Button,
|
|
4477
4506
|
className: ClassNames.IconButton,
|
|
4478
4507
|
title: id,
|
|
4479
4508
|
'data-command': command,
|
|
@@ -4492,7 +4521,7 @@ const getActionVirtualDom = action => {
|
|
|
4492
4521
|
|
|
4493
4522
|
const getActionsVirtualDom = actions => {
|
|
4494
4523
|
return [{
|
|
4495
|
-
type: Div,
|
|
4524
|
+
type: VirtualDomElements.Div,
|
|
4496
4525
|
className: ClassNames.Actions,
|
|
4497
4526
|
role: ToolBar,
|
|
4498
4527
|
childCount: actions.length
|
|
@@ -4796,10 +4825,6 @@ const submit = state => {
|
|
|
4796
4825
|
});
|
|
4797
4826
|
};
|
|
4798
4827
|
|
|
4799
|
-
const terminate = () => {
|
|
4800
|
-
globalThis.close();
|
|
4801
|
-
};
|
|
4802
|
-
|
|
4803
4828
|
const viewAsTree = async state => {
|
|
4804
4829
|
return state;
|
|
4805
4830
|
};
|
|
@@ -4812,7 +4837,7 @@ const show = async (x, y, id, ...args) => {
|
|
|
4812
4837
|
number(y);
|
|
4813
4838
|
number(id);
|
|
4814
4839
|
// TODO
|
|
4815
|
-
await
|
|
4840
|
+
await showContextMenu(x, y, id, ...args);
|
|
4816
4841
|
};
|
|
4817
4842
|
|
|
4818
4843
|
const Search = 18;
|
|
@@ -4965,6 +4990,7 @@ const textSearch$1 = async (scheme, root, query, options, assetDir, platform) =>
|
|
|
4965
4990
|
// @ts-ignore
|
|
4966
4991
|
return result.results;
|
|
4967
4992
|
}
|
|
4993
|
+
// TODO always create search process messageport rpc to have one api, in web can send the messageport to renderer worker
|
|
4968
4994
|
const results = await invoke$1('SearchProcess.invoke', 'TextSearch.search', actualOptions);
|
|
4969
4995
|
// TODO api is weird
|
|
4970
4996
|
return results.results;
|
|
@@ -5000,7 +5026,7 @@ const listen = async () => {
|
|
|
5000
5026
|
const rpc = await WebWorkerRpcClient.create({
|
|
5001
5027
|
commandMap: commandMap
|
|
5002
5028
|
});
|
|
5003
|
-
set$
|
|
5029
|
+
set$1(rpc);
|
|
5004
5030
|
};
|
|
5005
5031
|
|
|
5006
5032
|
const main = async () => {
|