@lvce-editor/about-view 1.4.0 → 1.6.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 +77 -55
- package/package.json +5 -3
package/dist/aboutWorkerMain.js
CHANGED
@@ -65,7 +65,7 @@ const focusPrevious = state => {
|
|
65
65
|
};
|
66
66
|
|
67
67
|
const emptyObject = {};
|
68
|
-
const RE_PLACEHOLDER =
|
68
|
+
const RE_PLACEHOLDER = /{(PH\d+)}/g;
|
69
69
|
const i18nString = (key, placeholders = emptyObject) => {
|
70
70
|
if (placeholders === emptyObject) {
|
71
71
|
return key;
|
@@ -342,7 +342,7 @@ const formatDate = (date, now) => {
|
|
342
342
|
return formatDateFuture(-seconds);
|
343
343
|
};
|
344
344
|
|
345
|
-
const formatAboutDate = isoDate => {
|
345
|
+
const formatAboutDate = (isoDate, now) => {
|
346
346
|
if (!isoDate) {
|
347
347
|
return 'unknown';
|
348
348
|
}
|
@@ -350,7 +350,6 @@ const formatAboutDate = isoDate => {
|
|
350
350
|
if (isNaN(date)) {
|
351
351
|
return `Invalid Date: ${isoDate}`;
|
352
352
|
}
|
353
|
-
const now = Date.now();
|
354
353
|
const ago = formatDate(date, now);
|
355
354
|
return `${isoDate} (${ago})`;
|
356
355
|
};
|
@@ -389,7 +388,8 @@ const productNameLong = 'Lvce Editor - OSS';
|
|
389
388
|
|
390
389
|
const getDetailString = async () => {
|
391
390
|
const [electronVersion, nodeVersion, chromeVersion, version, commit, v8Version, date] = await Promise.all([getElectronVersion(), getNodeVersion(), getChromeVersion(), getVersion(), getCommit(), getV8Version(), getDate()]);
|
392
|
-
const
|
391
|
+
const now = Date.now();
|
392
|
+
const formattedDate = formatAboutDate(date, now);
|
393
393
|
const lines = [`Version: ${version}`, `Commit: ${commit}`, `Date: ${formattedDate}`, `Electron: ${electronVersion}`, `Chromium: ${chromeVersion}`, `Node: ${nodeVersion}`, `V8: ${v8Version}`];
|
394
394
|
return joinLines$1(lines);
|
395
395
|
};
|
@@ -402,34 +402,42 @@ const getDetailStringWeb = () => {
|
|
402
402
|
const version$1 = version;
|
403
403
|
const commit$1 = commit;
|
404
404
|
const date$1 = date;
|
405
|
-
const
|
405
|
+
const now = Date.now();
|
406
|
+
const formattedDate = formatAboutDate(date$1, now);
|
406
407
|
const browser = getBrowser();
|
407
408
|
const lines = [`Version: ${version$1}`, `Commit: ${commit$1}`, `Date: ${formattedDate}`, `Browser: ${browser}`];
|
408
409
|
return lines;
|
409
410
|
};
|
410
411
|
|
411
|
-
const
|
412
|
-
const HandleClickCopy = 'handleClickCopy';
|
413
|
-
const HandleClickOk = 'handleClickOk';
|
414
|
-
const HandleContextMenu = 'handleContextMenu';
|
415
|
-
const HandleFocusIn = 'handleFocusIn';
|
416
|
-
|
417
|
-
const Button$2 = 1;
|
418
|
-
const Div = 4;
|
419
|
-
const Text = 12;
|
420
|
-
const Br = 55;
|
421
|
-
|
422
|
-
const Button$1 = 'Button';
|
412
|
+
const Button$2 = 'Button';
|
423
413
|
const ButtonPrimary = 'ButtonPrimary';
|
424
414
|
const ButtonSecondary = 'ButtonSecondary';
|
425
415
|
const DialogButtonsRow = 'DialogButtonsRow';
|
426
416
|
const DialogClose = 'DialogClose';
|
427
417
|
const DialogContent = 'DialogContent';
|
428
418
|
const DialogContentRight = 'DialogContentRight';
|
429
|
-
const DialogHeading = 'DialogHeading';
|
419
|
+
const DialogHeading$1 = 'DialogHeading';
|
430
420
|
const DialogMessage = 'DialogMessage';
|
431
421
|
const DialogMessageRow = 'DialogMessageRow';
|
422
|
+
const About = 'About';
|
423
|
+
const Viewlet = 'Viewlet';
|
432
424
|
const DialogToolBarRow = 'DialogToolBarRow';
|
425
|
+
const MaskIcon = 'MaskIcon';
|
426
|
+
const MaskIconClose = 'MaskIconClose';
|
427
|
+
const DialogIcon$1 = 'DialogIcon';
|
428
|
+
const DialogInfoIcon = 'DialogInfoIcon';
|
429
|
+
const MaskIconInfo = 'MaskIconInfo';
|
430
|
+
|
431
|
+
const HandleClickClose = 'handleClickClose';
|
432
|
+
const HandleClickCopy = 'handleClickCopy';
|
433
|
+
const HandleClickOk = 'handleClickOk';
|
434
|
+
const HandleContextMenu = 'handleContextMenu';
|
435
|
+
const HandleFocusIn = 'handleFocusIn';
|
436
|
+
|
437
|
+
const Button$1 = 1;
|
438
|
+
const Div = 4;
|
439
|
+
const Text = 12;
|
440
|
+
const Br = 55;
|
433
441
|
|
434
442
|
const text = data => {
|
435
443
|
return {
|
@@ -458,26 +466,39 @@ const getAboutContentVirtualDom = lines => {
|
|
458
466
|
return dom;
|
459
467
|
};
|
460
468
|
|
469
|
+
const True = 'true';
|
470
|
+
|
461
471
|
const Button = 'button';
|
462
472
|
const Dialog = 'dialog';
|
463
473
|
|
474
|
+
const joinBySpace = (...items) => {
|
475
|
+
return items.join(' ');
|
476
|
+
};
|
477
|
+
|
478
|
+
const mergeClassNames = (...classNames) => {
|
479
|
+
return joinBySpace(...classNames.filter(Boolean));
|
480
|
+
};
|
481
|
+
|
464
482
|
const getPrimaryButtonVirtualDom = (message, onClick) => {
|
465
483
|
return [{
|
466
|
-
type: Button$
|
467
|
-
className:
|
484
|
+
type: Button$1,
|
485
|
+
className: mergeClassNames(Button$2, ButtonPrimary),
|
468
486
|
onClick,
|
469
487
|
childCount: 1
|
470
488
|
}, text(message)];
|
471
489
|
};
|
472
490
|
const getSecondaryButtonVirtualDom = (message, onClick) => {
|
473
491
|
return [{
|
474
|
-
type: Button$
|
475
|
-
className:
|
492
|
+
type: Button$1,
|
493
|
+
className: mergeClassNames(Button$2, ButtonSecondary),
|
476
494
|
onClick,
|
477
495
|
childCount: 1
|
478
496
|
}, text(message)];
|
479
497
|
};
|
480
498
|
|
499
|
+
const DialogIcon = 'DialogIcon';
|
500
|
+
const DialogHeading = 'DialogHeading';
|
501
|
+
|
481
502
|
const Focusable = -1;
|
482
503
|
|
483
504
|
const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copyMessage, productName) => {
|
@@ -486,8 +507,8 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
|
|
486
507
|
className: DialogContent,
|
487
508
|
tabIndex: Focusable,
|
488
509
|
role: Dialog,
|
489
|
-
ariaModal:
|
490
|
-
ariaLabelledBy:
|
510
|
+
ariaModal: True,
|
511
|
+
ariaLabelledBy: joinBySpace(DialogIcon, DialogHeading),
|
491
512
|
onFocusIn: HandleFocusIn,
|
492
513
|
childCount: 3
|
493
514
|
}, {
|
@@ -503,7 +524,7 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
|
|
503
524
|
childCount: 1
|
504
525
|
}, {
|
505
526
|
type: Div,
|
506
|
-
className:
|
527
|
+
className: mergeClassNames(MaskIcon, MaskIconClose),
|
507
528
|
childCount: 0
|
508
529
|
}, {
|
509
530
|
type: Div,
|
@@ -511,8 +532,8 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
|
|
511
532
|
childCount: 2
|
512
533
|
}, {
|
513
534
|
type: Div,
|
514
|
-
className:
|
515
|
-
id:
|
535
|
+
className: mergeClassNames(DialogIcon$1, DialogInfoIcon, MaskIcon, MaskIconInfo),
|
536
|
+
id: DialogIcon,
|
516
537
|
ariaLabel: infoMessage,
|
517
538
|
childCount: 0
|
518
539
|
}, {
|
@@ -521,8 +542,8 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
|
|
521
542
|
childCount: 2
|
522
543
|
}, {
|
523
544
|
type: Div,
|
524
|
-
id:
|
525
|
-
className: DialogHeading,
|
545
|
+
id: DialogHeading,
|
546
|
+
className: DialogHeading$1,
|
526
547
|
childCount: 1
|
527
548
|
}, text(productName), ...content, {
|
528
549
|
type: Div,
|
@@ -536,14 +557,14 @@ const getAboutVirtualDom = (productName, lines, closeMessage, okMessage, copyMes
|
|
536
557
|
const content = getAboutContentVirtualDom(lines);
|
537
558
|
return [{
|
538
559
|
type: Div,
|
539
|
-
className:
|
560
|
+
className: mergeClassNames(Viewlet, About),
|
540
561
|
onContextMenu: HandleContextMenu,
|
541
562
|
childCount: 1
|
542
563
|
}, ...getDialogVirtualDom(content, closeMessage, infoMessage, okMessage, copyMessage, productName)];
|
543
564
|
};
|
544
565
|
|
545
|
-
const loadContent =
|
546
|
-
const lines =
|
566
|
+
const loadContent = state => {
|
567
|
+
const lines = getDetailStringWeb();
|
547
568
|
return {
|
548
569
|
...state,
|
549
570
|
productName: productNameLong,
|
@@ -639,7 +660,7 @@ class AssertionError extends Error {
|
|
639
660
|
this.name = 'AssertionError';
|
640
661
|
}
|
641
662
|
}
|
642
|
-
const getType
|
663
|
+
const getType = value => {
|
643
664
|
switch (typeof value) {
|
644
665
|
case 'number':
|
645
666
|
return 'number';
|
@@ -662,7 +683,7 @@ const getType$1 = value => {
|
|
662
683
|
}
|
663
684
|
};
|
664
685
|
const number = value => {
|
665
|
-
const type = getType
|
686
|
+
const type = getType(value);
|
666
687
|
if (type !== 'number') {
|
667
688
|
throw new AssertionError('expected value to be of type number');
|
668
689
|
}
|
@@ -699,7 +720,7 @@ class JsonRpcError extends Error {
|
|
699
720
|
const MethodNotFound = -32601;
|
700
721
|
const Custom = -32001;
|
701
722
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
702
|
-
const
|
723
|
+
const getErrorType = prettyError => {
|
703
724
|
if (prettyError && prettyError.type) {
|
704
725
|
return prettyError.type;
|
705
726
|
}
|
@@ -722,7 +743,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
722
743
|
data: {
|
723
744
|
stack: prettyError.stack,
|
724
745
|
codeFrame: prettyError.codeFrame,
|
725
|
-
type:
|
746
|
+
type: getErrorType(prettyError),
|
726
747
|
code: prettyError.code,
|
727
748
|
name: prettyError.name
|
728
749
|
}
|
@@ -823,7 +844,7 @@ const requiresSocket = () => {
|
|
823
844
|
const preparePrettyError = error => {
|
824
845
|
return error;
|
825
846
|
};
|
826
|
-
const logError =
|
847
|
+
const logError = () => {
|
827
848
|
// handled by renderer worker
|
828
849
|
};
|
829
850
|
const handleMessage = event => {
|
@@ -834,22 +855,6 @@ const handleIpc = ipc => {
|
|
834
855
|
ipc.addEventListener('message', handleMessage);
|
835
856
|
};
|
836
857
|
|
837
|
-
const MessagePort$1 = 1;
|
838
|
-
const ModuleWorker = 2;
|
839
|
-
const ReferencePort = 3;
|
840
|
-
const ModuleWorkerAndMessagePort = 8;
|
841
|
-
const Auto = () => {
|
842
|
-
// @ts-ignore
|
843
|
-
if (globalThis.acceptPort) {
|
844
|
-
return MessagePort$1;
|
845
|
-
}
|
846
|
-
// @ts-ignore
|
847
|
-
if (globalThis.acceptReferencePort) {
|
848
|
-
return ReferencePort;
|
849
|
-
}
|
850
|
-
return ModuleWorkerAndMessagePort;
|
851
|
-
};
|
852
|
-
|
853
858
|
const getData$1 = event => {
|
854
859
|
return event.data;
|
855
860
|
};
|
@@ -1239,6 +1244,23 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
1239
1244
|
wrap: wrap$5
|
1240
1245
|
};
|
1241
1246
|
|
1247
|
+
const MessagePort$1 = 1;
|
1248
|
+
const ModuleWorker = 2;
|
1249
|
+
const ReferencePort = 3;
|
1250
|
+
const ModuleWorkerAndMessagePort = 8;
|
1251
|
+
const Auto = () => {
|
1252
|
+
// @ts-expect-error
|
1253
|
+
if (globalThis.acceptPort) {
|
1254
|
+
return MessagePort$1;
|
1255
|
+
}
|
1256
|
+
// @ts-expect-error
|
1257
|
+
if (globalThis.acceptReferencePort) {
|
1258
|
+
return ReferencePort;
|
1259
|
+
}
|
1260
|
+
return ModuleWorkerAndMessagePort;
|
1261
|
+
};
|
1262
|
+
|
1263
|
+
// @ts-ignore
|
1242
1264
|
const getModule = method => {
|
1243
1265
|
switch (method) {
|
1244
1266
|
case ModuleWorker:
|
@@ -1253,7 +1275,7 @@ const getModule = method => {
|
|
1253
1275
|
const listen$1 = async ({
|
1254
1276
|
method
|
1255
1277
|
}) => {
|
1256
|
-
const module =
|
1278
|
+
const module = getModule(method);
|
1257
1279
|
const rawIpc = await module.listen();
|
1258
1280
|
if (module.signal) {
|
1259
1281
|
module.signal(rawIpc);
|
@@ -1274,4 +1296,4 @@ const main = async () => {
|
|
1274
1296
|
await listen();
|
1275
1297
|
};
|
1276
1298
|
|
1277
|
-
main();
|
1299
|
+
await main();
|
package/package.json
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lvce-editor/about-view",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.6.0",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/aboutWorkerMain.js",
|
6
6
|
"type": "module",
|
7
|
-
"keywords": [
|
8
|
-
|
7
|
+
"keywords": [
|
8
|
+
"about"
|
9
|
+
],
|
10
|
+
"author": "Lvce Editor",
|
9
11
|
"license": "MIT"
|
10
12
|
}
|