@lvce-editor/menu-worker 3.0.0 → 4.0.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/menuWorkerMain.js +546 -871
- package/package.json +1 -1
package/dist/menuWorkerMain.js
CHANGED
|
@@ -225,8 +225,8 @@ const getModuleNotFoundError = stderr => {
|
|
|
225
225
|
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
226
226
|
const message = lines[messageIndex];
|
|
227
227
|
return {
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
229
|
+
message
|
|
230
230
|
};
|
|
231
231
|
};
|
|
232
232
|
const isModuleNotFoundError = stderr => {
|
|
@@ -249,14 +249,14 @@ const isUnhelpfulNativeModuleError = stderr => {
|
|
|
249
249
|
const getNativeModuleErrorMessage = stderr => {
|
|
250
250
|
const message = getMessageCodeBlock(stderr);
|
|
251
251
|
return {
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
253
|
+
message: `Incompatible native node module: ${message}`
|
|
254
254
|
};
|
|
255
255
|
};
|
|
256
256
|
const getModuleSyntaxError = () => {
|
|
257
257
|
return {
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
259
|
+
message: `ES Modules are not supported in electron`
|
|
260
260
|
};
|
|
261
261
|
};
|
|
262
262
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -275,8 +275,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
275
275
|
rest
|
|
276
276
|
} = getDetails(lines);
|
|
277
277
|
return {
|
|
278
|
-
message: actualMessage,
|
|
279
278
|
code: '',
|
|
279
|
+
message: actualMessage,
|
|
280
280
|
stack: rest
|
|
281
281
|
};
|
|
282
282
|
};
|
|
@@ -286,8 +286,8 @@ class IpcError extends VError {
|
|
|
286
286
|
if (stdout || stderr) {
|
|
287
287
|
// @ts-ignore
|
|
288
288
|
const {
|
|
289
|
-
message,
|
|
290
289
|
code,
|
|
290
|
+
message,
|
|
291
291
|
stack
|
|
292
292
|
} = getHelpfulChildProcessError(stdout, stderr);
|
|
293
293
|
const cause = new Error(message);
|
|
@@ -348,8 +348,8 @@ const wrap$f = global => {
|
|
|
348
348
|
};
|
|
349
349
|
const waitForFirstMessage = async port => {
|
|
350
350
|
const {
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
promise,
|
|
352
|
+
resolve
|
|
353
353
|
} = Promise.withResolvers();
|
|
354
354
|
port.addEventListener('message', resolve, {
|
|
355
355
|
once: true
|
|
@@ -369,8 +369,8 @@ const listen$6 = async () => {
|
|
|
369
369
|
const type = firstMessage.params[0];
|
|
370
370
|
if (type === 'message-port') {
|
|
371
371
|
parentIpc.send({
|
|
372
|
-
jsonrpc: '2.0',
|
|
373
372
|
id: firstMessage.id,
|
|
373
|
+
jsonrpc: '2.0',
|
|
374
374
|
result: null
|
|
375
375
|
});
|
|
376
376
|
parentIpc.dispose();
|
|
@@ -427,8 +427,8 @@ const removeListener = (emitter, type, callback) => {
|
|
|
427
427
|
};
|
|
428
428
|
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
429
429
|
const {
|
|
430
|
-
|
|
431
|
-
|
|
430
|
+
promise,
|
|
431
|
+
resolve
|
|
432
432
|
} = Promise.withResolvers();
|
|
433
433
|
const listenerMap = Object.create(null);
|
|
434
434
|
const cleanup = value => {
|
|
@@ -440,8 +440,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
440
440
|
for (const [event, type] of Object.entries(eventMap)) {
|
|
441
441
|
const listener = event => {
|
|
442
442
|
cleanup({
|
|
443
|
-
|
|
444
|
-
|
|
443
|
+
event,
|
|
444
|
+
type
|
|
445
445
|
});
|
|
446
446
|
};
|
|
447
447
|
addListener(eventEmitter, event, listener);
|
|
@@ -451,8 +451,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
451
451
|
};
|
|
452
452
|
const Message$1 = 3;
|
|
453
453
|
const create$5$1 = async ({
|
|
454
|
-
|
|
455
|
-
|
|
454
|
+
isMessagePortOpen,
|
|
455
|
+
messagePort
|
|
456
456
|
}) => {
|
|
457
457
|
if (!isMessagePort(messagePort)) {
|
|
458
458
|
throw new IpcError('port must be of type MessagePort');
|
|
@@ -465,8 +465,8 @@ const create$5$1 = async ({
|
|
|
465
465
|
});
|
|
466
466
|
messagePort.start();
|
|
467
467
|
const {
|
|
468
|
-
|
|
469
|
-
|
|
468
|
+
event,
|
|
469
|
+
type
|
|
470
470
|
} = await eventPromise;
|
|
471
471
|
if (type !== Message$1) {
|
|
472
472
|
throw new IpcError('Failed to wait for ipc message');
|
|
@@ -506,56 +506,35 @@ const IpcParentWithMessagePort$1 = {
|
|
|
506
506
|
wrap: wrap$5
|
|
507
507
|
};
|
|
508
508
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
509
|
+
class CommandNotFoundError extends Error {
|
|
510
|
+
constructor(command) {
|
|
511
|
+
super(`Command not found ${command}`);
|
|
512
|
+
this.name = 'CommandNotFoundError';
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
const commands = Object.create(null);
|
|
516
|
+
const register = commandMap => {
|
|
517
|
+
Object.assign(commands, commandMap);
|
|
516
518
|
};
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
callbacks[id] = fn;
|
|
519
|
+
const getCommand = key => {
|
|
520
|
+
return commands[key];
|
|
520
521
|
};
|
|
522
|
+
const execute = (command, ...args) => {
|
|
523
|
+
const fn = getCommand(command);
|
|
524
|
+
if (!fn) {
|
|
525
|
+
throw new CommandNotFoundError(command);
|
|
526
|
+
}
|
|
527
|
+
return fn(...args);
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
const Two$1 = '2.0';
|
|
531
|
+
const callbacks = Object.create(null);
|
|
521
532
|
const get$3 = id => {
|
|
522
533
|
return callbacks[id];
|
|
523
534
|
};
|
|
524
|
-
const remove = id => {
|
|
535
|
+
const remove$1 = id => {
|
|
525
536
|
delete callbacks[id];
|
|
526
537
|
};
|
|
527
|
-
let id$a = 0;
|
|
528
|
-
const create$3$1 = () => {
|
|
529
|
-
return ++id$a;
|
|
530
|
-
};
|
|
531
|
-
const registerPromise = () => {
|
|
532
|
-
const id = create$3$1();
|
|
533
|
-
const {
|
|
534
|
-
resolve,
|
|
535
|
-
promise
|
|
536
|
-
} = Promise.withResolvers();
|
|
537
|
-
set$5(id, resolve);
|
|
538
|
-
return {
|
|
539
|
-
id,
|
|
540
|
-
promise
|
|
541
|
-
};
|
|
542
|
-
};
|
|
543
|
-
const create$2$1 = (method, params) => {
|
|
544
|
-
const {
|
|
545
|
-
id,
|
|
546
|
-
promise
|
|
547
|
-
} = registerPromise();
|
|
548
|
-
const message = {
|
|
549
|
-
jsonrpc: Two,
|
|
550
|
-
method,
|
|
551
|
-
params,
|
|
552
|
-
id
|
|
553
|
-
};
|
|
554
|
-
return {
|
|
555
|
-
message,
|
|
556
|
-
promise
|
|
557
|
-
};
|
|
558
|
-
};
|
|
559
538
|
class JsonRpcError extends Error {
|
|
560
539
|
constructor(message) {
|
|
561
540
|
super(message);
|
|
@@ -572,12 +551,12 @@ const getErrorConstructor = (message, type) => {
|
|
|
572
551
|
switch (type) {
|
|
573
552
|
case DomException:
|
|
574
553
|
return DOMException;
|
|
575
|
-
case TypeError$1:
|
|
576
|
-
return TypeError;
|
|
577
|
-
case SyntaxError$1:
|
|
578
|
-
return SyntaxError;
|
|
579
554
|
case ReferenceError$1:
|
|
580
555
|
return ReferenceError;
|
|
556
|
+
case SyntaxError$1:
|
|
557
|
+
return SyntaxError;
|
|
558
|
+
case TypeError$1:
|
|
559
|
+
return TypeError;
|
|
581
560
|
default:
|
|
582
561
|
return Error;
|
|
583
562
|
}
|
|
@@ -706,7 +685,7 @@ const resolve = (id, response) => {
|
|
|
706
685
|
return;
|
|
707
686
|
}
|
|
708
687
|
fn(response);
|
|
709
|
-
remove(id);
|
|
688
|
+
remove$1(id);
|
|
710
689
|
};
|
|
711
690
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
712
691
|
const getErrorType = prettyError => {
|
|
@@ -733,27 +712,27 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
733
712
|
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
|
734
713
|
return {
|
|
735
714
|
code: MethodNotFound,
|
|
736
|
-
|
|
737
|
-
|
|
715
|
+
data: error.stack,
|
|
716
|
+
message: error.message
|
|
738
717
|
};
|
|
739
718
|
}
|
|
740
719
|
return {
|
|
741
720
|
code: Custom,
|
|
742
|
-
message: prettyError.message,
|
|
743
721
|
data: {
|
|
744
|
-
stack: getStack(prettyError),
|
|
745
|
-
codeFrame: prettyError.codeFrame,
|
|
746
|
-
type: getErrorType(prettyError),
|
|
747
722
|
code: prettyError.code,
|
|
748
|
-
|
|
749
|
-
|
|
723
|
+
codeFrame: prettyError.codeFrame,
|
|
724
|
+
name: prettyError.name,
|
|
725
|
+
stack: getStack(prettyError),
|
|
726
|
+
type: getErrorType(prettyError)
|
|
727
|
+
},
|
|
728
|
+
message: prettyError.message
|
|
750
729
|
};
|
|
751
730
|
};
|
|
752
731
|
const create$1$1 = (id, error) => {
|
|
753
732
|
return {
|
|
754
|
-
|
|
733
|
+
error,
|
|
755
734
|
id,
|
|
756
|
-
|
|
735
|
+
jsonrpc: Two$1
|
|
757
736
|
};
|
|
758
737
|
};
|
|
759
738
|
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
@@ -762,27 +741,27 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
762
741
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
763
742
|
return create$1$1(id, errorProperty);
|
|
764
743
|
};
|
|
765
|
-
const create$
|
|
744
|
+
const create$8 = (message, result) => {
|
|
766
745
|
return {
|
|
767
|
-
jsonrpc: Two,
|
|
768
746
|
id: message.id,
|
|
747
|
+
jsonrpc: Two$1,
|
|
769
748
|
result: result ?? null
|
|
770
749
|
};
|
|
771
750
|
};
|
|
772
751
|
const getSuccessResponse = (message, result) => {
|
|
773
752
|
const resultProperty = result ?? null;
|
|
774
|
-
return create$
|
|
753
|
+
return create$8(message, resultProperty);
|
|
775
754
|
};
|
|
776
755
|
const getErrorResponseSimple = (id, error) => {
|
|
777
756
|
return {
|
|
778
|
-
jsonrpc: Two,
|
|
779
|
-
id,
|
|
780
757
|
error: {
|
|
781
758
|
code: Custom,
|
|
759
|
+
data: error,
|
|
782
760
|
// @ts-ignore
|
|
783
|
-
message: error.message
|
|
784
|
-
|
|
785
|
-
|
|
761
|
+
message: error.message
|
|
762
|
+
},
|
|
763
|
+
id,
|
|
764
|
+
jsonrpc: Two$1
|
|
786
765
|
};
|
|
787
766
|
};
|
|
788
767
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
@@ -812,35 +791,35 @@ const normalizeParams = args => {
|
|
|
812
791
|
if (args.length === 1) {
|
|
813
792
|
const options = args[0];
|
|
814
793
|
return {
|
|
794
|
+
execute: options.execute,
|
|
815
795
|
ipc: options.ipc,
|
|
796
|
+
logError: options.logError || defaultLogError,
|
|
816
797
|
message: options.message,
|
|
817
|
-
execute: options.execute,
|
|
818
|
-
resolve: options.resolve || defaultResolve,
|
|
819
798
|
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
820
|
-
|
|
821
|
-
|
|
799
|
+
requiresSocket: options.requiresSocket || defaultRequiresSocket,
|
|
800
|
+
resolve: options.resolve || defaultResolve
|
|
822
801
|
};
|
|
823
802
|
}
|
|
824
803
|
return {
|
|
804
|
+
execute: args[2],
|
|
825
805
|
ipc: args[0],
|
|
806
|
+
logError: args[5],
|
|
826
807
|
message: args[1],
|
|
827
|
-
execute: args[2],
|
|
828
|
-
resolve: args[3],
|
|
829
808
|
preparePrettyError: args[4],
|
|
830
|
-
|
|
831
|
-
|
|
809
|
+
requiresSocket: args[6],
|
|
810
|
+
resolve: args[3]
|
|
832
811
|
};
|
|
833
812
|
};
|
|
834
813
|
const handleJsonRpcMessage = async (...args) => {
|
|
835
814
|
const options = normalizeParams(args);
|
|
836
815
|
const {
|
|
837
|
-
message,
|
|
838
|
-
ipc,
|
|
839
816
|
execute,
|
|
840
|
-
|
|
841
|
-
preparePrettyError,
|
|
817
|
+
ipc,
|
|
842
818
|
logError,
|
|
843
|
-
|
|
819
|
+
message,
|
|
820
|
+
preparePrettyError,
|
|
821
|
+
requiresSocket,
|
|
822
|
+
resolve
|
|
844
823
|
} = options;
|
|
845
824
|
if ('id' in message) {
|
|
846
825
|
if ('method' in message) {
|
|
@@ -862,11 +841,51 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
862
841
|
}
|
|
863
842
|
throw new JsonRpcError('unexpected message');
|
|
864
843
|
};
|
|
865
|
-
|
|
844
|
+
|
|
845
|
+
const Two = '2.0';
|
|
846
|
+
|
|
847
|
+
const create$7 = (method, params) => {
|
|
848
|
+
return {
|
|
849
|
+
jsonrpc: Two,
|
|
850
|
+
method,
|
|
851
|
+
params
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
const create$6 = (id, method, params) => {
|
|
856
|
+
const message = {
|
|
857
|
+
id,
|
|
858
|
+
jsonrpc: Two,
|
|
859
|
+
method,
|
|
860
|
+
params
|
|
861
|
+
};
|
|
862
|
+
return message;
|
|
863
|
+
};
|
|
864
|
+
|
|
865
|
+
let id$a = 0;
|
|
866
|
+
const create$5 = () => {
|
|
867
|
+
return ++id$a;
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
const registerPromise = map => {
|
|
871
|
+
const id = create$5();
|
|
866
872
|
const {
|
|
867
|
-
|
|
873
|
+
promise,
|
|
874
|
+
resolve
|
|
875
|
+
} = Promise.withResolvers();
|
|
876
|
+
map[id] = resolve;
|
|
877
|
+
return {
|
|
878
|
+
id,
|
|
879
|
+
promise
|
|
880
|
+
};
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
884
|
+
const {
|
|
885
|
+
id,
|
|
868
886
|
promise
|
|
869
|
-
} =
|
|
887
|
+
} = registerPromise(callbacks);
|
|
888
|
+
const message = create$6(id, method, params);
|
|
870
889
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
871
890
|
ipc.sendAndTransfer(message);
|
|
872
891
|
} else {
|
|
@@ -875,60 +894,40 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
|
875
894
|
const responseMessage = await promise;
|
|
876
895
|
return unwrapJsonRpcResult(responseMessage);
|
|
877
896
|
};
|
|
878
|
-
const send$1 = (transport, method, ...params) => {
|
|
879
|
-
const message = create$4(method, params);
|
|
880
|
-
transport.send(message);
|
|
881
|
-
};
|
|
882
|
-
const invoke$4 = (ipc, method, ...params) => {
|
|
883
|
-
return invokeHelper(ipc, method, params, false);
|
|
884
|
-
};
|
|
885
|
-
const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
886
|
-
return invokeHelper(ipc, method, params, true);
|
|
887
|
-
};
|
|
888
|
-
|
|
889
|
-
class CommandNotFoundError extends Error {
|
|
890
|
-
constructor(command) {
|
|
891
|
-
super(`Command not found ${command}`);
|
|
892
|
-
this.name = 'CommandNotFoundError';
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
const commands = Object.create(null);
|
|
896
|
-
const register = commandMap => {
|
|
897
|
-
Object.assign(commands, commandMap);
|
|
898
|
-
};
|
|
899
|
-
const getCommand = key => {
|
|
900
|
-
return commands[key];
|
|
901
|
-
};
|
|
902
|
-
const execute = (command, ...args) => {
|
|
903
|
-
const fn = getCommand(command);
|
|
904
|
-
if (!fn) {
|
|
905
|
-
throw new CommandNotFoundError(command);
|
|
906
|
-
}
|
|
907
|
-
return fn(...args);
|
|
908
|
-
};
|
|
909
|
-
|
|
910
897
|
const createRpc = ipc => {
|
|
898
|
+
const callbacks = Object.create(null);
|
|
899
|
+
ipc._resolve = (id, response) => {
|
|
900
|
+
const fn = callbacks[id];
|
|
901
|
+
if (!fn) {
|
|
902
|
+
console.warn(`callback ${id} may already be disposed`);
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
fn(response);
|
|
906
|
+
delete callbacks[id];
|
|
907
|
+
};
|
|
911
908
|
const rpc = {
|
|
909
|
+
async dispose() {
|
|
910
|
+
await ipc?.dispose();
|
|
911
|
+
},
|
|
912
|
+
invoke(method, ...params) {
|
|
913
|
+
return invokeHelper(callbacks, ipc, method, params, false);
|
|
914
|
+
},
|
|
915
|
+
invokeAndTransfer(method, ...params) {
|
|
916
|
+
return invokeHelper(callbacks, ipc, method, params, true);
|
|
917
|
+
},
|
|
912
918
|
// @ts-ignore
|
|
913
919
|
ipc,
|
|
914
920
|
/**
|
|
915
921
|
* @deprecated
|
|
916
922
|
*/
|
|
917
923
|
send(method, ...params) {
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
invoke(method, ...params) {
|
|
921
|
-
return invoke$4(ipc, method, ...params);
|
|
922
|
-
},
|
|
923
|
-
invokeAndTransfer(method, ...params) {
|
|
924
|
-
return invokeAndTransfer$1(ipc, method, ...params);
|
|
925
|
-
},
|
|
926
|
-
async dispose() {
|
|
927
|
-
await ipc?.dispose();
|
|
924
|
+
const message = create$7(method, params);
|
|
925
|
+
ipc.send(message);
|
|
928
926
|
}
|
|
929
927
|
};
|
|
930
928
|
return rpc;
|
|
931
929
|
};
|
|
930
|
+
|
|
932
931
|
const requiresSocket = () => {
|
|
933
932
|
return false;
|
|
934
933
|
};
|
|
@@ -941,8 +940,9 @@ const logError = () => {
|
|
|
941
940
|
const handleMessage = event => {
|
|
942
941
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
943
942
|
const actualExecute = event?.target?.execute || execute;
|
|
944
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute,
|
|
943
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
945
944
|
};
|
|
945
|
+
|
|
946
946
|
const handleIpc = ipc => {
|
|
947
947
|
if ('addEventListener' in ipc) {
|
|
948
948
|
ipc.addEventListener('message', handleMessage);
|
|
@@ -951,6 +951,7 @@ const handleIpc = ipc => {
|
|
|
951
951
|
ipc.on('message', handleMessage);
|
|
952
952
|
}
|
|
953
953
|
};
|
|
954
|
+
|
|
954
955
|
const listen$1 = async (module, options) => {
|
|
955
956
|
const rawIpc = await module.listen(options);
|
|
956
957
|
if (module.signal) {
|
|
@@ -959,15 +960,17 @@ const listen$1 = async (module, options) => {
|
|
|
959
960
|
const ipc = module.wrap(rawIpc);
|
|
960
961
|
return ipc;
|
|
961
962
|
};
|
|
962
|
-
|
|
963
|
+
|
|
964
|
+
const create$4 = async ({
|
|
963
965
|
commandMap,
|
|
966
|
+
isMessagePortOpen = true,
|
|
964
967
|
messagePort
|
|
965
968
|
}) => {
|
|
966
969
|
// TODO create a commandMap per rpc instance
|
|
967
970
|
register(commandMap);
|
|
968
971
|
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
969
|
-
|
|
970
|
-
|
|
972
|
+
isMessagePortOpen,
|
|
973
|
+
messagePort
|
|
971
974
|
});
|
|
972
975
|
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
973
976
|
handleIpc(ipc);
|
|
@@ -975,8 +978,10 @@ const create$5 = async ({
|
|
|
975
978
|
messagePort.start();
|
|
976
979
|
return rpc;
|
|
977
980
|
};
|
|
981
|
+
|
|
978
982
|
const create$3 = async ({
|
|
979
983
|
commandMap,
|
|
984
|
+
isMessagePortOpen,
|
|
980
985
|
send
|
|
981
986
|
}) => {
|
|
982
987
|
const {
|
|
@@ -984,15 +989,13 @@ const create$3 = async ({
|
|
|
984
989
|
port2
|
|
985
990
|
} = new MessageChannel();
|
|
986
991
|
await send(port1);
|
|
987
|
-
return create$
|
|
992
|
+
return create$4({
|
|
988
993
|
commandMap,
|
|
994
|
+
isMessagePortOpen,
|
|
989
995
|
messagePort: port2
|
|
990
996
|
});
|
|
991
997
|
};
|
|
992
|
-
|
|
993
|
-
__proto__: null,
|
|
994
|
-
create: create$3
|
|
995
|
-
};
|
|
998
|
+
|
|
996
999
|
const create$2 = async ({
|
|
997
1000
|
commandMap
|
|
998
1001
|
}) => {
|
|
@@ -1003,10 +1006,7 @@ const create$2 = async ({
|
|
|
1003
1006
|
const rpc = createRpc(ipc);
|
|
1004
1007
|
return rpc;
|
|
1005
1008
|
};
|
|
1006
|
-
|
|
1007
|
-
__proto__: null,
|
|
1008
|
-
create: create$2
|
|
1009
|
-
};
|
|
1009
|
+
|
|
1010
1010
|
const createMockRpc = ({
|
|
1011
1011
|
commandMap
|
|
1012
1012
|
}) => {
|
|
@@ -1020,13 +1020,62 @@ const createMockRpc = ({
|
|
|
1020
1020
|
return command(...params);
|
|
1021
1021
|
};
|
|
1022
1022
|
const mockRpc = {
|
|
1023
|
+
invocations,
|
|
1023
1024
|
invoke,
|
|
1024
|
-
invokeAndTransfer: invoke
|
|
1025
|
-
invocations
|
|
1025
|
+
invokeAndTransfer: invoke
|
|
1026
1026
|
};
|
|
1027
1027
|
return mockRpc;
|
|
1028
1028
|
};
|
|
1029
1029
|
|
|
1030
|
+
const rpcs = Object.create(null);
|
|
1031
|
+
const set$4 = (id, rpc) => {
|
|
1032
|
+
rpcs[id] = rpc;
|
|
1033
|
+
};
|
|
1034
|
+
const get$2 = id => {
|
|
1035
|
+
return rpcs[id];
|
|
1036
|
+
};
|
|
1037
|
+
const remove = id => {
|
|
1038
|
+
delete rpcs[id];
|
|
1039
|
+
};
|
|
1040
|
+
|
|
1041
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1042
|
+
const create$1 = rpcId => {
|
|
1043
|
+
return {
|
|
1044
|
+
async dispose() {
|
|
1045
|
+
const rpc = get$2(rpcId);
|
|
1046
|
+
await rpc.dispose();
|
|
1047
|
+
},
|
|
1048
|
+
// @ts-ignore
|
|
1049
|
+
invoke(method, ...params) {
|
|
1050
|
+
const rpc = get$2(rpcId);
|
|
1051
|
+
// @ts-ignore
|
|
1052
|
+
return rpc.invoke(method, ...params);
|
|
1053
|
+
},
|
|
1054
|
+
// @ts-ignore
|
|
1055
|
+
invokeAndTransfer(method, ...params) {
|
|
1056
|
+
const rpc = get$2(rpcId);
|
|
1057
|
+
// @ts-ignore
|
|
1058
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
1059
|
+
},
|
|
1060
|
+
registerMockRpc(commandMap) {
|
|
1061
|
+
const mockRpc = createMockRpc({
|
|
1062
|
+
commandMap
|
|
1063
|
+
});
|
|
1064
|
+
set$4(rpcId, mockRpc);
|
|
1065
|
+
// @ts-ignore
|
|
1066
|
+
mockRpc[Symbol.dispose] = () => {
|
|
1067
|
+
remove(rpcId);
|
|
1068
|
+
};
|
|
1069
|
+
// @ts-ignore
|
|
1070
|
+
return mockRpc;
|
|
1071
|
+
},
|
|
1072
|
+
set(rpc) {
|
|
1073
|
+
set$4(rpcId, rpc);
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
};
|
|
1077
|
+
|
|
1078
|
+
const Div$1 = 4;
|
|
1030
1079
|
const Text = 12;
|
|
1031
1080
|
|
|
1032
1081
|
const Button = 'event.button';
|
|
@@ -1166,34 +1215,14 @@ const Plus = '+';
|
|
|
1166
1215
|
|
|
1167
1216
|
const getKeyCodeString = keyCode => {
|
|
1168
1217
|
switch (keyCode) {
|
|
1218
|
+
case Backquote$1:
|
|
1219
|
+
return Backquote;
|
|
1220
|
+
case Backslash$1:
|
|
1221
|
+
return Backslash;
|
|
1169
1222
|
case Backspace$1:
|
|
1170
1223
|
return Backspace;
|
|
1171
|
-
case
|
|
1172
|
-
return
|
|
1173
|
-
case Escape$1:
|
|
1174
|
-
return Escape;
|
|
1175
|
-
case Enter$1:
|
|
1176
|
-
return Enter;
|
|
1177
|
-
case Space$1:
|
|
1178
|
-
return Space;
|
|
1179
|
-
case PageUp$1:
|
|
1180
|
-
return PageUp;
|
|
1181
|
-
case PageDown$1:
|
|
1182
|
-
return PageDown;
|
|
1183
|
-
case End$1:
|
|
1184
|
-
return End;
|
|
1185
|
-
case Home$1:
|
|
1186
|
-
return Home;
|
|
1187
|
-
case LeftArrow$1:
|
|
1188
|
-
return LeftArrow;
|
|
1189
|
-
case UpArrow$1:
|
|
1190
|
-
return UpArrow;
|
|
1191
|
-
case RightArrow$1:
|
|
1192
|
-
return RightArrow;
|
|
1193
|
-
case DownArrow$1:
|
|
1194
|
-
return DownArrow;
|
|
1195
|
-
case Insert$1:
|
|
1196
|
-
return Insert;
|
|
1224
|
+
case Comma$1:
|
|
1225
|
+
return Comma;
|
|
1197
1226
|
case Delete$1:
|
|
1198
1227
|
return Delete;
|
|
1199
1228
|
case Digit0$1:
|
|
@@ -1216,6 +1245,32 @@ const getKeyCodeString = keyCode => {
|
|
|
1216
1245
|
return Digit8;
|
|
1217
1246
|
case Digit9$1:
|
|
1218
1247
|
return Digit9;
|
|
1248
|
+
case DownArrow$1:
|
|
1249
|
+
return DownArrow;
|
|
1250
|
+
case End$1:
|
|
1251
|
+
return End;
|
|
1252
|
+
case Enter$1:
|
|
1253
|
+
return Enter;
|
|
1254
|
+
case Equal$1:
|
|
1255
|
+
return Equal;
|
|
1256
|
+
case Escape$1:
|
|
1257
|
+
return Escape;
|
|
1258
|
+
case F1$1:
|
|
1259
|
+
return F1;
|
|
1260
|
+
case F2$1:
|
|
1261
|
+
return F2;
|
|
1262
|
+
case F3$1:
|
|
1263
|
+
return F3;
|
|
1264
|
+
case F4$1:
|
|
1265
|
+
return F4;
|
|
1266
|
+
case F5$1:
|
|
1267
|
+
return F5;
|
|
1268
|
+
case F6$1:
|
|
1269
|
+
return F6;
|
|
1270
|
+
case Home$1:
|
|
1271
|
+
return Home;
|
|
1272
|
+
case Insert$1:
|
|
1273
|
+
return Insert;
|
|
1219
1274
|
case KeyA$1:
|
|
1220
1275
|
return KeyA;
|
|
1221
1276
|
case KeyB$1:
|
|
@@ -1268,481 +1323,102 @@ const getKeyCodeString = keyCode => {
|
|
|
1268
1323
|
return KeyY;
|
|
1269
1324
|
case KeyZ$1:
|
|
1270
1325
|
return KeyZ;
|
|
1271
|
-
case
|
|
1272
|
-
return
|
|
1273
|
-
case
|
|
1274
|
-
return
|
|
1275
|
-
case
|
|
1276
|
-
return
|
|
1277
|
-
case
|
|
1278
|
-
return
|
|
1279
|
-
case F5$1:
|
|
1280
|
-
return F5;
|
|
1281
|
-
case F6$1:
|
|
1282
|
-
return F6;
|
|
1283
|
-
case Backslash$1:
|
|
1284
|
-
return Backslash;
|
|
1285
|
-
case Equal$1:
|
|
1286
|
-
return Equal;
|
|
1287
|
-
case Comma$1:
|
|
1288
|
-
return Comma;
|
|
1289
|
-
case Backquote$1:
|
|
1290
|
-
return Backquote;
|
|
1326
|
+
case LeftArrow$1:
|
|
1327
|
+
return LeftArrow;
|
|
1328
|
+
case Minus$1:
|
|
1329
|
+
return Minus;
|
|
1330
|
+
case PageDown$1:
|
|
1331
|
+
return PageDown;
|
|
1332
|
+
case PageUp$1:
|
|
1333
|
+
return PageUp;
|
|
1291
1334
|
case Plus$1:
|
|
1292
1335
|
return Plus;
|
|
1336
|
+
case RightArrow$1:
|
|
1337
|
+
return RightArrow;
|
|
1338
|
+
case Space$1:
|
|
1339
|
+
return Space;
|
|
1293
1340
|
case Star$1:
|
|
1294
1341
|
return Star;
|
|
1295
|
-
case
|
|
1296
|
-
return
|
|
1342
|
+
case Tab$1:
|
|
1343
|
+
return Tab;
|
|
1344
|
+
case UpArrow$1:
|
|
1345
|
+
return UpArrow;
|
|
1297
1346
|
default:
|
|
1298
1347
|
return Unknown;
|
|
1299
1348
|
}
|
|
1300
1349
|
};
|
|
1301
1350
|
|
|
1302
|
-
const
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
const
|
|
1306
|
-
|
|
1307
|
-
const
|
|
1308
|
-
const
|
|
1309
|
-
const
|
|
1310
|
-
const Disabled$1 = 5;
|
|
1311
|
-
const RestoreFocus$1 = 6;
|
|
1312
|
-
const Ignore$1 = 7;
|
|
1313
|
-
|
|
1314
|
-
const parseKey = rawKey => {
|
|
1315
|
-
const isCtrl = Boolean(rawKey & CtrlCmd);
|
|
1316
|
-
const isShift = Boolean(rawKey & Shift);
|
|
1317
|
-
const keyCode = rawKey & 0x00_00_00_ff;
|
|
1318
|
-
const key = getKeyCodeString(keyCode);
|
|
1319
|
-
return {
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
};
|
|
1324
|
-
};
|
|
1325
|
-
|
|
1326
|
-
const DebugWorker = 55;
|
|
1327
|
-
const RendererProcess = 1670;
|
|
1328
|
-
const RendererWorker$1 = 1;
|
|
1329
|
-
|
|
1330
|
-
const FocusSelector = 'Viewlet.focusSelector';
|
|
1331
|
-
|
|
1332
|
-
const rpcs = Object.create(null);
|
|
1333
|
-
const set$4 = (id, rpc) => {
|
|
1334
|
-
rpcs[id] = rpc;
|
|
1335
|
-
};
|
|
1336
|
-
const get$2 = id => {
|
|
1337
|
-
return rpcs[id];
|
|
1338
|
-
};
|
|
1339
|
-
|
|
1340
|
-
const create$1 = rpcId => {
|
|
1341
|
-
return {
|
|
1342
|
-
// @ts-ignore
|
|
1343
|
-
invoke(method, ...params) {
|
|
1344
|
-
const rpc = get$2(rpcId);
|
|
1345
|
-
// @ts-ignore
|
|
1346
|
-
return rpc.invoke(method, ...params);
|
|
1347
|
-
},
|
|
1348
|
-
// @ts-ignore
|
|
1349
|
-
invokeAndTransfer(method, ...params) {
|
|
1350
|
-
const rpc = get$2(rpcId);
|
|
1351
|
-
// @ts-ignore
|
|
1352
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1353
|
-
},
|
|
1354
|
-
set(rpc) {
|
|
1355
|
-
set$4(rpcId, rpc);
|
|
1356
|
-
},
|
|
1357
|
-
async dispose() {
|
|
1358
|
-
const rpc = get$2(rpcId);
|
|
1359
|
-
await rpc.dispose();
|
|
1360
|
-
}
|
|
1361
|
-
};
|
|
1362
|
-
};
|
|
1363
|
-
|
|
1364
|
-
const {
|
|
1365
|
-
invoke: invoke$3,
|
|
1366
|
-
set: set$3} = create$1(RendererProcess);
|
|
1367
|
-
|
|
1368
|
-
const {
|
|
1369
|
-
invoke: invoke$2,
|
|
1370
|
-
invokeAndTransfer,
|
|
1371
|
-
set: set$2,
|
|
1372
|
-
dispose
|
|
1373
|
-
} = create$1(RendererWorker$1);
|
|
1374
|
-
const searchFileHtml = async uri => {
|
|
1375
|
-
return invoke$2('ExtensionHost.searchFileWithHtml', uri);
|
|
1376
|
-
};
|
|
1377
|
-
const getFilePathElectron = async file => {
|
|
1378
|
-
return invoke$2('FileSystemHandle.getFilePathElectron', file);
|
|
1379
|
-
};
|
|
1380
|
-
const showContextMenu = async (x, y, id, ...args) => {
|
|
1381
|
-
return invoke$2('ContextMenu.show', x, y, id, ...args);
|
|
1382
|
-
};
|
|
1383
|
-
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1384
|
-
number(uid);
|
|
1385
|
-
number(menuId);
|
|
1386
|
-
number(x);
|
|
1387
|
-
number(y);
|
|
1388
|
-
// @ts-ignore
|
|
1389
|
-
await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1390
|
-
};
|
|
1391
|
-
const getElectronVersion = async () => {
|
|
1392
|
-
return invoke$2('Process.getElectronVersion');
|
|
1393
|
-
};
|
|
1394
|
-
const applyBulkReplacement = async bulkEdits => {
|
|
1395
|
-
await invoke$2('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1396
|
-
};
|
|
1397
|
-
const setColorTheme = async id => {
|
|
1398
|
-
// @ts-ignore
|
|
1399
|
-
return invoke$2(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1400
|
-
};
|
|
1401
|
-
const getNodeVersion = async () => {
|
|
1402
|
-
return invoke$2('Process.getNodeVersion');
|
|
1403
|
-
};
|
|
1404
|
-
const getChromeVersion = async () => {
|
|
1405
|
-
return invoke$2('Process.getChromeVersion');
|
|
1406
|
-
};
|
|
1407
|
-
const getV8Version = async () => {
|
|
1408
|
-
return invoke$2('Process.getV8Version');
|
|
1409
|
-
};
|
|
1410
|
-
const getFileHandles = async fileIds => {
|
|
1411
|
-
const files = await invoke$2('FileSystemHandle.getFileHandles', fileIds);
|
|
1412
|
-
return files;
|
|
1413
|
-
};
|
|
1414
|
-
const setWorkspacePath = async path => {
|
|
1415
|
-
await invoke$2('Workspace.setPath', path);
|
|
1416
|
-
};
|
|
1417
|
-
const registerWebViewInterceptor = async (id, port) => {
|
|
1418
|
-
await invokeAndTransfer('WebView.registerInterceptor', id, port);
|
|
1419
|
-
};
|
|
1420
|
-
const unregisterWebViewInterceptor = async id => {
|
|
1421
|
-
await invoke$2('WebView.unregisterInterceptor', id);
|
|
1422
|
-
};
|
|
1423
|
-
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1424
|
-
const command = 'HandleMessagePort.handleMessagePort';
|
|
1425
|
-
// @ts-ignore
|
|
1426
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1427
|
-
};
|
|
1428
|
-
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1429
|
-
const command = 'Errors.handleMessagePort';
|
|
1430
|
-
// @ts-ignore
|
|
1431
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1432
|
-
};
|
|
1433
|
-
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
1434
|
-
const command = 'Markdown.handleMessagePort';
|
|
1435
|
-
// @ts-ignore
|
|
1436
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1437
|
-
};
|
|
1438
|
-
const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
1439
|
-
const command = 'IconTheme.handleMessagePort';
|
|
1440
|
-
// @ts-ignore
|
|
1441
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1442
|
-
};
|
|
1443
|
-
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1444
|
-
const command = 'FileSystem.handleMessagePort';
|
|
1445
|
-
// @ts-ignore
|
|
1446
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1447
|
-
};
|
|
1448
|
-
const readFile = async uri => {
|
|
1449
|
-
return invoke$2('FileSystem.readFile', uri);
|
|
1450
|
-
};
|
|
1451
|
-
const getWebViewSecret = async key => {
|
|
1452
|
-
// @ts-ignore
|
|
1453
|
-
return invoke$2('WebView.getSecret', key);
|
|
1454
|
-
};
|
|
1455
|
-
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1456
|
-
return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
|
|
1457
|
-
};
|
|
1458
|
-
const setFocus = key => {
|
|
1459
|
-
return invoke$2('Focus.setFocus', key);
|
|
1460
|
-
};
|
|
1461
|
-
const getFileIcon = async options => {
|
|
1462
|
-
return invoke$2('IconTheme.getFileIcon', options);
|
|
1463
|
-
};
|
|
1464
|
-
const getColorThemeNames = async () => {
|
|
1465
|
-
return invoke$2('ColorTheme.getColorThemeNames');
|
|
1466
|
-
};
|
|
1467
|
-
const disableExtension = async id => {
|
|
1468
|
-
// @ts-ignore
|
|
1469
|
-
return invoke$2('ExtensionManagement.disable', id);
|
|
1470
|
-
};
|
|
1471
|
-
const enableExtension = async id => {
|
|
1472
|
-
// @ts-ignore
|
|
1473
|
-
return invoke$2('ExtensionManagement.enable', id);
|
|
1474
|
-
};
|
|
1475
|
-
const handleDebugChange = async params => {
|
|
1476
|
-
// @ts-ignore
|
|
1477
|
-
return invoke$2('Run And Debug.handleChange', params);
|
|
1478
|
-
};
|
|
1479
|
-
const getFolderIcon = async options => {
|
|
1480
|
-
return invoke$2('IconTheme.getFolderIcon', options);
|
|
1481
|
-
};
|
|
1482
|
-
const closeWidget = async widgetId => {
|
|
1483
|
-
return invoke$2('Viewlet.closeWidget', widgetId);
|
|
1484
|
-
};
|
|
1485
|
-
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
1486
|
-
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1487
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1488
|
-
};
|
|
1489
|
-
const sendMessagePortToSearchProcess = async port => {
|
|
1490
|
-
await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1491
|
-
};
|
|
1492
|
-
const confirm = async (message, options) => {
|
|
1493
|
-
// @ts-ignore
|
|
1494
|
-
const result = await invoke$2('ConfirmPrompt.prompt', message, options);
|
|
1495
|
-
return result;
|
|
1496
|
-
};
|
|
1497
|
-
const getRecentlyOpened$1 = async () => {
|
|
1498
|
-
return invoke$2(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1499
|
-
};
|
|
1500
|
-
const getKeyBindings$1 = async () => {
|
|
1501
|
-
return invoke$2('KeyBindingsInitial.getKeyBindings');
|
|
1502
|
-
};
|
|
1503
|
-
const writeClipBoardText = async text => {
|
|
1504
|
-
await invoke$2('ClipBoard.writeText', /* text */text);
|
|
1505
|
-
};
|
|
1506
|
-
const readClipBoardText = async () => {
|
|
1507
|
-
return invoke$2('ClipBoard.readText');
|
|
1508
|
-
};
|
|
1509
|
-
const writeClipBoardImage = async blob => {
|
|
1510
|
-
// @ts-ignore
|
|
1511
|
-
await invoke$2('ClipBoard.writeImage', /* text */blob);
|
|
1512
|
-
};
|
|
1513
|
-
const searchFileMemory = async uri => {
|
|
1514
|
-
// @ts-ignore
|
|
1515
|
-
return invoke$2('ExtensionHost.searchFileWithMemory', uri);
|
|
1516
|
-
};
|
|
1517
|
-
const searchFileFetch = async uri => {
|
|
1518
|
-
return invoke$2('ExtensionHost.searchFileWithFetch', uri);
|
|
1519
|
-
};
|
|
1520
|
-
const showMessageBox = async options => {
|
|
1521
|
-
return invoke$2('ElectronDialog.showMessageBox', options);
|
|
1522
|
-
};
|
|
1523
|
-
const handleDebugResumed = async params => {
|
|
1524
|
-
await invoke$2('Run And Debug.handleResumed', params);
|
|
1525
|
-
};
|
|
1526
|
-
const openWidget = async name => {
|
|
1527
|
-
await invoke$2('Viewlet.openWidget', name);
|
|
1528
|
-
};
|
|
1529
|
-
const getIcons = async requests => {
|
|
1530
|
-
const icons = await invoke$2('IconTheme.getIcons', requests);
|
|
1531
|
-
return icons;
|
|
1532
|
-
};
|
|
1533
|
-
const activateByEvent = event => {
|
|
1534
|
-
return invoke$2('ExtensionHostManagement.activateByEvent', event);
|
|
1535
|
-
};
|
|
1536
|
-
const setAdditionalFocus = focusKey => {
|
|
1537
|
-
// @ts-ignore
|
|
1538
|
-
return invoke$2('Focus.setAdditionalFocus', focusKey);
|
|
1539
|
-
};
|
|
1540
|
-
const getActiveEditorId = () => {
|
|
1541
|
-
// @ts-ignore
|
|
1542
|
-
return invoke$2('GetActiveEditor.getActiveEditorId');
|
|
1543
|
-
};
|
|
1544
|
-
const getWorkspacePath = () => {
|
|
1545
|
-
return invoke$2('Workspace.getPath');
|
|
1546
|
-
};
|
|
1547
|
-
const sendMessagePortToRendererProcess = async port => {
|
|
1548
|
-
const command = 'HandleMessagePort.handleMessagePort';
|
|
1549
|
-
// @ts-ignore
|
|
1550
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
1551
|
-
};
|
|
1552
|
-
const sendMessagePortToTextMeasurementWorker = async port => {
|
|
1553
|
-
const command = 'TextMeasurement.handleMessagePort';
|
|
1554
|
-
// @ts-ignore
|
|
1555
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
|
|
1556
|
-
};
|
|
1557
|
-
const sendMessagePortToSourceControlWorker = async port => {
|
|
1558
|
-
const command = 'SourceControl.handleMessagePort';
|
|
1559
|
-
// @ts-ignore
|
|
1560
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSourceControlWorker', port, command, 0);
|
|
1561
|
-
};
|
|
1562
|
-
const getPreference = async key => {
|
|
1563
|
-
return await invoke$2('Preferences.get', key);
|
|
1564
|
-
};
|
|
1565
|
-
const getAllExtensions = async () => {
|
|
1566
|
-
return invoke$2('ExtensionManagement.getAllExtensions');
|
|
1567
|
-
};
|
|
1568
|
-
const rerenderEditor = async key => {
|
|
1569
|
-
// @ts-ignore
|
|
1570
|
-
return invoke$2('Editor.rerender', key);
|
|
1571
|
-
};
|
|
1572
|
-
const handleDebugPaused = async params => {
|
|
1573
|
-
await invoke$2('Run And Debug.handlePaused', params);
|
|
1574
|
-
};
|
|
1575
|
-
const openUri = async (uri, focus, options) => {
|
|
1576
|
-
await invoke$2('Main.openUri', uri, focus, options);
|
|
1577
|
-
};
|
|
1578
|
-
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
1579
|
-
await invokeAndTransfer(
|
|
1580
|
-
// @ts-ignore
|
|
1581
|
-
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1582
|
-
};
|
|
1583
|
-
const handleDebugScriptParsed = async script => {
|
|
1584
|
-
await invoke$2('Run And Debug.handleScriptParsed', script);
|
|
1585
|
-
};
|
|
1586
|
-
const getWindowId = async () => {
|
|
1587
|
-
return invoke$2('GetWindowId.getWindowId');
|
|
1588
|
-
};
|
|
1589
|
-
const getBlob = async uri => {
|
|
1590
|
-
// @ts-ignore
|
|
1591
|
-
return invoke$2('FileSystem.getBlob', uri);
|
|
1592
|
-
};
|
|
1593
|
-
const getExtensionCommands = async () => {
|
|
1594
|
-
return invoke$2('ExtensionHost.getCommands');
|
|
1595
|
-
};
|
|
1596
|
-
const showErrorDialog = async errorInfo => {
|
|
1597
|
-
// @ts-ignore
|
|
1598
|
-
await invoke$2('ErrorHandling.showErrorDialog', errorInfo);
|
|
1599
|
-
};
|
|
1600
|
-
const getFolderSize = async uri => {
|
|
1601
|
-
// @ts-ignore
|
|
1602
|
-
return await invoke$2('FileSystem.getFolderSize', uri);
|
|
1603
|
-
};
|
|
1604
|
-
const getExtension = async id => {
|
|
1605
|
-
// @ts-ignore
|
|
1606
|
-
return invoke$2('ExtensionManagement.getExtension', id);
|
|
1607
|
-
};
|
|
1608
|
-
const getMarkdownDom = async html => {
|
|
1609
|
-
// @ts-ignore
|
|
1610
|
-
return invoke$2('Markdown.getVirtualDom', html);
|
|
1611
|
-
};
|
|
1612
|
-
const renderMarkdown = async (markdown, options) => {
|
|
1613
|
-
// @ts-ignore
|
|
1614
|
-
return invoke$2('Markdown.renderMarkdown', markdown, options);
|
|
1615
|
-
};
|
|
1616
|
-
const openNativeFolder = async uri => {
|
|
1617
|
-
// @ts-ignore
|
|
1618
|
-
await invoke$2('OpenNativeFolder.openNativeFolder', uri);
|
|
1619
|
-
};
|
|
1620
|
-
const uninstallExtension = async id => {
|
|
1621
|
-
return invoke$2('ExtensionManagement.uninstall', id);
|
|
1622
|
-
};
|
|
1623
|
-
const installExtension = async id => {
|
|
1624
|
-
// @ts-ignore
|
|
1625
|
-
return invoke$2('ExtensionManagement.install', id);
|
|
1626
|
-
};
|
|
1627
|
-
const openExtensionSearch = async () => {
|
|
1628
|
-
// @ts-ignore
|
|
1629
|
-
return invoke$2('SideBar.openViewlet', 'Extensions');
|
|
1630
|
-
};
|
|
1631
|
-
const setExtensionsSearchValue = async searchValue => {
|
|
1632
|
-
// @ts-ignore
|
|
1633
|
-
return invoke$2('Extensions.handleInput', searchValue, Script);
|
|
1634
|
-
};
|
|
1635
|
-
const openExternal = async uri => {
|
|
1636
|
-
// @ts-ignore
|
|
1637
|
-
await invoke$2('Open.openExternal', uri);
|
|
1638
|
-
};
|
|
1639
|
-
const openUrl = async uri => {
|
|
1640
|
-
// @ts-ignore
|
|
1641
|
-
await invoke$2('Open.openUrl', uri);
|
|
1642
|
-
};
|
|
1643
|
-
const getAllPreferences = async () => {
|
|
1644
|
-
// @ts-ignore
|
|
1645
|
-
return invoke$2('Preferences.getAll');
|
|
1646
|
-
};
|
|
1647
|
-
const showSaveFilePicker = async () => {
|
|
1648
|
-
// @ts-ignore
|
|
1649
|
-
return invoke$2('FilePicker.showSaveFilePicker');
|
|
1650
|
-
};
|
|
1651
|
-
const getLogsDir = async () => {
|
|
1652
|
-
// @ts-ignore
|
|
1653
|
-
return invoke$2('PlatformPaths.getLogsDir');
|
|
1351
|
+
const CtrlCmd = 1 << 11 >>> 0;
|
|
1352
|
+
const Shift = 1 << 10 >>> 0;
|
|
1353
|
+
|
|
1354
|
+
const Separator$2 = 1;
|
|
1355
|
+
const None$1 = 0;
|
|
1356
|
+
const SubMenu$1 = 4;
|
|
1357
|
+
const Checked$1 = 2;
|
|
1358
|
+
const Unchecked$1 = 3;
|
|
1359
|
+
const Disabled$1 = 5;
|
|
1360
|
+
const RestoreFocus$1 = 6;
|
|
1361
|
+
const Ignore$1 = 7;
|
|
1362
|
+
|
|
1363
|
+
const parseKey = rawKey => {
|
|
1364
|
+
const isCtrl = Boolean(rawKey & CtrlCmd);
|
|
1365
|
+
const isShift = Boolean(rawKey & Shift);
|
|
1366
|
+
const keyCode = rawKey & 0x00_00_00_ff;
|
|
1367
|
+
const key = getKeyCodeString(keyCode);
|
|
1368
|
+
return {
|
|
1369
|
+
isCtrl,
|
|
1370
|
+
isShift,
|
|
1371
|
+
key
|
|
1372
|
+
};
|
|
1654
1373
|
};
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1374
|
+
|
|
1375
|
+
const DebugWorker = 55;
|
|
1376
|
+
const RendererProcess = 1670;
|
|
1377
|
+
const RendererWorker$1 = 1;
|
|
1378
|
+
|
|
1379
|
+
const FocusSelector = 'Viewlet.focusSelector';
|
|
1380
|
+
|
|
1381
|
+
const {
|
|
1382
|
+
invoke: invoke$3,
|
|
1383
|
+
set: set$3
|
|
1384
|
+
} = create$1(RendererProcess);
|
|
1385
|
+
|
|
1386
|
+
const {
|
|
1387
|
+
invoke: invoke$2,
|
|
1388
|
+
invokeAndTransfer,
|
|
1389
|
+
set: set$2
|
|
1390
|
+
} = create$1(RendererWorker$1);
|
|
1391
|
+
const sendMessagePortToRendererProcess = async port => {
|
|
1392
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1393
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
1661
1394
|
};
|
|
1662
1395
|
|
|
1663
1396
|
const RendererWorker = {
|
|
1664
1397
|
__proto__: null,
|
|
1665
|
-
activateByEvent,
|
|
1666
|
-
applyBulkReplacement,
|
|
1667
|
-
closeWidget,
|
|
1668
|
-
confirm,
|
|
1669
|
-
disableExtension,
|
|
1670
|
-
dispose,
|
|
1671
|
-
enableExtension,
|
|
1672
|
-
getActiveEditorId,
|
|
1673
|
-
getAllExtensions,
|
|
1674
|
-
getAllPreferences,
|
|
1675
|
-
getBlob,
|
|
1676
|
-
getChromeVersion,
|
|
1677
|
-
getColorThemeNames,
|
|
1678
|
-
getElectronVersion,
|
|
1679
|
-
getExtension,
|
|
1680
|
-
getExtensionCommands,
|
|
1681
|
-
getFileHandles,
|
|
1682
|
-
getFileIcon,
|
|
1683
|
-
getFilePathElectron,
|
|
1684
|
-
getFolderIcon,
|
|
1685
|
-
getFolderSize,
|
|
1686
|
-
getIcons,
|
|
1687
|
-
getKeyBindings: getKeyBindings$1,
|
|
1688
|
-
getLogsDir,
|
|
1689
|
-
getMarkdownDom,
|
|
1690
|
-
getNodeVersion,
|
|
1691
|
-
getPreference,
|
|
1692
|
-
getRecentlyOpened: getRecentlyOpened$1,
|
|
1693
|
-
getV8Version,
|
|
1694
|
-
getWebViewSecret,
|
|
1695
|
-
getWindowId,
|
|
1696
|
-
getWorkspacePath,
|
|
1697
|
-
handleDebugChange,
|
|
1698
|
-
handleDebugPaused,
|
|
1699
|
-
handleDebugResumed,
|
|
1700
|
-
handleDebugScriptParsed,
|
|
1701
|
-
installExtension,
|
|
1702
1398
|
invoke: invoke$2,
|
|
1703
1399
|
invokeAndTransfer,
|
|
1704
|
-
openExtensionSearch,
|
|
1705
|
-
openExternal,
|
|
1706
|
-
openNativeFolder,
|
|
1707
|
-
openUri,
|
|
1708
|
-
openUrl,
|
|
1709
|
-
openWidget,
|
|
1710
|
-
readClipBoardText,
|
|
1711
|
-
readFile,
|
|
1712
|
-
registerMockRpc,
|
|
1713
|
-
registerWebViewInterceptor,
|
|
1714
|
-
renderMarkdown,
|
|
1715
|
-
rerenderEditor,
|
|
1716
|
-
searchFileFetch,
|
|
1717
|
-
searchFileHtml,
|
|
1718
|
-
searchFileMemory,
|
|
1719
|
-
sendMessagePortToEditorWorker,
|
|
1720
|
-
sendMessagePortToErrorWorker,
|
|
1721
|
-
sendMessagePortToExtensionHostWorker,
|
|
1722
|
-
sendMessagePortToFileSystemWorker,
|
|
1723
|
-
sendMessagePortToIconThemeWorker,
|
|
1724
|
-
sendMessagePortToMarkdownWorker,
|
|
1725
1400
|
sendMessagePortToRendererProcess,
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1401
|
+
set: set$2
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1404
|
+
const send = port => {
|
|
1405
|
+
return sendMessagePortToRendererProcess(port);
|
|
1406
|
+
};
|
|
1407
|
+
const createRendererProcessRpc = async () => {
|
|
1408
|
+
try {
|
|
1409
|
+
const rpc = await create$3({
|
|
1410
|
+
commandMap: {},
|
|
1411
|
+
send
|
|
1412
|
+
});
|
|
1413
|
+
return rpc;
|
|
1414
|
+
} catch (error) {
|
|
1415
|
+
throw new VError(error, `Failed to create renderer process rpc`);
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1419
|
+
const initializeRendererProcess = async () => {
|
|
1420
|
+
const rpc = await createRendererProcessRpc();
|
|
1421
|
+
set$3(rpc);
|
|
1746
1422
|
};
|
|
1747
1423
|
|
|
1748
1424
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
@@ -1755,8 +1431,9 @@ const RendererWorker = {
|
|
|
1755
1431
|
// TODO this code seems a bit too complicated, maybe it can be simplified
|
|
1756
1432
|
|
|
1757
1433
|
const state$1 = {
|
|
1758
|
-
|
|
1759
|
-
|
|
1434
|
+
latestTimeStamp: 0,
|
|
1435
|
+
menus: []
|
|
1436
|
+
};
|
|
1760
1437
|
const addMenuInternal = menu => {
|
|
1761
1438
|
if (state$1.menus.length > 5) {
|
|
1762
1439
|
throw new Error('too many menus');
|
|
@@ -1854,10 +1531,10 @@ const getMenuBounds = (x, y, items) => {
|
|
|
1854
1531
|
y = Math.max(y, 0);
|
|
1855
1532
|
}
|
|
1856
1533
|
return {
|
|
1857
|
-
|
|
1858
|
-
y,
|
|
1534
|
+
height: menuHeight,
|
|
1859
1535
|
width: menuWidth,
|
|
1860
|
-
|
|
1536
|
+
x,
|
|
1537
|
+
y
|
|
1861
1538
|
};
|
|
1862
1539
|
};
|
|
1863
1540
|
|
|
@@ -1931,7 +1608,8 @@ const UiStrings$2 = {
|
|
|
1931
1608
|
SelectAll: 'Select All',
|
|
1932
1609
|
ToggleBlockComment: 'Toggle Block Comment',
|
|
1933
1610
|
ToggleLineComment: 'Toggle Line Comment',
|
|
1934
|
-
Undo: 'Undo'
|
|
1611
|
+
Undo: 'Undo'
|
|
1612
|
+
};
|
|
1935
1613
|
const cut = () => {
|
|
1936
1614
|
return i18nString(UiStrings$2.Cut);
|
|
1937
1615
|
};
|
|
@@ -1981,49 +1659,49 @@ const TitleBar = 15;
|
|
|
1981
1659
|
const View$1 = 16;
|
|
1982
1660
|
|
|
1983
1661
|
const menuEntrySeparator = {
|
|
1984
|
-
|
|
1985
|
-
label: '',
|
|
1662
|
+
command: '',
|
|
1986
1663
|
flags: Separator$2,
|
|
1987
|
-
|
|
1664
|
+
id: 'separator',
|
|
1665
|
+
label: ''
|
|
1988
1666
|
};
|
|
1989
1667
|
|
|
1990
1668
|
const id$9 = Edit$1;
|
|
1991
1669
|
const getMenuEntries$d = () => {
|
|
1992
1670
|
return [{
|
|
1993
|
-
|
|
1994
|
-
label: undo(),
|
|
1671
|
+
command: /* TODO */'-1',
|
|
1995
1672
|
flags: Disabled,
|
|
1996
|
-
|
|
1673
|
+
id: 'undo',
|
|
1674
|
+
label: undo()
|
|
1997
1675
|
}, {
|
|
1998
|
-
|
|
1999
|
-
label: redo(),
|
|
1676
|
+
command: /* TODO */'-1',
|
|
2000
1677
|
flags: Disabled,
|
|
2001
|
-
|
|
1678
|
+
id: 'redo',
|
|
1679
|
+
label: redo()
|
|
2002
1680
|
}, menuEntrySeparator, {
|
|
2003
|
-
|
|
2004
|
-
label: cut(),
|
|
1681
|
+
command: /* Editor.cut */'Editor.cut',
|
|
2005
1682
|
flags: None,
|
|
2006
|
-
|
|
1683
|
+
id: 'cut',
|
|
1684
|
+
label: cut()
|
|
2007
1685
|
}, {
|
|
2008
|
-
|
|
2009
|
-
label: copy(),
|
|
1686
|
+
command: /* Editor.copy */'Editor.copy',
|
|
2010
1687
|
flags: None,
|
|
2011
|
-
|
|
1688
|
+
id: 'copy',
|
|
1689
|
+
label: copy()
|
|
2012
1690
|
}, {
|
|
2013
|
-
|
|
2014
|
-
label: paste(),
|
|
1691
|
+
command: /* Editor.paste */'Editor.paste',
|
|
2015
1692
|
flags: None,
|
|
2016
|
-
|
|
1693
|
+
id: 'paste',
|
|
1694
|
+
label: paste()
|
|
2017
1695
|
}, menuEntrySeparator, {
|
|
2018
|
-
|
|
2019
|
-
label: toggleLineComment(),
|
|
1696
|
+
command: /* Editor.toggleLineComment */'Editor.toggleLineComment',
|
|
2020
1697
|
flags: None,
|
|
2021
|
-
|
|
1698
|
+
id: 'toggle-line-comment',
|
|
1699
|
+
label: toggleLineComment()
|
|
2022
1700
|
}, {
|
|
2023
|
-
|
|
2024
|
-
label: toggleBlockComment(),
|
|
1701
|
+
command: /* Editor.toggleBlockComment */'Editor.toggleBlockComment',
|
|
2025
1702
|
flags: None,
|
|
2026
|
-
|
|
1703
|
+
id: 'toggle-block-comment',
|
|
1704
|
+
label: toggleBlockComment()
|
|
2027
1705
|
}];
|
|
2028
1706
|
};
|
|
2029
1707
|
|
|
@@ -2037,15 +1715,14 @@ const MenuEntriesEdit = {
|
|
|
2037
1715
|
* @enum {string}
|
|
2038
1716
|
*/
|
|
2039
1717
|
const UiStrings$1 = {
|
|
1718
|
+
Exit: 'Exit',
|
|
2040
1719
|
NewFile: 'New File',
|
|
2041
1720
|
NewWindow: 'New Window',
|
|
2042
1721
|
OpenFile: 'Open File',
|
|
2043
1722
|
OpenFolder: 'Open Folder',
|
|
2044
1723
|
OpenRecent: 'Open Recent',
|
|
2045
|
-
Exit: 'Exit',
|
|
2046
1724
|
Save: 'Save',
|
|
2047
|
-
SaveAll: 'Save All'
|
|
2048
|
-
};
|
|
1725
|
+
SaveAll: 'Save All'};
|
|
2049
1726
|
const newFile = () => {
|
|
2050
1727
|
return i18nString(UiStrings$1.NewFile);
|
|
2051
1728
|
};
|
|
@@ -2077,47 +1754,47 @@ const Electron = 2;
|
|
|
2077
1754
|
const id$8 = File$2;
|
|
2078
1755
|
const getMenuEntries$c = platform => {
|
|
2079
1756
|
const entries = [{
|
|
2080
|
-
|
|
2081
|
-
label: newFile(),
|
|
1757
|
+
command: '-1',
|
|
2082
1758
|
flags: None,
|
|
2083
|
-
|
|
1759
|
+
id: 'newFile',
|
|
1760
|
+
label: newFile()
|
|
2084
1761
|
}, {
|
|
2085
|
-
|
|
2086
|
-
label: newWindow(),
|
|
1762
|
+
command: /* Window.openNew */'Window.openNew',
|
|
2087
1763
|
flags: None,
|
|
2088
|
-
|
|
1764
|
+
id: 'newWindow',
|
|
1765
|
+
label: newWindow()
|
|
2089
1766
|
}, menuEntrySeparator, {
|
|
2090
|
-
|
|
2091
|
-
label: openFile(),
|
|
1767
|
+
command: 'Dialog.openFile',
|
|
2092
1768
|
flags: None,
|
|
2093
|
-
|
|
1769
|
+
id: 'openFile',
|
|
1770
|
+
label: openFile()
|
|
2094
1771
|
}, {
|
|
2095
|
-
|
|
2096
|
-
label: openFolder(),
|
|
1772
|
+
command: 'Dialog.openFolder',
|
|
2097
1773
|
flags: RestoreFocus,
|
|
2098
|
-
|
|
1774
|
+
id: 'openFolder',
|
|
1775
|
+
label: openFolder()
|
|
2099
1776
|
}, {
|
|
2100
|
-
|
|
2101
|
-
label: openRecent(),
|
|
1777
|
+
command: '',
|
|
2102
1778
|
flags: SubMenu,
|
|
2103
|
-
|
|
1779
|
+
id: OpenRecent,
|
|
1780
|
+
label: openRecent()
|
|
2104
1781
|
}, menuEntrySeparator, {
|
|
2105
|
-
|
|
2106
|
-
label: save(),
|
|
1782
|
+
command: 'Main.save',
|
|
2107
1783
|
flags: None,
|
|
2108
|
-
|
|
1784
|
+
id: 'save',
|
|
1785
|
+
label: save()
|
|
2109
1786
|
}, {
|
|
2110
|
-
|
|
2111
|
-
label: saveAll(),
|
|
1787
|
+
command: 'Main.saveAll',
|
|
2112
1788
|
flags: None,
|
|
2113
|
-
|
|
1789
|
+
id: 'saveAll',
|
|
1790
|
+
label: saveAll()
|
|
2114
1791
|
}];
|
|
2115
1792
|
if (platform === Electron) {
|
|
2116
1793
|
entries.push(menuEntrySeparator, {
|
|
2117
|
-
|
|
2118
|
-
label: exit(),
|
|
1794
|
+
command: 'Chrome.exit',
|
|
2119
1795
|
flags: Ignore,
|
|
2120
|
-
|
|
1796
|
+
id: 'exit',
|
|
1797
|
+
label: exit()
|
|
2121
1798
|
});
|
|
2122
1799
|
}
|
|
2123
1800
|
return entries;
|
|
@@ -2167,25 +1844,25 @@ const getMenuEntries$a = async platform => {
|
|
|
2167
1844
|
const entries = [];
|
|
2168
1845
|
if (platform !== Web) {
|
|
2169
1846
|
entries.push({
|
|
2170
|
-
|
|
2171
|
-
label: toggleDeveloperTools(),
|
|
1847
|
+
command: 'Developer.toggleDeveloperTools',
|
|
2172
1848
|
flags: None,
|
|
2173
|
-
|
|
1849
|
+
id: 'toggleDeveloperTools',
|
|
1850
|
+
label: toggleDeveloperTools()
|
|
2174
1851
|
}, {
|
|
2175
|
-
|
|
2176
|
-
label: openProcessExplorer(),
|
|
1852
|
+
command: 'Developer.openProcessExplorer',
|
|
2177
1853
|
flags: RestoreFocus,
|
|
2178
|
-
|
|
1854
|
+
id: 'openProcessExplorer',
|
|
1855
|
+
label: openProcessExplorer()
|
|
2179
1856
|
});
|
|
2180
1857
|
}
|
|
2181
1858
|
if (entries.length > 0) {
|
|
2182
1859
|
entries.push(menuEntrySeparator);
|
|
2183
1860
|
}
|
|
2184
1861
|
entries.push({
|
|
2185
|
-
|
|
2186
|
-
label: about(),
|
|
1862
|
+
command: 'About.showAbout',
|
|
2187
1863
|
flags: None,
|
|
2188
|
-
|
|
1864
|
+
id: 'about',
|
|
1865
|
+
label: about()
|
|
2189
1866
|
});
|
|
2190
1867
|
return entries;
|
|
2191
1868
|
};
|
|
@@ -2221,10 +1898,10 @@ const toMenuItem = folder => {
|
|
|
2221
1898
|
const homeDir = getHomeDir();
|
|
2222
1899
|
const label = getTitle(homeDir, folder);
|
|
2223
1900
|
return {
|
|
2224
|
-
|
|
2225
|
-
flags: None,
|
|
1901
|
+
args: [folder],
|
|
2226
1902
|
command: 'Workspace.setPath',
|
|
2227
|
-
|
|
1903
|
+
flags: None,
|
|
1904
|
+
label
|
|
2228
1905
|
};
|
|
2229
1906
|
};
|
|
2230
1907
|
const id$5 = OpenRecent;
|
|
@@ -2236,15 +1913,15 @@ const getMenuEntries$9 = async () => {
|
|
|
2236
1913
|
items.push(...itemsToShow.map(toMenuItem), menuEntrySeparator);
|
|
2237
1914
|
}
|
|
2238
1915
|
items.push({
|
|
2239
|
-
|
|
2240
|
-
label: '...',
|
|
1916
|
+
command: 'QuickPick.showRecent',
|
|
2241
1917
|
flags: None,
|
|
2242
|
-
|
|
1918
|
+
id: 'more',
|
|
1919
|
+
label: '...'
|
|
2243
1920
|
}, menuEntrySeparator, {
|
|
2244
|
-
|
|
2245
|
-
label: 'clear',
|
|
1921
|
+
command: 'RecentlyOpened.clearRecentlyOpened',
|
|
2246
1922
|
flags: None,
|
|
2247
|
-
|
|
1923
|
+
id: 'clearRecentlyOpened',
|
|
1924
|
+
label: 'clear'
|
|
2248
1925
|
});
|
|
2249
1926
|
return items;
|
|
2250
1927
|
};
|
|
@@ -2269,30 +1946,30 @@ const MenuEntriesRun = {
|
|
|
2269
1946
|
const id$3 = Selection$1;
|
|
2270
1947
|
const getMenuEntries$7 = () => {
|
|
2271
1948
|
return [{
|
|
2272
|
-
|
|
2273
|
-
label: selectAll(),
|
|
1949
|
+
command: 'Editor.selectAll',
|
|
2274
1950
|
flags: None,
|
|
2275
|
-
|
|
1951
|
+
id: 'selectAll',
|
|
1952
|
+
label: selectAll()
|
|
2276
1953
|
}, {
|
|
2277
|
-
|
|
2278
|
-
label: copyLineUp(),
|
|
1954
|
+
command: 'Editor.copyLineUp',
|
|
2279
1955
|
flags: None,
|
|
2280
|
-
|
|
1956
|
+
id: 'copyLineUp',
|
|
1957
|
+
label: copyLineUp()
|
|
2281
1958
|
}, {
|
|
2282
|
-
|
|
2283
|
-
label: copyLineDown(),
|
|
1959
|
+
command: 'Editor.copyLineDown',
|
|
2284
1960
|
flags: None,
|
|
2285
|
-
|
|
1961
|
+
id: 'copyLineDown',
|
|
1962
|
+
label: copyLineDown()
|
|
2286
1963
|
}, {
|
|
2287
|
-
|
|
2288
|
-
label: moveLineUp(),
|
|
1964
|
+
command: 'Editor.moveLineUp',
|
|
2289
1965
|
flags: Disabled,
|
|
2290
|
-
|
|
1966
|
+
id: 'moveLineUp',
|
|
1967
|
+
label: moveLineUp()
|
|
2291
1968
|
}, {
|
|
2292
|
-
|
|
2293
|
-
label: moveLineDown(),
|
|
1969
|
+
command: 'Editor.moveLineDown',
|
|
2294
1970
|
flags: Disabled,
|
|
2295
|
-
|
|
1971
|
+
id: 'moveLineDown',
|
|
1972
|
+
label: moveLineDown()
|
|
2296
1973
|
}];
|
|
2297
1974
|
};
|
|
2298
1975
|
|
|
@@ -2306,8 +1983,7 @@ const MenuEntriesSelection = {
|
|
|
2306
1983
|
* @enum {string}
|
|
2307
1984
|
*/
|
|
2308
1985
|
const UiStrings = {
|
|
2309
|
-
NewTerminal: 'New Terminal'
|
|
2310
|
-
};
|
|
1986
|
+
NewTerminal: 'New Terminal'};
|
|
2311
1987
|
const newTerminal = () => {
|
|
2312
1988
|
return i18nString(UiStrings.NewTerminal);
|
|
2313
1989
|
};
|
|
@@ -2315,11 +1991,11 @@ const newTerminal = () => {
|
|
|
2315
1991
|
const id$2 = Terminal$1;
|
|
2316
1992
|
const getMenuEntries$6 = () => {
|
|
2317
1993
|
return [{
|
|
2318
|
-
|
|
2319
|
-
label: newTerminal(),
|
|
2320
|
-
flags: None,
|
|
1994
|
+
args: ['Terminal'],
|
|
2321
1995
|
command: 'Layout.togglePanel',
|
|
2322
|
-
|
|
1996
|
+
flags: None,
|
|
1997
|
+
id: 'newTerminal',
|
|
1998
|
+
label: newTerminal()
|
|
2323
1999
|
}];
|
|
2324
2000
|
};
|
|
2325
2001
|
|
|
@@ -2356,68 +2032,68 @@ const help = () => {
|
|
|
2356
2032
|
|
|
2357
2033
|
const getMenuEntries$5 = () => {
|
|
2358
2034
|
return [{
|
|
2035
|
+
flags: SubMenu,
|
|
2359
2036
|
id: File$2,
|
|
2360
|
-
label: file()
|
|
2361
|
-
flags: SubMenu
|
|
2037
|
+
label: file()
|
|
2362
2038
|
}, {
|
|
2039
|
+
flags: SubMenu,
|
|
2363
2040
|
id: Edit$1,
|
|
2364
|
-
label: edit()
|
|
2365
|
-
flags: SubMenu
|
|
2041
|
+
label: edit()
|
|
2366
2042
|
}, {
|
|
2043
|
+
flags: SubMenu,
|
|
2367
2044
|
id: Selection$1,
|
|
2368
|
-
label: selection()
|
|
2369
|
-
flags: SubMenu
|
|
2045
|
+
label: selection()
|
|
2370
2046
|
}, {
|
|
2047
|
+
flags: SubMenu,
|
|
2371
2048
|
id: View$1,
|
|
2372
|
-
label: view()
|
|
2373
|
-
flags: SubMenu
|
|
2049
|
+
label: view()
|
|
2374
2050
|
}, {
|
|
2051
|
+
flags: SubMenu,
|
|
2375
2052
|
id: Go$1,
|
|
2376
|
-
label: go()
|
|
2377
|
-
flags: SubMenu
|
|
2053
|
+
label: go()
|
|
2378
2054
|
}, {
|
|
2055
|
+
flags: SubMenu,
|
|
2379
2056
|
id: Run$1,
|
|
2380
|
-
label: run(),
|
|
2381
2057
|
keyboardShortCut: 'Alt+r',
|
|
2382
|
-
|
|
2058
|
+
label: run()
|
|
2383
2059
|
}, {
|
|
2060
|
+
flags: SubMenu,
|
|
2384
2061
|
id: Terminal$1,
|
|
2385
|
-
label: terminal(),
|
|
2386
2062
|
keyboardShortCut: 'Alt+t',
|
|
2387
|
-
|
|
2063
|
+
label: terminal()
|
|
2388
2064
|
}, {
|
|
2065
|
+
flags: SubMenu,
|
|
2389
2066
|
id: Help$1,
|
|
2390
|
-
label: help(),
|
|
2391
2067
|
keyboardShortCut: 'Alt+h',
|
|
2392
|
-
|
|
2068
|
+
label: help()
|
|
2393
2069
|
}];
|
|
2394
2070
|
};
|
|
2395
2071
|
|
|
2396
2072
|
const getMenuEntries$4 = () => {
|
|
2397
2073
|
return [{
|
|
2074
|
+
flags: None,
|
|
2398
2075
|
id: File$2,
|
|
2399
|
-
label: file()
|
|
2400
|
-
flags: None
|
|
2076
|
+
label: file()
|
|
2401
2077
|
}, {
|
|
2078
|
+
flags: None,
|
|
2402
2079
|
id: Edit$1,
|
|
2403
|
-
label: edit()
|
|
2404
|
-
flags: None
|
|
2080
|
+
label: edit()
|
|
2405
2081
|
}, {
|
|
2082
|
+
flags: None,
|
|
2406
2083
|
id: Selection$1,
|
|
2407
|
-
label: selection()
|
|
2408
|
-
flags: None
|
|
2084
|
+
label: selection()
|
|
2409
2085
|
}, {
|
|
2086
|
+
flags: None,
|
|
2410
2087
|
id: View$1,
|
|
2411
|
-
label: view()
|
|
2412
|
-
flags: None
|
|
2088
|
+
label: view()
|
|
2413
2089
|
}, {
|
|
2090
|
+
flags: None,
|
|
2414
2091
|
id: Go$1,
|
|
2415
|
-
label: go()
|
|
2416
|
-
flags: None
|
|
2092
|
+
label: go()
|
|
2417
2093
|
}, {
|
|
2094
|
+
flags: None,
|
|
2418
2095
|
id: Help$1,
|
|
2419
|
-
label: help()
|
|
2420
|
-
flags: None
|
|
2096
|
+
label: help()
|
|
2421
2097
|
}];
|
|
2422
2098
|
};
|
|
2423
2099
|
|
|
@@ -2514,9 +2190,9 @@ const mergeClassNames = (...classNames) => {
|
|
|
2514
2190
|
|
|
2515
2191
|
const text = data => {
|
|
2516
2192
|
return {
|
|
2517
|
-
|
|
2193
|
+
childCount: 0,
|
|
2518
2194
|
text: data,
|
|
2519
|
-
|
|
2195
|
+
type: Text
|
|
2520
2196
|
};
|
|
2521
2197
|
};
|
|
2522
2198
|
|
|
@@ -2524,16 +2200,16 @@ const Div = 4;
|
|
|
2524
2200
|
const Span = 8;
|
|
2525
2201
|
|
|
2526
2202
|
const checkboxChecked = {
|
|
2527
|
-
|
|
2203
|
+
ariaChecked: true,
|
|
2204
|
+
childCount: 2,
|
|
2528
2205
|
className: mergeClassNames(MenuItem, MenuItemCheckMark),
|
|
2529
2206
|
role: MenuItemCheckBox,
|
|
2530
|
-
ariaChecked: true,
|
|
2531
2207
|
tabIndex: -1,
|
|
2532
|
-
|
|
2208
|
+
type: Div
|
|
2533
2209
|
};
|
|
2534
2210
|
const checkMark = {
|
|
2535
|
-
|
|
2536
|
-
|
|
2211
|
+
className: mergeClassNames(MenuItemCheckmarkIcon, MaskIconCheck),
|
|
2212
|
+
type: Div
|
|
2537
2213
|
};
|
|
2538
2214
|
const getMenuItemCheckedDom = menuItem => {
|
|
2539
2215
|
const {
|
|
@@ -2556,41 +2232,41 @@ const getKeyBindingString = (key, altKey, ctrlKey, shiftKey, metaKey) => {
|
|
|
2556
2232
|
|
|
2557
2233
|
const getMenuItemDefaultDom = menuItem => {
|
|
2558
2234
|
const {
|
|
2559
|
-
label,
|
|
2560
2235
|
isFocused,
|
|
2561
|
-
key
|
|
2236
|
+
key,
|
|
2237
|
+
label
|
|
2562
2238
|
} = menuItem;
|
|
2563
2239
|
let className = MenuItem;
|
|
2564
2240
|
if (isFocused) {
|
|
2565
2241
|
className += ' ' + MenuItemFocused;
|
|
2566
2242
|
}
|
|
2567
2243
|
const dom = [{
|
|
2568
|
-
|
|
2244
|
+
childCount: 1,
|
|
2569
2245
|
className,
|
|
2570
2246
|
role: MenuItem$1,
|
|
2571
2247
|
tabIndex: -1,
|
|
2572
|
-
|
|
2248
|
+
type: Div
|
|
2573
2249
|
}, text(label)];
|
|
2574
2250
|
if (key) {
|
|
2575
2251
|
dom[0].childCount++;
|
|
2576
2252
|
const parsedKey = parseKey(key);
|
|
2577
2253
|
const keyBindingsString = getKeyBindingString(parsedKey.key, false, parsedKey.isCtrl, parsedKey.isShift);
|
|
2578
2254
|
dom.push({
|
|
2579
|
-
|
|
2255
|
+
childCount: 1,
|
|
2580
2256
|
className: MenuItemKeyBinding,
|
|
2581
|
-
|
|
2257
|
+
type: Span
|
|
2582
2258
|
}, text(keyBindingsString));
|
|
2583
2259
|
}
|
|
2584
2260
|
return dom;
|
|
2585
2261
|
};
|
|
2586
2262
|
|
|
2587
2263
|
const disabled = {
|
|
2588
|
-
|
|
2264
|
+
childCount: 1,
|
|
2589
2265
|
className: MenuItem,
|
|
2266
|
+
disabled: true,
|
|
2590
2267
|
role: MenuItem$1,
|
|
2591
2268
|
tabIndex: -1,
|
|
2592
|
-
|
|
2593
|
-
childCount: 1
|
|
2269
|
+
type: Div
|
|
2594
2270
|
};
|
|
2595
2271
|
const getMenuItemDisabledDom = menuItem => {
|
|
2596
2272
|
const {
|
|
@@ -2600,34 +2276,37 @@ const getMenuItemDisabledDom = menuItem => {
|
|
|
2600
2276
|
};
|
|
2601
2277
|
|
|
2602
2278
|
const getMenuItemsNoopDom = () => {
|
|
2603
|
-
return [
|
|
2279
|
+
return [{
|
|
2280
|
+
childCount: 1,
|
|
2281
|
+
type: Div$1
|
|
2282
|
+
}, text(`Unsupport menu item type`)];
|
|
2604
2283
|
};
|
|
2605
2284
|
|
|
2606
2285
|
const separator = {
|
|
2607
|
-
|
|
2286
|
+
childCount: 1,
|
|
2608
2287
|
className: MenuItemSeparator,
|
|
2609
2288
|
role: Separator,
|
|
2610
|
-
|
|
2289
|
+
type: Div
|
|
2611
2290
|
};
|
|
2612
2291
|
const separatorLine = {
|
|
2613
|
-
|
|
2292
|
+
childCount: 0,
|
|
2614
2293
|
className: MenuItemSeparatorLine,
|
|
2615
|
-
|
|
2294
|
+
type: Div
|
|
2616
2295
|
};
|
|
2617
2296
|
const getMenuItemSeparatorDom = menuItem => {
|
|
2618
2297
|
return [separator, separatorLine];
|
|
2619
2298
|
};
|
|
2620
2299
|
|
|
2621
2300
|
const arrowRight = {
|
|
2622
|
-
|
|
2301
|
+
childCount: 0,
|
|
2623
2302
|
className: MenuItemSubMenuArrowRight,
|
|
2624
|
-
|
|
2303
|
+
type: Div
|
|
2625
2304
|
};
|
|
2626
2305
|
const getMenuItemSubMenuDom = menuItem => {
|
|
2627
2306
|
const {
|
|
2628
|
-
label,
|
|
2629
|
-
isFocused,
|
|
2630
2307
|
isExpanded,
|
|
2308
|
+
isFocused,
|
|
2309
|
+
label,
|
|
2631
2310
|
level
|
|
2632
2311
|
} = menuItem;
|
|
2633
2312
|
let className = MenuItem;
|
|
@@ -2636,24 +2315,24 @@ const getMenuItemSubMenuDom = menuItem => {
|
|
|
2636
2315
|
className += ' ' + MenuItemFocused;
|
|
2637
2316
|
}
|
|
2638
2317
|
return [{
|
|
2639
|
-
|
|
2318
|
+
ariaExpanded: isExpanded,
|
|
2319
|
+
ariaHasPopup: true,
|
|
2320
|
+
ariaOwns: isExpanded ? `Menu-${level + 1}` : undefined,
|
|
2321
|
+
childCount: 2,
|
|
2640
2322
|
className,
|
|
2641
2323
|
role: MenuItem$1,
|
|
2642
2324
|
tabIndex: -1,
|
|
2643
|
-
|
|
2644
|
-
ariaExpanded: isExpanded,
|
|
2645
|
-
ariaOwns: isExpanded ? `Menu-${level + 1}` : undefined,
|
|
2646
|
-
childCount: 2
|
|
2325
|
+
type: Div
|
|
2647
2326
|
}, text(label), arrowRight];
|
|
2648
2327
|
};
|
|
2649
2328
|
|
|
2650
2329
|
const checkboxUnchecked = {
|
|
2651
|
-
|
|
2330
|
+
ariaChecked: false,
|
|
2331
|
+
childCount: 1,
|
|
2652
2332
|
className: MenuItem,
|
|
2653
2333
|
role: MenuItemCheckBox,
|
|
2654
|
-
ariaChecked: false,
|
|
2655
2334
|
tabIndex: -1,
|
|
2656
|
-
|
|
2335
|
+
type: Div
|
|
2657
2336
|
};
|
|
2658
2337
|
const getMenuItemUncheckedDom = menuItem => {
|
|
2659
2338
|
const {
|
|
@@ -2664,20 +2343,20 @@ const getMenuItemUncheckedDom = menuItem => {
|
|
|
2664
2343
|
|
|
2665
2344
|
const getMenuItemRenderer = flags => {
|
|
2666
2345
|
switch (flags) {
|
|
2346
|
+
case Checked:
|
|
2347
|
+
return getMenuItemCheckedDom;
|
|
2348
|
+
case Disabled:
|
|
2349
|
+
return getMenuItemDisabledDom;
|
|
2350
|
+
case Ignore:
|
|
2667
2351
|
case None:
|
|
2668
2352
|
case RestoreFocus:
|
|
2669
|
-
case Ignore:
|
|
2670
2353
|
return getMenuItemDefaultDom;
|
|
2671
2354
|
case Separator$1:
|
|
2672
2355
|
return getMenuItemSeparatorDom;
|
|
2673
|
-
case Checked:
|
|
2674
|
-
return getMenuItemCheckedDom;
|
|
2675
|
-
case Unchecked:
|
|
2676
|
-
return getMenuItemUncheckedDom;
|
|
2677
|
-
case Disabled:
|
|
2678
|
-
return getMenuItemDisabledDom;
|
|
2679
2356
|
case SubMenu:
|
|
2680
2357
|
return getMenuItemSubMenuDom;
|
|
2358
|
+
case Unchecked:
|
|
2359
|
+
return getMenuItemUncheckedDom;
|
|
2681
2360
|
default:
|
|
2682
2361
|
return getMenuItemsNoopDom;
|
|
2683
2362
|
}
|
|
@@ -2693,11 +2372,11 @@ const getMenuItemVirtualDom = menuItem => {
|
|
|
2693
2372
|
|
|
2694
2373
|
const getMenuVirtualDom = menuItems => {
|
|
2695
2374
|
const dom = [{
|
|
2696
|
-
|
|
2375
|
+
childCount: menuItems.length,
|
|
2697
2376
|
className: Menu,
|
|
2698
2377
|
role: Menu$1,
|
|
2699
2378
|
tabIndex: -1,
|
|
2700
|
-
|
|
2379
|
+
type: Div
|
|
2701
2380
|
}, ...menuItems.flatMap(getMenuItemVirtualDom)];
|
|
2702
2381
|
return dom;
|
|
2703
2382
|
};
|
|
@@ -2711,12 +2390,12 @@ const getVisible = (items, focusedIndex, expanded, level) => {
|
|
|
2711
2390
|
label
|
|
2712
2391
|
} = item;
|
|
2713
2392
|
visibleItems.push({
|
|
2714
|
-
label,
|
|
2715
2393
|
flags,
|
|
2716
|
-
isFocused: i === focusedIndex,
|
|
2717
2394
|
isExpanded: i === focusedIndex && expanded,
|
|
2718
|
-
|
|
2719
|
-
key: item.key
|
|
2395
|
+
isFocused: i === focusedIndex,
|
|
2396
|
+
key: item.key,
|
|
2397
|
+
label,
|
|
2398
|
+
level
|
|
2720
2399
|
});
|
|
2721
2400
|
}
|
|
2722
2401
|
return visibleItems;
|
|
@@ -2749,8 +2428,8 @@ const getMenuHeight = items => {
|
|
|
2749
2428
|
const getMenuHideCommands = async (restoreFocus = true) => {
|
|
2750
2429
|
if (getCount() === 0) {
|
|
2751
2430
|
return {
|
|
2752
|
-
|
|
2753
|
-
|
|
2431
|
+
commands: [],
|
|
2432
|
+
newMenus: []
|
|
2754
2433
|
};
|
|
2755
2434
|
}
|
|
2756
2435
|
reset();
|
|
@@ -2787,9 +2466,9 @@ const show$2 = async (x, y, id, mouseBlocking = false, ...args) => {
|
|
|
2787
2466
|
const items = await getMenuEntriesWithKeyBindings(id, ...args);
|
|
2788
2467
|
const bounds = getMenuBounds(x, y, items);
|
|
2789
2468
|
const menu = addMenuInternal({
|
|
2469
|
+
focusedIndex: -1,
|
|
2790
2470
|
id,
|
|
2791
2471
|
items,
|
|
2792
|
-
focusedIndex: -1,
|
|
2793
2472
|
level: getCount(),
|
|
2794
2473
|
x: bounds.x,
|
|
2795
2474
|
y: bounds.y
|
|
@@ -2802,9 +2481,9 @@ const show2$2 = async (uid, menuId, x, y, mouseBlocking = false, ...args) => {
|
|
|
2802
2481
|
const items = await getMenuEntriesWithKeyBindings2(uid, menuId, ...args);
|
|
2803
2482
|
const bounds = getMenuBounds(x, y, items);
|
|
2804
2483
|
const menu = addMenuInternal({
|
|
2484
|
+
focusedIndex: -1,
|
|
2805
2485
|
id: menuId,
|
|
2806
2486
|
items,
|
|
2807
|
-
focusedIndex: -1,
|
|
2808
2487
|
level: getCount(),
|
|
2809
2488
|
x: bounds.x,
|
|
2810
2489
|
y: bounds.y
|
|
@@ -2900,8 +2579,8 @@ const create = () => {
|
|
|
2900
2579
|
},
|
|
2901
2580
|
set(uid, oldState, newState) {
|
|
2902
2581
|
states[uid] = {
|
|
2903
|
-
|
|
2904
|
-
|
|
2582
|
+
newState,
|
|
2583
|
+
oldState
|
|
2905
2584
|
};
|
|
2906
2585
|
}
|
|
2907
2586
|
};
|
|
@@ -2914,16 +2593,16 @@ const {
|
|
|
2914
2593
|
|
|
2915
2594
|
const diff2 = uid => {
|
|
2916
2595
|
const {
|
|
2917
|
-
|
|
2918
|
-
|
|
2596
|
+
newState,
|
|
2597
|
+
oldState
|
|
2919
2598
|
} = get(uid);
|
|
2920
2599
|
return diff(oldState, newState);
|
|
2921
2600
|
};
|
|
2922
2601
|
|
|
2923
2602
|
const canBeFocused = item => {
|
|
2924
2603
|
switch (item.flags) {
|
|
2925
|
-
case Separator$2:
|
|
2926
2604
|
case Disabled$1:
|
|
2605
|
+
case Separator$2:
|
|
2927
2606
|
return false;
|
|
2928
2607
|
default:
|
|
2929
2608
|
return true;
|
|
@@ -3030,36 +2709,36 @@ const FocusTitleBarMenuBar = 26;
|
|
|
3030
2709
|
|
|
3031
2710
|
const getKeyBindings = () => {
|
|
3032
2711
|
return [{
|
|
3033
|
-
key: DownArrow$1,
|
|
3034
2712
|
command: 'TitleBarMenuBar.handleKeyArrowDown',
|
|
2713
|
+
key: DownArrow$1,
|
|
3035
2714
|
when: FocusTitleBarMenuBar
|
|
3036
2715
|
}, {
|
|
3037
|
-
key: UpArrow$1,
|
|
3038
2716
|
command: 'TitleBarMenuBar.handleKeyArrowUp',
|
|
2717
|
+
key: UpArrow$1,
|
|
3039
2718
|
when: FocusTitleBarMenuBar
|
|
3040
2719
|
}, {
|
|
3041
|
-
key: RightArrow$1,
|
|
3042
2720
|
command: 'TitleBarMenuBar.handleKeyArrowRight',
|
|
2721
|
+
key: RightArrow$1,
|
|
3043
2722
|
when: FocusTitleBarMenuBar
|
|
3044
2723
|
}, {
|
|
3045
|
-
key: LeftArrow$1,
|
|
3046
2724
|
command: 'TitleBarMenuBar.handleKeyArrowLeft',
|
|
2725
|
+
key: LeftArrow$1,
|
|
3047
2726
|
when: FocusTitleBarMenuBar
|
|
3048
2727
|
}, {
|
|
3049
|
-
key: Space$1,
|
|
3050
2728
|
command: 'TitleBarMenuBar.handleKeySpace',
|
|
2729
|
+
key: Space$1,
|
|
3051
2730
|
when: FocusTitleBarMenuBar
|
|
3052
2731
|
}, {
|
|
3053
|
-
key: Home$1,
|
|
3054
2732
|
command: 'TitleBarMenuBar.handleKeyHome',
|
|
2733
|
+
key: Home$1,
|
|
3055
2734
|
when: FocusTitleBarMenuBar
|
|
3056
2735
|
}, {
|
|
3057
|
-
key: End$1,
|
|
3058
2736
|
command: 'TitleBarMenuBar.handleKeyEnd',
|
|
2737
|
+
key: End$1,
|
|
3059
2738
|
when: FocusTitleBarMenuBar
|
|
3060
2739
|
}, {
|
|
3061
|
-
key: Escape$1,
|
|
3062
2740
|
command: 'TitleBarMenuBar.handleKeyEscape',
|
|
2741
|
+
key: Escape$1,
|
|
3063
2742
|
when: FocusTitleBarMenuBar
|
|
3064
2743
|
}];
|
|
3065
2744
|
};
|
|
@@ -3094,9 +2773,9 @@ const getMenuEntries = (id, platform) => {
|
|
|
3094
2773
|
const getMenuShowCommands = async (items, menuId, x, y, mouseBlocking = false) => {
|
|
3095
2774
|
const bounds = getMenuBounds(x, y, items);
|
|
3096
2775
|
const menu = addMenuInternal({
|
|
2776
|
+
focusedIndex: -1,
|
|
3097
2777
|
id: menuId,
|
|
3098
2778
|
items,
|
|
3099
|
-
focusedIndex: -1,
|
|
3100
2779
|
level: getCount(),
|
|
3101
2780
|
x: bounds.x,
|
|
3102
2781
|
y: bounds.y
|
|
@@ -3104,9 +2783,9 @@ const getMenuShowCommands = async (items, menuId, x, y, mouseBlocking = false) =
|
|
|
3104
2783
|
const visible = getVisible(menu.items, -1, false, menu.level);
|
|
3105
2784
|
const dom = getMenuVirtualDom(visible).slice(1);
|
|
3106
2785
|
return {
|
|
3107
|
-
|
|
2786
|
+
commands: [/* Menu.show */'Menu.showMenu', /* x */bounds.x, /* y */bounds.y, /* width */bounds.width, /* height */bounds.height, /* items */menu.items, /* level */menu.level, /* parentIndex */-1, /* dom */dom, /* mouseBlocking */mouseBlocking],
|
|
3108
2787
|
menu,
|
|
3109
|
-
|
|
2788
|
+
menus: getAll()
|
|
3110
2789
|
};
|
|
3111
2790
|
};
|
|
3112
2791
|
|
|
@@ -3124,8 +2803,8 @@ const hideSubMenus = async level => {
|
|
|
3124
2803
|
const MENU_DELAY_TRIANGLE = 300;
|
|
3125
2804
|
const resolveAfterTimeout = async () => {
|
|
3126
2805
|
const {
|
|
3127
|
-
|
|
3128
|
-
|
|
2806
|
+
promise,
|
|
2807
|
+
resolve
|
|
3129
2808
|
} = Promise.withResolvers();
|
|
3130
2809
|
setTimeout(resolve, MENU_DELAY_TRIANGLE);
|
|
3131
2810
|
await promise;
|
|
@@ -3138,14 +2817,14 @@ const showSubMenuAtEnter = async (level, index, enterX, enterY) => {
|
|
|
3138
2817
|
const item = parentMenu.items[index];
|
|
3139
2818
|
const subMenuItems = await getMenuEntries$1(item.id);
|
|
3140
2819
|
const subMenu = addMenuInternal({
|
|
2820
|
+
enterX,
|
|
2821
|
+
enterY,
|
|
2822
|
+
focusedIndex: -1,
|
|
3141
2823
|
id: item.id,
|
|
3142
2824
|
items: subMenuItems,
|
|
3143
|
-
focusedIndex: -1,
|
|
3144
2825
|
level: getCount(),
|
|
3145
|
-
y: parentMenu.y + index * 25,
|
|
3146
2826
|
x: parentMenu.x + MENU_WIDTH,
|
|
3147
|
-
|
|
3148
|
-
enterY
|
|
2827
|
+
y: parentMenu.y + index * 25
|
|
3149
2828
|
});
|
|
3150
2829
|
const width = getMenuWidth();
|
|
3151
2830
|
const height = getMenuHeight(subMenuItems);
|
|
@@ -3270,8 +2949,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
3270
2949
|
|
|
3271
2950
|
const render2 = async (uid, diffResult) => {
|
|
3272
2951
|
const {
|
|
3273
|
-
|
|
3274
|
-
|
|
2952
|
+
newState,
|
|
2953
|
+
oldState
|
|
3275
2954
|
} = get(uid);
|
|
3276
2955
|
set(uid, newState, newState);
|
|
3277
2956
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -3313,6 +2992,8 @@ const saveState = uid => {
|
|
|
3313
2992
|
};
|
|
3314
2993
|
};
|
|
3315
2994
|
|
|
2995
|
+
const selectIndexDefault = async () => {};
|
|
2996
|
+
|
|
3316
2997
|
const {
|
|
3317
2998
|
invoke} = RendererWorker;
|
|
3318
2999
|
|
|
@@ -3320,36 +3001,46 @@ const executeMenuItemCommand = async item => {
|
|
|
3320
3001
|
await invoke(item.command, ...(item.args || []));
|
|
3321
3002
|
};
|
|
3322
3003
|
|
|
3004
|
+
const selectIndexIgnore = async (menu, item) => {
|
|
3005
|
+
await executeMenuItemCommand(item);
|
|
3006
|
+
};
|
|
3007
|
+
|
|
3323
3008
|
const selectIndexNone = async (menu, item) => {
|
|
3324
|
-
await
|
|
3009
|
+
await hide(/* restoreFocus */false);
|
|
3010
|
+
await executeMenuItemCommand(item);
|
|
3325
3011
|
};
|
|
3012
|
+
|
|
3326
3013
|
const selectIndexRestoreFocus = async (menu, item) => {
|
|
3327
|
-
await
|
|
3014
|
+
await hide(/* restoreFocus */true);
|
|
3015
|
+
await executeMenuItemCommand(item);
|
|
3328
3016
|
};
|
|
3017
|
+
|
|
3329
3018
|
const selectIndexSubMenu = async (menu, item, index) => {
|
|
3330
3019
|
if (menu.focusedIndex === index) {
|
|
3331
3020
|
return;
|
|
3332
3021
|
}
|
|
3333
3022
|
await showSubMenu(menu.level, menu.focusedIndex);
|
|
3334
3023
|
};
|
|
3335
|
-
|
|
3336
|
-
const selectIndexIgnore = async (menu, item) => {
|
|
3337
|
-
await executeMenuItemCommand(item);
|
|
3338
|
-
};
|
|
3024
|
+
|
|
3339
3025
|
const getSelectIndexFunction = flags => {
|
|
3340
3026
|
switch (flags) {
|
|
3027
|
+
case Checked$1:
|
|
3028
|
+
return selectIndexRestoreFocus;
|
|
3029
|
+
case Ignore$1:
|
|
3030
|
+
return selectIndexIgnore;
|
|
3341
3031
|
case None$1:
|
|
3342
3032
|
return selectIndexNone;
|
|
3033
|
+
case RestoreFocus$1:
|
|
3034
|
+
return selectIndexRestoreFocus;
|
|
3343
3035
|
case SubMenu$1:
|
|
3344
3036
|
return selectIndexSubMenu;
|
|
3345
|
-
case
|
|
3037
|
+
case Unchecked$1:
|
|
3346
3038
|
return selectIndexRestoreFocus;
|
|
3347
|
-
case Ignore$1:
|
|
3348
|
-
return selectIndexIgnore;
|
|
3349
3039
|
default:
|
|
3350
3040
|
return selectIndexDefault;
|
|
3351
3041
|
}
|
|
3352
3042
|
};
|
|
3043
|
+
|
|
3353
3044
|
const selectIndex = async (level, index) => {
|
|
3354
3045
|
const menu = get$1(level);
|
|
3355
3046
|
// TODO avoid assignment
|
|
@@ -3418,31 +3109,15 @@ const commandMap = {
|
|
|
3418
3109
|
'Menu.showSubMenu': showSubMenu
|
|
3419
3110
|
};
|
|
3420
3111
|
|
|
3421
|
-
const
|
|
3422
|
-
|
|
3423
|
-
};
|
|
3424
|
-
const createRendererProcessRpc = async () => {
|
|
3425
|
-
try {
|
|
3426
|
-
const rpc = await TransferMessagePortRpcParent.create({
|
|
3427
|
-
commandMap: {},
|
|
3428
|
-
send
|
|
3429
|
-
});
|
|
3430
|
-
return rpc;
|
|
3431
|
-
} catch (error) {
|
|
3432
|
-
throw new VError(error, `Failed to create renderer process rpc`);
|
|
3433
|
-
}
|
|
3434
|
-
};
|
|
3435
|
-
|
|
3436
|
-
const initializeRendererProcess = async () => {
|
|
3437
|
-
const rpc = await createRendererProcessRpc();
|
|
3438
|
-
set$3(rpc);
|
|
3439
|
-
};
|
|
3440
|
-
|
|
3441
|
-
const listen = async () => {
|
|
3442
|
-
const rpc = await WebWorkerRpcClient.create({
|
|
3112
|
+
const initializeRendererWorker = async () => {
|
|
3113
|
+
const rpc = await create$2({
|
|
3443
3114
|
commandMap: commandMap
|
|
3444
3115
|
});
|
|
3445
3116
|
set$2(rpc);
|
|
3117
|
+
};
|
|
3118
|
+
|
|
3119
|
+
const listen = async () => {
|
|
3120
|
+
await initializeRendererWorker();
|
|
3446
3121
|
await initializeRendererProcess();
|
|
3447
3122
|
};
|
|
3448
3123
|
|