@lvce-editor/menu-worker 1.0.0 → 1.2.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/README.md +0 -4
- package/dist/menuWorkerMain.js +969 -745
- package/package.json +1 -1
package/dist/menuWorkerMain.js
CHANGED
|
@@ -421,7 +421,7 @@ const create$4 = (method, params) => {
|
|
|
421
421
|
};
|
|
422
422
|
};
|
|
423
423
|
const callbacks = Object.create(null);
|
|
424
|
-
const set$
|
|
424
|
+
const set$3 = (id, fn) => {
|
|
425
425
|
callbacks[id] = fn;
|
|
426
426
|
};
|
|
427
427
|
const get$2 = id => {
|
|
@@ -440,7 +440,7 @@ const registerPromise = () => {
|
|
|
440
440
|
resolve,
|
|
441
441
|
promise
|
|
442
442
|
} = Promise.withResolvers();
|
|
443
|
-
set$
|
|
443
|
+
set$3(id, resolve);
|
|
444
444
|
return {
|
|
445
445
|
id,
|
|
446
446
|
promise
|
|
@@ -785,7 +785,7 @@ const send = (transport, method, ...params) => {
|
|
|
785
785
|
const message = create$4(method, params);
|
|
786
786
|
transport.send(message);
|
|
787
787
|
};
|
|
788
|
-
const invoke$
|
|
788
|
+
const invoke$3 = (ipc, method, ...params) => {
|
|
789
789
|
return invokeHelper(ipc, method, params, false);
|
|
790
790
|
};
|
|
791
791
|
const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
@@ -824,7 +824,7 @@ const createRpc = ipc => {
|
|
|
824
824
|
send(ipc, method, ...params);
|
|
825
825
|
},
|
|
826
826
|
invoke(method, ...params) {
|
|
827
|
-
return invoke$
|
|
827
|
+
return invoke$3(ipc, method, ...params);
|
|
828
828
|
},
|
|
829
829
|
invokeAndTransfer(method, ...params) {
|
|
830
830
|
return invokeAndTransfer$1(ipc, method, ...params);
|
|
@@ -899,73 +899,6 @@ const createMockRpc = ({
|
|
|
899
899
|
return mockRpc;
|
|
900
900
|
};
|
|
901
901
|
|
|
902
|
-
const RenderEntries = 1;
|
|
903
|
-
const RenderFocusedIndex = 2;
|
|
904
|
-
const RenderMenus = 3;
|
|
905
|
-
|
|
906
|
-
const diffType$2 = RenderEntries;
|
|
907
|
-
const isEqual$2 = (oldState, newState) => {
|
|
908
|
-
return oldState.titleBarEntries === newState.titleBarEntries && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
|
|
909
|
-
};
|
|
910
|
-
|
|
911
|
-
const diffType$1 = RenderFocusedIndex;
|
|
912
|
-
const isEqual$1 = (oldState, newState) => {
|
|
913
|
-
return oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
|
|
914
|
-
};
|
|
915
|
-
|
|
916
|
-
const diffType = RenderMenus;
|
|
917
|
-
const isEqual = (oldState, newState) => {
|
|
918
|
-
return oldState.menus === newState.menus;
|
|
919
|
-
};
|
|
920
|
-
|
|
921
|
-
const modules = [isEqual$2, isEqual$1, isEqual];
|
|
922
|
-
const numbers = [diffType$2, diffType$1, diffType];
|
|
923
|
-
|
|
924
|
-
const diff = (oldState, newState) => {
|
|
925
|
-
const diffResult = [];
|
|
926
|
-
for (let i = 0; i < modules.length; i++) {
|
|
927
|
-
const fn = modules[i];
|
|
928
|
-
if (!fn(oldState, newState)) {
|
|
929
|
-
diffResult.push(numbers[i]);
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
return diffResult;
|
|
933
|
-
};
|
|
934
|
-
|
|
935
|
-
const create$1 = () => {
|
|
936
|
-
const states = Object.create(null);
|
|
937
|
-
return {
|
|
938
|
-
get(uid) {
|
|
939
|
-
return states[uid];
|
|
940
|
-
},
|
|
941
|
-
set(uid, oldState, newState) {
|
|
942
|
-
states[uid] = {
|
|
943
|
-
oldState,
|
|
944
|
-
newState
|
|
945
|
-
};
|
|
946
|
-
}
|
|
947
|
-
};
|
|
948
|
-
};
|
|
949
|
-
|
|
950
|
-
const {
|
|
951
|
-
get: get$1,
|
|
952
|
-
set: set$3
|
|
953
|
-
} = create$1();
|
|
954
|
-
|
|
955
|
-
const diff2 = uid => {
|
|
956
|
-
const {
|
|
957
|
-
oldState,
|
|
958
|
-
newState
|
|
959
|
-
} = get$1(uid);
|
|
960
|
-
return diff(oldState, newState);
|
|
961
|
-
};
|
|
962
|
-
|
|
963
|
-
const commandsIds = ['closeMenu', 'handleClickAt', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusPrevious', 'handleClick', 'handleFocus', 'handleFocusOut', 'handleKeyArrowDown', 'handleKeyArrowLeft', 'handleKeyArrowRight', 'handleKeyArrowUp', 'handleKeyEnd', 'handleKeyEnter', 'handleKeyEscape', 'handleKeyHome', 'handleKeySpace', 'handleMenuClick', 'handleMenuMouseOver', 'handleMouseOut', 'handleMouseOver', 'handlePointerOver', 'handlePointerOut', 'toggleIndex', 'toggleMenu'];
|
|
964
|
-
|
|
965
|
-
const getCommandIds = () => {
|
|
966
|
-
return commandsIds;
|
|
967
|
-
};
|
|
968
|
-
|
|
969
902
|
const Text = 12;
|
|
970
903
|
|
|
971
904
|
const Escape$2 = 8;
|
|
@@ -983,445 +916,94 @@ const Shift = 1 << 10 >>> 0;
|
|
|
983
916
|
const DebugWorker = 55;
|
|
984
917
|
const RendererWorker$1 = 1;
|
|
985
918
|
|
|
986
|
-
const
|
|
987
|
-
|
|
919
|
+
const rpcs = Object.create(null);
|
|
920
|
+
const set$2 = (id, rpc) => {
|
|
921
|
+
rpcs[id] = rpc;
|
|
922
|
+
};
|
|
923
|
+
const get$1 = id => {
|
|
924
|
+
return rpcs[id];
|
|
988
925
|
};
|
|
989
926
|
|
|
990
|
-
const
|
|
927
|
+
const create$1 = rpcId => {
|
|
991
928
|
return {
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
929
|
+
// @ts-ignore
|
|
930
|
+
invoke(method, ...params) {
|
|
931
|
+
const rpc = get$1(rpcId);
|
|
932
|
+
// @ts-ignore
|
|
933
|
+
return rpc.invoke(method, ...params);
|
|
934
|
+
},
|
|
935
|
+
// @ts-ignore
|
|
936
|
+
invokeAndTransfer(method, ...params) {
|
|
937
|
+
const rpc = get$1(rpcId);
|
|
938
|
+
// @ts-ignore
|
|
939
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
940
|
+
},
|
|
941
|
+
set(rpc) {
|
|
942
|
+
set$2(rpcId, rpc);
|
|
943
|
+
},
|
|
944
|
+
async dispose() {
|
|
945
|
+
const rpc = get$1(rpcId);
|
|
946
|
+
await rpc.dispose();
|
|
947
|
+
}
|
|
995
948
|
};
|
|
996
949
|
};
|
|
997
950
|
|
|
998
|
-
const
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
key: UpArrow$2,
|
|
1007
|
-
command: 'TitleBarMenuBar.handleKeyArrowUp',
|
|
1008
|
-
when: FocusTitleBarMenuBar
|
|
1009
|
-
}, {
|
|
1010
|
-
key: RightArrow$2,
|
|
1011
|
-
command: 'TitleBarMenuBar.handleKeyArrowRight',
|
|
1012
|
-
when: FocusTitleBarMenuBar
|
|
1013
|
-
}, {
|
|
1014
|
-
key: LeftArrow$2,
|
|
1015
|
-
command: 'TitleBarMenuBar.handleKeyArrowLeft',
|
|
1016
|
-
when: FocusTitleBarMenuBar
|
|
1017
|
-
}, {
|
|
1018
|
-
key: Space$2,
|
|
1019
|
-
command: 'TitleBarMenuBar.handleKeySpace',
|
|
1020
|
-
when: FocusTitleBarMenuBar
|
|
1021
|
-
}, {
|
|
1022
|
-
key: Home$2,
|
|
1023
|
-
command: 'TitleBarMenuBar.handleKeyHome',
|
|
1024
|
-
when: FocusTitleBarMenuBar
|
|
1025
|
-
}, {
|
|
1026
|
-
key: End$2,
|
|
1027
|
-
command: 'TitleBarMenuBar.handleKeyEnd',
|
|
1028
|
-
when: FocusTitleBarMenuBar
|
|
1029
|
-
}, {
|
|
1030
|
-
key: Escape$2,
|
|
1031
|
-
command: 'TitleBarMenuBar.handleKeyEscape',
|
|
1032
|
-
when: FocusTitleBarMenuBar
|
|
1033
|
-
}];
|
|
951
|
+
const {
|
|
952
|
+
invoke: invoke$2,
|
|
953
|
+
invokeAndTransfer,
|
|
954
|
+
set: set$1,
|
|
955
|
+
dispose
|
|
956
|
+
} = create$1(RendererWorker$1);
|
|
957
|
+
const searchFileHtml = async uri => {
|
|
958
|
+
return invoke$2('ExtensionHost.searchFileWithHtml', uri);
|
|
1034
959
|
};
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
1038
|
-
const i18nString = (key, placeholders = emptyObject) => {
|
|
1039
|
-
if (placeholders === emptyObject) {
|
|
1040
|
-
return key;
|
|
1041
|
-
}
|
|
1042
|
-
const replacer = (match, rest) => {
|
|
1043
|
-
return placeholders[rest];
|
|
1044
|
-
};
|
|
1045
|
-
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
960
|
+
const getFilePathElectron = async file => {
|
|
961
|
+
return invoke$2('FileSystemHandle.getFilePathElectron', file);
|
|
1046
962
|
};
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
* @enum {string}
|
|
1050
|
-
*/
|
|
1051
|
-
const UiStrings$2 = {
|
|
1052
|
-
Copy: 'Copy',
|
|
1053
|
-
CopyLineDown: 'Copy Line Down',
|
|
1054
|
-
CopyLineUp: 'Copy Line Up',
|
|
1055
|
-
Cut: 'Cut',
|
|
1056
|
-
MoveLineDown: 'Move Line Down',
|
|
1057
|
-
MoveLineUp: 'Move Line Up',
|
|
1058
|
-
Paste: 'Paste',
|
|
1059
|
-
Redo: 'Redo',
|
|
1060
|
-
SelectAll: 'Select All',
|
|
1061
|
-
ToggleBlockComment: 'Toggle Block Comment',
|
|
1062
|
-
ToggleLineComment: 'Toggle Line Comment',
|
|
1063
|
-
Undo: 'Undo'};
|
|
1064
|
-
const cut = () => {
|
|
1065
|
-
return i18nString(UiStrings$2.Cut);
|
|
963
|
+
const showContextMenu = async (x, y, id, ...args) => {
|
|
964
|
+
return invoke$2('ContextMenu.show', x, y, id, ...args);
|
|
1066
965
|
};
|
|
1067
|
-
const
|
|
1068
|
-
return
|
|
966
|
+
const getElectronVersion = async () => {
|
|
967
|
+
return invoke$2('Process.getElectronVersion');
|
|
1069
968
|
};
|
|
1070
|
-
const
|
|
1071
|
-
|
|
969
|
+
const applyBulkReplacement = async bulkEdits => {
|
|
970
|
+
await invoke$2('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1072
971
|
};
|
|
1073
|
-
const
|
|
1074
|
-
|
|
972
|
+
const setColorTheme = async id => {
|
|
973
|
+
// @ts-ignore
|
|
974
|
+
return invoke$2(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1075
975
|
};
|
|
1076
|
-
const
|
|
1077
|
-
return
|
|
976
|
+
const getNodeVersion = async () => {
|
|
977
|
+
return invoke$2('Process.getNodeVersion');
|
|
1078
978
|
};
|
|
1079
|
-
const
|
|
1080
|
-
return
|
|
979
|
+
const getChromeVersion = async () => {
|
|
980
|
+
return invoke$2('Process.getChromeVersion');
|
|
1081
981
|
};
|
|
1082
|
-
const
|
|
1083
|
-
return
|
|
982
|
+
const getV8Version = async () => {
|
|
983
|
+
return invoke$2('Process.getV8Version');
|
|
1084
984
|
};
|
|
1085
|
-
const
|
|
1086
|
-
|
|
985
|
+
const getFileHandles = async fileIds => {
|
|
986
|
+
const files = await invoke$2('FileSystemHandle.getFileHandles', fileIds);
|
|
987
|
+
return files;
|
|
1087
988
|
};
|
|
1088
|
-
const
|
|
1089
|
-
|
|
989
|
+
const setWorkspacePath = async path => {
|
|
990
|
+
await invoke$2('Workspace.setPath', path);
|
|
1090
991
|
};
|
|
1091
|
-
const
|
|
1092
|
-
|
|
992
|
+
const registerWebViewInterceptor = async (id, port) => {
|
|
993
|
+
await invokeAndTransfer('WebView.registerInterceptor', id, port);
|
|
1093
994
|
};
|
|
1094
|
-
const
|
|
1095
|
-
|
|
995
|
+
const unregisterWebViewInterceptor = async id => {
|
|
996
|
+
await invoke$2('WebView.unregisterInterceptor', id);
|
|
1096
997
|
};
|
|
1097
|
-
const
|
|
1098
|
-
|
|
998
|
+
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
999
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1000
|
+
// @ts-ignore
|
|
1001
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1099
1002
|
};
|
|
1100
|
-
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
const Help$1 = 7;
|
|
1105
|
-
const OpenRecent = 9;
|
|
1106
|
-
const Run$1 = 10;
|
|
1107
|
-
const Selection$1 = 11;
|
|
1108
|
-
const Terminal$1 = 14;
|
|
1109
|
-
const TitleBar = 15;
|
|
1110
|
-
const View$1 = 16;
|
|
1111
|
-
|
|
1112
|
-
const Separator$1 = 1;
|
|
1113
|
-
const None = 0;
|
|
1114
|
-
const SubMenu = 4;
|
|
1115
|
-
const Checked = 2;
|
|
1116
|
-
const Unchecked = 3;
|
|
1117
|
-
const Disabled = 5;
|
|
1118
|
-
const RestoreFocus = 6;
|
|
1119
|
-
const Ignore = 7;
|
|
1120
|
-
|
|
1121
|
-
const menuEntrySeparator = {
|
|
1122
|
-
id: 'separator',
|
|
1123
|
-
label: '',
|
|
1124
|
-
flags: Separator$1,
|
|
1125
|
-
command: ''
|
|
1126
|
-
};
|
|
1127
|
-
|
|
1128
|
-
const id$9 = Edit$1;
|
|
1129
|
-
const getMenuEntries$c = () => {
|
|
1130
|
-
return [{
|
|
1131
|
-
id: 'undo',
|
|
1132
|
-
label: undo(),
|
|
1133
|
-
flags: Disabled,
|
|
1134
|
-
command: /* TODO */'-1'
|
|
1135
|
-
}, {
|
|
1136
|
-
id: 'redo',
|
|
1137
|
-
label: redo(),
|
|
1138
|
-
flags: Disabled,
|
|
1139
|
-
command: /* TODO */'-1'
|
|
1140
|
-
}, menuEntrySeparator, {
|
|
1141
|
-
id: 'cut',
|
|
1142
|
-
label: cut(),
|
|
1143
|
-
flags: None,
|
|
1144
|
-
command: /* Editor.cut */'Editor.cut'
|
|
1145
|
-
}, {
|
|
1146
|
-
id: 'copy',
|
|
1147
|
-
label: copy(),
|
|
1148
|
-
flags: None,
|
|
1149
|
-
command: /* Editor.copy */'Editor.copy'
|
|
1150
|
-
}, {
|
|
1151
|
-
id: 'paste',
|
|
1152
|
-
label: paste(),
|
|
1153
|
-
flags: None,
|
|
1154
|
-
command: /* Editor.paste */'Editor.paste'
|
|
1155
|
-
}, menuEntrySeparator, {
|
|
1156
|
-
id: 'toggle-line-comment',
|
|
1157
|
-
label: toggleLineComment(),
|
|
1158
|
-
flags: None,
|
|
1159
|
-
command: /* Editor.toggleLineComment */'Editor.toggleLineComment'
|
|
1160
|
-
}, {
|
|
1161
|
-
id: 'toggle-block-comment',
|
|
1162
|
-
label: toggleBlockComment(),
|
|
1163
|
-
flags: None,
|
|
1164
|
-
command: /* Editor.toggleBlockComment */'Editor.toggleBlockComment'
|
|
1165
|
-
}];
|
|
1166
|
-
};
|
|
1167
|
-
|
|
1168
|
-
const MenuEntriesEdit = {
|
|
1169
|
-
__proto__: null,
|
|
1170
|
-
getMenuEntries: getMenuEntries$c,
|
|
1171
|
-
id: id$9
|
|
1172
|
-
};
|
|
1173
|
-
|
|
1174
|
-
/**
|
|
1175
|
-
* @enum {string}
|
|
1176
|
-
*/
|
|
1177
|
-
const UiStrings$1 = {
|
|
1178
|
-
NewFile: 'New File',
|
|
1179
|
-
NewWindow: 'New Window',
|
|
1180
|
-
OpenFile: 'Open File',
|
|
1181
|
-
OpenFolder: 'Open Folder',
|
|
1182
|
-
OpenRecent: 'Open Recent',
|
|
1183
|
-
Exit: 'Exit',
|
|
1184
|
-
Save: 'Save',
|
|
1185
|
-
SaveAll: 'Save All'
|
|
1186
|
-
};
|
|
1187
|
-
const newFile = () => {
|
|
1188
|
-
return i18nString(UiStrings$1.NewFile);
|
|
1189
|
-
};
|
|
1190
|
-
const newWindow = () => {
|
|
1191
|
-
return i18nString(UiStrings$1.NewWindow);
|
|
1192
|
-
};
|
|
1193
|
-
const openFile = () => {
|
|
1194
|
-
return i18nString(UiStrings$1.OpenFile);
|
|
1195
|
-
};
|
|
1196
|
-
const openFolder = () => {
|
|
1197
|
-
return i18nString(UiStrings$1.OpenFolder);
|
|
1198
|
-
};
|
|
1199
|
-
const openRecent = () => {
|
|
1200
|
-
return i18nString(UiStrings$1.OpenRecent);
|
|
1201
|
-
};
|
|
1202
|
-
const save = () => {
|
|
1203
|
-
return i18nString(UiStrings$1.Save);
|
|
1204
|
-
};
|
|
1205
|
-
const saveAll = () => {
|
|
1206
|
-
return i18nString(UiStrings$1.SaveAll);
|
|
1207
|
-
};
|
|
1208
|
-
const exit = () => {
|
|
1209
|
-
return i18nString(UiStrings$1.Exit);
|
|
1210
|
-
};
|
|
1211
|
-
|
|
1212
|
-
const Web = 1;
|
|
1213
|
-
const Electron = 2;
|
|
1214
|
-
|
|
1215
|
-
const id$8 = File$2;
|
|
1216
|
-
const getMenuEntries$b = platform => {
|
|
1217
|
-
const entries = [{
|
|
1218
|
-
id: 'newFile',
|
|
1219
|
-
label: newFile(),
|
|
1220
|
-
flags: None,
|
|
1221
|
-
command: '-1'
|
|
1222
|
-
}, {
|
|
1223
|
-
id: 'newWindow',
|
|
1224
|
-
label: newWindow(),
|
|
1225
|
-
flags: None,
|
|
1226
|
-
command: /* Window.openNew */'Window.openNew'
|
|
1227
|
-
}, menuEntrySeparator, {
|
|
1228
|
-
id: 'openFile',
|
|
1229
|
-
label: openFile(),
|
|
1230
|
-
flags: None,
|
|
1231
|
-
command: 'Dialog.openFile'
|
|
1232
|
-
}, {
|
|
1233
|
-
id: 'openFolder',
|
|
1234
|
-
label: openFolder(),
|
|
1235
|
-
flags: RestoreFocus,
|
|
1236
|
-
command: 'Dialog.openFolder'
|
|
1237
|
-
}, {
|
|
1238
|
-
id: OpenRecent,
|
|
1239
|
-
label: openRecent(),
|
|
1240
|
-
flags: SubMenu,
|
|
1241
|
-
command: ''
|
|
1242
|
-
}, menuEntrySeparator, {
|
|
1243
|
-
id: 'save',
|
|
1244
|
-
label: save(),
|
|
1245
|
-
flags: None,
|
|
1246
|
-
command: 'Main.save'
|
|
1247
|
-
}, {
|
|
1248
|
-
id: 'saveAll',
|
|
1249
|
-
label: saveAll(),
|
|
1250
|
-
flags: None,
|
|
1251
|
-
command: 'Main.saveAll'
|
|
1252
|
-
}];
|
|
1253
|
-
if (platform === Electron) {
|
|
1254
|
-
entries.push(menuEntrySeparator, {
|
|
1255
|
-
id: 'exit',
|
|
1256
|
-
label: exit(),
|
|
1257
|
-
flags: Ignore,
|
|
1258
|
-
command: 'Chrome.exit'
|
|
1259
|
-
});
|
|
1260
|
-
}
|
|
1261
|
-
return entries;
|
|
1262
|
-
};
|
|
1263
|
-
|
|
1264
|
-
const MenuEntriesFile = {
|
|
1265
|
-
__proto__: null,
|
|
1266
|
-
getMenuEntries: getMenuEntries$b,
|
|
1267
|
-
id: id$8
|
|
1268
|
-
};
|
|
1269
|
-
|
|
1270
|
-
const id$7 = Go$1;
|
|
1271
|
-
const getMenuEntries$a = () => {
|
|
1272
|
-
return [];
|
|
1273
|
-
};
|
|
1274
|
-
|
|
1275
|
-
const MenuEntriesGo = {
|
|
1276
|
-
__proto__: null,
|
|
1277
|
-
getMenuEntries: getMenuEntries$a,
|
|
1278
|
-
id: id$7
|
|
1279
|
-
};
|
|
1280
|
-
|
|
1281
|
-
const About = 'About';
|
|
1282
|
-
const Edit = 'Edit';
|
|
1283
|
-
const File$1 = 'File';
|
|
1284
|
-
const Go = 'Go';
|
|
1285
|
-
const Help = 'Help';
|
|
1286
|
-
const OpenProcessExplorer = 'Open Process Explorer';
|
|
1287
|
-
const Run = 'Run';
|
|
1288
|
-
const Selection = 'Selection';
|
|
1289
|
-
const Terminal = 'Terminal';
|
|
1290
|
-
const ToggleDeveloperTools = 'Toggle Developer Tools';
|
|
1291
|
-
const View = 'View';
|
|
1292
|
-
|
|
1293
|
-
const toggleDeveloperTools = () => {
|
|
1294
|
-
return i18nString(ToggleDeveloperTools);
|
|
1295
|
-
};
|
|
1296
|
-
const openProcessExplorer = () => {
|
|
1297
|
-
return i18nString(OpenProcessExplorer);
|
|
1298
|
-
};
|
|
1299
|
-
const about = () => {
|
|
1300
|
-
return i18nString(About);
|
|
1301
|
-
};
|
|
1302
|
-
|
|
1303
|
-
const id$6 = Help$1;
|
|
1304
|
-
const getMenuEntries$9 = async platform => {
|
|
1305
|
-
const entries = [];
|
|
1306
|
-
if (platform !== Web) {
|
|
1307
|
-
entries.push({
|
|
1308
|
-
id: 'toggleDeveloperTools',
|
|
1309
|
-
label: toggleDeveloperTools(),
|
|
1310
|
-
flags: None,
|
|
1311
|
-
command: 'Developer.toggleDeveloperTools'
|
|
1312
|
-
}, {
|
|
1313
|
-
id: 'openProcessExplorer',
|
|
1314
|
-
label: openProcessExplorer(),
|
|
1315
|
-
flags: RestoreFocus,
|
|
1316
|
-
command: 'Developer.openProcessExplorer'
|
|
1317
|
-
});
|
|
1318
|
-
}
|
|
1319
|
-
if (entries.length > 0) {
|
|
1320
|
-
entries.push(menuEntrySeparator);
|
|
1321
|
-
}
|
|
1322
|
-
entries.push({
|
|
1323
|
-
id: 'about',
|
|
1324
|
-
label: about(),
|
|
1325
|
-
flags: None,
|
|
1326
|
-
command: 'About.showAbout'
|
|
1327
|
-
});
|
|
1328
|
-
return entries;
|
|
1329
|
-
};
|
|
1330
|
-
|
|
1331
|
-
const MenuEntriesHelp = {
|
|
1332
|
-
__proto__: null,
|
|
1333
|
-
getMenuEntries: getMenuEntries$9,
|
|
1334
|
-
id: id$6
|
|
1335
|
-
};
|
|
1336
|
-
|
|
1337
|
-
const rpcs = Object.create(null);
|
|
1338
|
-
const set$2 = (id, rpc) => {
|
|
1339
|
-
rpcs[id] = rpc;
|
|
1340
|
-
};
|
|
1341
|
-
const get = id => {
|
|
1342
|
-
return rpcs[id];
|
|
1343
|
-
};
|
|
1344
|
-
|
|
1345
|
-
const create = rpcId => {
|
|
1346
|
-
return {
|
|
1347
|
-
// @ts-ignore
|
|
1348
|
-
invoke(method, ...params) {
|
|
1349
|
-
const rpc = get(rpcId);
|
|
1350
|
-
// @ts-ignore
|
|
1351
|
-
return rpc.invoke(method, ...params);
|
|
1352
|
-
},
|
|
1353
|
-
// @ts-ignore
|
|
1354
|
-
invokeAndTransfer(method, ...params) {
|
|
1355
|
-
const rpc = get(rpcId);
|
|
1356
|
-
// @ts-ignore
|
|
1357
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1358
|
-
},
|
|
1359
|
-
set(rpc) {
|
|
1360
|
-
set$2(rpcId, rpc);
|
|
1361
|
-
},
|
|
1362
|
-
async dispose() {
|
|
1363
|
-
const rpc = get(rpcId);
|
|
1364
|
-
await rpc.dispose();
|
|
1365
|
-
}
|
|
1366
|
-
};
|
|
1367
|
-
};
|
|
1368
|
-
|
|
1369
|
-
const {
|
|
1370
|
-
invoke: invoke$1,
|
|
1371
|
-
invokeAndTransfer,
|
|
1372
|
-
set: set$1,
|
|
1373
|
-
dispose
|
|
1374
|
-
} = create(RendererWorker$1);
|
|
1375
|
-
const searchFileHtml = async uri => {
|
|
1376
|
-
return invoke$1('ExtensionHost.searchFileWithHtml', uri);
|
|
1377
|
-
};
|
|
1378
|
-
const getFilePathElectron = async file => {
|
|
1379
|
-
return invoke$1('FileSystemHandle.getFilePathElectron', file);
|
|
1380
|
-
};
|
|
1381
|
-
const showContextMenu = async (x, y, id, ...args) => {
|
|
1382
|
-
return invoke$1('ContextMenu.show', x, y, id, ...args);
|
|
1383
|
-
};
|
|
1384
|
-
const getElectronVersion = async () => {
|
|
1385
|
-
return invoke$1('Process.getElectronVersion');
|
|
1386
|
-
};
|
|
1387
|
-
const applyBulkReplacement = async bulkEdits => {
|
|
1388
|
-
await invoke$1('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1389
|
-
};
|
|
1390
|
-
const setColorTheme = async id => {
|
|
1391
|
-
// @ts-ignore
|
|
1392
|
-
return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1393
|
-
};
|
|
1394
|
-
const getNodeVersion = async () => {
|
|
1395
|
-
return invoke$1('Process.getNodeVersion');
|
|
1396
|
-
};
|
|
1397
|
-
const getChromeVersion = async () => {
|
|
1398
|
-
return invoke$1('Process.getChromeVersion');
|
|
1399
|
-
};
|
|
1400
|
-
const getV8Version = async () => {
|
|
1401
|
-
return invoke$1('Process.getV8Version');
|
|
1402
|
-
};
|
|
1403
|
-
const getFileHandles = async fileIds => {
|
|
1404
|
-
const files = await invoke$1('FileSystemHandle.getFileHandles', fileIds);
|
|
1405
|
-
return files;
|
|
1406
|
-
};
|
|
1407
|
-
const setWorkspacePath = async path => {
|
|
1408
|
-
await invoke$1('Workspace.setPath', path);
|
|
1409
|
-
};
|
|
1410
|
-
const registerWebViewInterceptor = async (id, port) => {
|
|
1411
|
-
await invokeAndTransfer('WebView.registerInterceptor', id, port);
|
|
1412
|
-
};
|
|
1413
|
-
const unregisterWebViewInterceptor = async id => {
|
|
1414
|
-
await invoke$1('WebView.unregisterInterceptor', id);
|
|
1415
|
-
};
|
|
1416
|
-
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1417
|
-
const command = 'HandleMessagePort.handleMessagePort';
|
|
1418
|
-
// @ts-ignore
|
|
1419
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1420
|
-
};
|
|
1421
|
-
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1422
|
-
const command = 'Errors.handleMessagePort';
|
|
1423
|
-
// @ts-ignore
|
|
1424
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1003
|
+
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1004
|
+
const command = 'Errors.handleMessagePort';
|
|
1005
|
+
// @ts-ignore
|
|
1006
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1425
1007
|
};
|
|
1426
1008
|
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
1427
1009
|
const command = 'Markdown.handleMessagePort';
|
|
@@ -1439,41 +1021,41 @@ const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
|
1439
1021
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1440
1022
|
};
|
|
1441
1023
|
const readFile = async uri => {
|
|
1442
|
-
return invoke$
|
|
1024
|
+
return invoke$2('FileSystem.readFile', uri);
|
|
1443
1025
|
};
|
|
1444
1026
|
const getWebViewSecret = async key => {
|
|
1445
1027
|
// @ts-ignore
|
|
1446
|
-
return invoke$
|
|
1028
|
+
return invoke$2('WebView.getSecret', key);
|
|
1447
1029
|
};
|
|
1448
1030
|
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1449
1031
|
return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
|
|
1450
1032
|
};
|
|
1451
1033
|
const setFocus = key => {
|
|
1452
|
-
return invoke$
|
|
1034
|
+
return invoke$2('Focus.setFocus', key);
|
|
1453
1035
|
};
|
|
1454
1036
|
const getFileIcon = async options => {
|
|
1455
|
-
return invoke$
|
|
1037
|
+
return invoke$2('IconTheme.getFileIcon', options);
|
|
1456
1038
|
};
|
|
1457
1039
|
const getColorThemeNames = async () => {
|
|
1458
|
-
return invoke$
|
|
1040
|
+
return invoke$2('ColorTheme.getColorThemeNames');
|
|
1459
1041
|
};
|
|
1460
1042
|
const disableExtension = async id => {
|
|
1461
1043
|
// @ts-ignore
|
|
1462
|
-
return invoke$
|
|
1044
|
+
return invoke$2('ExtensionManagement.disable', id);
|
|
1463
1045
|
};
|
|
1464
1046
|
const enableExtension = async id => {
|
|
1465
1047
|
// @ts-ignore
|
|
1466
|
-
return invoke$
|
|
1048
|
+
return invoke$2('ExtensionManagement.enable', id);
|
|
1467
1049
|
};
|
|
1468
1050
|
const handleDebugChange = async params => {
|
|
1469
1051
|
// @ts-ignore
|
|
1470
|
-
return invoke$
|
|
1052
|
+
return invoke$2('Run And Debug.handleChange', params);
|
|
1471
1053
|
};
|
|
1472
1054
|
const getFolderIcon = async options => {
|
|
1473
|
-
return invoke$
|
|
1055
|
+
return invoke$2('IconTheme.getFolderIcon', options);
|
|
1474
1056
|
};
|
|
1475
1057
|
const closeWidget = async widgetId => {
|
|
1476
|
-
return invoke$
|
|
1058
|
+
return invoke$2('Viewlet.closeWidget', widgetId);
|
|
1477
1059
|
};
|
|
1478
1060
|
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
1479
1061
|
const command = 'HandleMessagePort.handleMessagePort2';
|
|
@@ -1484,55 +1066,55 @@ const sendMessagePortToSearchProcess = async port => {
|
|
|
1484
1066
|
};
|
|
1485
1067
|
const confirm = async (message, options) => {
|
|
1486
1068
|
// @ts-ignore
|
|
1487
|
-
const result = await invoke$
|
|
1069
|
+
const result = await invoke$2('ConfirmPrompt.prompt', message, options);
|
|
1488
1070
|
return result;
|
|
1489
1071
|
};
|
|
1490
1072
|
const getRecentlyOpened$1 = async () => {
|
|
1491
|
-
return invoke$
|
|
1073
|
+
return invoke$2(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1492
1074
|
};
|
|
1493
|
-
const getKeyBindings = async () => {
|
|
1494
|
-
return invoke$
|
|
1075
|
+
const getKeyBindings$1 = async () => {
|
|
1076
|
+
return invoke$2('KeyBindingsInitial.getKeyBindings');
|
|
1495
1077
|
};
|
|
1496
1078
|
const writeClipBoardText = async text => {
|
|
1497
|
-
await invoke$
|
|
1079
|
+
await invoke$2('ClipBoard.writeText', /* text */text);
|
|
1498
1080
|
};
|
|
1499
1081
|
const writeClipBoardImage = async blob => {
|
|
1500
1082
|
// @ts-ignore
|
|
1501
|
-
await invoke$
|
|
1083
|
+
await invoke$2('ClipBoard.writeImage', /* text */blob);
|
|
1502
1084
|
};
|
|
1503
1085
|
const searchFileMemory = async uri => {
|
|
1504
1086
|
// @ts-ignore
|
|
1505
|
-
return invoke$
|
|
1087
|
+
return invoke$2('ExtensionHost.searchFileWithMemory', uri);
|
|
1506
1088
|
};
|
|
1507
1089
|
const searchFileFetch = async uri => {
|
|
1508
|
-
return invoke$
|
|
1090
|
+
return invoke$2('ExtensionHost.searchFileWithFetch', uri);
|
|
1509
1091
|
};
|
|
1510
1092
|
const showMessageBox = async options => {
|
|
1511
|
-
return invoke$
|
|
1093
|
+
return invoke$2('ElectronDialog.showMessageBox', options);
|
|
1512
1094
|
};
|
|
1513
1095
|
const handleDebugResumed = async params => {
|
|
1514
|
-
await invoke$
|
|
1096
|
+
await invoke$2('Run And Debug.handleResumed', params);
|
|
1515
1097
|
};
|
|
1516
1098
|
const openWidget = async name => {
|
|
1517
|
-
await invoke$
|
|
1099
|
+
await invoke$2('Viewlet.openWidget', name);
|
|
1518
1100
|
};
|
|
1519
1101
|
const getIcons = async requests => {
|
|
1520
|
-
const icons = await invoke$
|
|
1102
|
+
const icons = await invoke$2('IconTheme.getIcons', requests);
|
|
1521
1103
|
return icons;
|
|
1522
1104
|
};
|
|
1523
1105
|
const activateByEvent = event => {
|
|
1524
|
-
return invoke$
|
|
1106
|
+
return invoke$2('ExtensionHostManagement.activateByEvent', event);
|
|
1525
1107
|
};
|
|
1526
1108
|
const setAdditionalFocus = focusKey => {
|
|
1527
1109
|
// @ts-ignore
|
|
1528
|
-
return invoke$
|
|
1110
|
+
return invoke$2('Focus.setAdditionalFocus', focusKey);
|
|
1529
1111
|
};
|
|
1530
1112
|
const getActiveEditorId = () => {
|
|
1531
1113
|
// @ts-ignore
|
|
1532
|
-
return invoke$
|
|
1114
|
+
return invoke$2('GetActiveEditor.getActiveEditorId');
|
|
1533
1115
|
};
|
|
1534
1116
|
const getWorkspacePath = () => {
|
|
1535
|
-
return invoke$
|
|
1117
|
+
return invoke$2('Workspace.getPath');
|
|
1536
1118
|
};
|
|
1537
1119
|
const sendMessagePortToRendererProcess = async port => {
|
|
1538
1120
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
@@ -1540,20 +1122,20 @@ const sendMessagePortToRendererProcess = async port => {
|
|
|
1540
1122
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
1541
1123
|
};
|
|
1542
1124
|
const getPreference = async key => {
|
|
1543
|
-
return await invoke$
|
|
1125
|
+
return await invoke$2('Preferences.get', key);
|
|
1544
1126
|
};
|
|
1545
1127
|
const getAllExtensions = async () => {
|
|
1546
|
-
return invoke$
|
|
1128
|
+
return invoke$2('ExtensionManagement.getAllExtensions');
|
|
1547
1129
|
};
|
|
1548
1130
|
const rerenderEditor = async key => {
|
|
1549
1131
|
// @ts-ignore
|
|
1550
|
-
return invoke$
|
|
1132
|
+
return invoke$2('Editor.rerender', key);
|
|
1551
1133
|
};
|
|
1552
1134
|
const handleDebugPaused = async params => {
|
|
1553
|
-
await invoke$
|
|
1135
|
+
await invoke$2('Run And Debug.handlePaused', params);
|
|
1554
1136
|
};
|
|
1555
1137
|
const openUri = async (uri, focus, options) => {
|
|
1556
|
-
await invoke$
|
|
1138
|
+
await invoke$2('Main.openUri', uri, focus, options);
|
|
1557
1139
|
};
|
|
1558
1140
|
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
1559
1141
|
await invokeAndTransfer(
|
|
@@ -1561,170 +1143,506 @@ const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
|
1561
1143
|
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1562
1144
|
};
|
|
1563
1145
|
const handleDebugScriptParsed = async script => {
|
|
1564
|
-
await invoke$
|
|
1146
|
+
await invoke$2('Run And Debug.handleScriptParsed', script);
|
|
1565
1147
|
};
|
|
1566
1148
|
const getWindowId = async () => {
|
|
1567
|
-
return invoke$
|
|
1149
|
+
return invoke$2('GetWindowId.getWindowId');
|
|
1568
1150
|
};
|
|
1569
1151
|
const getBlob = async uri => {
|
|
1570
1152
|
// @ts-ignore
|
|
1571
|
-
return invoke$
|
|
1153
|
+
return invoke$2('FileSystem.getBlob', uri);
|
|
1572
1154
|
};
|
|
1573
1155
|
const getExtensionCommands = async () => {
|
|
1574
|
-
return invoke$
|
|
1156
|
+
return invoke$2('ExtensionHost.getCommands');
|
|
1575
1157
|
};
|
|
1576
1158
|
const showErrorDialog = async errorInfo => {
|
|
1577
1159
|
// @ts-ignore
|
|
1578
|
-
await invoke$
|
|
1160
|
+
await invoke$2('ErrorHandling.showErrorDialog', errorInfo);
|
|
1579
1161
|
};
|
|
1580
1162
|
const getFolderSize = async uri => {
|
|
1581
1163
|
// @ts-ignore
|
|
1582
|
-
return await invoke$
|
|
1164
|
+
return await invoke$2('FileSystem.getFolderSize', uri);
|
|
1583
1165
|
};
|
|
1584
1166
|
const getExtension = async id => {
|
|
1585
1167
|
// @ts-ignore
|
|
1586
|
-
return invoke$
|
|
1168
|
+
return invoke$2('ExtensionManagement.getExtension', id);
|
|
1587
1169
|
};
|
|
1588
1170
|
const getMarkdownDom = async html => {
|
|
1589
1171
|
// @ts-ignore
|
|
1590
|
-
return invoke$
|
|
1172
|
+
return invoke$2('Markdown.getVirtualDom', html);
|
|
1591
1173
|
};
|
|
1592
1174
|
const renderMarkdown = async (markdown, options) => {
|
|
1593
1175
|
// @ts-ignore
|
|
1594
|
-
return invoke$
|
|
1176
|
+
return invoke$2('Markdown.renderMarkdown', markdown, options);
|
|
1595
1177
|
};
|
|
1596
1178
|
const openNativeFolder = async uri => {
|
|
1597
1179
|
// @ts-ignore
|
|
1598
|
-
await invoke$
|
|
1180
|
+
await invoke$2('OpenNativeFolder.openNativeFolder', uri);
|
|
1599
1181
|
};
|
|
1600
1182
|
const uninstallExtension = async id => {
|
|
1601
|
-
return invoke$
|
|
1183
|
+
return invoke$2('ExtensionManagement.uninstall', id);
|
|
1602
1184
|
};
|
|
1603
1185
|
const installExtension = async id => {
|
|
1604
1186
|
// @ts-ignore
|
|
1605
|
-
return invoke$
|
|
1187
|
+
return invoke$2('ExtensionManagement.install', id);
|
|
1606
1188
|
};
|
|
1607
1189
|
const openExtensionSearch = async () => {
|
|
1608
1190
|
// @ts-ignore
|
|
1609
|
-
return invoke$
|
|
1191
|
+
return invoke$2('SideBar.openViewlet', 'Extensions');
|
|
1192
|
+
};
|
|
1193
|
+
const setExtensionsSearchValue = async searchValue => {
|
|
1194
|
+
// @ts-ignore
|
|
1195
|
+
return invoke$2('Extensions.handleInput', searchValue);
|
|
1196
|
+
};
|
|
1197
|
+
const openExternal = async uri => {
|
|
1198
|
+
// @ts-ignore
|
|
1199
|
+
await invoke$2('Open.openExternal', uri);
|
|
1200
|
+
};
|
|
1201
|
+
const openUrl = async uri => {
|
|
1202
|
+
// @ts-ignore
|
|
1203
|
+
await invoke$2('Open.openUrl', uri);
|
|
1204
|
+
};
|
|
1205
|
+
const getAllPreferences = async () => {
|
|
1206
|
+
// @ts-ignore
|
|
1207
|
+
return invoke$2('Preferences.getAll');
|
|
1208
|
+
};
|
|
1209
|
+
const showSaveFilePicker = async () => {
|
|
1210
|
+
// @ts-ignore
|
|
1211
|
+
return invoke$2('FilePicker.showSaveFilePicker');
|
|
1212
|
+
};
|
|
1213
|
+
const getLogsDir = async () => {
|
|
1214
|
+
// @ts-ignore
|
|
1215
|
+
return invoke$2('PlatformPaths.getLogsDir');
|
|
1216
|
+
};
|
|
1217
|
+
const registerMockRpc = commandMap => {
|
|
1218
|
+
const mockRpc = createMockRpc({
|
|
1219
|
+
commandMap
|
|
1220
|
+
});
|
|
1221
|
+
set$1(mockRpc);
|
|
1222
|
+
return mockRpc;
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
const RendererWorker = {
|
|
1226
|
+
__proto__: null,
|
|
1227
|
+
activateByEvent,
|
|
1228
|
+
applyBulkReplacement,
|
|
1229
|
+
closeWidget,
|
|
1230
|
+
confirm,
|
|
1231
|
+
disableExtension,
|
|
1232
|
+
dispose,
|
|
1233
|
+
enableExtension,
|
|
1234
|
+
getActiveEditorId,
|
|
1235
|
+
getAllExtensions,
|
|
1236
|
+
getAllPreferences,
|
|
1237
|
+
getBlob,
|
|
1238
|
+
getChromeVersion,
|
|
1239
|
+
getColorThemeNames,
|
|
1240
|
+
getElectronVersion,
|
|
1241
|
+
getExtension,
|
|
1242
|
+
getExtensionCommands,
|
|
1243
|
+
getFileHandles,
|
|
1244
|
+
getFileIcon,
|
|
1245
|
+
getFilePathElectron,
|
|
1246
|
+
getFolderIcon,
|
|
1247
|
+
getFolderSize,
|
|
1248
|
+
getIcons,
|
|
1249
|
+
getKeyBindings: getKeyBindings$1,
|
|
1250
|
+
getLogsDir,
|
|
1251
|
+
getMarkdownDom,
|
|
1252
|
+
getNodeVersion,
|
|
1253
|
+
getPreference,
|
|
1254
|
+
getRecentlyOpened: getRecentlyOpened$1,
|
|
1255
|
+
getV8Version,
|
|
1256
|
+
getWebViewSecret,
|
|
1257
|
+
getWindowId,
|
|
1258
|
+
getWorkspacePath,
|
|
1259
|
+
handleDebugChange,
|
|
1260
|
+
handleDebugPaused,
|
|
1261
|
+
handleDebugResumed,
|
|
1262
|
+
handleDebugScriptParsed,
|
|
1263
|
+
installExtension,
|
|
1264
|
+
invoke: invoke$2,
|
|
1265
|
+
invokeAndTransfer,
|
|
1266
|
+
openExtensionSearch,
|
|
1267
|
+
openExternal,
|
|
1268
|
+
openNativeFolder,
|
|
1269
|
+
openUri,
|
|
1270
|
+
openUrl,
|
|
1271
|
+
openWidget,
|
|
1272
|
+
readFile,
|
|
1273
|
+
registerMockRpc,
|
|
1274
|
+
registerWebViewInterceptor,
|
|
1275
|
+
renderMarkdown,
|
|
1276
|
+
rerenderEditor,
|
|
1277
|
+
searchFileFetch,
|
|
1278
|
+
searchFileHtml,
|
|
1279
|
+
searchFileMemory,
|
|
1280
|
+
sendMessagePortToEditorWorker,
|
|
1281
|
+
sendMessagePortToErrorWorker,
|
|
1282
|
+
sendMessagePortToExtensionHostWorker,
|
|
1283
|
+
sendMessagePortToFileSystemWorker,
|
|
1284
|
+
sendMessagePortToIconThemeWorker,
|
|
1285
|
+
sendMessagePortToMarkdownWorker,
|
|
1286
|
+
sendMessagePortToRendererProcess,
|
|
1287
|
+
sendMessagePortToSearchProcess,
|
|
1288
|
+
sendMessagePortToSyntaxHighlightingWorker,
|
|
1289
|
+
set: set$1,
|
|
1290
|
+
setAdditionalFocus,
|
|
1291
|
+
setColorTheme,
|
|
1292
|
+
setExtensionsSearchValue,
|
|
1293
|
+
setFocus,
|
|
1294
|
+
setWebViewPort,
|
|
1295
|
+
setWorkspacePath,
|
|
1296
|
+
showContextMenu,
|
|
1297
|
+
showErrorDialog,
|
|
1298
|
+
showMessageBox,
|
|
1299
|
+
showSaveFilePicker,
|
|
1300
|
+
uninstallExtension,
|
|
1301
|
+
unregisterWebViewInterceptor,
|
|
1302
|
+
writeClipBoardImage,
|
|
1303
|
+
writeClipBoardText
|
|
1304
|
+
};
|
|
1305
|
+
|
|
1306
|
+
const matchesArgs = (a, b) => {
|
|
1307
|
+
if (!a && !b) {
|
|
1308
|
+
return true;
|
|
1309
|
+
}
|
|
1310
|
+
if (!a && b || !b && a) {
|
|
1311
|
+
return false;
|
|
1312
|
+
}
|
|
1313
|
+
if (a.length !== b.length) {
|
|
1314
|
+
return false;
|
|
1315
|
+
}
|
|
1316
|
+
for (let i = 0; i < a.length; i++) {
|
|
1317
|
+
if (a[i] !== b[i]) {
|
|
1318
|
+
return false;
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
return true;
|
|
1322
|
+
};
|
|
1323
|
+
const getCommandKeyBinding = (keyBindings, command, args) => {
|
|
1324
|
+
for (const keyBinding of keyBindings) {
|
|
1325
|
+
if (keyBinding.command === command && matchesArgs(keyBinding.args, args)) {
|
|
1326
|
+
return keyBinding;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
return undefined;
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1332
|
+
const invoke$1 = async (method, ...params) => {
|
|
1333
|
+
// TODO
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1336
|
+
const state$1 = {
|
|
1337
|
+
/**
|
|
1338
|
+
* @type {any}
|
|
1339
|
+
*/
|
|
1340
|
+
matchingKeyBindings: []
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
const emptyObject = {};
|
|
1344
|
+
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
1345
|
+
const i18nString = (key, placeholders = emptyObject) => {
|
|
1346
|
+
if (placeholders === emptyObject) {
|
|
1347
|
+
return key;
|
|
1348
|
+
}
|
|
1349
|
+
const replacer = (match, rest) => {
|
|
1350
|
+
return placeholders[rest];
|
|
1351
|
+
};
|
|
1352
|
+
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* @enum {string}
|
|
1357
|
+
*/
|
|
1358
|
+
const UiStrings$2 = {
|
|
1359
|
+
Copy: 'Copy',
|
|
1360
|
+
CopyLineDown: 'Copy Line Down',
|
|
1361
|
+
CopyLineUp: 'Copy Line Up',
|
|
1362
|
+
Cut: 'Cut',
|
|
1363
|
+
MoveLineDown: 'Move Line Down',
|
|
1364
|
+
MoveLineUp: 'Move Line Up',
|
|
1365
|
+
Paste: 'Paste',
|
|
1366
|
+
Redo: 'Redo',
|
|
1367
|
+
SelectAll: 'Select All',
|
|
1368
|
+
ToggleBlockComment: 'Toggle Block Comment',
|
|
1369
|
+
ToggleLineComment: 'Toggle Line Comment',
|
|
1370
|
+
Undo: 'Undo'};
|
|
1371
|
+
const cut = () => {
|
|
1372
|
+
return i18nString(UiStrings$2.Cut);
|
|
1373
|
+
};
|
|
1374
|
+
const copy = () => {
|
|
1375
|
+
return i18nString(UiStrings$2.Copy);
|
|
1376
|
+
};
|
|
1377
|
+
const paste = () => {
|
|
1378
|
+
return i18nString(UiStrings$2.Paste);
|
|
1379
|
+
};
|
|
1380
|
+
const undo = () => {
|
|
1381
|
+
return i18nString(UiStrings$2.Undo);
|
|
1382
|
+
};
|
|
1383
|
+
const redo = () => {
|
|
1384
|
+
return i18nString(UiStrings$2.Redo);
|
|
1385
|
+
};
|
|
1386
|
+
const toggleLineComment = () => {
|
|
1387
|
+
return i18nString(UiStrings$2.ToggleLineComment);
|
|
1388
|
+
};
|
|
1389
|
+
const toggleBlockComment = () => {
|
|
1390
|
+
return i18nString(UiStrings$2.ToggleBlockComment);
|
|
1391
|
+
};
|
|
1392
|
+
const selectAll = () => {
|
|
1393
|
+
return i18nString(UiStrings$2.SelectAll);
|
|
1394
|
+
};
|
|
1395
|
+
const copyLineUp = () => {
|
|
1396
|
+
return i18nString(UiStrings$2.CopyLineUp);
|
|
1397
|
+
};
|
|
1398
|
+
const copyLineDown = () => {
|
|
1399
|
+
return i18nString(UiStrings$2.CopyLineDown);
|
|
1400
|
+
};
|
|
1401
|
+
const moveLineUp = () => {
|
|
1402
|
+
return i18nString(UiStrings$2.MoveLineUp);
|
|
1403
|
+
};
|
|
1404
|
+
const moveLineDown = () => {
|
|
1405
|
+
return i18nString(UiStrings$2.MoveLineDown);
|
|
1406
|
+
};
|
|
1407
|
+
|
|
1408
|
+
const Edit$1 = 2;
|
|
1409
|
+
const File$2 = 5;
|
|
1410
|
+
const Go$1 = 6;
|
|
1411
|
+
const Help$1 = 7;
|
|
1412
|
+
const OpenRecent = 9;
|
|
1413
|
+
const Run$1 = 10;
|
|
1414
|
+
const Selection$1 = 11;
|
|
1415
|
+
const Terminal$1 = 14;
|
|
1416
|
+
const TitleBar = 15;
|
|
1417
|
+
const View$1 = 16;
|
|
1418
|
+
|
|
1419
|
+
const Separator$1 = 1;
|
|
1420
|
+
const None = 0;
|
|
1421
|
+
const SubMenu = 4;
|
|
1422
|
+
const Checked = 2;
|
|
1423
|
+
const Unchecked = 3;
|
|
1424
|
+
const Disabled = 5;
|
|
1425
|
+
const RestoreFocus = 6;
|
|
1426
|
+
const Ignore = 7;
|
|
1427
|
+
|
|
1428
|
+
const menuEntrySeparator = {
|
|
1429
|
+
id: 'separator',
|
|
1430
|
+
label: '',
|
|
1431
|
+
flags: Separator$1,
|
|
1432
|
+
command: ''
|
|
1433
|
+
};
|
|
1434
|
+
|
|
1435
|
+
const id$9 = Edit$1;
|
|
1436
|
+
const getMenuEntries$d = () => {
|
|
1437
|
+
return [{
|
|
1438
|
+
id: 'undo',
|
|
1439
|
+
label: undo(),
|
|
1440
|
+
flags: Disabled,
|
|
1441
|
+
command: /* TODO */'-1'
|
|
1442
|
+
}, {
|
|
1443
|
+
id: 'redo',
|
|
1444
|
+
label: redo(),
|
|
1445
|
+
flags: Disabled,
|
|
1446
|
+
command: /* TODO */'-1'
|
|
1447
|
+
}, menuEntrySeparator, {
|
|
1448
|
+
id: 'cut',
|
|
1449
|
+
label: cut(),
|
|
1450
|
+
flags: None,
|
|
1451
|
+
command: /* Editor.cut */'Editor.cut'
|
|
1452
|
+
}, {
|
|
1453
|
+
id: 'copy',
|
|
1454
|
+
label: copy(),
|
|
1455
|
+
flags: None,
|
|
1456
|
+
command: /* Editor.copy */'Editor.copy'
|
|
1457
|
+
}, {
|
|
1458
|
+
id: 'paste',
|
|
1459
|
+
label: paste(),
|
|
1460
|
+
flags: None,
|
|
1461
|
+
command: /* Editor.paste */'Editor.paste'
|
|
1462
|
+
}, menuEntrySeparator, {
|
|
1463
|
+
id: 'toggle-line-comment',
|
|
1464
|
+
label: toggleLineComment(),
|
|
1465
|
+
flags: None,
|
|
1466
|
+
command: /* Editor.toggleLineComment */'Editor.toggleLineComment'
|
|
1467
|
+
}, {
|
|
1468
|
+
id: 'toggle-block-comment',
|
|
1469
|
+
label: toggleBlockComment(),
|
|
1470
|
+
flags: None,
|
|
1471
|
+
command: /* Editor.toggleBlockComment */'Editor.toggleBlockComment'
|
|
1472
|
+
}];
|
|
1473
|
+
};
|
|
1474
|
+
|
|
1475
|
+
const MenuEntriesEdit = {
|
|
1476
|
+
__proto__: null,
|
|
1477
|
+
getMenuEntries: getMenuEntries$d,
|
|
1478
|
+
id: id$9
|
|
1479
|
+
};
|
|
1480
|
+
|
|
1481
|
+
/**
|
|
1482
|
+
* @enum {string}
|
|
1483
|
+
*/
|
|
1484
|
+
const UiStrings$1 = {
|
|
1485
|
+
NewFile: 'New File',
|
|
1486
|
+
NewWindow: 'New Window',
|
|
1487
|
+
OpenFile: 'Open File',
|
|
1488
|
+
OpenFolder: 'Open Folder',
|
|
1489
|
+
OpenRecent: 'Open Recent',
|
|
1490
|
+
Exit: 'Exit',
|
|
1491
|
+
Save: 'Save',
|
|
1492
|
+
SaveAll: 'Save All'
|
|
1493
|
+
};
|
|
1494
|
+
const newFile = () => {
|
|
1495
|
+
return i18nString(UiStrings$1.NewFile);
|
|
1496
|
+
};
|
|
1497
|
+
const newWindow = () => {
|
|
1498
|
+
return i18nString(UiStrings$1.NewWindow);
|
|
1499
|
+
};
|
|
1500
|
+
const openFile = () => {
|
|
1501
|
+
return i18nString(UiStrings$1.OpenFile);
|
|
1502
|
+
};
|
|
1503
|
+
const openFolder = () => {
|
|
1504
|
+
return i18nString(UiStrings$1.OpenFolder);
|
|
1505
|
+
};
|
|
1506
|
+
const openRecent = () => {
|
|
1507
|
+
return i18nString(UiStrings$1.OpenRecent);
|
|
1508
|
+
};
|
|
1509
|
+
const save = () => {
|
|
1510
|
+
return i18nString(UiStrings$1.Save);
|
|
1511
|
+
};
|
|
1512
|
+
const saveAll = () => {
|
|
1513
|
+
return i18nString(UiStrings$1.SaveAll);
|
|
1514
|
+
};
|
|
1515
|
+
const exit = () => {
|
|
1516
|
+
return i18nString(UiStrings$1.Exit);
|
|
1517
|
+
};
|
|
1518
|
+
|
|
1519
|
+
const Web = 1;
|
|
1520
|
+
const Electron = 2;
|
|
1521
|
+
|
|
1522
|
+
const id$8 = File$2;
|
|
1523
|
+
const getMenuEntries$c = platform => {
|
|
1524
|
+
const entries = [{
|
|
1525
|
+
id: 'newFile',
|
|
1526
|
+
label: newFile(),
|
|
1527
|
+
flags: None,
|
|
1528
|
+
command: '-1'
|
|
1529
|
+
}, {
|
|
1530
|
+
id: 'newWindow',
|
|
1531
|
+
label: newWindow(),
|
|
1532
|
+
flags: None,
|
|
1533
|
+
command: /* Window.openNew */'Window.openNew'
|
|
1534
|
+
}, menuEntrySeparator, {
|
|
1535
|
+
id: 'openFile',
|
|
1536
|
+
label: openFile(),
|
|
1537
|
+
flags: None,
|
|
1538
|
+
command: 'Dialog.openFile'
|
|
1539
|
+
}, {
|
|
1540
|
+
id: 'openFolder',
|
|
1541
|
+
label: openFolder(),
|
|
1542
|
+
flags: RestoreFocus,
|
|
1543
|
+
command: 'Dialog.openFolder'
|
|
1544
|
+
}, {
|
|
1545
|
+
id: OpenRecent,
|
|
1546
|
+
label: openRecent(),
|
|
1547
|
+
flags: SubMenu,
|
|
1548
|
+
command: ''
|
|
1549
|
+
}, menuEntrySeparator, {
|
|
1550
|
+
id: 'save',
|
|
1551
|
+
label: save(),
|
|
1552
|
+
flags: None,
|
|
1553
|
+
command: 'Main.save'
|
|
1554
|
+
}, {
|
|
1555
|
+
id: 'saveAll',
|
|
1556
|
+
label: saveAll(),
|
|
1557
|
+
flags: None,
|
|
1558
|
+
command: 'Main.saveAll'
|
|
1559
|
+
}];
|
|
1560
|
+
if (platform === Electron) {
|
|
1561
|
+
entries.push(menuEntrySeparator, {
|
|
1562
|
+
id: 'exit',
|
|
1563
|
+
label: exit(),
|
|
1564
|
+
flags: Ignore,
|
|
1565
|
+
command: 'Chrome.exit'
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
return entries;
|
|
1610
1569
|
};
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1570
|
+
|
|
1571
|
+
const MenuEntriesFile = {
|
|
1572
|
+
__proto__: null,
|
|
1573
|
+
getMenuEntries: getMenuEntries$c,
|
|
1574
|
+
id: id$8
|
|
1614
1575
|
};
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1576
|
+
|
|
1577
|
+
const id$7 = Go$1;
|
|
1578
|
+
const getMenuEntries$b = () => {
|
|
1579
|
+
return [];
|
|
1618
1580
|
};
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1581
|
+
|
|
1582
|
+
const MenuEntriesGo = {
|
|
1583
|
+
__proto__: null,
|
|
1584
|
+
getMenuEntries: getMenuEntries$b,
|
|
1585
|
+
id: id$7
|
|
1622
1586
|
};
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1587
|
+
|
|
1588
|
+
const About = 'About';
|
|
1589
|
+
const Edit = 'Edit';
|
|
1590
|
+
const File$1 = 'File';
|
|
1591
|
+
const Go = 'Go';
|
|
1592
|
+
const Help = 'Help';
|
|
1593
|
+
const OpenProcessExplorer = 'Open Process Explorer';
|
|
1594
|
+
const Run = 'Run';
|
|
1595
|
+
const Selection = 'Selection';
|
|
1596
|
+
const Terminal = 'Terminal';
|
|
1597
|
+
const ToggleDeveloperTools = 'Toggle Developer Tools';
|
|
1598
|
+
const View = 'View';
|
|
1599
|
+
|
|
1600
|
+
const toggleDeveloperTools = () => {
|
|
1601
|
+
return i18nString(ToggleDeveloperTools);
|
|
1626
1602
|
};
|
|
1627
|
-
const
|
|
1628
|
-
|
|
1629
|
-
return invoke$1('FilePicker.showSaveFilePicker');
|
|
1603
|
+
const openProcessExplorer = () => {
|
|
1604
|
+
return i18nString(OpenProcessExplorer);
|
|
1630
1605
|
};
|
|
1631
|
-
const
|
|
1632
|
-
|
|
1633
|
-
return invoke$1('PlatformPaths.getLogsDir');
|
|
1606
|
+
const about = () => {
|
|
1607
|
+
return i18nString(About);
|
|
1634
1608
|
};
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1609
|
+
|
|
1610
|
+
const id$6 = Help$1;
|
|
1611
|
+
const getMenuEntries$a = async platform => {
|
|
1612
|
+
const entries = [];
|
|
1613
|
+
if (platform !== Web) {
|
|
1614
|
+
entries.push({
|
|
1615
|
+
id: 'toggleDeveloperTools',
|
|
1616
|
+
label: toggleDeveloperTools(),
|
|
1617
|
+
flags: None,
|
|
1618
|
+
command: 'Developer.toggleDeveloperTools'
|
|
1619
|
+
}, {
|
|
1620
|
+
id: 'openProcessExplorer',
|
|
1621
|
+
label: openProcessExplorer(),
|
|
1622
|
+
flags: RestoreFocus,
|
|
1623
|
+
command: 'Developer.openProcessExplorer'
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
if (entries.length > 0) {
|
|
1627
|
+
entries.push(menuEntrySeparator);
|
|
1628
|
+
}
|
|
1629
|
+
entries.push({
|
|
1630
|
+
id: 'about',
|
|
1631
|
+
label: about(),
|
|
1632
|
+
flags: None,
|
|
1633
|
+
command: 'About.showAbout'
|
|
1638
1634
|
});
|
|
1639
|
-
|
|
1640
|
-
return mockRpc;
|
|
1635
|
+
return entries;
|
|
1641
1636
|
};
|
|
1642
1637
|
|
|
1643
|
-
const
|
|
1638
|
+
const MenuEntriesHelp = {
|
|
1644
1639
|
__proto__: null,
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
closeWidget,
|
|
1648
|
-
confirm,
|
|
1649
|
-
disableExtension,
|
|
1650
|
-
dispose,
|
|
1651
|
-
enableExtension,
|
|
1652
|
-
getActiveEditorId,
|
|
1653
|
-
getAllExtensions,
|
|
1654
|
-
getAllPreferences,
|
|
1655
|
-
getBlob,
|
|
1656
|
-
getChromeVersion,
|
|
1657
|
-
getColorThemeNames,
|
|
1658
|
-
getElectronVersion,
|
|
1659
|
-
getExtension,
|
|
1660
|
-
getExtensionCommands,
|
|
1661
|
-
getFileHandles,
|
|
1662
|
-
getFileIcon,
|
|
1663
|
-
getFilePathElectron,
|
|
1664
|
-
getFolderIcon,
|
|
1665
|
-
getFolderSize,
|
|
1666
|
-
getIcons,
|
|
1667
|
-
getKeyBindings,
|
|
1668
|
-
getLogsDir,
|
|
1669
|
-
getMarkdownDom,
|
|
1670
|
-
getNodeVersion,
|
|
1671
|
-
getPreference,
|
|
1672
|
-
getRecentlyOpened: getRecentlyOpened$1,
|
|
1673
|
-
getV8Version,
|
|
1674
|
-
getWebViewSecret,
|
|
1675
|
-
getWindowId,
|
|
1676
|
-
getWorkspacePath,
|
|
1677
|
-
handleDebugChange,
|
|
1678
|
-
handleDebugPaused,
|
|
1679
|
-
handleDebugResumed,
|
|
1680
|
-
handleDebugScriptParsed,
|
|
1681
|
-
installExtension,
|
|
1682
|
-
invoke: invoke$1,
|
|
1683
|
-
invokeAndTransfer,
|
|
1684
|
-
openExtensionSearch,
|
|
1685
|
-
openExternal,
|
|
1686
|
-
openNativeFolder,
|
|
1687
|
-
openUri,
|
|
1688
|
-
openUrl,
|
|
1689
|
-
openWidget,
|
|
1690
|
-
readFile,
|
|
1691
|
-
registerMockRpc,
|
|
1692
|
-
registerWebViewInterceptor,
|
|
1693
|
-
renderMarkdown,
|
|
1694
|
-
rerenderEditor,
|
|
1695
|
-
searchFileFetch,
|
|
1696
|
-
searchFileHtml,
|
|
1697
|
-
searchFileMemory,
|
|
1698
|
-
sendMessagePortToEditorWorker,
|
|
1699
|
-
sendMessagePortToErrorWorker,
|
|
1700
|
-
sendMessagePortToExtensionHostWorker,
|
|
1701
|
-
sendMessagePortToFileSystemWorker,
|
|
1702
|
-
sendMessagePortToIconThemeWorker,
|
|
1703
|
-
sendMessagePortToMarkdownWorker,
|
|
1704
|
-
sendMessagePortToRendererProcess,
|
|
1705
|
-
sendMessagePortToSearchProcess,
|
|
1706
|
-
sendMessagePortToSyntaxHighlightingWorker,
|
|
1707
|
-
set: set$1,
|
|
1708
|
-
setAdditionalFocus,
|
|
1709
|
-
setColorTheme,
|
|
1710
|
-
setExtensionsSearchValue,
|
|
1711
|
-
setFocus,
|
|
1712
|
-
setWebViewPort,
|
|
1713
|
-
setWorkspacePath,
|
|
1714
|
-
showContextMenu,
|
|
1715
|
-
showErrorDialog,
|
|
1716
|
-
showMessageBox,
|
|
1717
|
-
showSaveFilePicker,
|
|
1718
|
-
uninstallExtension,
|
|
1719
|
-
unregisterWebViewInterceptor,
|
|
1720
|
-
writeClipBoardImage,
|
|
1721
|
-
writeClipBoardText
|
|
1640
|
+
getMenuEntries: getMenuEntries$a,
|
|
1641
|
+
id: id$6
|
|
1722
1642
|
};
|
|
1723
1643
|
|
|
1724
1644
|
const {
|
|
1725
|
-
invoke
|
|
1726
|
-
set
|
|
1727
|
-
} = RendererWorker;
|
|
1645
|
+
invoke} = RendererWorker;
|
|
1728
1646
|
|
|
1729
1647
|
const getRecentlyOpened = () => {
|
|
1730
1648
|
return invoke(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
@@ -1758,7 +1676,7 @@ const toMenuItem = folder => {
|
|
|
1758
1676
|
};
|
|
1759
1677
|
};
|
|
1760
1678
|
const id$5 = OpenRecent;
|
|
1761
|
-
const getMenuEntries$
|
|
1679
|
+
const getMenuEntries$9 = async () => {
|
|
1762
1680
|
const allItems = await getRecentlyOpened();
|
|
1763
1681
|
const itemsToShow = allItems.slice(0, MAX_MENU_RECENT_ENTRIES);
|
|
1764
1682
|
const items = [];
|
|
@@ -1781,23 +1699,23 @@ const getMenuEntries$8 = async () => {
|
|
|
1781
1699
|
|
|
1782
1700
|
const MenuEntriesOpenRecent = {
|
|
1783
1701
|
__proto__: null,
|
|
1784
|
-
getMenuEntries: getMenuEntries$
|
|
1702
|
+
getMenuEntries: getMenuEntries$9,
|
|
1785
1703
|
id: id$5
|
|
1786
1704
|
};
|
|
1787
1705
|
|
|
1788
1706
|
const id$4 = Run$1;
|
|
1789
|
-
const getMenuEntries$
|
|
1707
|
+
const getMenuEntries$8 = () => {
|
|
1790
1708
|
return [];
|
|
1791
1709
|
};
|
|
1792
1710
|
|
|
1793
1711
|
const MenuEntriesRun = {
|
|
1794
1712
|
__proto__: null,
|
|
1795
|
-
getMenuEntries: getMenuEntries$
|
|
1713
|
+
getMenuEntries: getMenuEntries$8,
|
|
1796
1714
|
id: id$4
|
|
1797
1715
|
};
|
|
1798
1716
|
|
|
1799
1717
|
const id$3 = Selection$1;
|
|
1800
|
-
const getMenuEntries$
|
|
1718
|
+
const getMenuEntries$7 = () => {
|
|
1801
1719
|
return [{
|
|
1802
1720
|
id: 'selectAll',
|
|
1803
1721
|
label: selectAll(),
|
|
@@ -1828,7 +1746,7 @@ const getMenuEntries$6 = () => {
|
|
|
1828
1746
|
|
|
1829
1747
|
const MenuEntriesSelection = {
|
|
1830
1748
|
__proto__: null,
|
|
1831
|
-
getMenuEntries: getMenuEntries$
|
|
1749
|
+
getMenuEntries: getMenuEntries$7,
|
|
1832
1750
|
id: id$3
|
|
1833
1751
|
};
|
|
1834
1752
|
|
|
@@ -1843,7 +1761,7 @@ const newTerminal = () => {
|
|
|
1843
1761
|
};
|
|
1844
1762
|
|
|
1845
1763
|
const id$2 = Terminal$1;
|
|
1846
|
-
const getMenuEntries$
|
|
1764
|
+
const getMenuEntries$6 = () => {
|
|
1847
1765
|
return [{
|
|
1848
1766
|
id: 'newTerminal',
|
|
1849
1767
|
label: newTerminal(),
|
|
@@ -1855,7 +1773,7 @@ const getMenuEntries$5 = () => {
|
|
|
1855
1773
|
|
|
1856
1774
|
const MenuEntriesTerminal = {
|
|
1857
1775
|
__proto__: null,
|
|
1858
|
-
getMenuEntries: getMenuEntries$
|
|
1776
|
+
getMenuEntries: getMenuEntries$6,
|
|
1859
1777
|
id: id$2
|
|
1860
1778
|
};
|
|
1861
1779
|
|
|
@@ -1884,7 +1802,7 @@ const help = () => {
|
|
|
1884
1802
|
return i18nString(Help);
|
|
1885
1803
|
};
|
|
1886
1804
|
|
|
1887
|
-
const getMenuEntries$
|
|
1805
|
+
const getMenuEntries$5 = () => {
|
|
1888
1806
|
return [{
|
|
1889
1807
|
id: File$2,
|
|
1890
1808
|
label: file(),
|
|
@@ -1923,7 +1841,7 @@ const getMenuEntries$4 = () => {
|
|
|
1923
1841
|
}];
|
|
1924
1842
|
};
|
|
1925
1843
|
|
|
1926
|
-
const getMenuEntries$
|
|
1844
|
+
const getMenuEntries$4 = () => {
|
|
1927
1845
|
return [{
|
|
1928
1846
|
id: File$2,
|
|
1929
1847
|
label: file(),
|
|
@@ -1954,106 +1872,82 @@ const getMenuEntries$3 = () => {
|
|
|
1954
1872
|
const getFn = platform => {
|
|
1955
1873
|
switch (platform) {
|
|
1956
1874
|
case Web:
|
|
1957
|
-
return getMenuEntries$
|
|
1958
|
-
default:
|
|
1959
|
-
return getMenuEntries$
|
|
1960
|
-
}
|
|
1961
|
-
};
|
|
1962
|
-
const id$1 = TitleBar;
|
|
1963
|
-
const getMenuEntries$2 = async platform => {
|
|
1964
|
-
const fn = getFn(platform);
|
|
1965
|
-
return fn();
|
|
1966
|
-
};
|
|
1967
|
-
|
|
1968
|
-
const MenuEntriesTitleBar = {
|
|
1969
|
-
__proto__: null,
|
|
1970
|
-
getMenuEntries: getMenuEntries$2,
|
|
1971
|
-
id: id$1
|
|
1972
|
-
};
|
|
1973
|
-
|
|
1974
|
-
const id = View$1;
|
|
1975
|
-
const getMenuEntries$1 = () => {
|
|
1976
|
-
return [];
|
|
1977
|
-
};
|
|
1978
|
-
|
|
1979
|
-
const MenuEntriesView = {
|
|
1980
|
-
__proto__: null,
|
|
1981
|
-
getMenuEntries: getMenuEntries$1,
|
|
1982
|
-
id
|
|
1983
|
-
};
|
|
1984
|
-
|
|
1985
|
-
const menus$1 = [MenuEntriesEdit, MenuEntriesFile, MenuEntriesGo, MenuEntriesHelp, MenuEntriesRun, MenuEntriesSelection, MenuEntriesTerminal, MenuEntriesTitleBar, MenuEntriesView, MenuEntriesOpenRecent];
|
|
1986
|
-
|
|
1987
|
-
const getMenuIds = () => {
|
|
1988
|
-
return menus$1.map(menu => menu.id);
|
|
1989
|
-
};
|
|
1990
|
-
const getMenuEntries = (id, platform) => {
|
|
1991
|
-
const menu = menus$1.find(item => item.id === id);
|
|
1992
|
-
if (!menu) {
|
|
1993
|
-
return [];
|
|
1994
|
-
}
|
|
1995
|
-
return menu.getMenuEntries(platform);
|
|
1996
|
-
};
|
|
1997
|
-
|
|
1998
|
-
const maximize = async () => {
|
|
1999
|
-
await invoke('ElectronWindow.maximize');
|
|
2000
|
-
};
|
|
2001
|
-
const minimize = async () => {
|
|
2002
|
-
await invoke('ElectronWindow.minimize');
|
|
2003
|
-
};
|
|
2004
|
-
const close = async () => {
|
|
2005
|
-
await invoke('ElectronWindow.close');
|
|
2006
|
-
};
|
|
2007
|
-
|
|
2008
|
-
const handleClickClose = async state => {
|
|
2009
|
-
await close();
|
|
2010
|
-
return state;
|
|
2011
|
-
};
|
|
2012
|
-
|
|
2013
|
-
const handleClickMinimize = async state => {
|
|
2014
|
-
await minimize();
|
|
2015
|
-
return state;
|
|
2016
|
-
};
|
|
2017
|
-
|
|
2018
|
-
const handleClickToggleMaximize = async state => {
|
|
2019
|
-
const fn = maximize;
|
|
2020
|
-
await fn();
|
|
2021
|
-
return state;
|
|
2022
|
-
};
|
|
2023
|
-
|
|
2024
|
-
const handleClick = (state, className) => {
|
|
2025
|
-
if (className.includes('Minimize')) {
|
|
2026
|
-
return handleClickMinimize(state);
|
|
2027
|
-
}
|
|
2028
|
-
if (className.includes('Maximize') || className.includes('Restore')) {
|
|
2029
|
-
return handleClickToggleMaximize(state);
|
|
2030
|
-
}
|
|
2031
|
-
if (className.includes('Close')) {
|
|
2032
|
-
return handleClickClose(state);
|
|
1875
|
+
return getMenuEntries$4;
|
|
1876
|
+
default:
|
|
1877
|
+
return getMenuEntries$5;
|
|
2033
1878
|
}
|
|
2034
|
-
|
|
1879
|
+
};
|
|
1880
|
+
const id$1 = TitleBar;
|
|
1881
|
+
const getMenuEntries$3 = async platform => {
|
|
1882
|
+
const fn = getFn(platform);
|
|
1883
|
+
return fn();
|
|
2035
1884
|
};
|
|
2036
1885
|
|
|
2037
|
-
const
|
|
2038
|
-
|
|
1886
|
+
const MenuEntriesTitleBar = {
|
|
1887
|
+
__proto__: null,
|
|
1888
|
+
getMenuEntries: getMenuEntries$3,
|
|
1889
|
+
id: id$1
|
|
2039
1890
|
};
|
|
2040
1891
|
|
|
2041
|
-
const
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
};
|
|
1892
|
+
const id = View$1;
|
|
1893
|
+
const getMenuEntries$2 = () => {
|
|
1894
|
+
return [];
|
|
2045
1895
|
};
|
|
2046
1896
|
|
|
2047
|
-
const
|
|
1897
|
+
const MenuEntriesView = {
|
|
1898
|
+
__proto__: null,
|
|
1899
|
+
getMenuEntries: getMenuEntries$2,
|
|
1900
|
+
id
|
|
1901
|
+
};
|
|
1902
|
+
|
|
1903
|
+
const menus$1 = [MenuEntriesEdit, MenuEntriesFile, MenuEntriesGo, MenuEntriesHelp, MenuEntriesRun, MenuEntriesSelection, MenuEntriesTerminal, MenuEntriesTitleBar, MenuEntriesView, MenuEntriesOpenRecent];
|
|
2048
1904
|
const getMenus = () => {
|
|
2049
|
-
return menus;
|
|
1905
|
+
return menus$1;
|
|
1906
|
+
};
|
|
1907
|
+
const getModule$1 = id => {
|
|
1908
|
+
for (const module of menus$1) {
|
|
1909
|
+
if (module.id === id) {
|
|
1910
|
+
return module;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
return undefined;
|
|
1914
|
+
};
|
|
1915
|
+
const getMenuEntries$1 = async (id, ...args) => {
|
|
1916
|
+
try {
|
|
1917
|
+
const module = getModule$1(id);
|
|
1918
|
+
// @ts-ignore
|
|
1919
|
+
const inject = module.inject || [];
|
|
1920
|
+
// @ts-ignore
|
|
1921
|
+
return module.getMenuEntries(...args);
|
|
1922
|
+
} catch (error) {
|
|
1923
|
+
throw new VError(error, `Failed to load menu entries for id ${id}`);
|
|
1924
|
+
}
|
|
2050
1925
|
};
|
|
2051
1926
|
|
|
2052
|
-
const
|
|
2053
|
-
|
|
2054
|
-
|
|
1927
|
+
const addKeyBindings = menuEntries => {
|
|
1928
|
+
const keyBindings = state$1.matchingKeyBindings;
|
|
1929
|
+
const newMenuEntries = [];
|
|
1930
|
+
for (const menuEntry of menuEntries) {
|
|
1931
|
+
const keyBinding = getCommandKeyBinding(keyBindings, menuEntry.command, menuEntry.args);
|
|
1932
|
+
const key = keyBinding ? keyBinding.key : 0;
|
|
1933
|
+
const newMenuEntry = {
|
|
1934
|
+
...menuEntry,
|
|
1935
|
+
key
|
|
1936
|
+
};
|
|
1937
|
+
newMenuEntries.push(newMenuEntry);
|
|
2055
1938
|
}
|
|
2056
|
-
return
|
|
1939
|
+
return newMenuEntries;
|
|
1940
|
+
};
|
|
1941
|
+
const getMenuEntriesWithKeyBindings = async (id, ...args) => {
|
|
1942
|
+
const menuEntries = await getMenuEntries$1(id, ...args);
|
|
1943
|
+
const newMenuEntries = addKeyBindings(menuEntries);
|
|
1944
|
+
return newMenuEntries;
|
|
1945
|
+
};
|
|
1946
|
+
const getMenuEntriesWithKeyBindings2 = async (uid, menuId, ...args) => {
|
|
1947
|
+
// @ts-ignore
|
|
1948
|
+
const menuEntries = await undefined(uid, menuId, ...args);
|
|
1949
|
+
const newMenuEntries = addKeyBindings(menuEntries);
|
|
1950
|
+
return newMenuEntries;
|
|
2057
1951
|
};
|
|
2058
1952
|
|
|
2059
1953
|
const Menu$1 = 'menu';
|
|
@@ -2073,6 +1967,18 @@ const MenuItemSeparatorLine = 'MenuItemSeparatorLine';
|
|
|
2073
1967
|
const MenuItemSubMenu = 'MenuItemSubMenu';
|
|
2074
1968
|
const MenuItemSubMenuArrowRight = 'MenuItemSubMenuArrowRight';
|
|
2075
1969
|
|
|
1970
|
+
const mergeClassNames = (...classNames) => {
|
|
1971
|
+
return classNames.filter(Boolean).join(' ');
|
|
1972
|
+
};
|
|
1973
|
+
|
|
1974
|
+
const text = data => {
|
|
1975
|
+
return {
|
|
1976
|
+
type: Text,
|
|
1977
|
+
text: data,
|
|
1978
|
+
childCount: 0
|
|
1979
|
+
};
|
|
1980
|
+
};
|
|
1981
|
+
|
|
2076
1982
|
const Div = 4;
|
|
2077
1983
|
const Span = 8;
|
|
2078
1984
|
|
|
@@ -2554,6 +2460,322 @@ const getVisible = (items, focusedIndex, expanded, level) => {
|
|
|
2554
2460
|
return visibleItems;
|
|
2555
2461
|
};
|
|
2556
2462
|
|
|
2463
|
+
// TODO lazyload menuEntries and use Command.execute (maybe)
|
|
2464
|
+
const CONTEXT_MENU_WIDTH = 250;
|
|
2465
|
+
const state = {
|
|
2466
|
+
menus: []};
|
|
2467
|
+
const addMenuInternal = menu => {
|
|
2468
|
+
if (state.menus.length > 5) {
|
|
2469
|
+
throw new Error('too many menus');
|
|
2470
|
+
}
|
|
2471
|
+
state.menus.push(menu);
|
|
2472
|
+
return menu;
|
|
2473
|
+
};
|
|
2474
|
+
|
|
2475
|
+
// TODO handle printable letter and focus item that starts with that letter
|
|
2476
|
+
|
|
2477
|
+
// TODO pageup / pagedown keys
|
|
2478
|
+
|
|
2479
|
+
// TODO more tests
|
|
2480
|
+
|
|
2481
|
+
const CONTEXT_MENU_ITEM_HEIGHT = 26;
|
|
2482
|
+
const CONTEXT_MENU_SEPARATOR_HEIGHT = 11;
|
|
2483
|
+
const CONTEXT_MENU_PADDING = 8;
|
|
2484
|
+
const getMenuHeight = items => {
|
|
2485
|
+
let height = CONTEXT_MENU_PADDING;
|
|
2486
|
+
for (const item of items) {
|
|
2487
|
+
switch (item.flags) {
|
|
2488
|
+
case Separator$1:
|
|
2489
|
+
height += CONTEXT_MENU_SEPARATOR_HEIGHT;
|
|
2490
|
+
break;
|
|
2491
|
+
default:
|
|
2492
|
+
height += CONTEXT_MENU_ITEM_HEIGHT;
|
|
2493
|
+
break;
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
return height;
|
|
2497
|
+
};
|
|
2498
|
+
const getMenuBounds = (x, y, items) => {
|
|
2499
|
+
const menuWidth = CONTEXT_MENU_WIDTH;
|
|
2500
|
+
const menuHeight = getMenuHeight(items);
|
|
2501
|
+
const layoutState = {
|
|
2502
|
+
points: [0, 0]
|
|
2503
|
+
};
|
|
2504
|
+
const windowWidth = layoutState.points[0];
|
|
2505
|
+
const windowHeight = layoutState.points[1];
|
|
2506
|
+
// TODO maybe only send labels and keybindings to ui (id not needed on ui)
|
|
2507
|
+
// TODO what about separators?
|
|
2508
|
+
|
|
2509
|
+
if (x + menuWidth > windowWidth) {
|
|
2510
|
+
x -= menuWidth;
|
|
2511
|
+
}
|
|
2512
|
+
if (y + menuHeight > windowHeight) {
|
|
2513
|
+
y -= menuHeight;
|
|
2514
|
+
}
|
|
2515
|
+
return {
|
|
2516
|
+
x,
|
|
2517
|
+
y,
|
|
2518
|
+
width: menuWidth,
|
|
2519
|
+
height: menuHeight
|
|
2520
|
+
};
|
|
2521
|
+
};
|
|
2522
|
+
const show$2 = async (x, y, id, mouseBlocking = false, ...args) => {
|
|
2523
|
+
const items = await getMenuEntriesWithKeyBindings(id, ...args);
|
|
2524
|
+
const bounds = getMenuBounds(x, y, items);
|
|
2525
|
+
const menu = addMenuInternal({
|
|
2526
|
+
id,
|
|
2527
|
+
items,
|
|
2528
|
+
focusedIndex: -1,
|
|
2529
|
+
level: state.menus.length,
|
|
2530
|
+
x: bounds.x,
|
|
2531
|
+
y: bounds.y
|
|
2532
|
+
});
|
|
2533
|
+
const visible = getVisible(menu.items, -1, false, menu.level);
|
|
2534
|
+
const dom = getMenuVirtualDom(visible).slice(1);
|
|
2535
|
+
await invoke$1(/* Menu.show */'Menu.showMenu', /* x */bounds.x, /* y */bounds.y, /* width */bounds.width, /* height */bounds.height, /* items */menu.items, /* level */menu.level, /* parentIndex */-1, /* dom */dom, /* mouseBlocking */mouseBlocking);
|
|
2536
|
+
};
|
|
2537
|
+
const show2$2 = async (uid, menuId, x, y, mouseBlocking = false, ...args) => {
|
|
2538
|
+
const items = await getMenuEntriesWithKeyBindings2(uid, menuId, ...args);
|
|
2539
|
+
const bounds = getMenuBounds(x, y, items);
|
|
2540
|
+
const menu = addMenuInternal({
|
|
2541
|
+
id: menuId,
|
|
2542
|
+
items,
|
|
2543
|
+
focusedIndex: -1,
|
|
2544
|
+
level: state.menus.length,
|
|
2545
|
+
x: bounds.x,
|
|
2546
|
+
y: bounds.y
|
|
2547
|
+
});
|
|
2548
|
+
const visible = getVisible(menu.items, -1, false, menu.level);
|
|
2549
|
+
const dom = getMenuVirtualDom(visible).slice(1);
|
|
2550
|
+
await invoke$1(/* Menu.show */'Menu.showMenu', /* x */bounds.x, /* y */bounds.y, /* width */bounds.width, /* height */bounds.height, /* items */menu.items, /* level */menu.level, /* parentIndex */-1, /* dom */dom, /* mouseBlocking */mouseBlocking);
|
|
2551
|
+
};
|
|
2552
|
+
const hide = async (restoreFocus = true) => {
|
|
2553
|
+
if (state.menus.length === 0) {
|
|
2554
|
+
return;
|
|
2555
|
+
}
|
|
2556
|
+
state.menus = [];
|
|
2557
|
+
await invoke$1(/* Menu.hide */'Menu.hide', /* restoreFocus */restoreFocus);
|
|
2558
|
+
};
|
|
2559
|
+
|
|
2560
|
+
const show$1 = async (x, y, id, ...args) => {
|
|
2561
|
+
// @ts-ignore
|
|
2562
|
+
await hide();
|
|
2563
|
+
// TODO handle error
|
|
2564
|
+
// TODO race condition
|
|
2565
|
+
await show$2(x, y, id, /* mouseBlocking */true, ...args);
|
|
2566
|
+
// TODO maybe only send labels and keybindings to ui (id not needed on ui)
|
|
2567
|
+
// TODO what about separators?
|
|
2568
|
+
};
|
|
2569
|
+
const show2$1 = async (uid, menuId, x, y, ...args) => {
|
|
2570
|
+
// @ts-ignore
|
|
2571
|
+
await hide();
|
|
2572
|
+
// TODO handle error
|
|
2573
|
+
// TODO race condition
|
|
2574
|
+
await show2$2(uid, menuId, x, y, /* mouseBlocking */true, ...args);
|
|
2575
|
+
// TODO maybe only send labels and keybindings to ui (id not needed on ui)
|
|
2576
|
+
// TODO what about separators?
|
|
2577
|
+
};
|
|
2578
|
+
|
|
2579
|
+
const ContextMenuBrowser = {
|
|
2580
|
+
__proto__: null,
|
|
2581
|
+
show: show$1,
|
|
2582
|
+
show2: show2$1
|
|
2583
|
+
};
|
|
2584
|
+
|
|
2585
|
+
const getModule = async platform => {
|
|
2586
|
+
return ContextMenuBrowser;
|
|
2587
|
+
};
|
|
2588
|
+
const show = async (x, y, id, ...args) => {
|
|
2589
|
+
number(x);
|
|
2590
|
+
number(y);
|
|
2591
|
+
number(id);
|
|
2592
|
+
const module = await getModule();
|
|
2593
|
+
return module.show(x, y, id, ...args);
|
|
2594
|
+
};
|
|
2595
|
+
const show2 = async (uid, menuId, x, y, ...args) => {
|
|
2596
|
+
number(uid);
|
|
2597
|
+
number(menuId);
|
|
2598
|
+
number(x);
|
|
2599
|
+
number(y);
|
|
2600
|
+
const module = getModule();
|
|
2601
|
+
// @ts-ignore
|
|
2602
|
+
return module.show2(uid, menuId, x, y, ...args);
|
|
2603
|
+
};
|
|
2604
|
+
|
|
2605
|
+
const RenderEntries = 1;
|
|
2606
|
+
const RenderFocusedIndex = 2;
|
|
2607
|
+
const RenderMenus = 3;
|
|
2608
|
+
|
|
2609
|
+
const diffType$2 = RenderEntries;
|
|
2610
|
+
const isEqual$2 = (oldState, newState) => {
|
|
2611
|
+
return oldState.titleBarEntries === newState.titleBarEntries && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
|
|
2612
|
+
};
|
|
2613
|
+
|
|
2614
|
+
const diffType$1 = RenderFocusedIndex;
|
|
2615
|
+
const isEqual$1 = (oldState, newState) => {
|
|
2616
|
+
return oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
|
|
2617
|
+
};
|
|
2618
|
+
|
|
2619
|
+
const diffType = RenderMenus;
|
|
2620
|
+
const isEqual = (oldState, newState) => {
|
|
2621
|
+
return oldState.menus === newState.menus;
|
|
2622
|
+
};
|
|
2623
|
+
|
|
2624
|
+
const modules = [isEqual$2, isEqual$1, isEqual];
|
|
2625
|
+
const numbers = [diffType$2, diffType$1, diffType];
|
|
2626
|
+
|
|
2627
|
+
const diff = (oldState, newState) => {
|
|
2628
|
+
const diffResult = [];
|
|
2629
|
+
for (let i = 0; i < modules.length; i++) {
|
|
2630
|
+
const fn = modules[i];
|
|
2631
|
+
if (!fn(oldState, newState)) {
|
|
2632
|
+
diffResult.push(numbers[i]);
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
return diffResult;
|
|
2636
|
+
};
|
|
2637
|
+
|
|
2638
|
+
const create = () => {
|
|
2639
|
+
const states = Object.create(null);
|
|
2640
|
+
return {
|
|
2641
|
+
get(uid) {
|
|
2642
|
+
return states[uid];
|
|
2643
|
+
},
|
|
2644
|
+
set(uid, oldState, newState) {
|
|
2645
|
+
states[uid] = {
|
|
2646
|
+
oldState,
|
|
2647
|
+
newState
|
|
2648
|
+
};
|
|
2649
|
+
}
|
|
2650
|
+
};
|
|
2651
|
+
};
|
|
2652
|
+
|
|
2653
|
+
const {
|
|
2654
|
+
get,
|
|
2655
|
+
set
|
|
2656
|
+
} = create();
|
|
2657
|
+
|
|
2658
|
+
const diff2 = uid => {
|
|
2659
|
+
const {
|
|
2660
|
+
oldState,
|
|
2661
|
+
newState
|
|
2662
|
+
} = get(uid);
|
|
2663
|
+
return diff(oldState, newState);
|
|
2664
|
+
};
|
|
2665
|
+
|
|
2666
|
+
const commandsIds = ['closeMenu', 'handleClickAt', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusPrevious', 'handleClick', 'handleFocus', 'handleFocusOut', 'handleKeyArrowDown', 'handleKeyArrowLeft', 'handleKeyArrowRight', 'handleKeyArrowUp', 'handleKeyEnd', 'handleKeyEnter', 'handleKeyEscape', 'handleKeyHome', 'handleKeySpace', 'handleMenuClick', 'handleMenuMouseOver', 'handleMouseOut', 'handleMouseOver', 'handlePointerOver', 'handlePointerOut', 'toggleIndex', 'toggleMenu'];
|
|
2667
|
+
|
|
2668
|
+
const getCommandIds = () => {
|
|
2669
|
+
return commandsIds;
|
|
2670
|
+
};
|
|
2671
|
+
|
|
2672
|
+
const FocusTitleBarMenuBar = 26;
|
|
2673
|
+
|
|
2674
|
+
const getKeyBindings = () => {
|
|
2675
|
+
return [{
|
|
2676
|
+
key: DownArrow$2,
|
|
2677
|
+
command: 'TitleBarMenuBar.handleKeyArrowDown',
|
|
2678
|
+
when: FocusTitleBarMenuBar
|
|
2679
|
+
}, {
|
|
2680
|
+
key: UpArrow$2,
|
|
2681
|
+
command: 'TitleBarMenuBar.handleKeyArrowUp',
|
|
2682
|
+
when: FocusTitleBarMenuBar
|
|
2683
|
+
}, {
|
|
2684
|
+
key: RightArrow$2,
|
|
2685
|
+
command: 'TitleBarMenuBar.handleKeyArrowRight',
|
|
2686
|
+
when: FocusTitleBarMenuBar
|
|
2687
|
+
}, {
|
|
2688
|
+
key: LeftArrow$2,
|
|
2689
|
+
command: 'TitleBarMenuBar.handleKeyArrowLeft',
|
|
2690
|
+
when: FocusTitleBarMenuBar
|
|
2691
|
+
}, {
|
|
2692
|
+
key: Space$2,
|
|
2693
|
+
command: 'TitleBarMenuBar.handleKeySpace',
|
|
2694
|
+
when: FocusTitleBarMenuBar
|
|
2695
|
+
}, {
|
|
2696
|
+
key: Home$2,
|
|
2697
|
+
command: 'TitleBarMenuBar.handleKeyHome',
|
|
2698
|
+
when: FocusTitleBarMenuBar
|
|
2699
|
+
}, {
|
|
2700
|
+
key: End$2,
|
|
2701
|
+
command: 'TitleBarMenuBar.handleKeyEnd',
|
|
2702
|
+
when: FocusTitleBarMenuBar
|
|
2703
|
+
}, {
|
|
2704
|
+
key: Escape$2,
|
|
2705
|
+
command: 'TitleBarMenuBar.handleKeyEscape',
|
|
2706
|
+
when: FocusTitleBarMenuBar
|
|
2707
|
+
}];
|
|
2708
|
+
};
|
|
2709
|
+
|
|
2710
|
+
const menus = [MenuEntriesEdit, MenuEntriesFile, MenuEntriesGo, MenuEntriesHelp, MenuEntriesRun, MenuEntriesSelection, MenuEntriesTerminal, MenuEntriesTitleBar, MenuEntriesView, MenuEntriesOpenRecent];
|
|
2711
|
+
|
|
2712
|
+
const getMenuIds = () => {
|
|
2713
|
+
return menus.map(menu => menu.id);
|
|
2714
|
+
};
|
|
2715
|
+
const getMenuEntries = (id, platform) => {
|
|
2716
|
+
const menu = menus.find(item => item.id === id);
|
|
2717
|
+
if (!menu) {
|
|
2718
|
+
return [];
|
|
2719
|
+
}
|
|
2720
|
+
return menu.getMenuEntries(platform);
|
|
2721
|
+
};
|
|
2722
|
+
|
|
2723
|
+
const maximize = async () => {
|
|
2724
|
+
await invoke('ElectronWindow.maximize');
|
|
2725
|
+
};
|
|
2726
|
+
const minimize = async () => {
|
|
2727
|
+
await invoke('ElectronWindow.minimize');
|
|
2728
|
+
};
|
|
2729
|
+
const close = async () => {
|
|
2730
|
+
await invoke('ElectronWindow.close');
|
|
2731
|
+
};
|
|
2732
|
+
|
|
2733
|
+
const handleClickClose = async state => {
|
|
2734
|
+
await close();
|
|
2735
|
+
return state;
|
|
2736
|
+
};
|
|
2737
|
+
|
|
2738
|
+
const handleClickMinimize = async state => {
|
|
2739
|
+
await minimize();
|
|
2740
|
+
return state;
|
|
2741
|
+
};
|
|
2742
|
+
|
|
2743
|
+
const handleClickToggleMaximize = async state => {
|
|
2744
|
+
const fn = maximize;
|
|
2745
|
+
await fn();
|
|
2746
|
+
return state;
|
|
2747
|
+
};
|
|
2748
|
+
|
|
2749
|
+
const handleClick = (state, className) => {
|
|
2750
|
+
if (className.includes('Minimize')) {
|
|
2751
|
+
return handleClickMinimize(state);
|
|
2752
|
+
}
|
|
2753
|
+
if (className.includes('Maximize') || className.includes('Restore')) {
|
|
2754
|
+
return handleClickToggleMaximize(state);
|
|
2755
|
+
}
|
|
2756
|
+
if (className.includes('Close')) {
|
|
2757
|
+
return handleClickClose(state);
|
|
2758
|
+
}
|
|
2759
|
+
return state;
|
|
2760
|
+
};
|
|
2761
|
+
|
|
2762
|
+
const handleContextMenu = state => {
|
|
2763
|
+
return state;
|
|
2764
|
+
};
|
|
2765
|
+
|
|
2766
|
+
const loadContent = async (state, titleBarEntries) => {
|
|
2767
|
+
return {
|
|
2768
|
+
...state
|
|
2769
|
+
};
|
|
2770
|
+
};
|
|
2771
|
+
|
|
2772
|
+
const renderFocusedIndex = (oldState, newState) => {
|
|
2773
|
+
if (newState.focusedIndex === -1) {
|
|
2774
|
+
return [];
|
|
2775
|
+
}
|
|
2776
|
+
return ['Viewlet.focusSelector', '.ViewletTitleBarMenuBar'];
|
|
2777
|
+
};
|
|
2778
|
+
|
|
2557
2779
|
const SetMenus = 'setMenus';
|
|
2558
2780
|
|
|
2559
2781
|
const renderMenus = (oldState, newState) => {
|
|
@@ -2611,8 +2833,8 @@ const render2 = async (uid, diffResult) => {
|
|
|
2611
2833
|
const {
|
|
2612
2834
|
oldState,
|
|
2613
2835
|
newState
|
|
2614
|
-
} = get
|
|
2615
|
-
set
|
|
2836
|
+
} = get(uid);
|
|
2837
|
+
set(uid, newState, newState);
|
|
2616
2838
|
const commands = applyRender(oldState, newState, diffResult);
|
|
2617
2839
|
return commands;
|
|
2618
2840
|
};
|
|
@@ -2656,13 +2878,13 @@ const wrapCommand = fn => {
|
|
|
2656
2878
|
const wrapped = async (uid, ...args) => {
|
|
2657
2879
|
const {
|
|
2658
2880
|
newState
|
|
2659
|
-
} = get
|
|
2881
|
+
} = get(uid);
|
|
2660
2882
|
const newerState = await fn(newState, ...args);
|
|
2661
2883
|
if (newState === newerState) {
|
|
2662
2884
|
return;
|
|
2663
2885
|
}
|
|
2664
|
-
const latest = get
|
|
2665
|
-
set
|
|
2886
|
+
const latest = get(uid);
|
|
2887
|
+
set(uid, latest.oldState, newerState);
|
|
2666
2888
|
};
|
|
2667
2889
|
return wrapped;
|
|
2668
2890
|
};
|
|
@@ -2675,18 +2897,20 @@ const commandMap = {
|
|
|
2675
2897
|
'Menu.renderEventListeners': renderEventListeners,
|
|
2676
2898
|
'Menu.diff2': diff2,
|
|
2677
2899
|
'Menu.getCommands': getCommandIds,
|
|
2678
|
-
'Menu.getKeyBindings': getKeyBindings
|
|
2900
|
+
'Menu.getKeyBindings': getKeyBindings,
|
|
2679
2901
|
'Menu.getMenus': getMenus,
|
|
2680
2902
|
'Menu.loadContent': wrapCommand(loadContent),
|
|
2681
2903
|
'Menu.render2': render2,
|
|
2682
|
-
'Menu.saveState': saveState
|
|
2904
|
+
'Menu.saveState': saveState,
|
|
2905
|
+
'Menu.show': show,
|
|
2906
|
+
'Menu.show2': show2
|
|
2683
2907
|
};
|
|
2684
2908
|
|
|
2685
2909
|
const listen = async () => {
|
|
2686
2910
|
const rpc = await WebWorkerRpcClient.create({
|
|
2687
2911
|
commandMap: commandMap
|
|
2688
2912
|
});
|
|
2689
|
-
set(rpc);
|
|
2913
|
+
set$1(rpc);
|
|
2690
2914
|
};
|
|
2691
2915
|
|
|
2692
2916
|
const main = async () => {
|