@lvce-editor/about-view 5.9.0 → 5.11.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.
@@ -741,7 +741,7 @@ const send = (transport, method, ...params) => {
741
741
  const message = create$4(method, params);
742
742
  transport.send(message);
743
743
  };
744
- const invoke$1 = (ipc, method, ...params) => {
744
+ const invoke = (ipc, method, ...params) => {
745
745
  return invokeHelper(ipc, method, params, false);
746
746
  };
747
747
  const invokeAndTransfer = (ipc, method, ...params) => {
@@ -774,7 +774,7 @@ const createRpc = ipc => {
774
774
  send(ipc, method, ...params);
775
775
  },
776
776
  invoke(method, ...params) {
777
- return invoke$1(ipc, method, ...params);
777
+ return invoke(ipc, method, ...params);
778
778
  },
779
779
  invokeAndTransfer(method, ...params) {
780
780
  return invokeAndTransfer(ipc, method, ...params);
@@ -1006,22 +1006,47 @@ const getCommandIds = () => {
1006
1006
 
1007
1007
  const Tab = 2;
1008
1008
  const Escape = 8;
1009
-
1009
+ const KeyCode = {
1010
+ __proto__: null,
1011
+ Escape,
1012
+ Tab};
1010
1013
  const Shift = 1 << 10 >>> 0;
1014
+ const KeyModifier = {
1015
+ __proto__: null,
1016
+ Shift};
1017
+ const mergeClassNames = (...classNames) => {
1018
+ return classNames.filter(Boolean).join(' ');
1019
+ };
1020
+ const Button$2 = 1;
1021
+ const Div = 4;
1022
+ const Text = 12;
1023
+ const Br = 55;
1024
+ const VirtualDomElements = {
1025
+ __proto__: null,
1026
+ Br,
1027
+ Button: Button$2,
1028
+ Div};
1029
+ const text = data => {
1030
+ return {
1031
+ type: Text,
1032
+ text: data,
1033
+ childCount: 0
1034
+ };
1035
+ };
1011
1036
 
1012
1037
  const FocusAbout = 4;
1013
1038
 
1014
1039
  const getKeyBindings = () => {
1015
1040
  return [{
1016
- key: Escape,
1041
+ key: KeyCode.Escape,
1017
1042
  command: 'About.handleClickClose',
1018
1043
  when: FocusAbout
1019
1044
  }, {
1020
- key: Tab,
1045
+ key: KeyCode.Tab,
1021
1046
  command: 'About.focusNext',
1022
1047
  when: FocusAbout
1023
1048
  }, {
1024
- key: Tab | Shift,
1049
+ key: KeyCode.Tab | KeyModifier.Shift,
1025
1050
  command: 'About.focusPrevious',
1026
1051
  when: FocusAbout
1027
1052
  }];
@@ -1064,23 +1089,88 @@ const RendererWorker$1 = 1;
1064
1089
  const {
1065
1090
  invoke: invoke$4,
1066
1091
  set: set$3} = create(RendererWorker$1);
1092
+ const getElectronVersion$2 = async () => {
1093
+ return invoke$4('Process.getElectronVersion');
1094
+ };
1095
+ const getNodeVersion$2 = async () => {
1096
+ return invoke$4('Process.getNodeVersion');
1097
+ };
1098
+ const getChromeVersion$2 = async () => {
1099
+ return invoke$4('Process.getChromeVersion');
1100
+ };
1101
+ const getV8Version$2 = async () => {
1102
+ return invoke$4('Process.getV8Version');
1103
+ };
1104
+ const setFocus$1 = key => {
1105
+ return invoke$4('Focus.setFocus', key);
1106
+ };
1107
+ const closeWidget$2 = async widgetId => {
1108
+ return invoke$4('Viewlet.closeWidget', widgetId);
1109
+ };
1110
+ const writeClipBoardText$1 = async text => {
1111
+ await invoke$4('ClipBoard.writeText', /* text */text);
1112
+ };
1113
+ const showMessageBox$2 = async options => {
1114
+ return invoke$4('ElectronDialog.showMessageBox', options);
1115
+ };
1116
+ const openWidget$1 = async name => {
1117
+ await invoke$4('Viewlet.openWidget', name);
1118
+ };
1119
+ const getWindowId$2 = async () => {
1120
+ return invoke$4('GetWindowId.getWindowId');
1121
+ };
1122
+ const RendererWorker$2 = {
1123
+ __proto__: null,
1124
+ closeWidget: closeWidget$2,
1125
+ getChromeVersion: getChromeVersion$2,
1126
+ getElectronVersion: getElectronVersion$2,
1127
+ getNodeVersion: getNodeVersion$2,
1128
+ getV8Version: getV8Version$2,
1129
+ getWindowId: getWindowId$2,
1130
+ openWidget: openWidget$1,
1131
+ set: set$3,
1132
+ setFocus: setFocus$1,
1133
+ showMessageBox: showMessageBox$2,
1134
+ writeClipBoardText: writeClipBoardText$1
1135
+ };
1136
+
1137
+ const {
1138
+ closeWidget: closeWidget$1,
1139
+ getChromeVersion: getChromeVersion$1,
1140
+ getElectronVersion: getElectronVersion$1,
1141
+ getNodeVersion: getNodeVersion$1,
1142
+ getV8Version: getV8Version$1,
1143
+ getWindowId: getWindowId$1,
1144
+ openWidget,
1145
+ set,
1146
+ setFocus,
1147
+ showMessageBox: showMessageBox$1,
1148
+ writeClipBoardText
1149
+ } = RendererWorker$2;
1150
+
1067
1151
  const RendererWorker = {
1068
1152
  __proto__: null,
1069
- invoke: invoke$4,
1070
- set: set$3
1153
+ closeWidget: closeWidget$1,
1154
+ getChromeVersion: getChromeVersion$1,
1155
+ getElectronVersion: getElectronVersion$1,
1156
+ getNodeVersion: getNodeVersion$1,
1157
+ getV8Version: getV8Version$1,
1158
+ getWindowId: getWindowId$1,
1159
+ openWidget,
1160
+ set,
1161
+ setFocus,
1162
+ showMessageBox: showMessageBox$1,
1163
+ writeClipBoardText
1071
1164
  };
1072
1165
 
1073
1166
  const {
1074
- invoke,
1075
- set
1167
+ closeWidget
1076
1168
  } = RendererWorker;
1077
1169
 
1078
- const closeWidget = async id => {
1079
- await invoke('Viewlet.closeWidget', id);
1080
- };
1170
+ const About$1 = 'About';
1081
1171
 
1082
1172
  const close = async () => {
1083
- await closeWidget('About');
1173
+ await closeWidget(About$1);
1084
1174
  };
1085
1175
 
1086
1176
  const handleClickClose = async state => {
@@ -1089,7 +1179,7 @@ const handleClickClose = async state => {
1089
1179
  };
1090
1180
 
1091
1181
  const writeText = async text => {
1092
- await invoke('ClipBoard.writeText', /* text */text);
1182
+ await writeClipBoardText(text);
1093
1183
  };
1094
1184
 
1095
1185
  const NewLine = '\n';
@@ -1136,7 +1226,7 @@ const handleClickButton = async (state, name) => {
1136
1226
 
1137
1227
  const handleFocusIn = async state => {
1138
1228
  // TODO remove side effect
1139
- await invoke('Focus.setFocus', FocusAbout);
1229
+ await setFocus(FocusAbout);
1140
1230
  if (state.focusId) {
1141
1231
  return state;
1142
1232
  }
@@ -1431,30 +1521,31 @@ const formatAboutDate = (isoDate, now) => {
1431
1521
  };
1432
1522
 
1433
1523
  const getBrowser = () => {
1524
+ // @ts-ignore
1434
1525
  return `${navigator.userAgent}`;
1435
1526
  };
1436
1527
 
1437
1528
  const version = '0.0.0-dev';
1438
1529
  const commit = 'unknown commit';
1439
1530
  const date = '';
1440
- const getElectronVersion = () => {
1441
- return invoke('Process.getElectronVersion');
1442
- };
1443
- const getNodeVersion = () => {
1444
- return invoke('Process.getNodeVersion');
1445
- };
1446
- const getChromeVersion = () => {
1447
- return invoke('Process.getChromeVersion');
1448
- };
1531
+ const {
1532
+ getElectronVersion
1533
+ } = RendererWorker;
1534
+ const {
1535
+ getNodeVersion
1536
+ } = RendererWorker;
1537
+ const {
1538
+ getChromeVersion
1539
+ } = RendererWorker;
1449
1540
  const getVersion = () => {
1450
1541
  return version;
1451
1542
  };
1452
1543
  const getCommit = () => {
1453
1544
  return commit;
1454
1545
  };
1455
- const getV8Version = () => {
1456
- return invoke('Process.getV8Version');
1457
- };
1546
+ const {
1547
+ getV8Version
1548
+ } = RendererWorker;
1458
1549
  const getDate = () => {
1459
1550
  return date;
1460
1551
  };
@@ -1539,7 +1630,7 @@ const createViewModel = state => {
1539
1630
  };
1540
1631
  };
1541
1632
 
1542
- const Button$2 = 'Button';
1633
+ const Button$1 = 'Button';
1543
1634
  const ButtonPrimary = 'ButtonPrimary';
1544
1635
  const ButtonSecondary = 'ButtonSecondary';
1545
1636
  const DialogButtonsRow = 'DialogButtonsRow';
@@ -1549,7 +1640,7 @@ const DialogContentRight = 'DialogContentRight';
1549
1640
  const DialogHeading$1 = 'DialogHeading';
1550
1641
  const DialogMessage = 'DialogMessage';
1551
1642
  const DialogMessageRow = 'DialogMessageRow';
1552
- const About$1 = 'About';
1643
+ const About = 'About';
1553
1644
  const Viewlet = 'Viewlet';
1554
1645
  const DialogToolBarRow = 'DialogToolBarRow';
1555
1646
  const MaskIcon = 'MaskIcon';
@@ -1563,24 +1654,8 @@ const HandleClickButton = 4;
1563
1654
  const HandleContextMenu = 5;
1564
1655
  const HandleFocusIn = 6;
1565
1656
 
1566
- const Button$1 = 1;
1567
- const Div = 4;
1568
- const Br = 55;
1569
-
1570
- const mergeClassNames = (...classNames) => {
1571
- return classNames.filter(Boolean).join(' ');
1572
- };
1573
- const Text = 12;
1574
- const text = data => {
1575
- return {
1576
- type: Text,
1577
- text: data,
1578
- childCount: 0
1579
- };
1580
- };
1581
-
1582
1657
  const br = {
1583
- type: Br,
1658
+ type: VirtualDomElements.Br,
1584
1659
  childCount: 0
1585
1660
  };
1586
1661
  const renderLine = (line, index) => {
@@ -1592,7 +1667,7 @@ const renderLine = (line, index) => {
1592
1667
 
1593
1668
  const getAboutContentVirtualDom = lines => {
1594
1669
  const dom = [{
1595
- type: Div,
1670
+ type: VirtualDomElements.Div,
1596
1671
  className: DialogMessage,
1597
1672
  childCount: lines.length * 2 - 1
1598
1673
  }, ...lines.flatMap(renderLine)];
@@ -1606,8 +1681,8 @@ const Dialog = 'dialog';
1606
1681
 
1607
1682
  const getPrimaryButtonVirtualDom = (message, name) => {
1608
1683
  return [{
1609
- type: Button$1,
1610
- className: mergeClassNames(Button$2, ButtonPrimary),
1684
+ type: VirtualDomElements.Button,
1685
+ className: mergeClassNames(Button$1, ButtonPrimary),
1611
1686
  onClick: HandleClickButton,
1612
1687
  childCount: 1,
1613
1688
  name
@@ -1616,8 +1691,8 @@ const getPrimaryButtonVirtualDom = (message, name) => {
1616
1691
 
1617
1692
  const getSecondaryButtonVirtualDom = (message, name) => {
1618
1693
  return [{
1619
- type: Button$1,
1620
- className: mergeClassNames(Button$2, ButtonSecondary),
1694
+ type: VirtualDomElements.Button,
1695
+ className: mergeClassNames(Button$1, ButtonSecondary),
1621
1696
  onClick: HandleClickButton,
1622
1697
  childCount: 1,
1623
1698
  name
@@ -1635,7 +1710,7 @@ const Focusable = -1;
1635
1710
 
1636
1711
  const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copyMessage, productName) => {
1637
1712
  const dom = [{
1638
- type: Div,
1713
+ type: VirtualDomElements.Div,
1639
1714
  className: DialogContent,
1640
1715
  tabIndex: Focusable,
1641
1716
  role: Dialog,
@@ -1644,41 +1719,41 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
1644
1719
  onFocusIn: HandleFocusIn,
1645
1720
  childCount: 3
1646
1721
  }, {
1647
- type: Div,
1722
+ type: VirtualDomElements.Div,
1648
1723
  className: DialogToolBarRow,
1649
1724
  childCount: 1
1650
1725
  }, {
1651
- type: Div,
1726
+ type: VirtualDomElements.Div,
1652
1727
  className: DialogClose,
1653
1728
  ariaLabel: closeMessage,
1654
1729
  role: Button,
1655
1730
  onClick: HandleClickClose,
1656
1731
  childCount: 1
1657
1732
  }, {
1658
- type: Div,
1733
+ type: VirtualDomElements.Div,
1659
1734
  className: mergeClassNames(MaskIcon, MaskIconClose),
1660
1735
  childCount: 0
1661
1736
  }, {
1662
- type: Div,
1737
+ type: VirtualDomElements.Div,
1663
1738
  className: DialogMessageRow,
1664
1739
  childCount: 2
1665
1740
  }, {
1666
- type: Div,
1741
+ type: VirtualDomElements.Div,
1667
1742
  className: mergeClassNames(DialogIcon$1, DialogInfoIcon, MaskIcon, MaskIconInfo),
1668
1743
  id: DialogIcon,
1669
1744
  ariaLabel: infoMessage,
1670
1745
  childCount: 0
1671
1746
  }, {
1672
- type: Div,
1747
+ type: VirtualDomElements.Div,
1673
1748
  className: DialogContentRight,
1674
1749
  childCount: 2
1675
1750
  }, {
1676
- type: Div,
1751
+ type: VirtualDomElements.Div,
1677
1752
  id: DialogHeading,
1678
1753
  className: DialogHeading$1,
1679
1754
  childCount: 1
1680
1755
  }, text(productName), ...content, {
1681
- type: Div,
1756
+ type: VirtualDomElements.Div,
1682
1757
  className: DialogButtonsRow,
1683
1758
  childCount: 2
1684
1759
  }, ...getSecondaryButtonVirtualDom(okMessage, Ok$1), ...getPrimaryButtonVirtualDom(copyMessage, Copy$1)];
@@ -1688,8 +1763,8 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
1688
1763
  const getAboutVirtualDom = (productName, lines, closeMessage, okMessage, copyMessage, infoMessage) => {
1689
1764
  const content = getAboutContentVirtualDom(lines);
1690
1765
  return [{
1691
- type: Div,
1692
- className: mergeClassNames(Viewlet, About$1),
1766
+ type: VirtualDomElements.Div,
1767
+ className: mergeClassNames(Viewlet, About),
1693
1768
  onContextMenu: HandleContextMenu,
1694
1769
  childCount: 1
1695
1770
  }, ...getDialogVirtualDom(content, closeMessage, infoMessage, okMessage, copyMessage, productName)];
@@ -1772,15 +1847,13 @@ const renderEventListeners = () => {
1772
1847
 
1773
1848
  const Electron = 2;
1774
1849
 
1775
- const About = 'About';
1776
-
1777
1850
  const showAboutDefault = async () => {
1778
- await invoke('Viewlet.openWidget', About);
1851
+ await openWidget(About$1);
1779
1852
  };
1780
1853
 
1781
- const getWindowId = async () => {
1782
- return invoke('GetWindowId.getWindowId');
1783
- };
1854
+ const {
1855
+ getWindowId
1856
+ } = RendererWorker;
1784
1857
 
1785
1858
  const productNameLong = 'Lvce Editor - OSS';
1786
1859
  const getProductNameLong = () => {
@@ -1795,7 +1868,7 @@ const showMessageBox = async options => {
1795
1868
  productName,
1796
1869
  windowId
1797
1870
  };
1798
- return invoke('ElectronDialog.showMessageBox', finalOptions);
1871
+ return showMessageBox$1(finalOptions);
1799
1872
  };
1800
1873
 
1801
1874
  const Info = 'info';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/about-view",
3
- "version": "5.9.0",
3
+ "version": "5.11.0",
4
4
  "description": "About View Worker",
5
5
  "keywords": [
6
6
  "about-view"