@lvce-editor/about-view 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -65,7 +65,7 @@ const focusPrevious = state => {
65
65
  };
66
66
 
67
67
  const emptyObject = {};
68
- const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
68
+ const RE_PLACEHOLDER = /{(PH\d+)}/g;
69
69
  const i18nString = (key, placeholders = emptyObject) => {
70
70
  if (placeholders === emptyObject) {
71
71
  return key;
@@ -409,28 +409,35 @@ const getDetailStringWeb = () => {
409
409
  return lines;
410
410
  };
411
411
 
412
- const HandleClickClose = 'handleClickClose';
413
- const HandleClickCopy = 'handleClickCopy';
414
- const HandleClickOk = 'handleClickOk';
415
- const HandleContextMenu = 'handleContextMenu';
416
- const HandleFocusIn = 'handleFocusIn';
417
-
418
- const Button$2 = 1;
419
- const Div = 4;
420
- const Text = 12;
421
- const Br = 55;
422
-
423
- const Button$1 = 'Button';
412
+ const Button$2 = 'Button';
424
413
  const ButtonPrimary = 'ButtonPrimary';
425
414
  const ButtonSecondary = 'ButtonSecondary';
426
415
  const DialogButtonsRow = 'DialogButtonsRow';
427
416
  const DialogClose = 'DialogClose';
428
417
  const DialogContent = 'DialogContent';
429
418
  const DialogContentRight = 'DialogContentRight';
430
- const DialogHeading = 'DialogHeading';
419
+ const DialogHeading$1 = 'DialogHeading';
431
420
  const DialogMessage = 'DialogMessage';
432
421
  const DialogMessageRow = 'DialogMessageRow';
422
+ const About = 'About';
423
+ const Viewlet = 'Viewlet';
433
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;
434
441
 
435
442
  const text = data => {
436
443
  return {
@@ -459,30 +466,39 @@ const getAboutContentVirtualDom = lines => {
459
466
  return dom;
460
467
  };
461
468
 
469
+ const True = 'true';
470
+
462
471
  const Button = 'button';
463
472
  const Dialog = 'dialog';
464
473
 
474
+ const joinBySpace = (...items) => {
475
+ return items.join(' ');
476
+ };
477
+
465
478
  const mergeClassNames = (...classNames) => {
466
- return classNames.filter(Boolean).join(' ');
479
+ return joinBySpace(...classNames.filter(Boolean));
467
480
  };
468
481
 
469
482
  const getPrimaryButtonVirtualDom = (message, onClick) => {
470
483
  return [{
471
- type: Button$2,
472
- className: mergeClassNames(Button$1, ButtonPrimary),
484
+ type: Button$1,
485
+ className: mergeClassNames(Button$2, ButtonPrimary),
473
486
  onClick,
474
487
  childCount: 1
475
488
  }, text(message)];
476
489
  };
477
490
  const getSecondaryButtonVirtualDom = (message, onClick) => {
478
491
  return [{
479
- type: Button$2,
480
- className: mergeClassNames(Button$1, ButtonSecondary),
492
+ type: Button$1,
493
+ className: mergeClassNames(Button$2, ButtonSecondary),
481
494
  onClick,
482
495
  childCount: 1
483
496
  }, text(message)];
484
497
  };
485
498
 
499
+ const DialogIcon = 'DialogIcon';
500
+ const DialogHeading = 'DialogHeading';
501
+
486
502
  const Focusable = -1;
487
503
 
488
504
  const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copyMessage, productName) => {
@@ -491,8 +507,8 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
491
507
  className: DialogContent,
492
508
  tabIndex: Focusable,
493
509
  role: Dialog,
494
- ariaModal: 'true',
495
- ariaLabelledBy: 'DialogIcon DialogHeading',
510
+ ariaModal: True,
511
+ ariaLabelledBy: joinBySpace(DialogIcon, DialogHeading),
496
512
  onFocusIn: HandleFocusIn,
497
513
  childCount: 3
498
514
  }, {
@@ -508,7 +524,7 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
508
524
  childCount: 1
509
525
  }, {
510
526
  type: Div,
511
- className: 'MaskIcon MaskIconClose',
527
+ className: mergeClassNames(MaskIcon, MaskIconClose),
512
528
  childCount: 0
513
529
  }, {
514
530
  type: Div,
@@ -516,8 +532,8 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
516
532
  childCount: 2
517
533
  }, {
518
534
  type: Div,
519
- className: 'DialogIcon DialogInfoIcon MaskIcon MaskIconInfo',
520
- id: 'DialogIcon',
535
+ className: mergeClassNames(DialogIcon$1, DialogInfoIcon, MaskIcon, MaskIconInfo),
536
+ id: DialogIcon,
521
537
  ariaLabel: infoMessage,
522
538
  childCount: 0
523
539
  }, {
@@ -526,8 +542,8 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
526
542
  childCount: 2
527
543
  }, {
528
544
  type: Div,
529
- id: 'DialogHeading',
530
- className: DialogHeading,
545
+ id: DialogHeading,
546
+ className: DialogHeading$1,
531
547
  childCount: 1
532
548
  }, text(productName), ...content, {
533
549
  type: Div,
@@ -541,14 +557,14 @@ const getAboutVirtualDom = (productName, lines, closeMessage, okMessage, copyMes
541
557
  const content = getAboutContentVirtualDom(lines);
542
558
  return [{
543
559
  type: Div,
544
- className: 'Viewlet About',
560
+ className: mergeClassNames(Viewlet, About),
545
561
  onContextMenu: HandleContextMenu,
546
562
  childCount: 1
547
563
  }, ...getDialogVirtualDom(content, closeMessage, infoMessage, okMessage, copyMessage, productName)];
548
564
  };
549
565
 
550
- const loadContent = async state => {
551
- const lines = await getDetailStringWeb();
566
+ const loadContent = state => {
567
+ const lines = getDetailStringWeb();
552
568
  return {
553
569
  ...state,
554
570
  productName: productNameLong,
@@ -828,7 +844,7 @@ const requiresSocket = () => {
828
844
  const preparePrettyError = error => {
829
845
  return error;
830
846
  };
831
- const logError = error => {
847
+ const logError = () => {
832
848
  // handled by renderer worker
833
849
  };
834
850
  const handleMessage = event => {
@@ -839,22 +855,6 @@ const handleIpc = ipc => {
839
855
  ipc.addEventListener('message', handleMessage);
840
856
  };
841
857
 
842
- const MessagePort$1 = 1;
843
- const ModuleWorker = 2;
844
- const ReferencePort = 3;
845
- const ModuleWorkerAndMessagePort = 8;
846
- const Auto = () => {
847
- // @ts-ignore
848
- if (globalThis.acceptPort) {
849
- return MessagePort$1;
850
- }
851
- // @ts-ignore
852
- if (globalThis.acceptReferencePort) {
853
- return ReferencePort;
854
- }
855
- return ModuleWorkerAndMessagePort;
856
- };
857
-
858
858
  const getData$1 = event => {
859
859
  return event.data;
860
860
  };
@@ -1244,6 +1244,23 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
1244
1244
  wrap: wrap$5
1245
1245
  };
1246
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
1247
1264
  const getModule = method => {
1248
1265
  switch (method) {
1249
1266
  case ModuleWorker:
@@ -1258,7 +1275,7 @@ const getModule = method => {
1258
1275
  const listen$1 = async ({
1259
1276
  method
1260
1277
  }) => {
1261
- const module = await getModule(method);
1278
+ const module = getModule(method);
1262
1279
  const rawIpc = await module.listen();
1263
1280
  if (module.signal) {
1264
1281
  module.signal(rawIpc);
@@ -1279,4 +1296,4 @@ const main = async () => {
1279
1296
  await listen();
1280
1297
  };
1281
1298
 
1282
- main();
1299
+ await main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/about-view",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "",
5
5
  "main": "dist/aboutWorkerMain.js",
6
6
  "type": "module",