@lvce-editor/explorer-view 7.21.1 → 7.21.2
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/explorerViewWorkerMain.js +446 -399
- package/package.json +1 -1
|
@@ -1,249 +1,3 @@
|
|
|
1
|
-
const toCommandId = key => {
|
|
2
|
-
const dotIndex = key.indexOf('.');
|
|
3
|
-
return key.slice(dotIndex + 1);
|
|
4
|
-
};
|
|
5
|
-
const create$a = () => {
|
|
6
|
-
const commandQueues = new Map();
|
|
7
|
-
const generations = Object.create(null);
|
|
8
|
-
const states = Object.create(null);
|
|
9
|
-
const commandMapRef = {};
|
|
10
|
-
const getGeneration = uid => generations[uid] || 0;
|
|
11
|
-
const isCurrentGeneration = (uid, generation) => {
|
|
12
|
-
return states[uid] !== undefined && getGeneration(uid) === generation;
|
|
13
|
-
};
|
|
14
|
-
const updateState = (uid, generation, fallbackState, updater) => {
|
|
15
|
-
if (!isCurrentGeneration(uid, generation)) {
|
|
16
|
-
return Promise.resolve(fallbackState);
|
|
17
|
-
}
|
|
18
|
-
const current = states[uid];
|
|
19
|
-
const updatedState = updater(current.newState);
|
|
20
|
-
if (updatedState !== current.newState) {
|
|
21
|
-
states[uid] = {
|
|
22
|
-
newState: updatedState,
|
|
23
|
-
oldState: current.oldState,
|
|
24
|
-
scheduledState: updatedState
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
return Promise.resolve(updatedState);
|
|
28
|
-
};
|
|
29
|
-
const createAsyncCommandContext = (uid, generation) => {
|
|
30
|
-
let latestState = states[uid].newState;
|
|
31
|
-
return {
|
|
32
|
-
getState: () => {
|
|
33
|
-
if (isCurrentGeneration(uid, generation)) {
|
|
34
|
-
latestState = states[uid].newState;
|
|
35
|
-
}
|
|
36
|
-
return latestState;
|
|
37
|
-
},
|
|
38
|
-
updateState: async updater => {
|
|
39
|
-
latestState = await updateState(uid, generation, latestState, updater);
|
|
40
|
-
return latestState;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
const enqueueCommand = async (uid, command) => {
|
|
45
|
-
const previous = commandQueues.get(uid) || Promise.resolve();
|
|
46
|
-
const run = async () => {
|
|
47
|
-
try {
|
|
48
|
-
await previous;
|
|
49
|
-
} catch {
|
|
50
|
-
// The previous caller receives its error; later commands must still run.
|
|
51
|
-
}
|
|
52
|
-
await command();
|
|
53
|
-
};
|
|
54
|
-
const current = run();
|
|
55
|
-
commandQueues.set(uid, current);
|
|
56
|
-
try {
|
|
57
|
-
await current;
|
|
58
|
-
} finally {
|
|
59
|
-
if (commandQueues.get(uid) === current) {
|
|
60
|
-
commandQueues.delete(uid);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
return {
|
|
65
|
-
clear() {
|
|
66
|
-
commandQueues.clear();
|
|
67
|
-
for (const key of Object.keys(states)) {
|
|
68
|
-
delete states[key];
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
diff(uid, modules, numbers) {
|
|
72
|
-
const {
|
|
73
|
-
oldState,
|
|
74
|
-
scheduledState
|
|
75
|
-
} = states[uid];
|
|
76
|
-
const diffResult = [];
|
|
77
|
-
for (let i = 0; i < modules.length; i++) {
|
|
78
|
-
const fn = modules[i];
|
|
79
|
-
if (!fn(oldState, scheduledState)) {
|
|
80
|
-
diffResult.push(numbers[i]);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return diffResult;
|
|
84
|
-
},
|
|
85
|
-
dispose(uid) {
|
|
86
|
-
commandQueues.delete(uid);
|
|
87
|
-
delete states[uid];
|
|
88
|
-
},
|
|
89
|
-
get(uid) {
|
|
90
|
-
return states[uid];
|
|
91
|
-
},
|
|
92
|
-
getCommandIds() {
|
|
93
|
-
const keys = Object.keys(commandMapRef);
|
|
94
|
-
const ids = keys.map(toCommandId);
|
|
95
|
-
return ids;
|
|
96
|
-
},
|
|
97
|
-
getKeys() {
|
|
98
|
-
return Object.keys(states).map(Number);
|
|
99
|
-
},
|
|
100
|
-
registerCommands(commandMap) {
|
|
101
|
-
Object.assign(commandMapRef, commandMap);
|
|
102
|
-
},
|
|
103
|
-
set(uid, oldState, newState, scheduledState) {
|
|
104
|
-
const current = states[uid];
|
|
105
|
-
if (!current || oldState === newState && newState !== current.newState) {
|
|
106
|
-
generations[uid] = getGeneration(uid) + 1;
|
|
107
|
-
}
|
|
108
|
-
states[uid] = {
|
|
109
|
-
newState,
|
|
110
|
-
oldState,
|
|
111
|
-
scheduledState: scheduledState ?? newState
|
|
112
|
-
};
|
|
113
|
-
},
|
|
114
|
-
wrapAsyncCommand(fn) {
|
|
115
|
-
const wrapped = async (uid, ...args) => {
|
|
116
|
-
const generation = getGeneration(uid);
|
|
117
|
-
const context = createAsyncCommandContext(uid, generation);
|
|
118
|
-
await fn(context, ...args);
|
|
119
|
-
};
|
|
120
|
-
return wrapped;
|
|
121
|
-
},
|
|
122
|
-
wrapCommand(fn) {
|
|
123
|
-
const wrapped = async (uid, ...args) => {
|
|
124
|
-
const generation = getGeneration(uid);
|
|
125
|
-
const {
|
|
126
|
-
newState,
|
|
127
|
-
oldState
|
|
128
|
-
} = states[uid];
|
|
129
|
-
const newerState = await fn(newState, ...args);
|
|
130
|
-
if (oldState === newerState || newState === newerState) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (!isCurrentGeneration(uid, generation)) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const latestOld = states[uid];
|
|
137
|
-
const latestNew = {
|
|
138
|
-
...latestOld.newState,
|
|
139
|
-
...newerState
|
|
140
|
-
};
|
|
141
|
-
states[uid] = {
|
|
142
|
-
newState: latestNew,
|
|
143
|
-
oldState: latestOld.oldState,
|
|
144
|
-
scheduledState: latestNew
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
return wrapped;
|
|
148
|
-
},
|
|
149
|
-
wrapGetter(fn) {
|
|
150
|
-
const wrapped = (uid, ...args) => {
|
|
151
|
-
const {
|
|
152
|
-
newState
|
|
153
|
-
} = states[uid];
|
|
154
|
-
return fn(newState, ...args);
|
|
155
|
-
};
|
|
156
|
-
return wrapped;
|
|
157
|
-
},
|
|
158
|
-
wrapLoadContent(fn) {
|
|
159
|
-
const wrapped = async (uid, ...args) => {
|
|
160
|
-
const generation = getGeneration(uid);
|
|
161
|
-
const {
|
|
162
|
-
newState,
|
|
163
|
-
oldState
|
|
164
|
-
} = states[uid];
|
|
165
|
-
const result = await fn(newState, ...args);
|
|
166
|
-
const {
|
|
167
|
-
error,
|
|
168
|
-
state
|
|
169
|
-
} = result;
|
|
170
|
-
if (oldState === state || newState === state) {
|
|
171
|
-
return {
|
|
172
|
-
error
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
if (!isCurrentGeneration(uid, generation)) {
|
|
176
|
-
return {
|
|
177
|
-
error
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
const latestOld = states[uid];
|
|
181
|
-
const latestNew = {
|
|
182
|
-
...latestOld.newState,
|
|
183
|
-
...state
|
|
184
|
-
};
|
|
185
|
-
states[uid] = {
|
|
186
|
-
newState: latestNew,
|
|
187
|
-
oldState: latestOld.oldState,
|
|
188
|
-
scheduledState: latestNew
|
|
189
|
-
};
|
|
190
|
-
return {
|
|
191
|
-
error
|
|
192
|
-
};
|
|
193
|
-
};
|
|
194
|
-
return wrapped;
|
|
195
|
-
},
|
|
196
|
-
wrapSerialAsyncCommand(fn) {
|
|
197
|
-
const wrapped = async (uid, ...args) => {
|
|
198
|
-
await enqueueCommand(uid, async () => {
|
|
199
|
-
if (!states[uid]) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
const generation = getGeneration(uid);
|
|
203
|
-
const context = createAsyncCommandContext(uid, generation);
|
|
204
|
-
await fn(context, ...args);
|
|
205
|
-
});
|
|
206
|
-
};
|
|
207
|
-
return wrapped;
|
|
208
|
-
},
|
|
209
|
-
wrapSerialCommand(fn) {
|
|
210
|
-
const wrapped = async (uid, ...args) => {
|
|
211
|
-
await enqueueCommand(uid, async () => {
|
|
212
|
-
if (!states[uid]) {
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
const generation = getGeneration(uid);
|
|
216
|
-
const {
|
|
217
|
-
newState,
|
|
218
|
-
oldState
|
|
219
|
-
} = states[uid];
|
|
220
|
-
const newerState = await fn(newState, ...args);
|
|
221
|
-
if (oldState === newerState || newState === newerState) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
if (!isCurrentGeneration(uid, generation)) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
const latestOld = states[uid];
|
|
228
|
-
const latestNew = {
|
|
229
|
-
...latestOld.newState,
|
|
230
|
-
...newerState
|
|
231
|
-
};
|
|
232
|
-
states[uid] = {
|
|
233
|
-
newState: latestNew,
|
|
234
|
-
oldState: latestOld.oldState,
|
|
235
|
-
scheduledState: latestNew
|
|
236
|
-
};
|
|
237
|
-
});
|
|
238
|
-
};
|
|
239
|
-
return wrapped;
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
const terminate = () => {
|
|
244
|
-
globalThis.close();
|
|
245
|
-
};
|
|
246
|
-
|
|
247
1
|
const normalizeLine = line => {
|
|
248
2
|
if (line.startsWith('Error: ')) {
|
|
249
3
|
return line.slice('Error: '.length);
|
|
@@ -300,12 +54,6 @@ class VError extends Error {
|
|
|
300
54
|
}
|
|
301
55
|
}
|
|
302
56
|
|
|
303
|
-
const CreateFolder$1 = 1;
|
|
304
|
-
const CreateFile$1 = 2;
|
|
305
|
-
const Copy$1 = 3;
|
|
306
|
-
const Rename$2 = 4;
|
|
307
|
-
const Remove = 5;
|
|
308
|
-
|
|
309
57
|
const isMessagePort = value => {
|
|
310
58
|
return value && value instanceof MessagePort;
|
|
311
59
|
};
|
|
@@ -997,7 +745,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
997
745
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
998
746
|
return create$1$1(id, errorProperty);
|
|
999
747
|
};
|
|
1000
|
-
const create$
|
|
748
|
+
const create$a = (message, result) => {
|
|
1001
749
|
return {
|
|
1002
750
|
id: message.id,
|
|
1003
751
|
jsonrpc: Two$1,
|
|
@@ -1006,7 +754,7 @@ const create$9 = (message, result) => {
|
|
|
1006
754
|
};
|
|
1007
755
|
const getSuccessResponse = (message, result) => {
|
|
1008
756
|
const resultProperty = result ?? null;
|
|
1009
|
-
return create$
|
|
757
|
+
return create$a(message, resultProperty);
|
|
1010
758
|
};
|
|
1011
759
|
const getErrorResponseSimple = (id, error) => {
|
|
1012
760
|
return {
|
|
@@ -1100,7 +848,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
1100
848
|
|
|
1101
849
|
const Two = '2.0';
|
|
1102
850
|
|
|
1103
|
-
const create$
|
|
851
|
+
const create$9 = (method, params) => {
|
|
1104
852
|
return {
|
|
1105
853
|
jsonrpc: Two,
|
|
1106
854
|
method,
|
|
@@ -1108,7 +856,7 @@ const create$8 = (method, params) => {
|
|
|
1108
856
|
};
|
|
1109
857
|
};
|
|
1110
858
|
|
|
1111
|
-
const create$
|
|
859
|
+
const create$8 = (id, method, params) => {
|
|
1112
860
|
const message = {
|
|
1113
861
|
id,
|
|
1114
862
|
jsonrpc: Two,
|
|
@@ -1119,12 +867,12 @@ const create$7 = (id, method, params) => {
|
|
|
1119
867
|
};
|
|
1120
868
|
|
|
1121
869
|
let id = 0;
|
|
1122
|
-
const create$
|
|
870
|
+
const create$7 = () => {
|
|
1123
871
|
return ++id;
|
|
1124
872
|
};
|
|
1125
873
|
|
|
1126
874
|
const registerPromise = map => {
|
|
1127
|
-
const id = create$
|
|
875
|
+
const id = create$7();
|
|
1128
876
|
const {
|
|
1129
877
|
promise,
|
|
1130
878
|
resolve
|
|
@@ -1141,7 +889,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
1141
889
|
id,
|
|
1142
890
|
promise
|
|
1143
891
|
} = registerPromise(callbacks);
|
|
1144
|
-
const message = create$
|
|
892
|
+
const message = create$8(id, method, params);
|
|
1145
893
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
1146
894
|
ipc.sendAndTransfer(message);
|
|
1147
895
|
} else {
|
|
@@ -1177,7 +925,7 @@ const createRpc = ipc => {
|
|
|
1177
925
|
* @deprecated
|
|
1178
926
|
*/
|
|
1179
927
|
send(method, ...params) {
|
|
1180
|
-
const message = create$
|
|
928
|
+
const message = create$9(method, params);
|
|
1181
929
|
ipc.send(message);
|
|
1182
930
|
}
|
|
1183
931
|
};
|
|
@@ -1245,7 +993,7 @@ const createSharedLazyRpc = factory => {
|
|
|
1245
993
|
};
|
|
1246
994
|
};
|
|
1247
995
|
|
|
1248
|
-
const create$
|
|
996
|
+
const create$6 = async ({
|
|
1249
997
|
commandMap,
|
|
1250
998
|
isMessagePortOpen = true,
|
|
1251
999
|
messagePort
|
|
@@ -1263,7 +1011,7 @@ const create$5 = async ({
|
|
|
1263
1011
|
return rpc;
|
|
1264
1012
|
};
|
|
1265
1013
|
|
|
1266
|
-
const create$
|
|
1014
|
+
const create$5 = async ({
|
|
1267
1015
|
commandMap,
|
|
1268
1016
|
isMessagePortOpen,
|
|
1269
1017
|
send
|
|
@@ -1273,20 +1021,20 @@ const create$4 = async ({
|
|
|
1273
1021
|
port2
|
|
1274
1022
|
} = new MessageChannel();
|
|
1275
1023
|
await send(port1);
|
|
1276
|
-
return create$
|
|
1024
|
+
return create$6({
|
|
1277
1025
|
commandMap,
|
|
1278
1026
|
isMessagePortOpen,
|
|
1279
1027
|
messagePort: port2
|
|
1280
1028
|
});
|
|
1281
1029
|
};
|
|
1282
1030
|
|
|
1283
|
-
const create$
|
|
1031
|
+
const create$4 = async ({
|
|
1284
1032
|
commandMap,
|
|
1285
1033
|
isMessagePortOpen,
|
|
1286
1034
|
send
|
|
1287
1035
|
}) => {
|
|
1288
1036
|
return createSharedLazyRpc(() => {
|
|
1289
|
-
return create$
|
|
1037
|
+
return create$5({
|
|
1290
1038
|
commandMap,
|
|
1291
1039
|
isMessagePortOpen,
|
|
1292
1040
|
send
|
|
@@ -1294,7 +1042,7 @@ const create$3 = async ({
|
|
|
1294
1042
|
});
|
|
1295
1043
|
};
|
|
1296
1044
|
|
|
1297
|
-
const create$
|
|
1045
|
+
const create$3 = async ({
|
|
1298
1046
|
commandMap
|
|
1299
1047
|
}) => {
|
|
1300
1048
|
// TODO create a commandMap per rpc instance
|
|
@@ -1326,7 +1074,7 @@ const createMockRpc = ({
|
|
|
1326
1074
|
};
|
|
1327
1075
|
|
|
1328
1076
|
const rpcs = Object.create(null);
|
|
1329
|
-
const set$
|
|
1077
|
+
const set$9 = (id, rpc) => {
|
|
1330
1078
|
rpcs[id] = rpc;
|
|
1331
1079
|
};
|
|
1332
1080
|
const get$1 = id => {
|
|
@@ -1337,7 +1085,7 @@ const remove$1 = id => {
|
|
|
1337
1085
|
};
|
|
1338
1086
|
|
|
1339
1087
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1340
|
-
const create$
|
|
1088
|
+
const create$2 = rpcId => {
|
|
1341
1089
|
return {
|
|
1342
1090
|
async dispose() {
|
|
1343
1091
|
const rpc = get$1(rpcId);
|
|
@@ -1359,7 +1107,7 @@ const create$1 = rpcId => {
|
|
|
1359
1107
|
const mockRpc = createMockRpc({
|
|
1360
1108
|
commandMap
|
|
1361
1109
|
});
|
|
1362
|
-
set$
|
|
1110
|
+
set$9(rpcId, mockRpc);
|
|
1363
1111
|
// @ts-ignore
|
|
1364
1112
|
mockRpc[Symbol.dispose] = () => {
|
|
1365
1113
|
remove$1(rpcId);
|
|
@@ -1368,7 +1116,7 @@ const create$1 = rpcId => {
|
|
|
1368
1116
|
return mockRpc;
|
|
1369
1117
|
},
|
|
1370
1118
|
set(rpc) {
|
|
1371
|
-
set$
|
|
1119
|
+
set$9(rpcId, rpc);
|
|
1372
1120
|
}
|
|
1373
1121
|
};
|
|
1374
1122
|
};
|
|
@@ -1546,7 +1294,6 @@ const Button$3 = 'event.button';
|
|
|
1546
1294
|
const ClientX = 'event.clientX';
|
|
1547
1295
|
const ClientY = 'event.clientY';
|
|
1548
1296
|
const CtrlKey = 'event.ctrlKey';
|
|
1549
|
-
const DataTransferFiles = 'event.dataTransfer.files';
|
|
1550
1297
|
const DataTransferFiles2 = 'event.dataTransfer.files2';
|
|
1551
1298
|
const DefaultPrevented = 'event.defaultPrevented';
|
|
1552
1299
|
const DeltaMode = 'event.deltaMode';
|
|
@@ -1579,6 +1326,8 @@ const CtrlCmd = 1 << 11 >>> 0;
|
|
|
1579
1326
|
const Shift = 1 << 10 >>> 0;
|
|
1580
1327
|
const Alt = 1 << 9 >>> 0;
|
|
1581
1328
|
|
|
1329
|
+
const DialogWorker = 7014;
|
|
1330
|
+
const DragAndDropWorker = 3404;
|
|
1582
1331
|
const FileSystemWorker$1 = 209;
|
|
1583
1332
|
const IconThemeWorker = 7009;
|
|
1584
1333
|
const RendererWorker = 1;
|
|
@@ -1594,9 +1343,22 @@ const SetPatches = 'Viewlet.setPatches';
|
|
|
1594
1343
|
const FocusExplorer = 13;
|
|
1595
1344
|
const FocusExplorerEditBox = 14;
|
|
1596
1345
|
|
|
1346
|
+
const {
|
|
1347
|
+
invoke: invoke$5,
|
|
1348
|
+
set: set$8
|
|
1349
|
+
} = create$2(DialogWorker);
|
|
1350
|
+
|
|
1351
|
+
const {
|
|
1352
|
+
invoke: invoke$4,
|
|
1353
|
+
set: set$7
|
|
1354
|
+
} = create$2(DragAndDropWorker);
|
|
1355
|
+
const getDroppedItems$1 = async (itemIds, isElectron) => {
|
|
1356
|
+
return invoke$4('DragAndDrop.getDroppedItems', itemIds, isElectron);
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1597
1359
|
const {
|
|
1598
1360
|
set: set$6
|
|
1599
|
-
} = create$
|
|
1361
|
+
} = create$2(FileSystemWorker$1);
|
|
1600
1362
|
|
|
1601
1363
|
const FileSystemWorker = {
|
|
1602
1364
|
__proto__: null,
|
|
@@ -1606,7 +1368,7 @@ const FileSystemWorker = {
|
|
|
1606
1368
|
const {
|
|
1607
1369
|
invoke: invoke$3,
|
|
1608
1370
|
set: set$5
|
|
1609
|
-
} = create$
|
|
1371
|
+
} = create$2(IconThemeWorker);
|
|
1610
1372
|
const getIcons = async iconRequests => {
|
|
1611
1373
|
// @ts-ignore
|
|
1612
1374
|
return invoke$3('IconTheme.getIcons', iconRequests);
|
|
@@ -1641,85 +1403,341 @@ const getType = value => {
|
|
|
1641
1403
|
if (Array.isArray(value)) {
|
|
1642
1404
|
return Array$1;
|
|
1643
1405
|
}
|
|
1644
|
-
return Object$1;
|
|
1645
|
-
case 'boolean':
|
|
1646
|
-
return Boolean$1;
|
|
1647
|
-
default:
|
|
1648
|
-
return Unknown$1;
|
|
1649
|
-
}
|
|
1650
|
-
};
|
|
1651
|
-
const object = value => {
|
|
1652
|
-
const type = getType(value);
|
|
1653
|
-
if (type !== Object$1) {
|
|
1654
|
-
throw new AssertionError('expected value to be of type object');
|
|
1655
|
-
}
|
|
1656
|
-
};
|
|
1657
|
-
const number = value => {
|
|
1658
|
-
const type = getType(value);
|
|
1659
|
-
if (type !== Number$1) {
|
|
1660
|
-
throw new AssertionError('expected value to be of type number');
|
|
1661
|
-
}
|
|
1662
|
-
};
|
|
1663
|
-
const array = value => {
|
|
1664
|
-
const type = getType(value);
|
|
1665
|
-
if (type !== Array$1) {
|
|
1666
|
-
throw new AssertionError('expected value to be of type array');
|
|
1667
|
-
}
|
|
1668
|
-
};
|
|
1669
|
-
const string = value => {
|
|
1670
|
-
const type = getType(value);
|
|
1671
|
-
if (type !== String$1) {
|
|
1672
|
-
throw new AssertionError('expected value to be of type string');
|
|
1673
|
-
}
|
|
1674
|
-
};
|
|
1675
|
-
|
|
1676
|
-
const {
|
|
1677
|
-
invoke: invoke$2,
|
|
1678
|
-
invokeAndTransfer,
|
|
1679
|
-
set: set$4
|
|
1680
|
-
} = create$
|
|
1681
|
-
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1682
|
-
number(uid);
|
|
1683
|
-
number(menuId);
|
|
1684
|
-
number(x);
|
|
1685
|
-
number(y);
|
|
1686
|
-
await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1687
|
-
};
|
|
1688
|
-
const
|
|
1689
|
-
const
|
|
1690
|
-
|
|
1691
|
-
};
|
|
1692
|
-
const
|
|
1693
|
-
const command = '
|
|
1694
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.
|
|
1695
|
-
};
|
|
1696
|
-
const
|
|
1697
|
-
const command = '
|
|
1698
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.
|
|
1699
|
-
};
|
|
1700
|
-
const
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1703
|
-
};
|
|
1704
|
-
const
|
|
1705
|
-
await invoke$2('
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
await
|
|
1406
|
+
return Object$1;
|
|
1407
|
+
case 'boolean':
|
|
1408
|
+
return Boolean$1;
|
|
1409
|
+
default:
|
|
1410
|
+
return Unknown$1;
|
|
1411
|
+
}
|
|
1412
|
+
};
|
|
1413
|
+
const object = value => {
|
|
1414
|
+
const type = getType(value);
|
|
1415
|
+
if (type !== Object$1) {
|
|
1416
|
+
throw new AssertionError('expected value to be of type object');
|
|
1417
|
+
}
|
|
1418
|
+
};
|
|
1419
|
+
const number = value => {
|
|
1420
|
+
const type = getType(value);
|
|
1421
|
+
if (type !== Number$1) {
|
|
1422
|
+
throw new AssertionError('expected value to be of type number');
|
|
1423
|
+
}
|
|
1424
|
+
};
|
|
1425
|
+
const array = value => {
|
|
1426
|
+
const type = getType(value);
|
|
1427
|
+
if (type !== Array$1) {
|
|
1428
|
+
throw new AssertionError('expected value to be of type array');
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
const string = value => {
|
|
1432
|
+
const type = getType(value);
|
|
1433
|
+
if (type !== String$1) {
|
|
1434
|
+
throw new AssertionError('expected value to be of type string');
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
const {
|
|
1439
|
+
invoke: invoke$2,
|
|
1440
|
+
invokeAndTransfer,
|
|
1441
|
+
set: set$4
|
|
1442
|
+
} = create$2(RendererWorker);
|
|
1443
|
+
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1444
|
+
number(uid);
|
|
1445
|
+
number(menuId);
|
|
1446
|
+
number(x);
|
|
1447
|
+
number(y);
|
|
1448
|
+
await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1449
|
+
};
|
|
1450
|
+
const sendMessagePortToDragAndDropWorker = async port => {
|
|
1451
|
+
const command = 'DragAndDrop.handleMessagePort';
|
|
1452
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDragAndDropWorker', port, command);
|
|
1453
|
+
};
|
|
1454
|
+
const sendMessagePortToDialogWorker = async port => {
|
|
1455
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1456
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker', port, command);
|
|
1457
|
+
};
|
|
1458
|
+
const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
1459
|
+
const command = 'IconTheme.handleMessagePort';
|
|
1460
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1461
|
+
};
|
|
1462
|
+
const sendMessagePortToFileSystemWorker$1 = async (port, rpcId) => {
|
|
1463
|
+
const command = 'FileSystem.handleMessagePort';
|
|
1464
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1465
|
+
};
|
|
1466
|
+
const confirm$1 = async (message, options) => {
|
|
1467
|
+
const result = await invoke$2('ConfirmPrompt.prompt', message, options);
|
|
1468
|
+
return result;
|
|
1469
|
+
};
|
|
1470
|
+
const writeClipBoardText = async text => {
|
|
1471
|
+
await invoke$2('ClipBoard.writeText', /* text */text);
|
|
1472
|
+
};
|
|
1473
|
+
const sendMessagePortToSourceControlWorker = async port => {
|
|
1474
|
+
const command = 'SourceControl.handleMessagePort';
|
|
1475
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSourceControlWorker', port, command, 0);
|
|
1476
|
+
};
|
|
1477
|
+
const openUri$1 = async (uri, focus, options) => {
|
|
1478
|
+
await invoke$2('Main.openUri', {
|
|
1479
|
+
...options,
|
|
1480
|
+
focus,
|
|
1481
|
+
uri
|
|
1482
|
+
});
|
|
1483
|
+
};
|
|
1484
|
+
|
|
1485
|
+
const {
|
|
1486
|
+
invoke: invoke$1,
|
|
1487
|
+
set: set$3
|
|
1488
|
+
} = create$2(SourceControlWorker);
|
|
1489
|
+
|
|
1490
|
+
const toCommandId = key => {
|
|
1491
|
+
const dotIndex = key.indexOf('.');
|
|
1492
|
+
return key.slice(dotIndex + 1);
|
|
1493
|
+
};
|
|
1494
|
+
const create$1 = () => {
|
|
1495
|
+
const commandQueues = new Map();
|
|
1496
|
+
const generations = Object.create(null);
|
|
1497
|
+
const states = Object.create(null);
|
|
1498
|
+
const commandMapRef = {};
|
|
1499
|
+
const getGeneration = uid => generations[uid] || 0;
|
|
1500
|
+
const isCurrentGeneration = (uid, generation) => {
|
|
1501
|
+
return states[uid] !== undefined && getGeneration(uid) === generation;
|
|
1502
|
+
};
|
|
1503
|
+
const updateState = (uid, generation, fallbackState, updater) => {
|
|
1504
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
1505
|
+
return Promise.resolve(fallbackState);
|
|
1506
|
+
}
|
|
1507
|
+
const current = states[uid];
|
|
1508
|
+
const updatedState = updater(current.newState);
|
|
1509
|
+
if (updatedState !== current.newState) {
|
|
1510
|
+
states[uid] = {
|
|
1511
|
+
newState: updatedState,
|
|
1512
|
+
oldState: current.oldState,
|
|
1513
|
+
scheduledState: updatedState
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1516
|
+
return Promise.resolve(updatedState);
|
|
1517
|
+
};
|
|
1518
|
+
const createAsyncCommandContext = (uid, generation) => {
|
|
1519
|
+
let latestState = states[uid].newState;
|
|
1520
|
+
return {
|
|
1521
|
+
getState: () => {
|
|
1522
|
+
if (isCurrentGeneration(uid, generation)) {
|
|
1523
|
+
latestState = states[uid].newState;
|
|
1524
|
+
}
|
|
1525
|
+
return latestState;
|
|
1526
|
+
},
|
|
1527
|
+
updateState: async updater => {
|
|
1528
|
+
latestState = await updateState(uid, generation, latestState, updater);
|
|
1529
|
+
return latestState;
|
|
1530
|
+
}
|
|
1531
|
+
};
|
|
1532
|
+
};
|
|
1533
|
+
const enqueueCommand = async (uid, command) => {
|
|
1534
|
+
const previous = commandQueues.get(uid) || Promise.resolve();
|
|
1535
|
+
const run = async () => {
|
|
1536
|
+
try {
|
|
1537
|
+
await previous;
|
|
1538
|
+
} catch {
|
|
1539
|
+
// The previous caller receives its error; later commands must still run.
|
|
1540
|
+
}
|
|
1541
|
+
await command();
|
|
1542
|
+
};
|
|
1543
|
+
const current = run();
|
|
1544
|
+
commandQueues.set(uid, current);
|
|
1545
|
+
try {
|
|
1546
|
+
await current;
|
|
1547
|
+
} finally {
|
|
1548
|
+
if (commandQueues.get(uid) === current) {
|
|
1549
|
+
commandQueues.delete(uid);
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
};
|
|
1553
|
+
return {
|
|
1554
|
+
clear() {
|
|
1555
|
+
commandQueues.clear();
|
|
1556
|
+
for (const key of Object.keys(states)) {
|
|
1557
|
+
delete states[key];
|
|
1558
|
+
}
|
|
1559
|
+
},
|
|
1560
|
+
diff(uid, modules, numbers) {
|
|
1561
|
+
const {
|
|
1562
|
+
oldState,
|
|
1563
|
+
scheduledState
|
|
1564
|
+
} = states[uid];
|
|
1565
|
+
const diffResult = [];
|
|
1566
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1567
|
+
const fn = modules[i];
|
|
1568
|
+
if (!fn(oldState, scheduledState)) {
|
|
1569
|
+
diffResult.push(numbers[i]);
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
return diffResult;
|
|
1573
|
+
},
|
|
1574
|
+
dispose(uid) {
|
|
1575
|
+
commandQueues.delete(uid);
|
|
1576
|
+
delete states[uid];
|
|
1577
|
+
},
|
|
1578
|
+
get(uid) {
|
|
1579
|
+
return states[uid];
|
|
1580
|
+
},
|
|
1581
|
+
getCommandIds() {
|
|
1582
|
+
const keys = Object.keys(commandMapRef);
|
|
1583
|
+
const ids = keys.map(toCommandId);
|
|
1584
|
+
return ids;
|
|
1585
|
+
},
|
|
1586
|
+
getKeys() {
|
|
1587
|
+
return Object.keys(states).map(Number);
|
|
1588
|
+
},
|
|
1589
|
+
registerCommands(commandMap) {
|
|
1590
|
+
Object.assign(commandMapRef, commandMap);
|
|
1591
|
+
},
|
|
1592
|
+
set(uid, oldState, newState, scheduledState) {
|
|
1593
|
+
const current = states[uid];
|
|
1594
|
+
if (!current || oldState === newState && newState !== current.newState) {
|
|
1595
|
+
generations[uid] = getGeneration(uid) + 1;
|
|
1596
|
+
}
|
|
1597
|
+
states[uid] = {
|
|
1598
|
+
newState,
|
|
1599
|
+
oldState,
|
|
1600
|
+
scheduledState: scheduledState ?? newState
|
|
1601
|
+
};
|
|
1602
|
+
},
|
|
1603
|
+
wrapAsyncCommand(fn) {
|
|
1604
|
+
const wrapped = async (uid, ...args) => {
|
|
1605
|
+
const generation = getGeneration(uid);
|
|
1606
|
+
const context = createAsyncCommandContext(uid, generation);
|
|
1607
|
+
await fn(context, ...args);
|
|
1608
|
+
};
|
|
1609
|
+
return wrapped;
|
|
1610
|
+
},
|
|
1611
|
+
wrapCommand(fn) {
|
|
1612
|
+
const wrapped = async (uid, ...args) => {
|
|
1613
|
+
const generation = getGeneration(uid);
|
|
1614
|
+
const {
|
|
1615
|
+
newState,
|
|
1616
|
+
oldState
|
|
1617
|
+
} = states[uid];
|
|
1618
|
+
const newerState = await fn(newState, ...args);
|
|
1619
|
+
if (oldState === newerState || newState === newerState) {
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
1623
|
+
return;
|
|
1624
|
+
}
|
|
1625
|
+
const latestOld = states[uid];
|
|
1626
|
+
const latestNew = {
|
|
1627
|
+
...latestOld.newState,
|
|
1628
|
+
...newerState
|
|
1629
|
+
};
|
|
1630
|
+
states[uid] = {
|
|
1631
|
+
newState: latestNew,
|
|
1632
|
+
oldState: latestOld.oldState,
|
|
1633
|
+
scheduledState: latestNew
|
|
1634
|
+
};
|
|
1635
|
+
};
|
|
1636
|
+
return wrapped;
|
|
1637
|
+
},
|
|
1638
|
+
wrapGetter(fn) {
|
|
1639
|
+
const wrapped = (uid, ...args) => {
|
|
1640
|
+
const {
|
|
1641
|
+
newState
|
|
1642
|
+
} = states[uid];
|
|
1643
|
+
return fn(newState, ...args);
|
|
1644
|
+
};
|
|
1645
|
+
return wrapped;
|
|
1646
|
+
},
|
|
1647
|
+
wrapLoadContent(fn) {
|
|
1648
|
+
const wrapped = async (uid, ...args) => {
|
|
1649
|
+
const generation = getGeneration(uid);
|
|
1650
|
+
const {
|
|
1651
|
+
newState,
|
|
1652
|
+
oldState
|
|
1653
|
+
} = states[uid];
|
|
1654
|
+
const result = await fn(newState, ...args);
|
|
1655
|
+
const {
|
|
1656
|
+
error,
|
|
1657
|
+
state
|
|
1658
|
+
} = result;
|
|
1659
|
+
if (oldState === state || newState === state) {
|
|
1660
|
+
return {
|
|
1661
|
+
error
|
|
1662
|
+
};
|
|
1663
|
+
}
|
|
1664
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
1665
|
+
return {
|
|
1666
|
+
error
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
const latestOld = states[uid];
|
|
1670
|
+
const latestNew = {
|
|
1671
|
+
...latestOld.newState,
|
|
1672
|
+
...state
|
|
1673
|
+
};
|
|
1674
|
+
states[uid] = {
|
|
1675
|
+
newState: latestNew,
|
|
1676
|
+
oldState: latestOld.oldState,
|
|
1677
|
+
scheduledState: latestNew
|
|
1678
|
+
};
|
|
1679
|
+
return {
|
|
1680
|
+
error
|
|
1681
|
+
};
|
|
1682
|
+
};
|
|
1683
|
+
return wrapped;
|
|
1684
|
+
},
|
|
1685
|
+
wrapSerialAsyncCommand(fn) {
|
|
1686
|
+
const wrapped = async (uid, ...args) => {
|
|
1687
|
+
await enqueueCommand(uid, async () => {
|
|
1688
|
+
if (!states[uid]) {
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
const generation = getGeneration(uid);
|
|
1692
|
+
const context = createAsyncCommandContext(uid, generation);
|
|
1693
|
+
await fn(context, ...args);
|
|
1694
|
+
});
|
|
1695
|
+
};
|
|
1696
|
+
return wrapped;
|
|
1697
|
+
},
|
|
1698
|
+
wrapSerialCommand(fn) {
|
|
1699
|
+
const wrapped = async (uid, ...args) => {
|
|
1700
|
+
await enqueueCommand(uid, async () => {
|
|
1701
|
+
if (!states[uid]) {
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1704
|
+
const generation = getGeneration(uid);
|
|
1705
|
+
const {
|
|
1706
|
+
newState,
|
|
1707
|
+
oldState
|
|
1708
|
+
} = states[uid];
|
|
1709
|
+
const newerState = await fn(newState, ...args);
|
|
1710
|
+
if (oldState === newerState || newState === newerState) {
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
1714
|
+
return;
|
|
1715
|
+
}
|
|
1716
|
+
const latestOld = states[uid];
|
|
1717
|
+
const latestNew = {
|
|
1718
|
+
...latestOld.newState,
|
|
1719
|
+
...newerState
|
|
1720
|
+
};
|
|
1721
|
+
states[uid] = {
|
|
1722
|
+
newState: latestNew,
|
|
1723
|
+
oldState: latestOld.oldState,
|
|
1724
|
+
scheduledState: latestNew
|
|
1725
|
+
};
|
|
1726
|
+
});
|
|
1727
|
+
};
|
|
1728
|
+
return wrapped;
|
|
1729
|
+
}
|
|
1730
|
+
};
|
|
1710
1731
|
};
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1713
|
-
...options,
|
|
1714
|
-
focus,
|
|
1715
|
-
uri
|
|
1716
|
-
});
|
|
1732
|
+
const terminate = () => {
|
|
1733
|
+
globalThis.close();
|
|
1717
1734
|
};
|
|
1718
1735
|
|
|
1719
|
-
const
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1736
|
+
const CreateFolder$1 = 1;
|
|
1737
|
+
const CreateFile$1 = 2;
|
|
1738
|
+
const Copy$1 = 3;
|
|
1739
|
+
const Rename$2 = 4;
|
|
1740
|
+
const Remove = 5;
|
|
1723
1741
|
|
|
1724
1742
|
// TODO use direct connection
|
|
1725
1743
|
const invoke = async (method, ...params) => {
|
|
@@ -1862,11 +1880,12 @@ const createTree = (items, root) => {
|
|
|
1862
1880
|
return tree;
|
|
1863
1881
|
};
|
|
1864
1882
|
|
|
1865
|
-
const None$
|
|
1883
|
+
const None$6 = 0;
|
|
1866
1884
|
const CreateFile = 1;
|
|
1867
1885
|
const CreateFolder = 2;
|
|
1868
1886
|
const Rename$1 = 3;
|
|
1869
1887
|
|
|
1888
|
+
const None$5 = 0;
|
|
1870
1889
|
const List = 1;
|
|
1871
1890
|
const Input$1 = 2;
|
|
1872
1891
|
|
|
@@ -2498,7 +2517,7 @@ const acceptCreate = async (state, newDirentType) => {
|
|
|
2498
2517
|
return {
|
|
2499
2518
|
...state,
|
|
2500
2519
|
editingIndex: -1,
|
|
2501
|
-
editingType: None$
|
|
2520
|
+
editingType: None$6,
|
|
2502
2521
|
focus: List,
|
|
2503
2522
|
focusedIndex: newFocusedIndex,
|
|
2504
2523
|
items: dirents
|
|
@@ -2548,7 +2567,7 @@ const cancelEditRename = (state, keepFocus) => {
|
|
|
2548
2567
|
editingIndex: -1,
|
|
2549
2568
|
editingSelectionEnd: 0,
|
|
2550
2569
|
editingSelectionStart: 0,
|
|
2551
|
-
editingType: None$
|
|
2570
|
+
editingType: None$6,
|
|
2552
2571
|
editingValue: '',
|
|
2553
2572
|
focus: List,
|
|
2554
2573
|
focused: keepFocus,
|
|
@@ -2667,7 +2686,7 @@ const acceptRename = async state => {
|
|
|
2667
2686
|
editingIndex: -1,
|
|
2668
2687
|
editingSelectionEnd: 0,
|
|
2669
2688
|
editingSelectionStart: 0,
|
|
2670
|
-
editingType: None$
|
|
2689
|
+
editingType: None$6,
|
|
2671
2690
|
editingValue: '',
|
|
2672
2691
|
focus: List,
|
|
2673
2692
|
focused: true,
|
|
@@ -2722,7 +2741,7 @@ const cancelEditCreate = async (state, keepFocus) => {
|
|
|
2722
2741
|
...state,
|
|
2723
2742
|
editingErrorMessage: '',
|
|
2724
2743
|
editingIndex: -1,
|
|
2725
|
-
editingType: None$
|
|
2744
|
+
editingType: None$6,
|
|
2726
2745
|
editingValue: '',
|
|
2727
2746
|
focus: List,
|
|
2728
2747
|
focused: keepFocus,
|
|
@@ -2867,6 +2886,30 @@ const copyRelativePath = async state => {
|
|
|
2867
2886
|
return state;
|
|
2868
2887
|
};
|
|
2869
2888
|
|
|
2889
|
+
const missingDialogWorkerRelay = 'Command "SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker" not found';
|
|
2890
|
+
const state = {
|
|
2891
|
+
isTest: false
|
|
2892
|
+
};
|
|
2893
|
+
const setIsTest = value => {
|
|
2894
|
+
state.isTest = value;
|
|
2895
|
+
};
|
|
2896
|
+
const confirm = async message => {
|
|
2897
|
+
const {
|
|
2898
|
+
isTest
|
|
2899
|
+
} = state;
|
|
2900
|
+
if (isTest) {
|
|
2901
|
+
return confirm$1(message);
|
|
2902
|
+
}
|
|
2903
|
+
try {
|
|
2904
|
+
return await invoke$5('ConfirmPrompt.prompt', message, undefined);
|
|
2905
|
+
} catch (error) {
|
|
2906
|
+
if (!String(error).includes(missingDialogWorkerRelay)) {
|
|
2907
|
+
throw error;
|
|
2908
|
+
}
|
|
2909
|
+
return confirm$1(message);
|
|
2910
|
+
}
|
|
2911
|
+
};
|
|
2912
|
+
|
|
2870
2913
|
const commandCompletions = new WeakMap();
|
|
2871
2914
|
const set$1 = (state, completion) => {
|
|
2872
2915
|
commandCompletions.set(state, completion);
|
|
@@ -3663,7 +3706,7 @@ const {
|
|
|
3663
3706
|
registerCommands,
|
|
3664
3707
|
set,
|
|
3665
3708
|
wrapGetter
|
|
3666
|
-
} = create$
|
|
3709
|
+
} = create$1();
|
|
3667
3710
|
const commandQueues = new Map();
|
|
3668
3711
|
const runQueuedCommand = async (previousCommand, command) => {
|
|
3669
3712
|
await previousCommand;
|
|
@@ -3791,7 +3834,8 @@ const ListItem = 22;
|
|
|
3791
3834
|
const Slash = '/';
|
|
3792
3835
|
|
|
3793
3836
|
// TODO parentUid might ot be needed
|
|
3794
|
-
const create = (id, uri, x, y, width, height, args, parentUid, platform = 0, assetDir = '') => {
|
|
3837
|
+
const create = (id, uri, x, y, width, height, args, parentUid, platform = 0, assetDir = '', isTest = false) => {
|
|
3838
|
+
setIsTest(isTest);
|
|
3795
3839
|
const state = {
|
|
3796
3840
|
assetDir,
|
|
3797
3841
|
chevronSpace: 22,
|
|
@@ -3809,7 +3853,7 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0, ass
|
|
|
3809
3853
|
editingSelectionEnd: 0,
|
|
3810
3854
|
editingSelectionStart: 0,
|
|
3811
3855
|
editingSessionId: 0,
|
|
3812
|
-
editingType: None$
|
|
3856
|
+
editingType: None$6,
|
|
3813
3857
|
editingValue: '',
|
|
3814
3858
|
errorCode: '',
|
|
3815
3859
|
errorMessage: '',
|
|
@@ -4665,6 +4709,7 @@ const handleBlur = async state => {
|
|
|
4665
4709
|
});
|
|
4666
4710
|
return {
|
|
4667
4711
|
...state,
|
|
4712
|
+
focus: None$5,
|
|
4668
4713
|
focused: false,
|
|
4669
4714
|
items: newItems
|
|
4670
4715
|
};
|
|
@@ -5039,7 +5084,7 @@ const resetEditing = {
|
|
|
5039
5084
|
end: 0,
|
|
5040
5085
|
start: 0
|
|
5041
5086
|
},
|
|
5042
|
-
editingType: None$
|
|
5087
|
+
editingType: None$6,
|
|
5043
5088
|
editingValue: ''
|
|
5044
5089
|
};
|
|
5045
5090
|
|
|
@@ -6077,50 +6122,33 @@ const getDropHandler = index => {
|
|
|
6077
6122
|
}
|
|
6078
6123
|
};
|
|
6079
6124
|
|
|
6080
|
-
const
|
|
6081
|
-
|
|
6082
|
-
const files =
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
};
|
|
6093
|
-
|
|
6094
|
-
const getFilePathElectron = async file => {
|
|
6095
|
-
return invoke$2('FileSystemHandle.getFilePathElectron', file);
|
|
6096
|
-
};
|
|
6097
|
-
|
|
6098
|
-
const getFilepath = async file => {
|
|
6099
|
-
return getFilePathElectron(file);
|
|
6100
|
-
};
|
|
6101
|
-
const getFilePaths = async (files, platform) => {
|
|
6102
|
-
if (platform !== Electron) {
|
|
6103
|
-
return files.map(file => '');
|
|
6104
|
-
}
|
|
6105
|
-
const promises = files.map(getFilepath);
|
|
6106
|
-
const paths = await Promise.all(promises);
|
|
6107
|
-
return paths;
|
|
6125
|
+
const getDroppedItems = async (itemIds, isElectron) => {
|
|
6126
|
+
const result = await getDroppedItems$1(itemIds, isElectron);
|
|
6127
|
+
const files = isElectron ? result.files : result.files.filter(file => file.handle);
|
|
6128
|
+
const fileHandles = files.map(file => file.handle || {
|
|
6129
|
+
kind: file.kind,
|
|
6130
|
+
name: file.name
|
|
6131
|
+
});
|
|
6132
|
+
const paths = files.map(file => file.path);
|
|
6133
|
+
return {
|
|
6134
|
+
fileHandles,
|
|
6135
|
+
paths
|
|
6136
|
+
};
|
|
6108
6137
|
};
|
|
6109
6138
|
|
|
6110
|
-
const handleDrop = async (state, x, y, fileIds
|
|
6139
|
+
const handleDrop = async (state, x, y, fileIds) => {
|
|
6111
6140
|
if (state.isReadonly && state.root !== '') {
|
|
6112
6141
|
return state;
|
|
6113
6142
|
}
|
|
6114
6143
|
try {
|
|
6144
|
+
const isElectron = state.platform === Electron;
|
|
6115
6145
|
const {
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
const fileHandles = await getFileHandles(fileIds);
|
|
6120
|
-
const paths = await getFilePaths(files, platform);
|
|
6146
|
+
fileHandles,
|
|
6147
|
+
paths
|
|
6148
|
+
} = await getDroppedItems(fileIds, isElectron);
|
|
6121
6149
|
const index = getIndexFromPosition(state, x, y);
|
|
6122
6150
|
const fn = getDropHandler(index);
|
|
6123
|
-
const result = await fn(state, fileHandles,
|
|
6151
|
+
const result = await fn(state, fileHandles, [], paths, index);
|
|
6124
6152
|
return result;
|
|
6125
6153
|
} catch (error) {
|
|
6126
6154
|
throw new VError(error, 'Failed to drop files');
|
|
@@ -7679,7 +7707,7 @@ const renderEventListeners = () => {
|
|
|
7679
7707
|
preventDefault: true
|
|
7680
7708
|
}, {
|
|
7681
7709
|
name: HandleDrop,
|
|
7682
|
-
params: ['handleDrop', ClientX, ClientY, DataTransferFiles2
|
|
7710
|
+
params: ['handleDrop', ClientX, ClientY, DataTransferFiles2],
|
|
7683
7711
|
preventDefault: true
|
|
7684
7712
|
}, {
|
|
7685
7713
|
name: HandleDragLeave,
|
|
@@ -8095,13 +8123,27 @@ const commandMap = {
|
|
|
8095
8123
|
'Explorer.updateIcons': wrapListItemCommand(updateIcons)
|
|
8096
8124
|
};
|
|
8097
8125
|
|
|
8126
|
+
const send$2 = async port => {
|
|
8127
|
+
await sendMessagePortToDragAndDropWorker(port);
|
|
8128
|
+
};
|
|
8129
|
+
const createDragAndDropWorkerRpc = async () => {
|
|
8130
|
+
return create$4({
|
|
8131
|
+
commandMap: {},
|
|
8132
|
+
send: send$2
|
|
8133
|
+
});
|
|
8134
|
+
};
|
|
8135
|
+
|
|
8136
|
+
const initializeDragAndDropWorker = async () => {
|
|
8137
|
+
set$7(await createDragAndDropWorkerRpc());
|
|
8138
|
+
};
|
|
8139
|
+
|
|
8098
8140
|
const sendMessagePortToFileSystemWorker = async port => {
|
|
8099
8141
|
await sendMessagePortToFileSystemWorker$1(port, 0);
|
|
8100
8142
|
};
|
|
8101
8143
|
|
|
8102
8144
|
const createFileSystemWorkerRpc = async () => {
|
|
8103
8145
|
try {
|
|
8104
|
-
const rpc = await create$
|
|
8146
|
+
const rpc = await create$4({
|
|
8105
8147
|
commandMap: {},
|
|
8106
8148
|
send: sendMessagePortToFileSystemWorker
|
|
8107
8149
|
});
|
|
@@ -8121,7 +8163,7 @@ const send$1 = port => {
|
|
|
8121
8163
|
};
|
|
8122
8164
|
const createIconThemeWorkerRpc = async () => {
|
|
8123
8165
|
try {
|
|
8124
|
-
const rpc = await create$
|
|
8166
|
+
const rpc = await create$4({
|
|
8125
8167
|
commandMap: {},
|
|
8126
8168
|
send: send$1
|
|
8127
8169
|
});
|
|
@@ -8137,7 +8179,7 @@ const initializeIconThemeWorker = async () => {
|
|
|
8137
8179
|
};
|
|
8138
8180
|
|
|
8139
8181
|
const initializeRendererWorker = async () => {
|
|
8140
|
-
const rpc = await create$
|
|
8182
|
+
const rpc = await create$3({
|
|
8141
8183
|
commandMap: commandMap
|
|
8142
8184
|
});
|
|
8143
8185
|
set$4(rpc);
|
|
@@ -8149,7 +8191,7 @@ const send = port => {
|
|
|
8149
8191
|
};
|
|
8150
8192
|
const createSourceControlWorkerRpc = async () => {
|
|
8151
8193
|
try {
|
|
8152
|
-
const rpc = await create$
|
|
8194
|
+
const rpc = await create$4({
|
|
8153
8195
|
commandMap: {},
|
|
8154
8196
|
send
|
|
8155
8197
|
});
|
|
@@ -8171,7 +8213,12 @@ const initializeSourceControlWorker = async () => {
|
|
|
8171
8213
|
|
|
8172
8214
|
const listen = async () => {
|
|
8173
8215
|
registerCommands(commandMap);
|
|
8174
|
-
await Promise.all([initializeRendererWorker(), initializeFileSystemWorker(), initializeIconThemeWorker(), initializeSourceControlWorker()]);
|
|
8216
|
+
await Promise.all([initializeRendererWorker(), initializeFileSystemWorker(), initializeIconThemeWorker(), initializeSourceControlWorker(), initializeDragAndDropWorker()]);
|
|
8217
|
+
const dialogRpc = await create$4({
|
|
8218
|
+
commandMap: {},
|
|
8219
|
+
send: sendMessagePortToDialogWorker
|
|
8220
|
+
});
|
|
8221
|
+
set$8(dialogRpc);
|
|
8175
8222
|
};
|
|
8176
8223
|
|
|
8177
8224
|
const main = async () => {
|