@lvce-editor/about-view 7.0.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aboutWorkerMain.js +427 -358
- package/package.json +1 -1
package/dist/aboutWorkerMain.js
CHANGED
|
@@ -182,8 +182,8 @@ const getModuleNotFoundError = stderr => {
|
|
|
182
182
|
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
183
183
|
const message = lines[messageIndex];
|
|
184
184
|
return {
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
186
|
+
message
|
|
187
187
|
};
|
|
188
188
|
};
|
|
189
189
|
const isModuleNotFoundError = stderr => {
|
|
@@ -206,14 +206,14 @@ const isUnhelpfulNativeModuleError = stderr => {
|
|
|
206
206
|
const getNativeModuleErrorMessage = stderr => {
|
|
207
207
|
const message = getMessageCodeBlock(stderr);
|
|
208
208
|
return {
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
210
|
+
message: `Incompatible native node module: ${message}`
|
|
211
211
|
};
|
|
212
212
|
};
|
|
213
213
|
const getModuleSyntaxError = () => {
|
|
214
214
|
return {
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
216
|
+
message: `ES Modules are not supported in electron`
|
|
217
217
|
};
|
|
218
218
|
};
|
|
219
219
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -232,8 +232,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
232
232
|
rest
|
|
233
233
|
} = getDetails(lines);
|
|
234
234
|
return {
|
|
235
|
-
message: actualMessage,
|
|
236
235
|
code: '',
|
|
236
|
+
message: actualMessage,
|
|
237
237
|
stack: rest
|
|
238
238
|
};
|
|
239
239
|
};
|
|
@@ -243,8 +243,8 @@ class IpcError extends VError {
|
|
|
243
243
|
if (stdout || stderr) {
|
|
244
244
|
// @ts-ignore
|
|
245
245
|
const {
|
|
246
|
-
message,
|
|
247
246
|
code,
|
|
247
|
+
message,
|
|
248
248
|
stack
|
|
249
249
|
} = getHelpfulChildProcessError(stdout, stderr);
|
|
250
250
|
const cause = new Error(message);
|
|
@@ -305,8 +305,8 @@ const wrap$f = global => {
|
|
|
305
305
|
};
|
|
306
306
|
const waitForFirstMessage = async port => {
|
|
307
307
|
const {
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
promise,
|
|
309
|
+
resolve
|
|
310
310
|
} = Promise.withResolvers();
|
|
311
311
|
port.addEventListener('message', resolve, {
|
|
312
312
|
once: true
|
|
@@ -326,8 +326,8 @@ const listen$6 = async () => {
|
|
|
326
326
|
const type = firstMessage.params[0];
|
|
327
327
|
if (type === 'message-port') {
|
|
328
328
|
parentIpc.send({
|
|
329
|
-
jsonrpc: '2.0',
|
|
330
329
|
id: firstMessage.id,
|
|
330
|
+
jsonrpc: '2.0',
|
|
331
331
|
result: null
|
|
332
332
|
});
|
|
333
333
|
parentIpc.dispose();
|
|
@@ -369,56 +369,35 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
|
369
369
|
wrap: wrap$e
|
|
370
370
|
};
|
|
371
371
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
372
|
+
class CommandNotFoundError extends Error {
|
|
373
|
+
constructor(command) {
|
|
374
|
+
super(`Command not found ${command}`);
|
|
375
|
+
this.name = 'CommandNotFoundError';
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
const commands = Object.create(null);
|
|
379
|
+
const register = commandMap => {
|
|
380
|
+
Object.assign(commands, commandMap);
|
|
379
381
|
};
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
|
|
382
|
+
const getCommand = key => {
|
|
383
|
+
return commands[key];
|
|
384
|
+
};
|
|
385
|
+
const execute = (command, ...args) => {
|
|
386
|
+
const fn = getCommand(command);
|
|
387
|
+
if (!fn) {
|
|
388
|
+
throw new CommandNotFoundError(command);
|
|
389
|
+
}
|
|
390
|
+
return fn(...args);
|
|
383
391
|
};
|
|
392
|
+
|
|
393
|
+
const Two$1 = '2.0';
|
|
394
|
+
const callbacks = Object.create(null);
|
|
384
395
|
const get$2 = id => {
|
|
385
396
|
return callbacks[id];
|
|
386
397
|
};
|
|
387
|
-
const remove = id => {
|
|
398
|
+
const remove$1 = id => {
|
|
388
399
|
delete callbacks[id];
|
|
389
400
|
};
|
|
390
|
-
let id = 0;
|
|
391
|
-
const create$3$1 = () => {
|
|
392
|
-
return ++id;
|
|
393
|
-
};
|
|
394
|
-
const registerPromise = () => {
|
|
395
|
-
const id = create$3$1();
|
|
396
|
-
const {
|
|
397
|
-
resolve,
|
|
398
|
-
promise
|
|
399
|
-
} = Promise.withResolvers();
|
|
400
|
-
set$3(id, resolve);
|
|
401
|
-
return {
|
|
402
|
-
id,
|
|
403
|
-
promise
|
|
404
|
-
};
|
|
405
|
-
};
|
|
406
|
-
const create$2$1 = (method, params) => {
|
|
407
|
-
const {
|
|
408
|
-
id,
|
|
409
|
-
promise
|
|
410
|
-
} = registerPromise();
|
|
411
|
-
const message = {
|
|
412
|
-
jsonrpc: Two,
|
|
413
|
-
method,
|
|
414
|
-
params,
|
|
415
|
-
id
|
|
416
|
-
};
|
|
417
|
-
return {
|
|
418
|
-
message,
|
|
419
|
-
promise
|
|
420
|
-
};
|
|
421
|
-
};
|
|
422
401
|
class JsonRpcError extends Error {
|
|
423
402
|
constructor(message) {
|
|
424
403
|
super(message);
|
|
@@ -435,12 +414,12 @@ const getErrorConstructor = (message, type) => {
|
|
|
435
414
|
switch (type) {
|
|
436
415
|
case DomException:
|
|
437
416
|
return DOMException;
|
|
438
|
-
case TypeError$1:
|
|
439
|
-
return TypeError;
|
|
440
|
-
case SyntaxError$1:
|
|
441
|
-
return SyntaxError;
|
|
442
417
|
case ReferenceError$1:
|
|
443
418
|
return ReferenceError;
|
|
419
|
+
case SyntaxError$1:
|
|
420
|
+
return SyntaxError;
|
|
421
|
+
case TypeError$1:
|
|
422
|
+
return TypeError;
|
|
444
423
|
default:
|
|
445
424
|
return Error;
|
|
446
425
|
}
|
|
@@ -569,7 +548,7 @@ const resolve = (id, response) => {
|
|
|
569
548
|
return;
|
|
570
549
|
}
|
|
571
550
|
fn(response);
|
|
572
|
-
remove(id);
|
|
551
|
+
remove$1(id);
|
|
573
552
|
};
|
|
574
553
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
575
554
|
const getErrorType = prettyError => {
|
|
@@ -596,27 +575,27 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
596
575
|
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
|
597
576
|
return {
|
|
598
577
|
code: MethodNotFound,
|
|
599
|
-
|
|
600
|
-
|
|
578
|
+
data: error.stack,
|
|
579
|
+
message: error.message
|
|
601
580
|
};
|
|
602
581
|
}
|
|
603
582
|
return {
|
|
604
583
|
code: Custom,
|
|
605
|
-
message: prettyError.message,
|
|
606
584
|
data: {
|
|
607
|
-
stack: getStack(prettyError),
|
|
608
|
-
codeFrame: prettyError.codeFrame,
|
|
609
|
-
type: getErrorType(prettyError),
|
|
610
585
|
code: prettyError.code,
|
|
611
|
-
|
|
612
|
-
|
|
586
|
+
codeFrame: prettyError.codeFrame,
|
|
587
|
+
name: prettyError.name,
|
|
588
|
+
stack: getStack(prettyError),
|
|
589
|
+
type: getErrorType(prettyError)
|
|
590
|
+
},
|
|
591
|
+
message: prettyError.message
|
|
613
592
|
};
|
|
614
593
|
};
|
|
615
594
|
const create$1$1 = (id, error) => {
|
|
616
595
|
return {
|
|
617
|
-
|
|
596
|
+
error,
|
|
618
597
|
id,
|
|
619
|
-
|
|
598
|
+
jsonrpc: Two$1
|
|
620
599
|
};
|
|
621
600
|
};
|
|
622
601
|
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
@@ -625,27 +604,27 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
625
604
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
626
605
|
return create$1$1(id, errorProperty);
|
|
627
606
|
};
|
|
628
|
-
const create$
|
|
607
|
+
const create$7 = (message, result) => {
|
|
629
608
|
return {
|
|
630
|
-
jsonrpc: Two,
|
|
631
609
|
id: message.id,
|
|
610
|
+
jsonrpc: Two$1,
|
|
632
611
|
result: result ?? null
|
|
633
612
|
};
|
|
634
613
|
};
|
|
635
614
|
const getSuccessResponse = (message, result) => {
|
|
636
615
|
const resultProperty = result ?? null;
|
|
637
|
-
return create$
|
|
616
|
+
return create$7(message, resultProperty);
|
|
638
617
|
};
|
|
639
618
|
const getErrorResponseSimple = (id, error) => {
|
|
640
619
|
return {
|
|
641
|
-
jsonrpc: Two,
|
|
642
|
-
id,
|
|
643
620
|
error: {
|
|
644
621
|
code: Custom,
|
|
622
|
+
data: error,
|
|
645
623
|
// @ts-ignore
|
|
646
|
-
message: error.message
|
|
647
|
-
|
|
648
|
-
|
|
624
|
+
message: error.message
|
|
625
|
+
},
|
|
626
|
+
id,
|
|
627
|
+
jsonrpc: Two$1
|
|
649
628
|
};
|
|
650
629
|
};
|
|
651
630
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
@@ -675,35 +654,35 @@ const normalizeParams = args => {
|
|
|
675
654
|
if (args.length === 1) {
|
|
676
655
|
const options = args[0];
|
|
677
656
|
return {
|
|
657
|
+
execute: options.execute,
|
|
678
658
|
ipc: options.ipc,
|
|
659
|
+
logError: options.logError || defaultLogError,
|
|
679
660
|
message: options.message,
|
|
680
|
-
execute: options.execute,
|
|
681
|
-
resolve: options.resolve || defaultResolve,
|
|
682
661
|
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
683
|
-
|
|
684
|
-
|
|
662
|
+
requiresSocket: options.requiresSocket || defaultRequiresSocket,
|
|
663
|
+
resolve: options.resolve || defaultResolve
|
|
685
664
|
};
|
|
686
665
|
}
|
|
687
666
|
return {
|
|
667
|
+
execute: args[2],
|
|
688
668
|
ipc: args[0],
|
|
669
|
+
logError: args[5],
|
|
689
670
|
message: args[1],
|
|
690
|
-
execute: args[2],
|
|
691
|
-
resolve: args[3],
|
|
692
671
|
preparePrettyError: args[4],
|
|
693
|
-
|
|
694
|
-
|
|
672
|
+
requiresSocket: args[6],
|
|
673
|
+
resolve: args[3]
|
|
695
674
|
};
|
|
696
675
|
};
|
|
697
676
|
const handleJsonRpcMessage = async (...args) => {
|
|
698
677
|
const options = normalizeParams(args);
|
|
699
678
|
const {
|
|
700
|
-
message,
|
|
701
|
-
ipc,
|
|
702
679
|
execute,
|
|
703
|
-
|
|
704
|
-
preparePrettyError,
|
|
680
|
+
ipc,
|
|
705
681
|
logError,
|
|
706
|
-
|
|
682
|
+
message,
|
|
683
|
+
preparePrettyError,
|
|
684
|
+
requiresSocket,
|
|
685
|
+
resolve
|
|
707
686
|
} = options;
|
|
708
687
|
if ('id' in message) {
|
|
709
688
|
if ('method' in message) {
|
|
@@ -725,11 +704,51 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
725
704
|
}
|
|
726
705
|
throw new JsonRpcError('unexpected message');
|
|
727
706
|
};
|
|
728
|
-
|
|
707
|
+
|
|
708
|
+
const Two = '2.0';
|
|
709
|
+
|
|
710
|
+
const create$6 = (method, params) => {
|
|
711
|
+
return {
|
|
712
|
+
jsonrpc: Two,
|
|
713
|
+
method,
|
|
714
|
+
params
|
|
715
|
+
};
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
const create$5 = (id, method, params) => {
|
|
719
|
+
const message = {
|
|
720
|
+
id,
|
|
721
|
+
jsonrpc: Two,
|
|
722
|
+
method,
|
|
723
|
+
params
|
|
724
|
+
};
|
|
725
|
+
return message;
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
let id = 0;
|
|
729
|
+
const create$4 = () => {
|
|
730
|
+
return ++id;
|
|
731
|
+
};
|
|
732
|
+
|
|
733
|
+
const registerPromise = map => {
|
|
734
|
+
const id = create$4();
|
|
729
735
|
const {
|
|
730
|
-
|
|
736
|
+
promise,
|
|
737
|
+
resolve
|
|
738
|
+
} = Promise.withResolvers();
|
|
739
|
+
map[id] = resolve;
|
|
740
|
+
return {
|
|
741
|
+
id,
|
|
742
|
+
promise
|
|
743
|
+
};
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
747
|
+
const {
|
|
748
|
+
id,
|
|
731
749
|
promise
|
|
732
|
-
} =
|
|
750
|
+
} = registerPromise(callbacks);
|
|
751
|
+
const message = create$5(id, method, params);
|
|
733
752
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
734
753
|
ipc.sendAndTransfer(message);
|
|
735
754
|
} else {
|
|
@@ -738,60 +757,40 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
|
738
757
|
const responseMessage = await promise;
|
|
739
758
|
return unwrapJsonRpcResult(responseMessage);
|
|
740
759
|
};
|
|
741
|
-
const send = (transport, method, ...params) => {
|
|
742
|
-
const message = create$4(method, params);
|
|
743
|
-
transport.send(message);
|
|
744
|
-
};
|
|
745
|
-
const invoke$1 = (ipc, method, ...params) => {
|
|
746
|
-
return invokeHelper(ipc, method, params, false);
|
|
747
|
-
};
|
|
748
|
-
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
749
|
-
return invokeHelper(ipc, method, params, true);
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
class CommandNotFoundError extends Error {
|
|
753
|
-
constructor(command) {
|
|
754
|
-
super(`Command not found ${command}`);
|
|
755
|
-
this.name = 'CommandNotFoundError';
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
const commands = Object.create(null);
|
|
759
|
-
const register = commandMap => {
|
|
760
|
-
Object.assign(commands, commandMap);
|
|
761
|
-
};
|
|
762
|
-
const getCommand = key => {
|
|
763
|
-
return commands[key];
|
|
764
|
-
};
|
|
765
|
-
const execute = (command, ...args) => {
|
|
766
|
-
const fn = getCommand(command);
|
|
767
|
-
if (!fn) {
|
|
768
|
-
throw new CommandNotFoundError(command);
|
|
769
|
-
}
|
|
770
|
-
return fn(...args);
|
|
771
|
-
};
|
|
772
|
-
|
|
773
760
|
const createRpc = ipc => {
|
|
761
|
+
const callbacks = Object.create(null);
|
|
762
|
+
ipc._resolve = (id, response) => {
|
|
763
|
+
const fn = callbacks[id];
|
|
764
|
+
if (!fn) {
|
|
765
|
+
console.warn(`callback ${id} may already be disposed`);
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
fn(response);
|
|
769
|
+
delete callbacks[id];
|
|
770
|
+
};
|
|
774
771
|
const rpc = {
|
|
772
|
+
async dispose() {
|
|
773
|
+
await ipc?.dispose();
|
|
774
|
+
},
|
|
775
|
+
invoke(method, ...params) {
|
|
776
|
+
return invokeHelper(callbacks, ipc, method, params, false);
|
|
777
|
+
},
|
|
778
|
+
invokeAndTransfer(method, ...params) {
|
|
779
|
+
return invokeHelper(callbacks, ipc, method, params, true);
|
|
780
|
+
},
|
|
775
781
|
// @ts-ignore
|
|
776
782
|
ipc,
|
|
777
783
|
/**
|
|
778
784
|
* @deprecated
|
|
779
785
|
*/
|
|
780
786
|
send(method, ...params) {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
invoke(method, ...params) {
|
|
784
|
-
return invoke$1(ipc, method, ...params);
|
|
785
|
-
},
|
|
786
|
-
invokeAndTransfer(method, ...params) {
|
|
787
|
-
return invokeAndTransfer(ipc, method, ...params);
|
|
788
|
-
},
|
|
789
|
-
async dispose() {
|
|
790
|
-
await ipc?.dispose();
|
|
787
|
+
const message = create$6(method, params);
|
|
788
|
+
ipc.send(message);
|
|
791
789
|
}
|
|
792
790
|
};
|
|
793
791
|
return rpc;
|
|
794
792
|
};
|
|
793
|
+
|
|
795
794
|
const requiresSocket = () => {
|
|
796
795
|
return false;
|
|
797
796
|
};
|
|
@@ -804,8 +803,9 @@ const logError = () => {
|
|
|
804
803
|
const handleMessage = event => {
|
|
805
804
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
806
805
|
const actualExecute = event?.target?.execute || execute;
|
|
807
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute,
|
|
806
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
808
807
|
};
|
|
808
|
+
|
|
809
809
|
const handleIpc = ipc => {
|
|
810
810
|
if ('addEventListener' in ipc) {
|
|
811
811
|
ipc.addEventListener('message', handleMessage);
|
|
@@ -814,6 +814,7 @@ const handleIpc = ipc => {
|
|
|
814
814
|
ipc.on('message', handleMessage);
|
|
815
815
|
}
|
|
816
816
|
};
|
|
817
|
+
|
|
817
818
|
const listen$1 = async (module, options) => {
|
|
818
819
|
const rawIpc = await module.listen(options);
|
|
819
820
|
if (module.signal) {
|
|
@@ -822,6 +823,7 @@ const listen$1 = async (module, options) => {
|
|
|
822
823
|
const ipc = module.wrap(rawIpc);
|
|
823
824
|
return ipc;
|
|
824
825
|
};
|
|
826
|
+
|
|
825
827
|
const create$3 = async ({
|
|
826
828
|
commandMap
|
|
827
829
|
}) => {
|
|
@@ -832,24 +834,26 @@ const create$3 = async ({
|
|
|
832
834
|
const rpc = createRpc(ipc);
|
|
833
835
|
return rpc;
|
|
834
836
|
};
|
|
835
|
-
const WebWorkerRpcClient = {
|
|
836
|
-
__proto__: null,
|
|
837
|
-
create: create$3
|
|
838
|
-
};
|
|
839
|
-
|
|
840
|
-
const Button$2 = 1;
|
|
841
|
-
const Div = 4;
|
|
842
|
-
const Text = 12;
|
|
843
|
-
const Br = 55;
|
|
844
837
|
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
838
|
+
const createMockRpc = ({
|
|
839
|
+
commandMap
|
|
840
|
+
}) => {
|
|
841
|
+
const invocations = [];
|
|
842
|
+
const invoke = (method, ...params) => {
|
|
843
|
+
invocations.push([method, ...params]);
|
|
844
|
+
const command = commandMap[method];
|
|
845
|
+
if (!command) {
|
|
846
|
+
throw new Error(`command ${method} not found`);
|
|
847
|
+
}
|
|
848
|
+
return command(...params);
|
|
849
|
+
};
|
|
850
|
+
const mockRpc = {
|
|
851
|
+
invocations,
|
|
852
|
+
invoke,
|
|
853
|
+
invokeAndTransfer: invoke
|
|
854
|
+
};
|
|
855
|
+
return mockRpc;
|
|
856
|
+
};
|
|
853
857
|
|
|
854
858
|
const rpcs = Object.create(null);
|
|
855
859
|
const set$2 = (id, rpc) => {
|
|
@@ -858,9 +862,17 @@ const set$2 = (id, rpc) => {
|
|
|
858
862
|
const get$1 = id => {
|
|
859
863
|
return rpcs[id];
|
|
860
864
|
};
|
|
865
|
+
const remove = id => {
|
|
866
|
+
delete rpcs[id];
|
|
867
|
+
};
|
|
861
868
|
|
|
869
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
862
870
|
const create$2 = rpcId => {
|
|
863
871
|
return {
|
|
872
|
+
async dispose() {
|
|
873
|
+
const rpc = get$1(rpcId);
|
|
874
|
+
await rpc.dispose();
|
|
875
|
+
},
|
|
864
876
|
// @ts-ignore
|
|
865
877
|
invoke(method, ...params) {
|
|
866
878
|
const rpc = get$1(rpcId);
|
|
@@ -873,19 +885,42 @@ const create$2 = rpcId => {
|
|
|
873
885
|
// @ts-ignore
|
|
874
886
|
return rpc.invokeAndTransfer(method, ...params);
|
|
875
887
|
},
|
|
888
|
+
registerMockRpc(commandMap) {
|
|
889
|
+
const mockRpc = createMockRpc({
|
|
890
|
+
commandMap
|
|
891
|
+
});
|
|
892
|
+
set$2(rpcId, mockRpc);
|
|
893
|
+
// @ts-ignore
|
|
894
|
+
mockRpc[Symbol.dispose] = () => {
|
|
895
|
+
remove(rpcId);
|
|
896
|
+
};
|
|
897
|
+
// @ts-ignore
|
|
898
|
+
return mockRpc;
|
|
899
|
+
},
|
|
876
900
|
set(rpc) {
|
|
877
901
|
set$2(rpcId, rpc);
|
|
878
|
-
},
|
|
879
|
-
async dispose() {
|
|
880
|
-
const rpc = get$1(rpcId);
|
|
881
|
-
await rpc.dispose();
|
|
882
902
|
}
|
|
883
903
|
};
|
|
884
904
|
};
|
|
885
905
|
|
|
906
|
+
const Button$2 = 1;
|
|
907
|
+
const Div = 4;
|
|
908
|
+
const Text = 12;
|
|
909
|
+
const Br = 55;
|
|
910
|
+
|
|
911
|
+
const TargetName = 'event.target.name';
|
|
912
|
+
|
|
913
|
+
const Tab = 2;
|
|
914
|
+
const Escape = 8;
|
|
915
|
+
|
|
916
|
+
const Shift = 1 << 10 >>> 0;
|
|
917
|
+
|
|
918
|
+
const RendererWorker = 1;
|
|
919
|
+
|
|
886
920
|
const {
|
|
887
921
|
invoke,
|
|
888
|
-
set: set$1
|
|
922
|
+
set: set$1
|
|
923
|
+
} = create$2(RendererWorker);
|
|
889
924
|
const getElectronVersion$1 = async () => {
|
|
890
925
|
return invoke('Process.getElectronVersion');
|
|
891
926
|
};
|
|
@@ -925,41 +960,68 @@ const create$1 = () => {
|
|
|
925
960
|
const states = Object.create(null);
|
|
926
961
|
const commandMapRef = {};
|
|
927
962
|
return {
|
|
928
|
-
|
|
929
|
-
|
|
963
|
+
clear() {
|
|
964
|
+
for (const key of Object.keys(states)) {
|
|
965
|
+
delete states[key];
|
|
966
|
+
}
|
|
930
967
|
},
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
};
|
|
968
|
+
diff(uid, modules, numbers) {
|
|
969
|
+
const {
|
|
970
|
+
newState,
|
|
971
|
+
oldState
|
|
972
|
+
} = states[uid];
|
|
973
|
+
const diffResult = [];
|
|
974
|
+
for (let i = 0; i < modules.length; i++) {
|
|
975
|
+
const fn = modules[i];
|
|
976
|
+
if (!fn(oldState, newState)) {
|
|
977
|
+
diffResult.push(numbers[i]);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
return diffResult;
|
|
936
981
|
},
|
|
937
982
|
dispose(uid) {
|
|
938
983
|
delete states[uid];
|
|
939
984
|
},
|
|
985
|
+
get(uid) {
|
|
986
|
+
return states[uid];
|
|
987
|
+
},
|
|
988
|
+
getCommandIds() {
|
|
989
|
+
const keys = Object.keys(commandMapRef);
|
|
990
|
+
const ids = keys.map(toCommandId);
|
|
991
|
+
return ids;
|
|
992
|
+
},
|
|
940
993
|
getKeys() {
|
|
941
994
|
return Object.keys(states).map(key => {
|
|
942
|
-
return Number.
|
|
995
|
+
return Number.parseFloat(key);
|
|
943
996
|
});
|
|
944
997
|
},
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
998
|
+
registerCommands(commandMap) {
|
|
999
|
+
Object.assign(commandMapRef, commandMap);
|
|
1000
|
+
},
|
|
1001
|
+
set(uid, oldState, newState) {
|
|
1002
|
+
states[uid] = {
|
|
1003
|
+
newState,
|
|
1004
|
+
oldState
|
|
1005
|
+
};
|
|
949
1006
|
},
|
|
950
1007
|
wrapCommand(fn) {
|
|
951
1008
|
const wrapped = async (uid, ...args) => {
|
|
952
1009
|
const {
|
|
953
|
-
newState
|
|
1010
|
+
newState,
|
|
1011
|
+
oldState
|
|
954
1012
|
} = states[uid];
|
|
955
1013
|
const newerState = await fn(newState, ...args);
|
|
956
|
-
if (newState === newerState) {
|
|
1014
|
+
if (oldState === newerState || newState === newerState) {
|
|
957
1015
|
return;
|
|
958
1016
|
}
|
|
959
|
-
const
|
|
1017
|
+
const latestOld = states[uid];
|
|
1018
|
+
const latestNew = {
|
|
1019
|
+
...latestOld.newState,
|
|
1020
|
+
...newerState
|
|
1021
|
+
};
|
|
960
1022
|
states[uid] = {
|
|
961
|
-
|
|
962
|
-
|
|
1023
|
+
newState: latestNew,
|
|
1024
|
+
oldState: latestOld.oldState
|
|
963
1025
|
};
|
|
964
1026
|
};
|
|
965
1027
|
return wrapped;
|
|
@@ -973,46 +1035,55 @@ const create$1 = () => {
|
|
|
973
1035
|
};
|
|
974
1036
|
return wrapped;
|
|
975
1037
|
},
|
|
976
|
-
|
|
977
|
-
const {
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
const
|
|
984
|
-
|
|
985
|
-
|
|
1038
|
+
wrapLoadContent(fn) {
|
|
1039
|
+
const wrapped = async (uid, ...args) => {
|
|
1040
|
+
const {
|
|
1041
|
+
newState,
|
|
1042
|
+
oldState
|
|
1043
|
+
} = states[uid];
|
|
1044
|
+
const result = await fn(newState, ...args);
|
|
1045
|
+
const {
|
|
1046
|
+
error,
|
|
1047
|
+
state
|
|
1048
|
+
} = result;
|
|
1049
|
+
if (oldState === state || newState === state) {
|
|
1050
|
+
return {
|
|
1051
|
+
error
|
|
1052
|
+
};
|
|
986
1053
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1054
|
+
const latestOld = states[uid];
|
|
1055
|
+
const latestNew = {
|
|
1056
|
+
...latestOld.newState,
|
|
1057
|
+
...state
|
|
1058
|
+
};
|
|
1059
|
+
states[uid] = {
|
|
1060
|
+
newState: latestNew,
|
|
1061
|
+
oldState: latestOld.oldState
|
|
1062
|
+
};
|
|
1063
|
+
return {
|
|
1064
|
+
error
|
|
1065
|
+
};
|
|
1066
|
+
};
|
|
1067
|
+
return wrapped;
|
|
997
1068
|
}
|
|
998
1069
|
};
|
|
999
1070
|
};
|
|
1000
1071
|
|
|
1001
1072
|
const {
|
|
1002
|
-
get,
|
|
1003
|
-
set,
|
|
1004
1073
|
dispose: dispose$1,
|
|
1005
|
-
|
|
1074
|
+
get,
|
|
1075
|
+
getCommandIds,
|
|
1006
1076
|
registerCommands,
|
|
1007
|
-
|
|
1077
|
+
set,
|
|
1078
|
+
wrapCommand
|
|
1008
1079
|
} = create$1();
|
|
1009
1080
|
|
|
1010
1081
|
const create = uid => {
|
|
1011
1082
|
const state = {
|
|
1012
|
-
uid,
|
|
1013
1083
|
focusId: 0,
|
|
1014
1084
|
lines: [],
|
|
1015
|
-
productName: ''
|
|
1085
|
+
productName: '',
|
|
1086
|
+
uid
|
|
1016
1087
|
};
|
|
1017
1088
|
set(uid, state, state);
|
|
1018
1089
|
};
|
|
@@ -1052,8 +1123,8 @@ const diff = (oldState, newState) => {
|
|
|
1052
1123
|
|
|
1053
1124
|
const diff2 = uid => {
|
|
1054
1125
|
const {
|
|
1055
|
-
|
|
1056
|
-
|
|
1126
|
+
newState,
|
|
1127
|
+
oldState
|
|
1057
1128
|
} = get(uid);
|
|
1058
1129
|
const diffResult = diff(oldState, newState);
|
|
1059
1130
|
return diffResult;
|
|
@@ -1069,10 +1140,10 @@ const Copy$2 = 2;
|
|
|
1069
1140
|
|
|
1070
1141
|
const getNextFocus = focusId => {
|
|
1071
1142
|
switch (focusId) {
|
|
1072
|
-
case Ok$2:
|
|
1073
|
-
return Copy$2;
|
|
1074
1143
|
case Copy$2:
|
|
1075
1144
|
return Ok$2;
|
|
1145
|
+
case Ok$2:
|
|
1146
|
+
return Copy$2;
|
|
1076
1147
|
default:
|
|
1077
1148
|
return None;
|
|
1078
1149
|
}
|
|
@@ -1090,10 +1161,10 @@ const focusNext = state => {
|
|
|
1090
1161
|
|
|
1091
1162
|
const getPreviousFocus = focusId => {
|
|
1092
1163
|
switch (focusId) {
|
|
1093
|
-
case Ok$2:
|
|
1094
|
-
return Copy$2;
|
|
1095
1164
|
case Copy$2:
|
|
1096
1165
|
return Ok$2;
|
|
1166
|
+
case Ok$2:
|
|
1167
|
+
return Copy$2;
|
|
1097
1168
|
default:
|
|
1098
1169
|
return None;
|
|
1099
1170
|
}
|
|
@@ -1115,9 +1186,9 @@ const mergeClassNames = (...classNames) => {
|
|
|
1115
1186
|
|
|
1116
1187
|
const text = data => {
|
|
1117
1188
|
return {
|
|
1118
|
-
|
|
1189
|
+
childCount: 0,
|
|
1119
1190
|
text: data,
|
|
1120
|
-
|
|
1191
|
+
type: Text
|
|
1121
1192
|
};
|
|
1122
1193
|
};
|
|
1123
1194
|
|
|
@@ -1125,16 +1196,16 @@ const FocusAbout = 4;
|
|
|
1125
1196
|
|
|
1126
1197
|
const getKeyBindings = () => {
|
|
1127
1198
|
return [{
|
|
1128
|
-
key: Escape,
|
|
1129
1199
|
command: 'About.handleClickClose',
|
|
1200
|
+
key: Escape,
|
|
1130
1201
|
when: FocusAbout
|
|
1131
1202
|
}, {
|
|
1132
|
-
key: Tab,
|
|
1133
1203
|
command: 'About.focusNext',
|
|
1204
|
+
key: Tab,
|
|
1134
1205
|
when: FocusAbout
|
|
1135
1206
|
}, {
|
|
1136
|
-
key: Tab | Shift,
|
|
1137
1207
|
command: 'About.focusPrevious',
|
|
1208
|
+
key: Tab | Shift,
|
|
1138
1209
|
when: FocusAbout
|
|
1139
1210
|
}];
|
|
1140
1211
|
};
|
|
@@ -1187,12 +1258,12 @@ const Close = 'Close';
|
|
|
1187
1258
|
|
|
1188
1259
|
const handleClickButton = async (state, name) => {
|
|
1189
1260
|
switch (name) {
|
|
1261
|
+
case Close:
|
|
1262
|
+
return handleClickClose(state);
|
|
1190
1263
|
case Copy$1:
|
|
1191
1264
|
return handleClickCopy(state);
|
|
1192
1265
|
case Ok$1:
|
|
1193
1266
|
return handleClickOk(state);
|
|
1194
|
-
case Close:
|
|
1195
|
-
return handleClickClose(state);
|
|
1196
1267
|
default:
|
|
1197
1268
|
throw new Error(`unexpected button`);
|
|
1198
1269
|
}
|
|
@@ -1369,6 +1440,22 @@ const inSomeYears = years => {
|
|
|
1369
1440
|
});
|
|
1370
1441
|
};
|
|
1371
1442
|
|
|
1443
|
+
const formatRelativeDateRange = (seconds, range) => {
|
|
1444
|
+
const value = Math.floor(seconds / range.divisor);
|
|
1445
|
+
if (value === 1) {
|
|
1446
|
+
return range.one();
|
|
1447
|
+
}
|
|
1448
|
+
return range.some(value);
|
|
1449
|
+
};
|
|
1450
|
+
const formatRelativeDate = (seconds, ranges) => {
|
|
1451
|
+
for (const range of ranges) {
|
|
1452
|
+
if (seconds < range.limit) {
|
|
1453
|
+
return formatRelativeDateRange(seconds, range);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
throw new Error('unreachable');
|
|
1457
|
+
};
|
|
1458
|
+
|
|
1372
1459
|
const minute = 60;
|
|
1373
1460
|
const hour = minute * 60;
|
|
1374
1461
|
const day = hour * 24;
|
|
@@ -1377,103 +1464,85 @@ const month = day * 30;
|
|
|
1377
1464
|
const year = day * 365;
|
|
1378
1465
|
|
|
1379
1466
|
// based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
|
|
1467
|
+
const ranges$1 = [{
|
|
1468
|
+
divisor: 1,
|
|
1469
|
+
limit: minute,
|
|
1470
|
+
one: inOneSecond,
|
|
1471
|
+
some: inSomeSeconds
|
|
1472
|
+
}, {
|
|
1473
|
+
divisor: minute,
|
|
1474
|
+
limit: hour,
|
|
1475
|
+
one: inOneMinute,
|
|
1476
|
+
some: inSomeMinutes
|
|
1477
|
+
}, {
|
|
1478
|
+
divisor: hour,
|
|
1479
|
+
limit: day,
|
|
1480
|
+
one: inOneHour,
|
|
1481
|
+
some: inSomeHours
|
|
1482
|
+
}, {
|
|
1483
|
+
divisor: day,
|
|
1484
|
+
limit: week,
|
|
1485
|
+
one: inOneDay,
|
|
1486
|
+
some: inSomeDays
|
|
1487
|
+
}, {
|
|
1488
|
+
divisor: week,
|
|
1489
|
+
limit: month,
|
|
1490
|
+
one: inOneWeek,
|
|
1491
|
+
some: inSomeWeeks
|
|
1492
|
+
}, {
|
|
1493
|
+
divisor: month,
|
|
1494
|
+
limit: year,
|
|
1495
|
+
one: inOneMonth,
|
|
1496
|
+
some: inSomeMonths
|
|
1497
|
+
}, {
|
|
1498
|
+
divisor: year,
|
|
1499
|
+
limit: Number.POSITIVE_INFINITY,
|
|
1500
|
+
one: inOneYear,
|
|
1501
|
+
some: inSomeYears
|
|
1502
|
+
}];
|
|
1380
1503
|
const formatDateFuture = seconds => {
|
|
1381
|
-
|
|
1382
|
-
if (seconds === 1) {
|
|
1383
|
-
return inOneSecond();
|
|
1384
|
-
}
|
|
1385
|
-
return inSomeSeconds(seconds);
|
|
1386
|
-
}
|
|
1387
|
-
if (seconds < hour) {
|
|
1388
|
-
const minutes = Math.floor(seconds / minute);
|
|
1389
|
-
if (minutes === 1) {
|
|
1390
|
-
return inOneMinute();
|
|
1391
|
-
}
|
|
1392
|
-
return inSomeMinutes(minutes);
|
|
1393
|
-
}
|
|
1394
|
-
if (seconds < day) {
|
|
1395
|
-
const days = Math.floor(seconds / hour);
|
|
1396
|
-
if (days === 1) {
|
|
1397
|
-
return inOneHour();
|
|
1398
|
-
}
|
|
1399
|
-
return inSomeHours(days);
|
|
1400
|
-
}
|
|
1401
|
-
if (seconds < week) {
|
|
1402
|
-
const days = Math.floor(seconds / day);
|
|
1403
|
-
if (days === 1) {
|
|
1404
|
-
return inOneDay();
|
|
1405
|
-
}
|
|
1406
|
-
return inSomeDays(days);
|
|
1407
|
-
}
|
|
1408
|
-
if (seconds < month) {
|
|
1409
|
-
const weeks = Math.floor(seconds / week);
|
|
1410
|
-
if (weeks === 1) {
|
|
1411
|
-
return inOneWeek();
|
|
1412
|
-
}
|
|
1413
|
-
return inSomeWeeks(weeks);
|
|
1414
|
-
}
|
|
1415
|
-
if (seconds < year) {
|
|
1416
|
-
const months = Math.floor(seconds / month);
|
|
1417
|
-
if (months === 1) {
|
|
1418
|
-
return inOneMonth();
|
|
1419
|
-
}
|
|
1420
|
-
return inSomeMonths(months);
|
|
1421
|
-
}
|
|
1422
|
-
const years = Math.floor(seconds / year);
|
|
1423
|
-
if (years === 1) {
|
|
1424
|
-
return inOneYear();
|
|
1425
|
-
}
|
|
1426
|
-
return inSomeYears(years);
|
|
1504
|
+
return formatRelativeDate(seconds, ranges$1);
|
|
1427
1505
|
};
|
|
1428
1506
|
|
|
1429
1507
|
// based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
|
|
1508
|
+
const ranges = [{
|
|
1509
|
+
divisor: 1,
|
|
1510
|
+
limit: minute,
|
|
1511
|
+
one: oneSecondAgo,
|
|
1512
|
+
some: someSecondsAgo
|
|
1513
|
+
}, {
|
|
1514
|
+
divisor: minute,
|
|
1515
|
+
limit: hour,
|
|
1516
|
+
one: oneMinuteAgo,
|
|
1517
|
+
some: someMinutesAgo
|
|
1518
|
+
}, {
|
|
1519
|
+
divisor: hour,
|
|
1520
|
+
limit: day,
|
|
1521
|
+
one: oneHourAgo,
|
|
1522
|
+
some: someHoursAgo
|
|
1523
|
+
}, {
|
|
1524
|
+
divisor: day,
|
|
1525
|
+
limit: week,
|
|
1526
|
+
one: oneDayAgo,
|
|
1527
|
+
some: someDaysAgo
|
|
1528
|
+
}, {
|
|
1529
|
+
divisor: week,
|
|
1530
|
+
limit: month,
|
|
1531
|
+
one: oneWeekAgo,
|
|
1532
|
+
some: someWeeksAgo
|
|
1533
|
+
}, {
|
|
1534
|
+
divisor: month,
|
|
1535
|
+
limit: year,
|
|
1536
|
+
one: oneMonthAgo,
|
|
1537
|
+
some: someMonthsAgo
|
|
1538
|
+
}, {
|
|
1539
|
+
divisor: year,
|
|
1540
|
+
limit: Number.POSITIVE_INFINITY,
|
|
1541
|
+
one: oneYearAgo,
|
|
1542
|
+
some: someYearsAgo
|
|
1543
|
+
}];
|
|
1430
1544
|
const formatDatePast = seconds => {
|
|
1431
|
-
|
|
1432
|
-
if (seconds === 1) {
|
|
1433
|
-
return oneSecondAgo();
|
|
1434
|
-
}
|
|
1435
|
-
return someSecondsAgo(seconds);
|
|
1436
|
-
}
|
|
1437
|
-
if (seconds < hour) {
|
|
1438
|
-
const minutes = Math.floor(seconds / minute);
|
|
1439
|
-
if (minutes === 1) {
|
|
1440
|
-
return oneMinuteAgo();
|
|
1441
|
-
}
|
|
1442
|
-
return someMinutesAgo(minutes);
|
|
1443
|
-
}
|
|
1444
|
-
if (seconds < day) {
|
|
1445
|
-
const days = Math.floor(seconds / hour);
|
|
1446
|
-
if (days === 1) {
|
|
1447
|
-
return oneHourAgo();
|
|
1448
|
-
}
|
|
1449
|
-
return someHoursAgo(days);
|
|
1450
|
-
}
|
|
1451
|
-
if (seconds < week) {
|
|
1452
|
-
const days = Math.floor(seconds / day);
|
|
1453
|
-
if (days === 1) {
|
|
1454
|
-
return oneDayAgo();
|
|
1455
|
-
}
|
|
1456
|
-
return someDaysAgo(days);
|
|
1457
|
-
}
|
|
1458
|
-
if (seconds < month) {
|
|
1459
|
-
const weeks = Math.floor(seconds / week);
|
|
1460
|
-
if (weeks === 1) {
|
|
1461
|
-
return oneWeekAgo();
|
|
1462
|
-
}
|
|
1463
|
-
return someWeeksAgo(weeks);
|
|
1464
|
-
}
|
|
1465
|
-
if (seconds < year) {
|
|
1466
|
-
const months = Math.floor(seconds / month);
|
|
1467
|
-
if (months === 1) {
|
|
1468
|
-
return oneMonthAgo();
|
|
1469
|
-
}
|
|
1470
|
-
return someMonthsAgo(months);
|
|
1471
|
-
}
|
|
1472
|
-
const years = Math.floor(seconds / year);
|
|
1473
|
-
if (years === 1) {
|
|
1474
|
-
return oneYearAgo();
|
|
1475
|
-
}
|
|
1476
|
-
return someYearsAgo(years);
|
|
1545
|
+
return formatRelativeDate(seconds, ranges);
|
|
1477
1546
|
};
|
|
1478
1547
|
|
|
1479
1548
|
// based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
|
|
@@ -1532,9 +1601,9 @@ const loadContent2 = state => {
|
|
|
1532
1601
|
const lines = getDetailStringWeb();
|
|
1533
1602
|
return {
|
|
1534
1603
|
...state,
|
|
1535
|
-
|
|
1604
|
+
focusId: Ok$2,
|
|
1536
1605
|
lines,
|
|
1537
|
-
|
|
1606
|
+
productName: productNameLong$1
|
|
1538
1607
|
};
|
|
1539
1608
|
};
|
|
1540
1609
|
|
|
@@ -1562,16 +1631,16 @@ const createViewModel = state => {
|
|
|
1562
1631
|
const closeMessage = closeDialog();
|
|
1563
1632
|
const infoMessage = info();
|
|
1564
1633
|
const {
|
|
1565
|
-
|
|
1566
|
-
|
|
1634
|
+
lines,
|
|
1635
|
+
productName
|
|
1567
1636
|
} = state;
|
|
1568
1637
|
return {
|
|
1569
|
-
productName,
|
|
1570
|
-
lines,
|
|
1571
1638
|
closeMessage,
|
|
1572
|
-
okMessage,
|
|
1573
1639
|
copyMessage,
|
|
1574
|
-
infoMessage
|
|
1640
|
+
infoMessage,
|
|
1641
|
+
lines,
|
|
1642
|
+
okMessage,
|
|
1643
|
+
productName
|
|
1575
1644
|
};
|
|
1576
1645
|
};
|
|
1577
1646
|
|
|
@@ -1600,8 +1669,8 @@ const HandleContextMenu = 5;
|
|
|
1600
1669
|
const HandleFocusIn = 6;
|
|
1601
1670
|
|
|
1602
1671
|
const br = {
|
|
1603
|
-
|
|
1604
|
-
|
|
1672
|
+
childCount: 0,
|
|
1673
|
+
type: Br
|
|
1605
1674
|
};
|
|
1606
1675
|
const renderLine = (line, index) => {
|
|
1607
1676
|
if (index === 0) {
|
|
@@ -1612,9 +1681,9 @@ const renderLine = (line, index) => {
|
|
|
1612
1681
|
|
|
1613
1682
|
const getAboutContentVirtualDom = lines => {
|
|
1614
1683
|
const dom = [{
|
|
1615
|
-
|
|
1684
|
+
childCount: lines.length * 2 - 1,
|
|
1616
1685
|
className: DialogMessage,
|
|
1617
|
-
|
|
1686
|
+
type: Div
|
|
1618
1687
|
}, ...lines.flatMap(renderLine)];
|
|
1619
1688
|
return dom;
|
|
1620
1689
|
};
|
|
@@ -1626,21 +1695,21 @@ const Dialog = 'dialog';
|
|
|
1626
1695
|
|
|
1627
1696
|
const getPrimaryButtonVirtualDom = (message, name) => {
|
|
1628
1697
|
return [{
|
|
1629
|
-
|
|
1698
|
+
childCount: 1,
|
|
1630
1699
|
className: mergeClassNames(Button$1, ButtonPrimary),
|
|
1700
|
+
name,
|
|
1631
1701
|
onClick: HandleClickButton,
|
|
1632
|
-
|
|
1633
|
-
name
|
|
1702
|
+
type: Button$2
|
|
1634
1703
|
}, text(message)];
|
|
1635
1704
|
};
|
|
1636
1705
|
|
|
1637
1706
|
const getSecondaryButtonVirtualDom = (message, name) => {
|
|
1638
1707
|
return [{
|
|
1639
|
-
|
|
1708
|
+
childCount: 1,
|
|
1640
1709
|
className: mergeClassNames(Button$1, ButtonSecondary),
|
|
1710
|
+
name,
|
|
1641
1711
|
onClick: HandleClickButton,
|
|
1642
|
-
|
|
1643
|
-
name
|
|
1712
|
+
type: Button$2
|
|
1644
1713
|
}, text(message)];
|
|
1645
1714
|
};
|
|
1646
1715
|
|
|
@@ -1655,52 +1724,52 @@ const Focusable = -1;
|
|
|
1655
1724
|
|
|
1656
1725
|
const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copyMessage, productName) => {
|
|
1657
1726
|
const dom = [{
|
|
1658
|
-
type: Div,
|
|
1659
|
-
className: DialogContent,
|
|
1660
|
-
tabIndex: Focusable,
|
|
1661
|
-
role: Dialog,
|
|
1662
|
-
ariaModal: True,
|
|
1663
1727
|
ariaLabelledBy: joinBySpace(DialogIcon, DialogHeading),
|
|
1728
|
+
ariaModal: True,
|
|
1729
|
+
childCount: 3,
|
|
1730
|
+
className: DialogContent,
|
|
1664
1731
|
onFocusIn: HandleFocusIn,
|
|
1665
|
-
|
|
1732
|
+
role: Dialog,
|
|
1733
|
+
tabIndex: Focusable,
|
|
1734
|
+
type: Div
|
|
1666
1735
|
}, {
|
|
1667
|
-
|
|
1736
|
+
childCount: 1,
|
|
1668
1737
|
className: DialogToolBarRow,
|
|
1669
|
-
|
|
1738
|
+
type: Div
|
|
1670
1739
|
}, {
|
|
1671
|
-
type: Div,
|
|
1672
|
-
className: DialogClose,
|
|
1673
1740
|
ariaLabel: closeMessage,
|
|
1674
|
-
|
|
1741
|
+
childCount: 1,
|
|
1742
|
+
className: DialogClose,
|
|
1675
1743
|
onClick: HandleClickClose,
|
|
1676
|
-
|
|
1744
|
+
role: Button,
|
|
1745
|
+
type: Div
|
|
1677
1746
|
}, {
|
|
1678
|
-
|
|
1747
|
+
childCount: 0,
|
|
1679
1748
|
className: mergeClassNames(MaskIcon, MaskIconClose),
|
|
1680
|
-
|
|
1749
|
+
type: Div
|
|
1681
1750
|
}, {
|
|
1682
|
-
|
|
1751
|
+
childCount: 2,
|
|
1683
1752
|
className: DialogMessageRow,
|
|
1684
|
-
|
|
1753
|
+
type: Div
|
|
1685
1754
|
}, {
|
|
1686
|
-
|
|
1755
|
+
ariaLabel: infoMessage,
|
|
1756
|
+
childCount: 0,
|
|
1687
1757
|
className: mergeClassNames(DialogIcon$1, DialogInfoIcon, MaskIcon, MaskIconInfo),
|
|
1688
1758
|
id: DialogIcon,
|
|
1689
|
-
|
|
1690
|
-
childCount: 0
|
|
1759
|
+
type: Div
|
|
1691
1760
|
}, {
|
|
1692
|
-
|
|
1761
|
+
childCount: 2,
|
|
1693
1762
|
className: DialogContentRight,
|
|
1694
|
-
|
|
1763
|
+
type: Div
|
|
1695
1764
|
}, {
|
|
1696
|
-
|
|
1697
|
-
id: DialogHeading,
|
|
1765
|
+
childCount: 1,
|
|
1698
1766
|
className: DialogHeading$1,
|
|
1699
|
-
|
|
1767
|
+
id: DialogHeading,
|
|
1768
|
+
type: Div
|
|
1700
1769
|
}, text(productName), ...content, {
|
|
1701
|
-
|
|
1770
|
+
childCount: 2,
|
|
1702
1771
|
className: DialogButtonsRow,
|
|
1703
|
-
|
|
1772
|
+
type: Div
|
|
1704
1773
|
}, ...getSecondaryButtonVirtualDom(okMessage, Ok$1), ...getPrimaryButtonVirtualDom(copyMessage, Copy$1)];
|
|
1705
1774
|
return dom;
|
|
1706
1775
|
};
|
|
@@ -1708,10 +1777,10 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
|
|
|
1708
1777
|
const getAboutVirtualDom = (productName, lines, closeMessage, okMessage, copyMessage, infoMessage) => {
|
|
1709
1778
|
const content = getAboutContentVirtualDom(lines);
|
|
1710
1779
|
return [{
|
|
1711
|
-
|
|
1780
|
+
childCount: 1,
|
|
1712
1781
|
className: mergeClassNames(Viewlet, About),
|
|
1713
1782
|
onContextMenu: HandleContextMenu,
|
|
1714
|
-
|
|
1783
|
+
type: Div
|
|
1715
1784
|
}, ...getDialogVirtualDom(content, closeMessage, infoMessage, okMessage, copyMessage, productName)];
|
|
1716
1785
|
};
|
|
1717
1786
|
|
|
@@ -1765,8 +1834,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
1765
1834
|
|
|
1766
1835
|
const doRender = (uid, diffResult) => {
|
|
1767
1836
|
const {
|
|
1768
|
-
|
|
1769
|
-
|
|
1837
|
+
newState,
|
|
1838
|
+
oldState
|
|
1770
1839
|
} = get(uid);
|
|
1771
1840
|
set(uid, newState, newState);
|
|
1772
1841
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -1830,11 +1899,11 @@ const showAboutElectron = async () => {
|
|
|
1830
1899
|
const detail = await getDetailString();
|
|
1831
1900
|
const productNameLong = getProductNameLong();
|
|
1832
1901
|
const options = {
|
|
1833
|
-
windowId,
|
|
1834
|
-
message: productNameLong,
|
|
1835
1902
|
buttons: [copy(), ok()],
|
|
1903
|
+
detail,
|
|
1904
|
+
message: productNameLong,
|
|
1836
1905
|
type: Info,
|
|
1837
|
-
|
|
1906
|
+
windowId
|
|
1838
1907
|
};
|
|
1839
1908
|
const index = await showMessageBox(options);
|
|
1840
1909
|
switch (index) {
|
|
@@ -1880,7 +1949,7 @@ const commandMap = {
|
|
|
1880
1949
|
|
|
1881
1950
|
const listen = async () => {
|
|
1882
1951
|
registerCommands(commandMap);
|
|
1883
|
-
const rpc = await
|
|
1952
|
+
const rpc = await create$3({
|
|
1884
1953
|
commandMap: commandMap
|
|
1885
1954
|
});
|
|
1886
1955
|
set$1(rpc);
|