@lvce-editor/about-view 6.1.0 → 7.1.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 +202 -220
- 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,14 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
|
369
369
|
wrap: wrap$e
|
|
370
370
|
};
|
|
371
371
|
|
|
372
|
-
const Two = '2.0';
|
|
373
|
-
const create$4 = (method, params) => {
|
|
374
|
-
return {
|
|
375
|
-
jsonrpc: Two,
|
|
376
|
-
method,
|
|
377
|
-
params
|
|
378
|
-
};
|
|
379
|
-
};
|
|
372
|
+
const Two$1 = '2.0';
|
|
380
373
|
const callbacks = Object.create(null);
|
|
381
|
-
const set$3 = (id, fn) => {
|
|
382
|
-
callbacks[id] = fn;
|
|
383
|
-
};
|
|
384
374
|
const get$2 = id => {
|
|
385
375
|
return callbacks[id];
|
|
386
376
|
};
|
|
387
377
|
const remove = id => {
|
|
388
378
|
delete callbacks[id];
|
|
389
379
|
};
|
|
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
380
|
class JsonRpcError extends Error {
|
|
423
381
|
constructor(message) {
|
|
424
382
|
super(message);
|
|
@@ -612,9 +570,9 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
612
570
|
}
|
|
613
571
|
};
|
|
614
572
|
};
|
|
615
|
-
const create$1$
|
|
573
|
+
const create$1$2 = (id, error) => {
|
|
616
574
|
return {
|
|
617
|
-
jsonrpc: Two,
|
|
575
|
+
jsonrpc: Two$1,
|
|
618
576
|
id,
|
|
619
577
|
error
|
|
620
578
|
};
|
|
@@ -623,22 +581,22 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
623
581
|
const prettyError = preparePrettyError(error);
|
|
624
582
|
logError(error, prettyError);
|
|
625
583
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
626
|
-
return create$1$
|
|
584
|
+
return create$1$2(id, errorProperty);
|
|
627
585
|
};
|
|
628
|
-
const create$
|
|
586
|
+
const create$3 = (message, result) => {
|
|
629
587
|
return {
|
|
630
|
-
jsonrpc: Two,
|
|
588
|
+
jsonrpc: Two$1,
|
|
631
589
|
id: message.id,
|
|
632
590
|
result: result ?? null
|
|
633
591
|
};
|
|
634
592
|
};
|
|
635
593
|
const getSuccessResponse = (message, result) => {
|
|
636
594
|
const resultProperty = result ?? null;
|
|
637
|
-
return create$
|
|
595
|
+
return create$3(message, resultProperty);
|
|
638
596
|
};
|
|
639
597
|
const getErrorResponseSimple = (id, error) => {
|
|
640
598
|
return {
|
|
641
|
-
jsonrpc: Two,
|
|
599
|
+
jsonrpc: Two$1,
|
|
642
600
|
id,
|
|
643
601
|
error: {
|
|
644
602
|
code: Custom,
|
|
@@ -725,29 +683,6 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
725
683
|
}
|
|
726
684
|
throw new JsonRpcError('unexpected message');
|
|
727
685
|
};
|
|
728
|
-
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
729
|
-
const {
|
|
730
|
-
message,
|
|
731
|
-
promise
|
|
732
|
-
} = create$2$1(method, params);
|
|
733
|
-
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
734
|
-
ipc.sendAndTransfer(message);
|
|
735
|
-
} else {
|
|
736
|
-
ipc.send(message);
|
|
737
|
-
}
|
|
738
|
-
const responseMessage = await promise;
|
|
739
|
-
return unwrapJsonRpcResult(responseMessage);
|
|
740
|
-
};
|
|
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
686
|
|
|
752
687
|
class CommandNotFoundError extends Error {
|
|
753
688
|
constructor(command) {
|
|
@@ -770,24 +705,87 @@ const execute = (command, ...args) => {
|
|
|
770
705
|
return fn(...args);
|
|
771
706
|
};
|
|
772
707
|
|
|
708
|
+
const Two = '2.0';
|
|
709
|
+
const create$o = (method, params) => {
|
|
710
|
+
return {
|
|
711
|
+
jsonrpc: Two,
|
|
712
|
+
method,
|
|
713
|
+
params
|
|
714
|
+
};
|
|
715
|
+
};
|
|
716
|
+
const create$n = (id, method, params) => {
|
|
717
|
+
const message = {
|
|
718
|
+
id,
|
|
719
|
+
jsonrpc: Two,
|
|
720
|
+
method,
|
|
721
|
+
params
|
|
722
|
+
};
|
|
723
|
+
return message;
|
|
724
|
+
};
|
|
725
|
+
let id = 0;
|
|
726
|
+
const create$m = () => {
|
|
727
|
+
return ++id;
|
|
728
|
+
};
|
|
729
|
+
|
|
730
|
+
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
731
|
+
|
|
732
|
+
const registerPromise = map => {
|
|
733
|
+
const id = create$m();
|
|
734
|
+
const {
|
|
735
|
+
promise,
|
|
736
|
+
resolve
|
|
737
|
+
} = Promise.withResolvers();
|
|
738
|
+
map[id] = resolve;
|
|
739
|
+
return {
|
|
740
|
+
id,
|
|
741
|
+
promise
|
|
742
|
+
};
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
// @ts-ignore
|
|
746
|
+
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
747
|
+
const {
|
|
748
|
+
id,
|
|
749
|
+
promise
|
|
750
|
+
} = registerPromise(callbacks);
|
|
751
|
+
const message = create$n(id, method, params);
|
|
752
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
753
|
+
ipc.sendAndTransfer(message);
|
|
754
|
+
} else {
|
|
755
|
+
ipc.send(message);
|
|
756
|
+
}
|
|
757
|
+
const responseMessage = await promise;
|
|
758
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
759
|
+
};
|
|
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$o(method, params);
|
|
788
|
+
ipc.send(message);
|
|
791
789
|
}
|
|
792
790
|
};
|
|
793
791
|
return rpc;
|
|
@@ -804,7 +802,7 @@ const logError = () => {
|
|
|
804
802
|
const handleMessage = event => {
|
|
805
803
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
806
804
|
const actualExecute = event?.target?.execute || execute;
|
|
807
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute,
|
|
805
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
808
806
|
};
|
|
809
807
|
const handleIpc = ipc => {
|
|
810
808
|
if ('addEventListener' in ipc) {
|
|
@@ -822,7 +820,7 @@ const listen$1 = async (module, options) => {
|
|
|
822
820
|
const ipc = module.wrap(rawIpc);
|
|
823
821
|
return ipc;
|
|
824
822
|
};
|
|
825
|
-
const create$
|
|
823
|
+
const create$1$1 = async ({
|
|
826
824
|
commandMap
|
|
827
825
|
}) => {
|
|
828
826
|
// TODO create a commandMap per rpc instance
|
|
@@ -834,18 +832,10 @@ const create$3 = async ({
|
|
|
834
832
|
};
|
|
835
833
|
const WebWorkerRpcClient = {
|
|
836
834
|
__proto__: null,
|
|
837
|
-
create: create$
|
|
835
|
+
create: create$1$1
|
|
838
836
|
};
|
|
839
837
|
|
|
840
|
-
const
|
|
841
|
-
const Div = 4;
|
|
842
|
-
const Text = 12;
|
|
843
|
-
const Br = 55;
|
|
844
|
-
|
|
845
|
-
const Tab = 2;
|
|
846
|
-
const Escape = 8;
|
|
847
|
-
|
|
848
|
-
const Shift = 1 << 10 >>> 0;
|
|
838
|
+
const TargetName = 'event.target.name';
|
|
849
839
|
|
|
850
840
|
const RendererWorker = 1;
|
|
851
841
|
|
|
@@ -859,6 +849,10 @@ const get$1 = id => {
|
|
|
859
849
|
|
|
860
850
|
const create$2 = rpcId => {
|
|
861
851
|
return {
|
|
852
|
+
async dispose() {
|
|
853
|
+
const rpc = get$1(rpcId);
|
|
854
|
+
await rpc.dispose();
|
|
855
|
+
},
|
|
862
856
|
// @ts-ignore
|
|
863
857
|
invoke(method, ...params) {
|
|
864
858
|
const rpc = get$1(rpcId);
|
|
@@ -873,17 +867,14 @@ const create$2 = rpcId => {
|
|
|
873
867
|
},
|
|
874
868
|
set(rpc) {
|
|
875
869
|
set$2(rpcId, rpc);
|
|
876
|
-
},
|
|
877
|
-
async dispose() {
|
|
878
|
-
const rpc = get$1(rpcId);
|
|
879
|
-
await rpc.dispose();
|
|
880
870
|
}
|
|
881
871
|
};
|
|
882
872
|
};
|
|
883
873
|
|
|
884
874
|
const {
|
|
885
875
|
invoke,
|
|
886
|
-
set: set$1
|
|
876
|
+
set: set$1
|
|
877
|
+
} = create$2(RendererWorker);
|
|
887
878
|
const getElectronVersion$1 = async () => {
|
|
888
879
|
return invoke('Process.getElectronVersion');
|
|
889
880
|
};
|
|
@@ -948,10 +939,11 @@ const create$1 = () => {
|
|
|
948
939
|
wrapCommand(fn) {
|
|
949
940
|
const wrapped = async (uid, ...args) => {
|
|
950
941
|
const {
|
|
942
|
+
oldState,
|
|
951
943
|
newState
|
|
952
944
|
} = states[uid];
|
|
953
945
|
const newerState = await fn(newState, ...args);
|
|
954
|
-
if (newState === newerState) {
|
|
946
|
+
if (oldState === newerState || newState === newerState) {
|
|
955
947
|
return;
|
|
956
948
|
}
|
|
957
949
|
const latest = states[uid];
|
|
@@ -997,20 +989,20 @@ const create$1 = () => {
|
|
|
997
989
|
};
|
|
998
990
|
|
|
999
991
|
const {
|
|
1000
|
-
get,
|
|
1001
|
-
set,
|
|
1002
992
|
dispose: dispose$1,
|
|
1003
|
-
|
|
993
|
+
get,
|
|
994
|
+
getCommandIds,
|
|
1004
995
|
registerCommands,
|
|
1005
|
-
|
|
996
|
+
set,
|
|
997
|
+
wrapCommand
|
|
1006
998
|
} = create$1();
|
|
1007
999
|
|
|
1008
1000
|
const create = uid => {
|
|
1009
1001
|
const state = {
|
|
1010
|
-
uid,
|
|
1011
1002
|
focusId: 0,
|
|
1012
1003
|
lines: [],
|
|
1013
|
-
productName: ''
|
|
1004
|
+
productName: '',
|
|
1005
|
+
uid
|
|
1014
1006
|
};
|
|
1015
1007
|
set(uid, state, state);
|
|
1016
1008
|
};
|
|
@@ -1050,8 +1042,8 @@ const diff = (oldState, newState) => {
|
|
|
1050
1042
|
|
|
1051
1043
|
const diff2 = uid => {
|
|
1052
1044
|
const {
|
|
1053
|
-
|
|
1054
|
-
|
|
1045
|
+
newState,
|
|
1046
|
+
oldState
|
|
1055
1047
|
} = get(uid);
|
|
1056
1048
|
const diffResult = diff(oldState, newState);
|
|
1057
1049
|
return diffResult;
|
|
@@ -1067,10 +1059,10 @@ const Copy$2 = 2;
|
|
|
1067
1059
|
|
|
1068
1060
|
const getNextFocus = focusId => {
|
|
1069
1061
|
switch (focusId) {
|
|
1070
|
-
case Ok$2:
|
|
1071
|
-
return Copy$2;
|
|
1072
1062
|
case Copy$2:
|
|
1073
1063
|
return Ok$2;
|
|
1064
|
+
case Ok$2:
|
|
1065
|
+
return Copy$2;
|
|
1074
1066
|
default:
|
|
1075
1067
|
return None;
|
|
1076
1068
|
}
|
|
@@ -1088,10 +1080,10 @@ const focusNext = state => {
|
|
|
1088
1080
|
|
|
1089
1081
|
const getPreviousFocus = focusId => {
|
|
1090
1082
|
switch (focusId) {
|
|
1091
|
-
case Ok$2:
|
|
1092
|
-
return Copy$2;
|
|
1093
1083
|
case Copy$2:
|
|
1094
1084
|
return Ok$2;
|
|
1085
|
+
case Ok$2:
|
|
1086
|
+
return Copy$2;
|
|
1095
1087
|
default:
|
|
1096
1088
|
return None;
|
|
1097
1089
|
}
|
|
@@ -1107,6 +1099,16 @@ const focusPrevious = state => {
|
|
|
1107
1099
|
};
|
|
1108
1100
|
};
|
|
1109
1101
|
|
|
1102
|
+
const Button$2 = 1;
|
|
1103
|
+
const Div = 4;
|
|
1104
|
+
const Text = 12;
|
|
1105
|
+
const Br = 55;
|
|
1106
|
+
|
|
1107
|
+
const Tab = 2;
|
|
1108
|
+
const Escape = 8;
|
|
1109
|
+
|
|
1110
|
+
const Shift = 1 << 10 >>> 0;
|
|
1111
|
+
|
|
1110
1112
|
const mergeClassNames = (...classNames) => {
|
|
1111
1113
|
return classNames.filter(Boolean).join(' ');
|
|
1112
1114
|
};
|
|
@@ -1123,16 +1125,16 @@ const FocusAbout = 4;
|
|
|
1123
1125
|
|
|
1124
1126
|
const getKeyBindings = () => {
|
|
1125
1127
|
return [{
|
|
1126
|
-
key: Escape,
|
|
1127
1128
|
command: 'About.handleClickClose',
|
|
1129
|
+
key: Escape,
|
|
1128
1130
|
when: FocusAbout
|
|
1129
1131
|
}, {
|
|
1130
|
-
key: Tab,
|
|
1131
1132
|
command: 'About.focusNext',
|
|
1133
|
+
key: Tab,
|
|
1132
1134
|
when: FocusAbout
|
|
1133
1135
|
}, {
|
|
1134
|
-
key: Tab | Shift,
|
|
1135
1136
|
command: 'About.focusPrevious',
|
|
1137
|
+
key: Tab | Shift,
|
|
1136
1138
|
when: FocusAbout
|
|
1137
1139
|
}];
|
|
1138
1140
|
};
|
|
@@ -1185,12 +1187,12 @@ const Close = 'Close';
|
|
|
1185
1187
|
|
|
1186
1188
|
const handleClickButton = async (state, name) => {
|
|
1187
1189
|
switch (name) {
|
|
1190
|
+
case Close:
|
|
1191
|
+
return handleClickClose(state);
|
|
1188
1192
|
case Copy$1:
|
|
1189
1193
|
return handleClickCopy(state);
|
|
1190
1194
|
case Ok$1:
|
|
1191
1195
|
return handleClickOk(state);
|
|
1192
|
-
case Close:
|
|
1193
|
-
return handleClickClose(state);
|
|
1194
1196
|
default:
|
|
1195
1197
|
throw new Error(`unexpected button`);
|
|
1196
1198
|
}
|
|
@@ -1208,6 +1210,10 @@ const handleFocusIn = async state => {
|
|
|
1208
1210
|
};
|
|
1209
1211
|
};
|
|
1210
1212
|
|
|
1213
|
+
const commit = 'unknown commit';
|
|
1214
|
+
|
|
1215
|
+
const commitDate = '';
|
|
1216
|
+
|
|
1211
1217
|
const OneSecondAgo = '1 second ago';
|
|
1212
1218
|
const SomeSecondsAgo = '{PH1} seconds ago';
|
|
1213
1219
|
const OneMinuteAgo = '1 minute ago';
|
|
@@ -1498,8 +1504,15 @@ const getBrowser = () => {
|
|
|
1498
1504
|
};
|
|
1499
1505
|
|
|
1500
1506
|
const version = '0.0.0-dev';
|
|
1501
|
-
|
|
1502
|
-
const
|
|
1507
|
+
|
|
1508
|
+
const getDetailStringWeb = () => {
|
|
1509
|
+
const now = Date.now();
|
|
1510
|
+
const formattedDate = formatAboutDate(commitDate, now);
|
|
1511
|
+
const browser = getBrowser();
|
|
1512
|
+
const lines = [`Version: ${version}`, `Commit: ${commit}`, `Date: ${formattedDate}`, `Browser: ${browser}`];
|
|
1513
|
+
return lines;
|
|
1514
|
+
};
|
|
1515
|
+
|
|
1503
1516
|
const getElectronVersion = getElectronVersion$1;
|
|
1504
1517
|
const getNodeVersion = getNodeVersion$1;
|
|
1505
1518
|
const getChromeVersion = getChromeVersion$1;
|
|
@@ -1511,50 +1524,18 @@ const getCommit = () => {
|
|
|
1511
1524
|
};
|
|
1512
1525
|
const getV8Version = getV8Version$1;
|
|
1513
1526
|
const getDate = () => {
|
|
1514
|
-
return
|
|
1527
|
+
return commitDate;
|
|
1515
1528
|
};
|
|
1516
1529
|
const productNameLong$1 = 'Lvce Editor - OSS';
|
|
1517
1530
|
|
|
1518
|
-
const
|
|
1519
|
-
__proto__: null,
|
|
1520
|
-
commit,
|
|
1521
|
-
date,
|
|
1522
|
-
getChromeVersion,
|
|
1523
|
-
getCommit,
|
|
1524
|
-
getDate,
|
|
1525
|
-
getElectronVersion,
|
|
1526
|
-
getNodeVersion,
|
|
1527
|
-
getV8Version,
|
|
1528
|
-
getVersion,
|
|
1529
|
-
productNameLong: productNameLong$1,
|
|
1530
|
-
version
|
|
1531
|
-
};
|
|
1532
|
-
|
|
1533
|
-
const getDetailStringWeb = () => {
|
|
1534
|
-
const {
|
|
1535
|
-
date,
|
|
1536
|
-
commit,
|
|
1537
|
-
version
|
|
1538
|
-
} = Process;
|
|
1539
|
-
const now = Date.now();
|
|
1540
|
-
const formattedDate = formatAboutDate(date, now);
|
|
1541
|
-
const browser = getBrowser();
|
|
1542
|
-
const lines = [`Version: ${version}`, `Commit: ${commit}`, `Date: ${formattedDate}`, `Browser: ${browser}`];
|
|
1543
|
-
return lines;
|
|
1544
|
-
};
|
|
1545
|
-
|
|
1546
|
-
const loadContent2 = uid => {
|
|
1531
|
+
const loadContent2 = state => {
|
|
1547
1532
|
const lines = getDetailStringWeb();
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
const newState = {
|
|
1552
|
-
...oldState,
|
|
1553
|
-
productName: productNameLong$1,
|
|
1533
|
+
return {
|
|
1534
|
+
...state,
|
|
1535
|
+
focusId: Ok$2,
|
|
1554
1536
|
lines,
|
|
1555
|
-
|
|
1537
|
+
productName: productNameLong$1
|
|
1556
1538
|
};
|
|
1557
|
-
set(uid, oldState, newState);
|
|
1558
1539
|
};
|
|
1559
1540
|
|
|
1560
1541
|
const Ok = 'Ok';
|
|
@@ -1581,16 +1562,16 @@ const createViewModel = state => {
|
|
|
1581
1562
|
const closeMessage = closeDialog();
|
|
1582
1563
|
const infoMessage = info();
|
|
1583
1564
|
const {
|
|
1584
|
-
|
|
1585
|
-
|
|
1565
|
+
lines,
|
|
1566
|
+
productName
|
|
1586
1567
|
} = state;
|
|
1587
1568
|
return {
|
|
1588
|
-
productName,
|
|
1589
|
-
lines,
|
|
1590
1569
|
closeMessage,
|
|
1591
|
-
okMessage,
|
|
1592
1570
|
copyMessage,
|
|
1593
|
-
infoMessage
|
|
1571
|
+
infoMessage,
|
|
1572
|
+
lines,
|
|
1573
|
+
okMessage,
|
|
1574
|
+
productName
|
|
1594
1575
|
};
|
|
1595
1576
|
};
|
|
1596
1577
|
|
|
@@ -1619,8 +1600,8 @@ const HandleContextMenu = 5;
|
|
|
1619
1600
|
const HandleFocusIn = 6;
|
|
1620
1601
|
|
|
1621
1602
|
const br = {
|
|
1622
|
-
|
|
1623
|
-
|
|
1603
|
+
childCount: 0,
|
|
1604
|
+
type: Br
|
|
1624
1605
|
};
|
|
1625
1606
|
const renderLine = (line, index) => {
|
|
1626
1607
|
if (index === 0) {
|
|
@@ -1631,9 +1612,9 @@ const renderLine = (line, index) => {
|
|
|
1631
1612
|
|
|
1632
1613
|
const getAboutContentVirtualDom = lines => {
|
|
1633
1614
|
const dom = [{
|
|
1634
|
-
|
|
1615
|
+
childCount: lines.length * 2 - 1,
|
|
1635
1616
|
className: DialogMessage,
|
|
1636
|
-
|
|
1617
|
+
type: Div
|
|
1637
1618
|
}, ...lines.flatMap(renderLine)];
|
|
1638
1619
|
return dom;
|
|
1639
1620
|
};
|
|
@@ -1645,21 +1626,21 @@ const Dialog = 'dialog';
|
|
|
1645
1626
|
|
|
1646
1627
|
const getPrimaryButtonVirtualDom = (message, name) => {
|
|
1647
1628
|
return [{
|
|
1648
|
-
|
|
1629
|
+
childCount: 1,
|
|
1649
1630
|
className: mergeClassNames(Button$1, ButtonPrimary),
|
|
1631
|
+
name,
|
|
1650
1632
|
onClick: HandleClickButton,
|
|
1651
|
-
|
|
1652
|
-
name
|
|
1633
|
+
type: Button$2
|
|
1653
1634
|
}, text(message)];
|
|
1654
1635
|
};
|
|
1655
1636
|
|
|
1656
1637
|
const getSecondaryButtonVirtualDom = (message, name) => {
|
|
1657
1638
|
return [{
|
|
1658
|
-
|
|
1639
|
+
childCount: 1,
|
|
1659
1640
|
className: mergeClassNames(Button$1, ButtonSecondary),
|
|
1641
|
+
name,
|
|
1660
1642
|
onClick: HandleClickButton,
|
|
1661
|
-
|
|
1662
|
-
name
|
|
1643
|
+
type: Button$2
|
|
1663
1644
|
}, text(message)];
|
|
1664
1645
|
};
|
|
1665
1646
|
|
|
@@ -1674,52 +1655,52 @@ const Focusable = -1;
|
|
|
1674
1655
|
|
|
1675
1656
|
const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copyMessage, productName) => {
|
|
1676
1657
|
const dom = [{
|
|
1677
|
-
type: Div,
|
|
1678
|
-
className: DialogContent,
|
|
1679
|
-
tabIndex: Focusable,
|
|
1680
|
-
role: Dialog,
|
|
1681
|
-
ariaModal: True,
|
|
1682
1658
|
ariaLabelledBy: joinBySpace(DialogIcon, DialogHeading),
|
|
1659
|
+
ariaModal: True,
|
|
1660
|
+
childCount: 3,
|
|
1661
|
+
className: DialogContent,
|
|
1683
1662
|
onFocusIn: HandleFocusIn,
|
|
1684
|
-
|
|
1663
|
+
role: Dialog,
|
|
1664
|
+
tabIndex: Focusable,
|
|
1665
|
+
type: Div
|
|
1685
1666
|
}, {
|
|
1686
|
-
|
|
1667
|
+
childCount: 1,
|
|
1687
1668
|
className: DialogToolBarRow,
|
|
1688
|
-
|
|
1669
|
+
type: Div
|
|
1689
1670
|
}, {
|
|
1690
|
-
type: Div,
|
|
1691
|
-
className: DialogClose,
|
|
1692
1671
|
ariaLabel: closeMessage,
|
|
1693
|
-
|
|
1672
|
+
childCount: 1,
|
|
1673
|
+
className: DialogClose,
|
|
1694
1674
|
onClick: HandleClickClose,
|
|
1695
|
-
|
|
1675
|
+
role: Button,
|
|
1676
|
+
type: Div
|
|
1696
1677
|
}, {
|
|
1697
|
-
|
|
1678
|
+
childCount: 0,
|
|
1698
1679
|
className: mergeClassNames(MaskIcon, MaskIconClose),
|
|
1699
|
-
|
|
1680
|
+
type: Div
|
|
1700
1681
|
}, {
|
|
1701
|
-
|
|
1682
|
+
childCount: 2,
|
|
1702
1683
|
className: DialogMessageRow,
|
|
1703
|
-
|
|
1684
|
+
type: Div
|
|
1704
1685
|
}, {
|
|
1705
|
-
|
|
1686
|
+
ariaLabel: infoMessage,
|
|
1687
|
+
childCount: 0,
|
|
1706
1688
|
className: mergeClassNames(DialogIcon$1, DialogInfoIcon, MaskIcon, MaskIconInfo),
|
|
1707
1689
|
id: DialogIcon,
|
|
1708
|
-
|
|
1709
|
-
childCount: 0
|
|
1690
|
+
type: Div
|
|
1710
1691
|
}, {
|
|
1711
|
-
|
|
1692
|
+
childCount: 2,
|
|
1712
1693
|
className: DialogContentRight,
|
|
1713
|
-
|
|
1694
|
+
type: Div
|
|
1714
1695
|
}, {
|
|
1715
|
-
|
|
1716
|
-
id: DialogHeading,
|
|
1696
|
+
childCount: 1,
|
|
1717
1697
|
className: DialogHeading$1,
|
|
1718
|
-
|
|
1698
|
+
id: DialogHeading,
|
|
1699
|
+
type: Div
|
|
1719
1700
|
}, text(productName), ...content, {
|
|
1720
|
-
|
|
1701
|
+
childCount: 2,
|
|
1721
1702
|
className: DialogButtonsRow,
|
|
1722
|
-
|
|
1703
|
+
type: Div
|
|
1723
1704
|
}, ...getSecondaryButtonVirtualDom(okMessage, Ok$1), ...getPrimaryButtonVirtualDom(copyMessage, Copy$1)];
|
|
1724
1705
|
return dom;
|
|
1725
1706
|
};
|
|
@@ -1727,10 +1708,10 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
|
|
|
1727
1708
|
const getAboutVirtualDom = (productName, lines, closeMessage, okMessage, copyMessage, infoMessage) => {
|
|
1728
1709
|
const content = getAboutContentVirtualDom(lines);
|
|
1729
1710
|
return [{
|
|
1730
|
-
|
|
1711
|
+
childCount: 1,
|
|
1731
1712
|
className: mergeClassNames(Viewlet, About),
|
|
1732
1713
|
onContextMenu: HandleContextMenu,
|
|
1733
|
-
|
|
1714
|
+
type: Div
|
|
1734
1715
|
}, ...getDialogVirtualDom(content, closeMessage, infoMessage, okMessage, copyMessage, productName)];
|
|
1735
1716
|
};
|
|
1736
1717
|
|
|
@@ -1784,8 +1765,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
1784
1765
|
|
|
1785
1766
|
const doRender = (uid, diffResult) => {
|
|
1786
1767
|
const {
|
|
1787
|
-
|
|
1788
|
-
|
|
1768
|
+
newState,
|
|
1769
|
+
oldState
|
|
1789
1770
|
} = get(uid);
|
|
1790
1771
|
set(uid, newState, newState);
|
|
1791
1772
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -1795,7 +1776,7 @@ const doRender = (uid, diffResult) => {
|
|
|
1795
1776
|
const renderEventListeners = () => {
|
|
1796
1777
|
return [{
|
|
1797
1778
|
name: HandleClickButton,
|
|
1798
|
-
params: ['handleClickButton',
|
|
1779
|
+
params: ['handleClickButton', TargetName]
|
|
1799
1780
|
}, {
|
|
1800
1781
|
name: HandleClickClose,
|
|
1801
1782
|
params: ['handleClickClose'] // TODO
|
|
@@ -1835,6 +1816,7 @@ const showMessageBox = async options => {
|
|
|
1835
1816
|
|
|
1836
1817
|
const Info = 'info';
|
|
1837
1818
|
|
|
1819
|
+
/* eslint-disable @typescript-eslint/await-thenable */
|
|
1838
1820
|
const getDetailString = async () => {
|
|
1839
1821
|
const [electronVersion, nodeVersion, chromeVersion, version, commit, v8Version, date] = await Promise.all([getElectronVersion(), getNodeVersion(), getChromeVersion(), getVersion(), getCommit(), getV8Version(), getDate()]);
|
|
1840
1822
|
const now = Date.now();
|
|
@@ -1848,11 +1830,11 @@ const showAboutElectron = async () => {
|
|
|
1848
1830
|
const detail = await getDetailString();
|
|
1849
1831
|
const productNameLong = getProductNameLong();
|
|
1850
1832
|
const options = {
|
|
1851
|
-
windowId,
|
|
1852
|
-
message: productNameLong,
|
|
1853
1833
|
buttons: [copy(), ok()],
|
|
1834
|
+
detail,
|
|
1835
|
+
message: productNameLong,
|
|
1854
1836
|
type: Info,
|
|
1855
|
-
|
|
1837
|
+
windowId
|
|
1856
1838
|
};
|
|
1857
1839
|
const index = await showMessageBox(options);
|
|
1858
1840
|
switch (index) {
|
|
@@ -1889,7 +1871,7 @@ const commandMap = {
|
|
|
1889
1871
|
'About.handleClickCopy': wrapCommand(handleClickCopy),
|
|
1890
1872
|
'About.handleClickOk': wrapCommand(handleClickOk),
|
|
1891
1873
|
'About.handleFocusIn': wrapCommand(handleFocusIn),
|
|
1892
|
-
'About.loadContent2': loadContent2,
|
|
1874
|
+
'About.loadContent2': wrapCommand(loadContent2),
|
|
1893
1875
|
'About.render2': doRender,
|
|
1894
1876
|
'About.renderEventListeners': renderEventListeners,
|
|
1895
1877
|
'About.showAbout': showAbout,
|