@lvce-editor/about-view 5.10.0 → 5.12.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 +97 -59
- package/package.json +1 -1
package/dist/aboutWorkerMain.js
CHANGED
@@ -477,7 +477,8 @@ const splitLines = lines => {
|
|
477
477
|
return lines.split(NewLine$1);
|
478
478
|
};
|
479
479
|
const getCurrentStack = () => {
|
480
|
-
const
|
480
|
+
const stackLinesToSkip = 3;
|
481
|
+
const currentStack = joinLines$1(splitLines(new Error().stack || '').slice(stackLinesToSkip));
|
481
482
|
return currentStack;
|
482
483
|
};
|
483
484
|
const getNewLineIndex = (string, startIndex = undefined) => {
|
@@ -748,6 +749,12 @@ const invokeAndTransfer = (ipc, method, ...params) => {
|
|
748
749
|
return invokeHelper(ipc, method, params, true);
|
749
750
|
};
|
750
751
|
|
752
|
+
class CommandNotFoundError extends Error {
|
753
|
+
constructor(command) {
|
754
|
+
super(`Command not found ${command}`);
|
755
|
+
this.name = 'CommandNotFoundError';
|
756
|
+
}
|
757
|
+
}
|
751
758
|
const commands = Object.create(null);
|
752
759
|
const register = commandMap => {
|
753
760
|
Object.assign(commands, commandMap);
|
@@ -758,7 +765,7 @@ const getCommand = key => {
|
|
758
765
|
const execute = (command, ...args) => {
|
759
766
|
const fn = getCommand(command);
|
760
767
|
if (!fn) {
|
761
|
-
throw new
|
768
|
+
throw new CommandNotFoundError(command);
|
762
769
|
}
|
763
770
|
return fn(...args);
|
764
771
|
};
|
@@ -830,8 +837,13 @@ const WebWorkerRpcClient = {
|
|
830
837
|
create: create$3
|
831
838
|
};
|
832
839
|
|
840
|
+
const toCommandId = key => {
|
841
|
+
const dotIndex = key.indexOf('.');
|
842
|
+
return key.slice(dotIndex + 1);
|
843
|
+
};
|
833
844
|
const create$2 = () => {
|
834
845
|
const states = Object.create(null);
|
846
|
+
const commandMapRef = {};
|
835
847
|
return {
|
836
848
|
get(uid) {
|
837
849
|
return states[uid];
|
@@ -872,6 +884,15 @@ const create$2 = () => {
|
|
872
884
|
};
|
873
885
|
return wrapped;
|
874
886
|
},
|
887
|
+
wrapGetter(fn) {
|
888
|
+
const wrapped = (uid, ...args) => {
|
889
|
+
const {
|
890
|
+
newState
|
891
|
+
} = states[uid];
|
892
|
+
return fn(newState, ...args);
|
893
|
+
};
|
894
|
+
return wrapped;
|
895
|
+
},
|
875
896
|
diff(uid, modules, numbers) {
|
876
897
|
const {
|
877
898
|
oldState,
|
@@ -885,6 +906,14 @@ const create$2 = () => {
|
|
885
906
|
}
|
886
907
|
}
|
887
908
|
return diffResult;
|
909
|
+
},
|
910
|
+
getCommandIds() {
|
911
|
+
const keys = Object.keys(commandMapRef);
|
912
|
+
const ids = keys.map(toCommandId);
|
913
|
+
return ids;
|
914
|
+
},
|
915
|
+
registerCommands(commandMap) {
|
916
|
+
Object.assign(commandMapRef, commandMap);
|
888
917
|
}
|
889
918
|
};
|
890
919
|
};
|
@@ -1006,22 +1035,47 @@ const getCommandIds = () => {
|
|
1006
1035
|
|
1007
1036
|
const Tab = 2;
|
1008
1037
|
const Escape = 8;
|
1009
|
-
|
1038
|
+
const KeyCode = {
|
1039
|
+
__proto__: null,
|
1040
|
+
Escape,
|
1041
|
+
Tab};
|
1010
1042
|
const Shift = 1 << 10 >>> 0;
|
1043
|
+
const KeyModifier = {
|
1044
|
+
__proto__: null,
|
1045
|
+
Shift};
|
1046
|
+
const mergeClassNames = (...classNames) => {
|
1047
|
+
return classNames.filter(Boolean).join(' ');
|
1048
|
+
};
|
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};
|
1058
|
+
const text = data => {
|
1059
|
+
return {
|
1060
|
+
type: Text,
|
1061
|
+
text: data,
|
1062
|
+
childCount: 0
|
1063
|
+
};
|
1064
|
+
};
|
1011
1065
|
|
1012
1066
|
const FocusAbout = 4;
|
1013
1067
|
|
1014
1068
|
const getKeyBindings = () => {
|
1015
1069
|
return [{
|
1016
|
-
key: Escape,
|
1070
|
+
key: KeyCode.Escape,
|
1017
1071
|
command: 'About.handleClickClose',
|
1018
1072
|
when: FocusAbout
|
1019
1073
|
}, {
|
1020
|
-
key: Tab,
|
1074
|
+
key: KeyCode.Tab,
|
1021
1075
|
command: 'About.focusNext',
|
1022
1076
|
when: FocusAbout
|
1023
1077
|
}, {
|
1024
|
-
key: Tab | Shift,
|
1078
|
+
key: KeyCode.Tab | KeyModifier.Shift,
|
1025
1079
|
command: 'About.focusPrevious',
|
1026
1080
|
when: FocusAbout
|
1027
1081
|
}];
|
@@ -1062,37 +1116,37 @@ const create = rpcId => {
|
|
1062
1116
|
};
|
1063
1117
|
const RendererWorker$1 = 1;
|
1064
1118
|
const {
|
1065
|
-
invoke: invoke$
|
1119
|
+
invoke: invoke$3,
|
1066
1120
|
set: set$3} = create(RendererWorker$1);
|
1067
1121
|
const getElectronVersion$2 = async () => {
|
1068
|
-
return invoke$
|
1122
|
+
return invoke$3('Process.getElectronVersion');
|
1069
1123
|
};
|
1070
1124
|
const getNodeVersion$2 = async () => {
|
1071
|
-
return invoke$
|
1125
|
+
return invoke$3('Process.getNodeVersion');
|
1072
1126
|
};
|
1073
1127
|
const getChromeVersion$2 = async () => {
|
1074
|
-
return invoke$
|
1128
|
+
return invoke$3('Process.getChromeVersion');
|
1075
1129
|
};
|
1076
1130
|
const getV8Version$2 = async () => {
|
1077
|
-
return invoke$
|
1131
|
+
return invoke$3('Process.getV8Version');
|
1078
1132
|
};
|
1079
1133
|
const setFocus$1 = key => {
|
1080
|
-
return invoke$
|
1134
|
+
return invoke$3('Focus.setFocus', key);
|
1081
1135
|
};
|
1082
|
-
const closeWidget$2 = async
|
1083
|
-
return invoke$
|
1136
|
+
const closeWidget$2 = async widgetId => {
|
1137
|
+
return invoke$3('Viewlet.closeWidget', widgetId);
|
1084
1138
|
};
|
1085
1139
|
const writeClipBoardText$1 = async text => {
|
1086
|
-
await invoke$
|
1140
|
+
await invoke$3('ClipBoard.writeText', /* text */text);
|
1087
1141
|
};
|
1088
1142
|
const showMessageBox$2 = async options => {
|
1089
|
-
return invoke$
|
1143
|
+
return invoke$3('ElectronDialog.showMessageBox', options);
|
1090
1144
|
};
|
1091
1145
|
const openWidget$1 = async name => {
|
1092
|
-
await invoke$
|
1146
|
+
await invoke$3('Viewlet.openWidget', name);
|
1093
1147
|
};
|
1094
1148
|
const getWindowId$2 = async () => {
|
1095
|
-
return invoke$
|
1149
|
+
return invoke$3('GetWindowId.getWindowId');
|
1096
1150
|
};
|
1097
1151
|
const RendererWorker$2 = {
|
1098
1152
|
__proto__: null,
|
@@ -1110,6 +1164,7 @@ const RendererWorker$2 = {
|
|
1110
1164
|
};
|
1111
1165
|
|
1112
1166
|
const {
|
1167
|
+
closeWidget: closeWidget$1,
|
1113
1168
|
getChromeVersion: getChromeVersion$1,
|
1114
1169
|
getElectronVersion: getElectronVersion$1,
|
1115
1170
|
getNodeVersion: getNodeVersion$1,
|
@@ -1119,8 +1174,7 @@ const {
|
|
1119
1174
|
set,
|
1120
1175
|
setFocus,
|
1121
1176
|
showMessageBox: showMessageBox$1,
|
1122
|
-
writeClipBoardText
|
1123
|
-
closeWidget: closeWidget$1
|
1177
|
+
writeClipBoardText
|
1124
1178
|
} = RendererWorker$2;
|
1125
1179
|
|
1126
1180
|
const RendererWorker = {
|
@@ -1142,8 +1196,10 @@ const {
|
|
1142
1196
|
closeWidget
|
1143
1197
|
} = RendererWorker;
|
1144
1198
|
|
1199
|
+
const About$1 = 'About';
|
1200
|
+
|
1145
1201
|
const close = async () => {
|
1146
|
-
await closeWidget(
|
1202
|
+
await closeWidget(About$1);
|
1147
1203
|
};
|
1148
1204
|
|
1149
1205
|
const handleClickClose = async state => {
|
@@ -1603,7 +1659,7 @@ const createViewModel = state => {
|
|
1603
1659
|
};
|
1604
1660
|
};
|
1605
1661
|
|
1606
|
-
const Button$
|
1662
|
+
const Button$1 = 'Button';
|
1607
1663
|
const ButtonPrimary = 'ButtonPrimary';
|
1608
1664
|
const ButtonSecondary = 'ButtonSecondary';
|
1609
1665
|
const DialogButtonsRow = 'DialogButtonsRow';
|
@@ -1613,7 +1669,7 @@ const DialogContentRight = 'DialogContentRight';
|
|
1613
1669
|
const DialogHeading$1 = 'DialogHeading';
|
1614
1670
|
const DialogMessage = 'DialogMessage';
|
1615
1671
|
const DialogMessageRow = 'DialogMessageRow';
|
1616
|
-
const About
|
1672
|
+
const About = 'About';
|
1617
1673
|
const Viewlet = 'Viewlet';
|
1618
1674
|
const DialogToolBarRow = 'DialogToolBarRow';
|
1619
1675
|
const MaskIcon = 'MaskIcon';
|
@@ -1627,24 +1683,8 @@ const HandleClickButton = 4;
|
|
1627
1683
|
const HandleContextMenu = 5;
|
1628
1684
|
const HandleFocusIn = 6;
|
1629
1685
|
|
1630
|
-
const Button$1 = 1;
|
1631
|
-
const Div = 4;
|
1632
|
-
const Br = 55;
|
1633
|
-
|
1634
|
-
const mergeClassNames = (...classNames) => {
|
1635
|
-
return classNames.filter(Boolean).join(' ');
|
1636
|
-
};
|
1637
|
-
const Text = 12;
|
1638
|
-
const text = data => {
|
1639
|
-
return {
|
1640
|
-
type: Text,
|
1641
|
-
text: data,
|
1642
|
-
childCount: 0
|
1643
|
-
};
|
1644
|
-
};
|
1645
|
-
|
1646
1686
|
const br = {
|
1647
|
-
type: Br,
|
1687
|
+
type: VirtualDomElements.Br,
|
1648
1688
|
childCount: 0
|
1649
1689
|
};
|
1650
1690
|
const renderLine = (line, index) => {
|
@@ -1656,7 +1696,7 @@ const renderLine = (line, index) => {
|
|
1656
1696
|
|
1657
1697
|
const getAboutContentVirtualDom = lines => {
|
1658
1698
|
const dom = [{
|
1659
|
-
type: Div,
|
1699
|
+
type: VirtualDomElements.Div,
|
1660
1700
|
className: DialogMessage,
|
1661
1701
|
childCount: lines.length * 2 - 1
|
1662
1702
|
}, ...lines.flatMap(renderLine)];
|
@@ -1670,8 +1710,8 @@ const Dialog = 'dialog';
|
|
1670
1710
|
|
1671
1711
|
const getPrimaryButtonVirtualDom = (message, name) => {
|
1672
1712
|
return [{
|
1673
|
-
type: Button
|
1674
|
-
className: mergeClassNames(Button$
|
1713
|
+
type: VirtualDomElements.Button,
|
1714
|
+
className: mergeClassNames(Button$1, ButtonPrimary),
|
1675
1715
|
onClick: HandleClickButton,
|
1676
1716
|
childCount: 1,
|
1677
1717
|
name
|
@@ -1680,8 +1720,8 @@ const getPrimaryButtonVirtualDom = (message, name) => {
|
|
1680
1720
|
|
1681
1721
|
const getSecondaryButtonVirtualDom = (message, name) => {
|
1682
1722
|
return [{
|
1683
|
-
type: Button
|
1684
|
-
className: mergeClassNames(Button$
|
1723
|
+
type: VirtualDomElements.Button,
|
1724
|
+
className: mergeClassNames(Button$1, ButtonSecondary),
|
1685
1725
|
onClick: HandleClickButton,
|
1686
1726
|
childCount: 1,
|
1687
1727
|
name
|
@@ -1699,7 +1739,7 @@ const Focusable = -1;
|
|
1699
1739
|
|
1700
1740
|
const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copyMessage, productName) => {
|
1701
1741
|
const dom = [{
|
1702
|
-
type: Div,
|
1742
|
+
type: VirtualDomElements.Div,
|
1703
1743
|
className: DialogContent,
|
1704
1744
|
tabIndex: Focusable,
|
1705
1745
|
role: Dialog,
|
@@ -1708,41 +1748,41 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
|
|
1708
1748
|
onFocusIn: HandleFocusIn,
|
1709
1749
|
childCount: 3
|
1710
1750
|
}, {
|
1711
|
-
type: Div,
|
1751
|
+
type: VirtualDomElements.Div,
|
1712
1752
|
className: DialogToolBarRow,
|
1713
1753
|
childCount: 1
|
1714
1754
|
}, {
|
1715
|
-
type: Div,
|
1755
|
+
type: VirtualDomElements.Div,
|
1716
1756
|
className: DialogClose,
|
1717
1757
|
ariaLabel: closeMessage,
|
1718
1758
|
role: Button,
|
1719
1759
|
onClick: HandleClickClose,
|
1720
1760
|
childCount: 1
|
1721
1761
|
}, {
|
1722
|
-
type: Div,
|
1762
|
+
type: VirtualDomElements.Div,
|
1723
1763
|
className: mergeClassNames(MaskIcon, MaskIconClose),
|
1724
1764
|
childCount: 0
|
1725
1765
|
}, {
|
1726
|
-
type: Div,
|
1766
|
+
type: VirtualDomElements.Div,
|
1727
1767
|
className: DialogMessageRow,
|
1728
1768
|
childCount: 2
|
1729
1769
|
}, {
|
1730
|
-
type: Div,
|
1770
|
+
type: VirtualDomElements.Div,
|
1731
1771
|
className: mergeClassNames(DialogIcon$1, DialogInfoIcon, MaskIcon, MaskIconInfo),
|
1732
1772
|
id: DialogIcon,
|
1733
1773
|
ariaLabel: infoMessage,
|
1734
1774
|
childCount: 0
|
1735
1775
|
}, {
|
1736
|
-
type: Div,
|
1776
|
+
type: VirtualDomElements.Div,
|
1737
1777
|
className: DialogContentRight,
|
1738
1778
|
childCount: 2
|
1739
1779
|
}, {
|
1740
|
-
type: Div,
|
1780
|
+
type: VirtualDomElements.Div,
|
1741
1781
|
id: DialogHeading,
|
1742
1782
|
className: DialogHeading$1,
|
1743
1783
|
childCount: 1
|
1744
1784
|
}, text(productName), ...content, {
|
1745
|
-
type: Div,
|
1785
|
+
type: VirtualDomElements.Div,
|
1746
1786
|
className: DialogButtonsRow,
|
1747
1787
|
childCount: 2
|
1748
1788
|
}, ...getSecondaryButtonVirtualDom(okMessage, Ok$1), ...getPrimaryButtonVirtualDom(copyMessage, Copy$1)];
|
@@ -1752,8 +1792,8 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
|
|
1752
1792
|
const getAboutVirtualDom = (productName, lines, closeMessage, okMessage, copyMessage, infoMessage) => {
|
1753
1793
|
const content = getAboutContentVirtualDom(lines);
|
1754
1794
|
return [{
|
1755
|
-
type: Div,
|
1756
|
-
className: mergeClassNames(Viewlet, About
|
1795
|
+
type: VirtualDomElements.Div,
|
1796
|
+
className: mergeClassNames(Viewlet, About),
|
1757
1797
|
onContextMenu: HandleContextMenu,
|
1758
1798
|
childCount: 1
|
1759
1799
|
}, ...getDialogVirtualDom(content, closeMessage, infoMessage, okMessage, copyMessage, productName)];
|
@@ -1836,10 +1876,8 @@ const renderEventListeners = () => {
|
|
1836
1876
|
|
1837
1877
|
const Electron = 2;
|
1838
1878
|
|
1839
|
-
const About = 'About';
|
1840
|
-
|
1841
1879
|
const showAboutDefault = async () => {
|
1842
|
-
await openWidget(About);
|
1880
|
+
await openWidget(About$1);
|
1843
1881
|
};
|
1844
1882
|
|
1845
1883
|
const {
|