@lvce-editor/ports-view 0.12.0 → 0.13.1
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/portsViewWorkerMain.js +233 -61
- package/package.json +1 -1
|
@@ -417,6 +417,100 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
|
417
417
|
listen: listen$6,
|
|
418
418
|
wrap: wrap$e
|
|
419
419
|
};
|
|
420
|
+
const addListener = (emitter, type, callback) => {
|
|
421
|
+
if ('addEventListener' in emitter) {
|
|
422
|
+
emitter.addEventListener(type, callback);
|
|
423
|
+
} else {
|
|
424
|
+
emitter.on(type, callback);
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
const removeListener = (emitter, type, callback) => {
|
|
428
|
+
if ('removeEventListener' in emitter) {
|
|
429
|
+
emitter.removeEventListener(type, callback);
|
|
430
|
+
} else {
|
|
431
|
+
emitter.off(type, callback);
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
435
|
+
const {
|
|
436
|
+
promise,
|
|
437
|
+
resolve
|
|
438
|
+
} = Promise.withResolvers();
|
|
439
|
+
const listenerMap = Object.create(null);
|
|
440
|
+
const cleanup = value => {
|
|
441
|
+
for (const event of Object.keys(eventMap)) {
|
|
442
|
+
removeListener(eventEmitter, event, listenerMap[event]);
|
|
443
|
+
}
|
|
444
|
+
resolve(value);
|
|
445
|
+
};
|
|
446
|
+
for (const [event, type] of Object.entries(eventMap)) {
|
|
447
|
+
const listener = event => {
|
|
448
|
+
cleanup({
|
|
449
|
+
event,
|
|
450
|
+
type
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
addListener(eventEmitter, event, listener);
|
|
454
|
+
listenerMap[event] = listener;
|
|
455
|
+
}
|
|
456
|
+
return promise;
|
|
457
|
+
};
|
|
458
|
+
const Message$1 = 3;
|
|
459
|
+
const create$5$1 = async ({
|
|
460
|
+
isMessagePortOpen,
|
|
461
|
+
messagePort
|
|
462
|
+
}) => {
|
|
463
|
+
if (!isMessagePort(messagePort)) {
|
|
464
|
+
throw new IpcError('port must be of type MessagePort');
|
|
465
|
+
}
|
|
466
|
+
if (isMessagePortOpen) {
|
|
467
|
+
return messagePort;
|
|
468
|
+
}
|
|
469
|
+
const eventPromise = getFirstEvent(messagePort, {
|
|
470
|
+
message: Message$1
|
|
471
|
+
});
|
|
472
|
+
messagePort.start();
|
|
473
|
+
const {
|
|
474
|
+
event,
|
|
475
|
+
type
|
|
476
|
+
} = await eventPromise;
|
|
477
|
+
if (type !== Message$1) {
|
|
478
|
+
throw new IpcError('Failed to wait for ipc message');
|
|
479
|
+
}
|
|
480
|
+
if (event.data !== readyMessage) {
|
|
481
|
+
throw new IpcError('unexpected first message');
|
|
482
|
+
}
|
|
483
|
+
return messagePort;
|
|
484
|
+
};
|
|
485
|
+
const signal$1 = messagePort => {
|
|
486
|
+
messagePort.start();
|
|
487
|
+
};
|
|
488
|
+
class IpcParentWithMessagePort extends Ipc {
|
|
489
|
+
getData = getData$2;
|
|
490
|
+
send(message) {
|
|
491
|
+
this._rawIpc.postMessage(message);
|
|
492
|
+
}
|
|
493
|
+
sendAndTransfer(message) {
|
|
494
|
+
const transfer = getTransferrables(message);
|
|
495
|
+
this._rawIpc.postMessage(message, transfer);
|
|
496
|
+
}
|
|
497
|
+
dispose() {
|
|
498
|
+
this._rawIpc.close();
|
|
499
|
+
}
|
|
500
|
+
onMessage(callback) {
|
|
501
|
+
this._rawIpc.addEventListener('message', callback);
|
|
502
|
+
}
|
|
503
|
+
onClose(callback) {}
|
|
504
|
+
}
|
|
505
|
+
const wrap$5 = messagePort => {
|
|
506
|
+
return new IpcParentWithMessagePort(messagePort);
|
|
507
|
+
};
|
|
508
|
+
const IpcParentWithMessagePort$1 = {
|
|
509
|
+
__proto__: null,
|
|
510
|
+
create: create$5$1,
|
|
511
|
+
signal: signal$1,
|
|
512
|
+
wrap: wrap$5
|
|
513
|
+
};
|
|
420
514
|
|
|
421
515
|
class CommandNotFoundError extends Error {
|
|
422
516
|
constructor(command) {
|
|
@@ -725,7 +819,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
725
819
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
726
820
|
return create$1$1(id, errorProperty);
|
|
727
821
|
};
|
|
728
|
-
const create$
|
|
822
|
+
const create$8 = (message, result) => {
|
|
729
823
|
return {
|
|
730
824
|
id: message.id,
|
|
731
825
|
jsonrpc: Two$1,
|
|
@@ -734,7 +828,7 @@ const create$7 = (message, result) => {
|
|
|
734
828
|
};
|
|
735
829
|
const getSuccessResponse = (message, result) => {
|
|
736
830
|
const resultProperty = result ?? null;
|
|
737
|
-
return create$
|
|
831
|
+
return create$8(message, resultProperty);
|
|
738
832
|
};
|
|
739
833
|
const getErrorResponseSimple = (id, error) => {
|
|
740
834
|
return {
|
|
@@ -833,7 +927,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
833
927
|
|
|
834
928
|
const Two = '2.0';
|
|
835
929
|
|
|
836
|
-
const create$
|
|
930
|
+
const create$7 = (method, params) => {
|
|
837
931
|
return {
|
|
838
932
|
jsonrpc: Two,
|
|
839
933
|
method,
|
|
@@ -841,7 +935,7 @@ const create$6 = (method, params) => {
|
|
|
841
935
|
};
|
|
842
936
|
};
|
|
843
937
|
|
|
844
|
-
const create$
|
|
938
|
+
const create$6 = (id, method, params) => {
|
|
845
939
|
const message = {
|
|
846
940
|
id,
|
|
847
941
|
jsonrpc: Two,
|
|
@@ -852,12 +946,12 @@ const create$5 = (id, method, params) => {
|
|
|
852
946
|
};
|
|
853
947
|
|
|
854
948
|
let id = 0;
|
|
855
|
-
const create$
|
|
949
|
+
const create$5 = () => {
|
|
856
950
|
return ++id;
|
|
857
951
|
};
|
|
858
952
|
|
|
859
953
|
const registerPromise = map => {
|
|
860
|
-
const id = create$
|
|
954
|
+
const id = create$5();
|
|
861
955
|
const {
|
|
862
956
|
promise,
|
|
863
957
|
resolve
|
|
@@ -874,7 +968,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
874
968
|
id,
|
|
875
969
|
promise
|
|
876
970
|
} = registerPromise(callbacks);
|
|
877
|
-
const message = create$
|
|
971
|
+
const message = create$6(id, method, params);
|
|
878
972
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
879
973
|
ipc.sendAndTransfer(message);
|
|
880
974
|
} else {
|
|
@@ -910,7 +1004,7 @@ const createRpc = ipc => {
|
|
|
910
1004
|
* @deprecated
|
|
911
1005
|
*/
|
|
912
1006
|
send(method, ...params) {
|
|
913
|
-
const message = create$
|
|
1007
|
+
const message = create$7(method, params);
|
|
914
1008
|
ipc.send(message);
|
|
915
1009
|
}
|
|
916
1010
|
};
|
|
@@ -950,6 +1044,24 @@ const listen$1 = async (module, options) => {
|
|
|
950
1044
|
return ipc;
|
|
951
1045
|
};
|
|
952
1046
|
|
|
1047
|
+
const create$4 = async ({
|
|
1048
|
+
commandMap,
|
|
1049
|
+
isMessagePortOpen = true,
|
|
1050
|
+
messagePort
|
|
1051
|
+
}) => {
|
|
1052
|
+
// TODO create a commandMap per rpc instance
|
|
1053
|
+
register(commandMap);
|
|
1054
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
1055
|
+
isMessagePortOpen,
|
|
1056
|
+
messagePort
|
|
1057
|
+
});
|
|
1058
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1059
|
+
handleIpc(ipc);
|
|
1060
|
+
const rpc = createRpc(ipc);
|
|
1061
|
+
messagePort.start();
|
|
1062
|
+
return rpc;
|
|
1063
|
+
};
|
|
1064
|
+
|
|
953
1065
|
const create$3 = async ({
|
|
954
1066
|
commandMap
|
|
955
1067
|
}) => {
|
|
@@ -982,7 +1094,7 @@ const createMockRpc = ({
|
|
|
982
1094
|
};
|
|
983
1095
|
|
|
984
1096
|
const rpcs = Object.create(null);
|
|
985
|
-
const set$
|
|
1097
|
+
const set$4 = (id, rpc) => {
|
|
986
1098
|
rpcs[id] = rpc;
|
|
987
1099
|
};
|
|
988
1100
|
const get$1 = id => {
|
|
@@ -1015,7 +1127,7 @@ const create$2 = rpcId => {
|
|
|
1015
1127
|
const mockRpc = createMockRpc({
|
|
1016
1128
|
commandMap
|
|
1017
1129
|
});
|
|
1018
|
-
set$
|
|
1130
|
+
set$4(rpcId, mockRpc);
|
|
1019
1131
|
// @ts-ignore
|
|
1020
1132
|
mockRpc[Symbol.dispose] = () => {
|
|
1021
1133
|
remove(rpcId);
|
|
@@ -1024,7 +1136,7 @@ const create$2 = rpcId => {
|
|
|
1024
1136
|
return mockRpc;
|
|
1025
1137
|
},
|
|
1026
1138
|
set(rpc) {
|
|
1027
|
-
set$
|
|
1139
|
+
set$4(rpcId, rpc);
|
|
1028
1140
|
}
|
|
1029
1141
|
};
|
|
1030
1142
|
};
|
|
@@ -1059,6 +1171,7 @@ const Shift = 1 << 10 >>> 0;
|
|
|
1059
1171
|
|
|
1060
1172
|
const None = 0;
|
|
1061
1173
|
|
|
1174
|
+
const RendererProcess = 1670;
|
|
1062
1175
|
const RendererWorker = 1;
|
|
1063
1176
|
|
|
1064
1177
|
const FocusSelector = 'Viewlet.focusSelector';
|
|
@@ -1068,18 +1181,23 @@ const SetFocusContext = 'Viewlet.setFocusContext';
|
|
|
1068
1181
|
const SetPatches = 'Viewlet.setPatches';
|
|
1069
1182
|
|
|
1070
1183
|
const {
|
|
1071
|
-
invoke,
|
|
1072
|
-
set: set$
|
|
1184
|
+
invoke: invoke$2,
|
|
1185
|
+
set: set$3
|
|
1186
|
+
} = create$2(RendererProcess);
|
|
1187
|
+
|
|
1188
|
+
const {
|
|
1189
|
+
invoke: invoke$1,
|
|
1190
|
+
set: set$2
|
|
1073
1191
|
} = create$2(RendererWorker);
|
|
1074
1192
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1075
1193
|
number(uid);
|
|
1076
1194
|
number(menuId);
|
|
1077
1195
|
number(x);
|
|
1078
1196
|
number(y);
|
|
1079
|
-
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1197
|
+
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1080
1198
|
};
|
|
1081
1199
|
const writeClipBoardText = async text => {
|
|
1082
|
-
await invoke('ClipBoard.writeText', /* text */text);
|
|
1200
|
+
await invoke$1('ClipBoard.writeText', /* text */text);
|
|
1083
1201
|
};
|
|
1084
1202
|
|
|
1085
1203
|
const toCommandId = key => {
|
|
@@ -1088,6 +1206,7 @@ const toCommandId = key => {
|
|
|
1088
1206
|
};
|
|
1089
1207
|
const create$1 = () => {
|
|
1090
1208
|
const commandQueues = new Map();
|
|
1209
|
+
const instanceIds = Object.create(null);
|
|
1091
1210
|
const generations = Object.create(null);
|
|
1092
1211
|
const states = Object.create(null);
|
|
1093
1212
|
const commandMapRef = Object.create(null);
|
|
@@ -1202,6 +1321,9 @@ const create$1 = () => {
|
|
|
1202
1321
|
},
|
|
1203
1322
|
set(uid, oldState, newState, scheduledState) {
|
|
1204
1323
|
const current = states[uid];
|
|
1324
|
+
if (!current) {
|
|
1325
|
+
instanceIds[uid] = (instanceIds[uid] || 0) + 1;
|
|
1326
|
+
}
|
|
1205
1327
|
if (!current || oldState === newState && newState !== current.newState) {
|
|
1206
1328
|
generations[uid] = getGeneration(uid) + 1;
|
|
1207
1329
|
}
|
|
@@ -1295,8 +1417,9 @@ const create$1 = () => {
|
|
|
1295
1417
|
},
|
|
1296
1418
|
wrapSerialAsyncCommand(fn) {
|
|
1297
1419
|
const wrapped = async (uid, ...args) => {
|
|
1420
|
+
const instanceId = instanceIds[uid];
|
|
1298
1421
|
await enqueueCommand(uid, async () => {
|
|
1299
|
-
if (!states[uid]) {
|
|
1422
|
+
if (!states[uid] || instanceIds[uid] !== instanceId) {
|
|
1300
1423
|
return;
|
|
1301
1424
|
}
|
|
1302
1425
|
const generation = getGeneration(uid);
|
|
@@ -1308,8 +1431,9 @@ const create$1 = () => {
|
|
|
1308
1431
|
},
|
|
1309
1432
|
wrapSerialCommand(fn) {
|
|
1310
1433
|
const wrapped = async (uid, ...args) => {
|
|
1434
|
+
const instanceId = instanceIds[uid];
|
|
1311
1435
|
await enqueueCommand(uid, async () => {
|
|
1312
|
-
if (!states[uid]) {
|
|
1436
|
+
if (!states[uid] || instanceIds[uid] !== instanceId) {
|
|
1313
1437
|
return;
|
|
1314
1438
|
}
|
|
1315
1439
|
const generation = getGeneration(uid);
|
|
@@ -1613,7 +1737,7 @@ const forwardRemotePort = async (state, port) => {
|
|
|
1613
1737
|
uid
|
|
1614
1738
|
} = state;
|
|
1615
1739
|
try {
|
|
1616
|
-
const forwardedPort = await invoke('Application.executeForView', uid, 'PortProvider.forwardPort', port);
|
|
1740
|
+
const forwardedPort = await invoke$1('Application.executeForView', uid, 'PortProvider.forwardPort', port);
|
|
1617
1741
|
if (!forwardedPort || typeof forwardedPort !== 'object' || !('localPort' in forwardedPort)) {
|
|
1618
1742
|
throw new Error('Remote SSH returned an invalid local forwarding port');
|
|
1619
1743
|
}
|
|
@@ -1639,14 +1763,15 @@ const copyLink = async (state, href) => {
|
|
|
1639
1763
|
};
|
|
1640
1764
|
|
|
1641
1765
|
const {
|
|
1766
|
+
createDirectEventCommandMap,
|
|
1642
1767
|
diff,
|
|
1643
1768
|
dispose,
|
|
1644
1769
|
get,
|
|
1645
1770
|
getCommandIds,
|
|
1646
1771
|
registerCommands,
|
|
1647
|
-
set,
|
|
1648
|
-
|
|
1649
|
-
|
|
1772
|
+
set: set$1,
|
|
1773
|
+
wrapGetter,
|
|
1774
|
+
wrapSerialCommand
|
|
1650
1775
|
} = create$1();
|
|
1651
1776
|
|
|
1652
1777
|
const create = (uid, uri, x, y, width, height, platform, assetDir, parentUid) => {
|
|
@@ -1681,7 +1806,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir, parentUid) =>
|
|
|
1681
1806
|
y
|
|
1682
1807
|
};
|
|
1683
1808
|
const calculated = recalculateVirtualList(state);
|
|
1684
|
-
set(uid, calculated, calculated);
|
|
1809
|
+
set$1(uid, calculated, calculated);
|
|
1685
1810
|
};
|
|
1686
1811
|
|
|
1687
1812
|
const isFocusContextEqual = (oldState, newState) => {
|
|
@@ -2234,8 +2359,8 @@ const openAddress = async (state, portNumber) => {
|
|
|
2234
2359
|
return state;
|
|
2235
2360
|
}
|
|
2236
2361
|
const url = getAddressUrl(port.forwardedAddress);
|
|
2237
|
-
await invoke('Layout.showPreview', 'simple-browser://');
|
|
2238
|
-
await invoke('SimpleBrowser.openOrRevealTab', url);
|
|
2362
|
+
await invoke$1('Layout.showPreview', 'simple-browser://');
|
|
2363
|
+
await invoke$1('SimpleBrowser.openOrRevealTab', url);
|
|
2239
2364
|
return state;
|
|
2240
2365
|
};
|
|
2241
2366
|
|
|
@@ -2279,9 +2404,9 @@ const toggleRemoteSshPort = async (state, portNumber) => {
|
|
|
2279
2404
|
let forwardedAddress = oldForwardedAddress;
|
|
2280
2405
|
try {
|
|
2281
2406
|
if (port.active) {
|
|
2282
|
-
await invoke('Application.executeForView', uid, 'PortProvider.stopForwardPort', portNumber);
|
|
2407
|
+
await invoke$1('Application.executeForView', uid, 'PortProvider.stopForwardPort', portNumber);
|
|
2283
2408
|
} else {
|
|
2284
|
-
const forwardedPort = await invoke('Application.executeForView', uid, 'PortProvider.forwardPort', portNumber);
|
|
2409
|
+
const forwardedPort = await invoke$1('Application.executeForView', uid, 'PortProvider.forwardPort', portNumber);
|
|
2285
2410
|
if (!forwardedPort || typeof forwardedPort !== 'object' || !('localPort' in forwardedPort)) {
|
|
2286
2411
|
throw new Error('Remote SSH returned an invalid local forwarding port');
|
|
2287
2412
|
}
|
|
@@ -2372,6 +2497,31 @@ const handleFocus = state => {
|
|
|
2372
2497
|
};
|
|
2373
2498
|
};
|
|
2374
2499
|
|
|
2500
|
+
const state = {
|
|
2501
|
+
connected: false
|
|
2502
|
+
};
|
|
2503
|
+
const isConnected = () => {
|
|
2504
|
+
const {
|
|
2505
|
+
connected
|
|
2506
|
+
} = state;
|
|
2507
|
+
return connected;
|
|
2508
|
+
};
|
|
2509
|
+
const invoke = (method, ...params) => {
|
|
2510
|
+
return invoke$2(method, ...params);
|
|
2511
|
+
};
|
|
2512
|
+
const set = rpc => {
|
|
2513
|
+
set$3(rpc);
|
|
2514
|
+
state.connected = true;
|
|
2515
|
+
};
|
|
2516
|
+
|
|
2517
|
+
const handleMessagePort = async port => {
|
|
2518
|
+
const rpc = await create$4({
|
|
2519
|
+
commandMap: createDirectEventCommandMap(uid => invoke$1('Viewlet.requestRender', uid)),
|
|
2520
|
+
messagePort: port
|
|
2521
|
+
});
|
|
2522
|
+
set(rpc);
|
|
2523
|
+
};
|
|
2524
|
+
|
|
2375
2525
|
const handleWheel = (state, deltaMode, deltaY) => {
|
|
2376
2526
|
const {
|
|
2377
2527
|
deltaY: oldDeltaY,
|
|
@@ -2389,7 +2539,7 @@ const loadContent = async (state, workspaceUri = '') => {
|
|
|
2389
2539
|
const request = {};
|
|
2390
2540
|
requests.set(uid, request);
|
|
2391
2541
|
try {
|
|
2392
|
-
const ports = workspaceUri ? await invoke('Application.executeForView', uid, 'PortProvider.getPorts', workspaceUri) : [];
|
|
2542
|
+
const ports = workspaceUri ? await invoke$1('Application.executeForView', uid, 'PortProvider.getPorts', workspaceUri) : [];
|
|
2393
2543
|
if (requests.get(uid) !== request) {
|
|
2394
2544
|
return get(uid).newState;
|
|
2395
2545
|
}
|
|
@@ -2435,7 +2585,7 @@ const stopRemotePort = async (state, portNumber) => {
|
|
|
2435
2585
|
uid
|
|
2436
2586
|
} = state;
|
|
2437
2587
|
try {
|
|
2438
|
-
await invoke('Application.executeForView', uid, 'PortProvider.stopForwardPort', portNumber);
|
|
2588
|
+
await invoke$1('Application.executeForView', uid, 'PortProvider.stopForwardPort', portNumber);
|
|
2439
2589
|
} catch (error) {
|
|
2440
2590
|
return {
|
|
2441
2591
|
...state,
|
|
@@ -2814,12 +2964,33 @@ const getRenderer = diffType => {
|
|
|
2814
2964
|
}
|
|
2815
2965
|
};
|
|
2816
2966
|
const render2 = (uid, diffResult) => {
|
|
2967
|
+
// An event may arrive between diff and render; include its changes in this snapshot.
|
|
2968
|
+
const pendingDiffs = [...new Set([...diffResult, ...diff2(uid)])];
|
|
2817
2969
|
const {
|
|
2818
|
-
|
|
2819
|
-
|
|
2970
|
+
oldState,
|
|
2971
|
+
scheduledState
|
|
2820
2972
|
} = get(uid);
|
|
2821
|
-
|
|
2822
|
-
|
|
2973
|
+
const commands = pendingDiffs.map(diffType => getRenderer(diffType)(oldState, scheduledState)).filter(command => command.length > 0);
|
|
2974
|
+
set$1(uid, scheduledState, scheduledState);
|
|
2975
|
+
if (!isConnected() || commands.length === 0) {
|
|
2976
|
+
return commands;
|
|
2977
|
+
}
|
|
2978
|
+
return renderDirect(uid, commands, oldState, scheduledState);
|
|
2979
|
+
};
|
|
2980
|
+
const isWorkerCommand = command => command[0] === SetFocusContext || command[0] === 'Viewlet.unsetAdditionalFocus';
|
|
2981
|
+
const renderDirect = async (uid, commands, oldState, renderedState) => {
|
|
2982
|
+
const workerCommands = commands.filter(isWorkerCommand);
|
|
2983
|
+
const processCommands = commands.filter(command => !isWorkerCommand(command));
|
|
2984
|
+
try {
|
|
2985
|
+
const transactionId = await invoke('Viewlet.queueCommands', uid, [...processCommands, ['Viewlet.setUid', uid, uid]]);
|
|
2986
|
+
return [...workerCommands, ['Viewlet.commitPending', uid, transactionId]];
|
|
2987
|
+
} catch (error) {
|
|
2988
|
+
const current = get(uid);
|
|
2989
|
+
if (current?.oldState === renderedState) {
|
|
2990
|
+
set$1(uid, oldState, current.newState, current.scheduledState);
|
|
2991
|
+
}
|
|
2992
|
+
throw error;
|
|
2993
|
+
}
|
|
2823
2994
|
};
|
|
2824
2995
|
|
|
2825
2996
|
const renderEventListeners = () => {
|
|
@@ -2877,7 +3048,7 @@ const applyComponentState = (currentState, state) => {
|
|
|
2877
3048
|
}
|
|
2878
3049
|
return state;
|
|
2879
3050
|
};
|
|
2880
|
-
const setComponentState =
|
|
3051
|
+
const setComponentState = wrapSerialCommand(applyComponentState);
|
|
2881
3052
|
|
|
2882
3053
|
const toggleFocusedPort = state => {
|
|
2883
3054
|
const {
|
|
@@ -2893,45 +3064,46 @@ const toggleFocusedPort = state => {
|
|
|
2893
3064
|
};
|
|
2894
3065
|
|
|
2895
3066
|
const commandMap = {
|
|
2896
|
-
'Ports.addPort':
|
|
2897
|
-
'Ports.cancelAddPort':
|
|
2898
|
-
'Ports.copyLink':
|
|
3067
|
+
'Ports.addPort': wrapSerialCommand(addPort),
|
|
3068
|
+
'Ports.cancelAddPort': wrapSerialCommand(cancelAddPort),
|
|
3069
|
+
'Ports.copyLink': wrapSerialCommand(copyLink),
|
|
2899
3070
|
'Ports.create': create,
|
|
2900
3071
|
'Ports.diff2': diff2,
|
|
2901
3072
|
'Ports.dispose': dispose,
|
|
2902
|
-
'Ports.focusFirst':
|
|
2903
|
-
'Ports.focusIndex':
|
|
2904
|
-
'Ports.focusLast':
|
|
2905
|
-
'Ports.focusNext':
|
|
2906
|
-
'Ports.focusPrevious':
|
|
3073
|
+
'Ports.focusFirst': wrapSerialCommand(focusFirst),
|
|
3074
|
+
'Ports.focusIndex': wrapSerialCommand(focusIndex),
|
|
3075
|
+
'Ports.focusLast': wrapSerialCommand(focusLast),
|
|
3076
|
+
'Ports.focusNext': wrapSerialCommand(focusNext),
|
|
3077
|
+
'Ports.focusPrevious': wrapSerialCommand(focusPrevious),
|
|
2907
3078
|
'Ports.getCommandIds': getCommandIds,
|
|
2908
3079
|
'Ports.getComponentState': getComponentState,
|
|
2909
3080
|
'Ports.getKeyBindings': getKeyBindings,
|
|
2910
3081
|
'Ports.getMenuEntries2': wrapGetter(getMenuEntries2),
|
|
2911
3082
|
'Ports.getMenuIds': getMenuIds,
|
|
2912
|
-
'Ports.handleAddPortInput':
|
|
2913
|
-
'Ports.handleBlur':
|
|
2914
|
-
'Ports.handleClick':
|
|
2915
|
-
'Ports.handleContextMenu':
|
|
2916
|
-
'Ports.handleFocus':
|
|
2917
|
-
'Ports.
|
|
2918
|
-
'Ports.
|
|
2919
|
-
'Ports.
|
|
2920
|
-
'Ports.
|
|
2921
|
-
'Ports.
|
|
2922
|
-
'Ports.
|
|
2923
|
-
'Ports.
|
|
3083
|
+
'Ports.handleAddPortInput': wrapSerialCommand(handleAddPortInput),
|
|
3084
|
+
'Ports.handleBlur': wrapSerialCommand(handleBlur),
|
|
3085
|
+
'Ports.handleClick': wrapSerialCommand(handleClick),
|
|
3086
|
+
'Ports.handleContextMenu': wrapSerialCommand(handleContextMenu),
|
|
3087
|
+
'Ports.handleFocus': wrapSerialCommand(handleFocus),
|
|
3088
|
+
'Ports.handleMessagePort': handleMessagePort,
|
|
3089
|
+
'Ports.handleWheel': wrapSerialCommand(handleWheel),
|
|
3090
|
+
'Ports.handleWorkspaceChange': wrapSerialCommand(loadContent),
|
|
3091
|
+
'Ports.loadContent': wrapSerialCommand(loadContent),
|
|
3092
|
+
'Ports.openAddress': wrapSerialCommand(openAddress),
|
|
3093
|
+
'Ports.openFocusedAddress': wrapSerialCommand(openFocusedAddress),
|
|
3094
|
+
'Ports.removeFocusedPort': wrapSerialCommand(removeFocusedPort),
|
|
3095
|
+
'Ports.removePort': wrapSerialCommand(removePort),
|
|
2924
3096
|
'Ports.render2': render2,
|
|
2925
3097
|
'Ports.renderEventListeners': renderEventListeners,
|
|
2926
|
-
'Ports.resize':
|
|
3098
|
+
'Ports.resize': wrapSerialCommand(resize),
|
|
2927
3099
|
'Ports.setComponentState': setComponentState,
|
|
2928
|
-
'Ports.setDeltaY':
|
|
2929
|
-
'Ports.setPorts':
|
|
2930
|
-
'Ports.startAddPort':
|
|
2931
|
-
'Ports.submitAddPort':
|
|
3100
|
+
'Ports.setDeltaY': wrapSerialCommand(setDeltaY),
|
|
3101
|
+
'Ports.setPorts': wrapSerialCommand(setPorts),
|
|
3102
|
+
'Ports.startAddPort': wrapSerialCommand(startAddPort),
|
|
3103
|
+
'Ports.submitAddPort': wrapSerialCommand(submitAddPort),
|
|
2932
3104
|
'Ports.terminate': terminate,
|
|
2933
|
-
'Ports.toggleFocusedPort':
|
|
2934
|
-
'Ports.togglePortActive':
|
|
3105
|
+
'Ports.toggleFocusedPort': wrapSerialCommand(toggleFocusedPort),
|
|
3106
|
+
'Ports.togglePortActive': wrapSerialCommand(togglePortActive)
|
|
2935
3107
|
};
|
|
2936
3108
|
|
|
2937
3109
|
const listen = async () => {
|
|
@@ -2939,7 +3111,7 @@ const listen = async () => {
|
|
|
2939
3111
|
const rpc = await create$3({
|
|
2940
3112
|
commandMap: commandMap
|
|
2941
3113
|
});
|
|
2942
|
-
set$
|
|
3114
|
+
set$2(rpc);
|
|
2943
3115
|
};
|
|
2944
3116
|
|
|
2945
3117
|
const main = async () => {
|