@lvce-editor/about-view 5.12.0 → 6.0.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.
@@ -378,7 +378,7 @@ const create$4 = (method, params) => {
378
378
  };
379
379
  };
380
380
  const callbacks = Object.create(null);
381
- const set$2 = (id, fn) => {
381
+ const set$3 = (id, fn) => {
382
382
  callbacks[id] = fn;
383
383
  };
384
384
  const get$2 = id => {
@@ -397,7 +397,7 @@ const registerPromise = () => {
397
397
  resolve,
398
398
  promise
399
399
  } = Promise.withResolvers();
400
- set$2(id, resolve);
400
+ set$3(id, resolve);
401
401
  return {
402
402
  id,
403
403
  promise
@@ -742,7 +742,7 @@ const send = (transport, method, ...params) => {
742
742
  const message = create$4(method, params);
743
743
  transport.send(message);
744
744
  };
745
- const invoke = (ipc, method, ...params) => {
745
+ const invoke$1 = (ipc, method, ...params) => {
746
746
  return invokeHelper(ipc, method, params, false);
747
747
  };
748
748
  const invokeAndTransfer = (ipc, method, ...params) => {
@@ -781,7 +781,7 @@ const createRpc = ipc => {
781
781
  send(ipc, method, ...params);
782
782
  },
783
783
  invoke(method, ...params) {
784
- return invoke(ipc, method, ...params);
784
+ return invoke$1(ipc, method, ...params);
785
785
  },
786
786
  invokeAndTransfer(method, ...params) {
787
787
  return invokeAndTransfer(ipc, method, ...params);
@@ -837,11 +837,89 @@ const WebWorkerRpcClient = {
837
837
  create: create$3
838
838
  };
839
839
 
840
+ const Button$2 = 1;
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;
849
+
850
+ const RendererWorker = 1;
851
+
852
+ const rpcs = Object.create(null);
853
+ const set$2 = (id, rpc) => {
854
+ rpcs[id] = rpc;
855
+ };
856
+ const get$1 = id => {
857
+ return rpcs[id];
858
+ };
859
+
860
+ const create$2 = rpcId => {
861
+ return {
862
+ // @ts-ignore
863
+ invoke(method, ...params) {
864
+ const rpc = get$1(rpcId);
865
+ // @ts-ignore
866
+ return rpc.invoke(method, ...params);
867
+ },
868
+ // @ts-ignore
869
+ invokeAndTransfer(method, ...params) {
870
+ const rpc = get$1(rpcId);
871
+ // @ts-ignore
872
+ return rpc.invokeAndTransfer(method, ...params);
873
+ },
874
+ set(rpc) {
875
+ set$2(rpcId, rpc);
876
+ },
877
+ async dispose() {
878
+ const rpc = get$1(rpcId);
879
+ await rpc.dispose();
880
+ }
881
+ };
882
+ };
883
+
884
+ const {
885
+ invoke,
886
+ set: set$1} = create$2(RendererWorker);
887
+ const getElectronVersion$1 = async () => {
888
+ return invoke('Process.getElectronVersion');
889
+ };
890
+ const getNodeVersion$1 = async () => {
891
+ return invoke('Process.getNodeVersion');
892
+ };
893
+ const getChromeVersion$1 = async () => {
894
+ return invoke('Process.getChromeVersion');
895
+ };
896
+ const getV8Version$1 = async () => {
897
+ return invoke('Process.getV8Version');
898
+ };
899
+ const setFocus = key => {
900
+ return invoke('Focus.setFocus', key);
901
+ };
902
+ const closeWidget$1 = async widgetId => {
903
+ return invoke('Viewlet.closeWidget', widgetId);
904
+ };
905
+ const writeClipBoardText = async text => {
906
+ await invoke('ClipBoard.writeText', /* text */text);
907
+ };
908
+ const showMessageBox$1 = async options => {
909
+ return invoke('ElectronDialog.showMessageBox', options);
910
+ };
911
+ const openWidget = async name => {
912
+ await invoke('Viewlet.openWidget', name);
913
+ };
914
+ const getWindowId$1 = async () => {
915
+ return invoke('GetWindowId.getWindowId');
916
+ };
917
+
840
918
  const toCommandId = key => {
841
919
  const dotIndex = key.indexOf('.');
842
920
  return key.slice(dotIndex + 1);
843
921
  };
844
- const create$2 = () => {
922
+ const create$1 = () => {
845
923
  const states = Object.create(null);
846
924
  const commandMapRef = {};
847
925
  return {
@@ -919,20 +997,22 @@ const create$2 = () => {
919
997
  };
920
998
 
921
999
  const {
922
- get: get$1,
923
- set: set$1,
1000
+ get,
1001
+ set,
924
1002
  dispose: dispose$1,
925
- wrapCommand
926
- } = create$2();
1003
+ wrapCommand,
1004
+ registerCommands,
1005
+ getCommandIds
1006
+ } = create$1();
927
1007
 
928
- const create$1 = uid => {
1008
+ const create = uid => {
929
1009
  const state = {
930
1010
  uid,
931
1011
  focusId: 0,
932
1012
  lines: [],
933
1013
  productName: ''
934
1014
  };
935
- set$1(uid, state, state);
1015
+ set(uid, state, state);
936
1016
  };
937
1017
 
938
1018
  const RenderFocus = 2;
@@ -972,7 +1052,7 @@ const diff2 = uid => {
972
1052
  const {
973
1053
  oldState,
974
1054
  newState
975
- } = get$1(uid);
1055
+ } = get(uid);
976
1056
  const diffResult = diff(oldState, newState);
977
1057
  return diffResult;
978
1058
  };
@@ -1027,34 +1107,10 @@ const focusPrevious = state => {
1027
1107
  };
1028
1108
  };
1029
1109
 
1030
- const commandIds = ['dispose', 'focusNext', 'focusPrevious', 'handleClickButton', 'handleClickClose', 'handleClickCopy', 'handleClickOk', 'handleFocusIn'];
1031
-
1032
- const getCommandIds = () => {
1033
- return commandIds;
1034
- };
1035
-
1036
- const Tab = 2;
1037
- const Escape = 8;
1038
- const KeyCode = {
1039
- __proto__: null,
1040
- Escape,
1041
- Tab};
1042
- const Shift = 1 << 10 >>> 0;
1043
- const KeyModifier = {
1044
- __proto__: null,
1045
- Shift};
1046
1110
  const mergeClassNames = (...classNames) => {
1047
1111
  return classNames.filter(Boolean).join(' ');
1048
1112
  };
1049
- const Button$2 = 1;
1050
- const Div = 4;
1051
- const Text = 12;
1052
- const Br = 55;
1053
- const VirtualDomElements = {
1054
- __proto__: null,
1055
- Br,
1056
- Button: Button$2,
1057
- Div};
1113
+
1058
1114
  const text = data => {
1059
1115
  return {
1060
1116
  type: Text,
@@ -1067,134 +1123,21 @@ const FocusAbout = 4;
1067
1123
 
1068
1124
  const getKeyBindings = () => {
1069
1125
  return [{
1070
- key: KeyCode.Escape,
1126
+ key: Escape,
1071
1127
  command: 'About.handleClickClose',
1072
1128
  when: FocusAbout
1073
1129
  }, {
1074
- key: KeyCode.Tab,
1130
+ key: Tab,
1075
1131
  command: 'About.focusNext',
1076
1132
  when: FocusAbout
1077
1133
  }, {
1078
- key: KeyCode.Tab | KeyModifier.Shift,
1134
+ key: Tab | Shift,
1079
1135
  command: 'About.focusPrevious',
1080
1136
  when: FocusAbout
1081
1137
  }];
1082
1138
  };
1083
1139
 
1084
- const rpcs = Object.create(null);
1085
- const set$g = (id, rpc) => {
1086
- rpcs[id] = rpc;
1087
- };
1088
- const get = id => {
1089
- return rpcs[id];
1090
- };
1091
-
1092
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
1093
-
1094
- const create = rpcId => {
1095
- return {
1096
- // @ts-ignore
1097
- invoke(method, ...params) {
1098
- const rpc = get(rpcId);
1099
- // @ts-ignore
1100
- return rpc.invoke(method, ...params);
1101
- },
1102
- // @ts-ignore
1103
- invokeAndTransfer(method, ...params) {
1104
- const rpc = get(rpcId);
1105
- // @ts-ignore
1106
- return rpc.invokeAndTransfer(method, ...params);
1107
- },
1108
- set(rpc) {
1109
- set$g(rpcId, rpc);
1110
- },
1111
- async dispose() {
1112
- const rpc = get(rpcId);
1113
- await rpc.dispose();
1114
- }
1115
- };
1116
- };
1117
- const RendererWorker$1 = 1;
1118
- const {
1119
- invoke: invoke$3,
1120
- set: set$3} = create(RendererWorker$1);
1121
- const getElectronVersion$2 = async () => {
1122
- return invoke$3('Process.getElectronVersion');
1123
- };
1124
- const getNodeVersion$2 = async () => {
1125
- return invoke$3('Process.getNodeVersion');
1126
- };
1127
- const getChromeVersion$2 = async () => {
1128
- return invoke$3('Process.getChromeVersion');
1129
- };
1130
- const getV8Version$2 = async () => {
1131
- return invoke$3('Process.getV8Version');
1132
- };
1133
- const setFocus$1 = key => {
1134
- return invoke$3('Focus.setFocus', key);
1135
- };
1136
- const closeWidget$2 = async widgetId => {
1137
- return invoke$3('Viewlet.closeWidget', widgetId);
1138
- };
1139
- const writeClipBoardText$1 = async text => {
1140
- await invoke$3('ClipBoard.writeText', /* text */text);
1141
- };
1142
- const showMessageBox$2 = async options => {
1143
- return invoke$3('ElectronDialog.showMessageBox', options);
1144
- };
1145
- const openWidget$1 = async name => {
1146
- await invoke$3('Viewlet.openWidget', name);
1147
- };
1148
- const getWindowId$2 = async () => {
1149
- return invoke$3('GetWindowId.getWindowId');
1150
- };
1151
- const RendererWorker$2 = {
1152
- __proto__: null,
1153
- closeWidget: closeWidget$2,
1154
- getChromeVersion: getChromeVersion$2,
1155
- getElectronVersion: getElectronVersion$2,
1156
- getNodeVersion: getNodeVersion$2,
1157
- getV8Version: getV8Version$2,
1158
- getWindowId: getWindowId$2,
1159
- openWidget: openWidget$1,
1160
- set: set$3,
1161
- setFocus: setFocus$1,
1162
- showMessageBox: showMessageBox$2,
1163
- writeClipBoardText: writeClipBoardText$1
1164
- };
1165
-
1166
- const {
1167
- closeWidget: closeWidget$1,
1168
- getChromeVersion: getChromeVersion$1,
1169
- getElectronVersion: getElectronVersion$1,
1170
- getNodeVersion: getNodeVersion$1,
1171
- getV8Version: getV8Version$1,
1172
- getWindowId: getWindowId$1,
1173
- openWidget,
1174
- set,
1175
- setFocus,
1176
- showMessageBox: showMessageBox$1,
1177
- writeClipBoardText
1178
- } = RendererWorker$2;
1179
-
1180
- const RendererWorker = {
1181
- __proto__: null,
1182
- closeWidget: closeWidget$1,
1183
- getChromeVersion: getChromeVersion$1,
1184
- getElectronVersion: getElectronVersion$1,
1185
- getNodeVersion: getNodeVersion$1,
1186
- getV8Version: getV8Version$1,
1187
- getWindowId: getWindowId$1,
1188
- openWidget,
1189
- set,
1190
- setFocus,
1191
- showMessageBox: showMessageBox$1,
1192
- writeClipBoardText
1193
- };
1194
-
1195
- const {
1196
- closeWidget
1197
- } = RendererWorker;
1140
+ const closeWidget = closeWidget$1;
1198
1141
 
1199
1142
  const About$1 = 'About';
1200
1143
 
@@ -1557,24 +1500,16 @@ const getBrowser = () => {
1557
1500
  const version = '0.0.0-dev';
1558
1501
  const commit = 'unknown commit';
1559
1502
  const date = '';
1560
- const {
1561
- getElectronVersion
1562
- } = RendererWorker;
1563
- const {
1564
- getNodeVersion
1565
- } = RendererWorker;
1566
- const {
1567
- getChromeVersion
1568
- } = RendererWorker;
1503
+ const getElectronVersion = getElectronVersion$1;
1504
+ const getNodeVersion = getNodeVersion$1;
1505
+ const getChromeVersion = getChromeVersion$1;
1569
1506
  const getVersion = () => {
1570
1507
  return version;
1571
1508
  };
1572
1509
  const getCommit = () => {
1573
1510
  return commit;
1574
1511
  };
1575
- const {
1576
- getV8Version
1577
- } = RendererWorker;
1512
+ const getV8Version = getV8Version$1;
1578
1513
  const getDate = () => {
1579
1514
  return date;
1580
1515
  };
@@ -1612,14 +1547,14 @@ const loadContent2 = uid => {
1612
1547
  const lines = getDetailStringWeb();
1613
1548
  const {
1614
1549
  oldState
1615
- } = get$1(uid);
1550
+ } = get(uid);
1616
1551
  const newState = {
1617
1552
  ...oldState,
1618
1553
  productName: productNameLong$1,
1619
1554
  lines,
1620
1555
  focusId: Ok$2
1621
1556
  };
1622
- set$1(uid, oldState, newState);
1557
+ set(uid, oldState, newState);
1623
1558
  };
1624
1559
 
1625
1560
  const Ok = 'Ok';
@@ -1684,7 +1619,7 @@ const HandleContextMenu = 5;
1684
1619
  const HandleFocusIn = 6;
1685
1620
 
1686
1621
  const br = {
1687
- type: VirtualDomElements.Br,
1622
+ type: Br,
1688
1623
  childCount: 0
1689
1624
  };
1690
1625
  const renderLine = (line, index) => {
@@ -1696,7 +1631,7 @@ const renderLine = (line, index) => {
1696
1631
 
1697
1632
  const getAboutContentVirtualDom = lines => {
1698
1633
  const dom = [{
1699
- type: VirtualDomElements.Div,
1634
+ type: Div,
1700
1635
  className: DialogMessage,
1701
1636
  childCount: lines.length * 2 - 1
1702
1637
  }, ...lines.flatMap(renderLine)];
@@ -1710,7 +1645,7 @@ const Dialog = 'dialog';
1710
1645
 
1711
1646
  const getPrimaryButtonVirtualDom = (message, name) => {
1712
1647
  return [{
1713
- type: VirtualDomElements.Button,
1648
+ type: Button$2,
1714
1649
  className: mergeClassNames(Button$1, ButtonPrimary),
1715
1650
  onClick: HandleClickButton,
1716
1651
  childCount: 1,
@@ -1720,7 +1655,7 @@ const getPrimaryButtonVirtualDom = (message, name) => {
1720
1655
 
1721
1656
  const getSecondaryButtonVirtualDom = (message, name) => {
1722
1657
  return [{
1723
- type: VirtualDomElements.Button,
1658
+ type: Button$2,
1724
1659
  className: mergeClassNames(Button$1, ButtonSecondary),
1725
1660
  onClick: HandleClickButton,
1726
1661
  childCount: 1,
@@ -1739,7 +1674,7 @@ const Focusable = -1;
1739
1674
 
1740
1675
  const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copyMessage, productName) => {
1741
1676
  const dom = [{
1742
- type: VirtualDomElements.Div,
1677
+ type: Div,
1743
1678
  className: DialogContent,
1744
1679
  tabIndex: Focusable,
1745
1680
  role: Dialog,
@@ -1748,41 +1683,41 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
1748
1683
  onFocusIn: HandleFocusIn,
1749
1684
  childCount: 3
1750
1685
  }, {
1751
- type: VirtualDomElements.Div,
1686
+ type: Div,
1752
1687
  className: DialogToolBarRow,
1753
1688
  childCount: 1
1754
1689
  }, {
1755
- type: VirtualDomElements.Div,
1690
+ type: Div,
1756
1691
  className: DialogClose,
1757
1692
  ariaLabel: closeMessage,
1758
1693
  role: Button,
1759
1694
  onClick: HandleClickClose,
1760
1695
  childCount: 1
1761
1696
  }, {
1762
- type: VirtualDomElements.Div,
1697
+ type: Div,
1763
1698
  className: mergeClassNames(MaskIcon, MaskIconClose),
1764
1699
  childCount: 0
1765
1700
  }, {
1766
- type: VirtualDomElements.Div,
1701
+ type: Div,
1767
1702
  className: DialogMessageRow,
1768
1703
  childCount: 2
1769
1704
  }, {
1770
- type: VirtualDomElements.Div,
1705
+ type: Div,
1771
1706
  className: mergeClassNames(DialogIcon$1, DialogInfoIcon, MaskIcon, MaskIconInfo),
1772
1707
  id: DialogIcon,
1773
1708
  ariaLabel: infoMessage,
1774
1709
  childCount: 0
1775
1710
  }, {
1776
- type: VirtualDomElements.Div,
1711
+ type: Div,
1777
1712
  className: DialogContentRight,
1778
1713
  childCount: 2
1779
1714
  }, {
1780
- type: VirtualDomElements.Div,
1715
+ type: Div,
1781
1716
  id: DialogHeading,
1782
1717
  className: DialogHeading$1,
1783
1718
  childCount: 1
1784
1719
  }, text(productName), ...content, {
1785
- type: VirtualDomElements.Div,
1720
+ type: Div,
1786
1721
  className: DialogButtonsRow,
1787
1722
  childCount: 2
1788
1723
  }, ...getSecondaryButtonVirtualDom(okMessage, Ok$1), ...getPrimaryButtonVirtualDom(copyMessage, Copy$1)];
@@ -1792,7 +1727,7 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
1792
1727
  const getAboutVirtualDom = (productName, lines, closeMessage, okMessage, copyMessage, infoMessage) => {
1793
1728
  const content = getAboutContentVirtualDom(lines);
1794
1729
  return [{
1795
- type: VirtualDomElements.Div,
1730
+ type: Div,
1796
1731
  className: mergeClassNames(Viewlet, About),
1797
1732
  onContextMenu: HandleContextMenu,
1798
1733
  childCount: 1
@@ -1851,8 +1786,8 @@ const doRender = (uid, diffResult) => {
1851
1786
  const {
1852
1787
  oldState,
1853
1788
  newState
1854
- } = get$1(uid);
1855
- set$1(uid, newState, newState);
1789
+ } = get(uid);
1790
+ set(uid, newState, newState);
1856
1791
  const commands = applyRender(oldState, newState, diffResult);
1857
1792
  return commands;
1858
1793
  };
@@ -1880,9 +1815,7 @@ const showAboutDefault = async () => {
1880
1815
  await openWidget(About$1);
1881
1816
  };
1882
1817
 
1883
- const {
1884
- getWindowId
1885
- } = RendererWorker;
1818
+ const getWindowId = getWindowId$1;
1886
1819
 
1887
1820
  const productNameLong = 'Lvce Editor - OSS';
1888
1821
  const getProductNameLong = () => {
@@ -1944,7 +1877,7 @@ const showAbout = async platform => {
1944
1877
  };
1945
1878
 
1946
1879
  const commandMap = {
1947
- 'About.create': create$1,
1880
+ 'About.create': create,
1948
1881
  'About.diff2': diff2,
1949
1882
  'About.dispose': dispose,
1950
1883
  'About.focusNext': wrapCommand(focusNext),
@@ -1964,10 +1897,11 @@ const commandMap = {
1964
1897
  };
1965
1898
 
1966
1899
  const listen = async () => {
1900
+ registerCommands(commandMap);
1967
1901
  const rpc = await WebWorkerRpcClient.create({
1968
1902
  commandMap: commandMap
1969
1903
  });
1970
- set(rpc);
1904
+ set$1(rpc);
1971
1905
  };
1972
1906
 
1973
1907
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/about-view",
3
- "version": "5.12.0",
3
+ "version": "6.0.0",
4
4
  "description": "About View Worker",
5
5
  "keywords": [
6
6
  "about-view"