@lvce-editor/title-bar-worker 2.29.0 → 3.1.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/titleBarWorkerMain.js +1038 -1401
- package/package.json +1 -1
|
@@ -433,7 +433,7 @@ const create$4 = (method, params) => {
|
|
|
433
433
|
};
|
|
434
434
|
};
|
|
435
435
|
const callbacks = Object.create(null);
|
|
436
|
-
const set$
|
|
436
|
+
const set$3 = (id, fn) => {
|
|
437
437
|
callbacks[id] = fn;
|
|
438
438
|
};
|
|
439
439
|
const get$2 = id => {
|
|
@@ -442,9 +442,9 @@ const get$2 = id => {
|
|
|
442
442
|
const remove = id => {
|
|
443
443
|
delete callbacks[id];
|
|
444
444
|
};
|
|
445
|
-
let id
|
|
445
|
+
let id = 0;
|
|
446
446
|
const create$3$1 = () => {
|
|
447
|
-
return ++id
|
|
447
|
+
return ++id;
|
|
448
448
|
};
|
|
449
449
|
const registerPromise = () => {
|
|
450
450
|
const id = create$3$1();
|
|
@@ -452,7 +452,7 @@ const registerPromise = () => {
|
|
|
452
452
|
resolve,
|
|
453
453
|
promise
|
|
454
454
|
} = Promise.withResolvers();
|
|
455
|
-
set$
|
|
455
|
+
set$3(id, resolve);
|
|
456
456
|
return {
|
|
457
457
|
id,
|
|
458
458
|
promise
|
|
@@ -797,10 +797,10 @@ const send = (transport, method, ...params) => {
|
|
|
797
797
|
const message = create$4(method, params);
|
|
798
798
|
transport.send(message);
|
|
799
799
|
};
|
|
800
|
-
const invoke$
|
|
800
|
+
const invoke$1 = (ipc, method, ...params) => {
|
|
801
801
|
return invokeHelper(ipc, method, params, false);
|
|
802
802
|
};
|
|
803
|
-
const invokeAndTransfer
|
|
803
|
+
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
804
804
|
return invokeHelper(ipc, method, params, true);
|
|
805
805
|
};
|
|
806
806
|
|
|
@@ -836,10 +836,10 @@ const createRpc = ipc => {
|
|
|
836
836
|
send(ipc, method, ...params);
|
|
837
837
|
},
|
|
838
838
|
invoke(method, ...params) {
|
|
839
|
-
return invoke$
|
|
839
|
+
return invoke$1(ipc, method, ...params);
|
|
840
840
|
},
|
|
841
841
|
invokeAndTransfer(method, ...params) {
|
|
842
|
-
return invokeAndTransfer
|
|
842
|
+
return invokeAndTransfer(ipc, method, ...params);
|
|
843
843
|
},
|
|
844
844
|
async dispose() {
|
|
845
845
|
await ipc?.dispose();
|
|
@@ -891,453 +891,91 @@ const WebWorkerRpcClient = {
|
|
|
891
891
|
__proto__: null,
|
|
892
892
|
create: create$3
|
|
893
893
|
};
|
|
894
|
-
const createMockRpc = ({
|
|
895
|
-
commandMap
|
|
896
|
-
}) => {
|
|
897
|
-
const invocations = [];
|
|
898
|
-
const invoke = (method, ...params) => {
|
|
899
|
-
invocations.push([method, ...params]);
|
|
900
|
-
const command = commandMap[method];
|
|
901
|
-
if (!command) {
|
|
902
|
-
throw new Error(`command ${method} not found`);
|
|
903
|
-
}
|
|
904
|
-
return command(...params);
|
|
905
|
-
};
|
|
906
|
-
const mockRpc = {
|
|
907
|
-
invoke,
|
|
908
|
-
invokeAndTransfer: invoke,
|
|
909
|
-
invocations
|
|
910
|
-
};
|
|
911
|
-
return mockRpc;
|
|
912
|
-
};
|
|
913
|
-
|
|
914
|
-
const toCommandId = key => {
|
|
915
|
-
const dotIndex = key.indexOf('.');
|
|
916
|
-
return key.slice(dotIndex + 1);
|
|
917
|
-
};
|
|
918
|
-
const create$2 = () => {
|
|
919
|
-
const states = Object.create(null);
|
|
920
|
-
const commandMapRef = {};
|
|
921
|
-
return {
|
|
922
|
-
get(uid) {
|
|
923
|
-
return states[uid];
|
|
924
|
-
},
|
|
925
|
-
set(uid, oldState, newState) {
|
|
926
|
-
states[uid] = {
|
|
927
|
-
oldState,
|
|
928
|
-
newState
|
|
929
|
-
};
|
|
930
|
-
},
|
|
931
|
-
dispose(uid) {
|
|
932
|
-
delete states[uid];
|
|
933
|
-
},
|
|
934
|
-
getKeys() {
|
|
935
|
-
return Object.keys(states).map(key => {
|
|
936
|
-
return Number.parseInt(key);
|
|
937
|
-
});
|
|
938
|
-
},
|
|
939
|
-
clear() {
|
|
940
|
-
for (const key of Object.keys(states)) {
|
|
941
|
-
delete states[key];
|
|
942
|
-
}
|
|
943
|
-
},
|
|
944
|
-
wrapCommand(fn) {
|
|
945
|
-
const wrapped = async (uid, ...args) => {
|
|
946
|
-
const {
|
|
947
|
-
newState
|
|
948
|
-
} = states[uid];
|
|
949
|
-
const newerState = await fn(newState, ...args);
|
|
950
|
-
if (newState === newerState) {
|
|
951
|
-
return;
|
|
952
|
-
}
|
|
953
|
-
const latest = states[uid];
|
|
954
|
-
states[uid] = {
|
|
955
|
-
oldState: latest.oldState,
|
|
956
|
-
newState: newerState
|
|
957
|
-
};
|
|
958
|
-
};
|
|
959
|
-
return wrapped;
|
|
960
|
-
},
|
|
961
|
-
wrapGetter(fn) {
|
|
962
|
-
const wrapped = (uid, ...args) => {
|
|
963
|
-
const {
|
|
964
|
-
newState
|
|
965
|
-
} = states[uid];
|
|
966
|
-
return fn(newState, ...args);
|
|
967
|
-
};
|
|
968
|
-
return wrapped;
|
|
969
|
-
},
|
|
970
|
-
diff(uid, modules, numbers) {
|
|
971
|
-
const {
|
|
972
|
-
oldState,
|
|
973
|
-
newState
|
|
974
|
-
} = states[uid];
|
|
975
|
-
const diffResult = [];
|
|
976
|
-
for (let i = 0; i < modules.length; i++) {
|
|
977
|
-
const fn = modules[i];
|
|
978
|
-
if (!fn(oldState, newState)) {
|
|
979
|
-
diffResult.push(numbers[i]);
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
return diffResult;
|
|
983
|
-
},
|
|
984
|
-
getCommandIds() {
|
|
985
|
-
const keys = Object.keys(commandMapRef);
|
|
986
|
-
const ids = keys.map(toCommandId);
|
|
987
|
-
return ids;
|
|
988
|
-
},
|
|
989
|
-
registerCommands(commandMap) {
|
|
990
|
-
Object.assign(commandMapRef, commandMap);
|
|
991
|
-
}
|
|
992
|
-
};
|
|
993
|
-
};
|
|
994
|
-
const terminate = () => {
|
|
995
|
-
globalThis.close();
|
|
996
|
-
};
|
|
997
894
|
|
|
998
|
-
const
|
|
999
|
-
const
|
|
1000
|
-
const
|
|
895
|
+
const ContentInfo = 'contentinfo';
|
|
896
|
+
const Menu$1 = 'menu';
|
|
897
|
+
const MenuBar$1 = 'menubar';
|
|
898
|
+
const MenuItem$1 = 'menuitem';
|
|
899
|
+
const MenuItemCheckBox = 'menuitemcheckbox';
|
|
900
|
+
const None$1 = 'none';
|
|
901
|
+
const Separator$1 = 'separator';
|
|
1001
902
|
|
|
1002
|
-
const
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
focusedIndex: -1,
|
|
1009
|
-
height: 30,
|
|
1010
|
-
iconWidth: 30,
|
|
1011
|
-
isMenuOpen: false,
|
|
1012
|
-
labelFontFamily: 'system-ui, Ubuntu, Droid Sans, sans-serif',
|
|
1013
|
-
labelFontSize: 13,
|
|
1014
|
-
labelFontWeight: 400,
|
|
1015
|
-
labelLetterSpacing: 0,
|
|
1016
|
-
labelPadding: 8,
|
|
1017
|
-
layoutControlsEnabled: false,
|
|
1018
|
-
menus: [],
|
|
1019
|
-
platform: Electron,
|
|
1020
|
-
title: '',
|
|
1021
|
-
titleBarButtons: [],
|
|
1022
|
-
titleBarButtonsEnabled: true,
|
|
1023
|
-
titleBarButtonsWidth: 90,
|
|
1024
|
-
titleBarEntries: [],
|
|
1025
|
-
titleBarHeight: 30,
|
|
1026
|
-
titleBarIconEnabled: true,
|
|
1027
|
-
titleBarIconWidth: 30,
|
|
1028
|
-
titleBarMenuBarEnabled: true,
|
|
1029
|
-
titleBarStyleCustom: true,
|
|
1030
|
-
titleBarTitleEnabled: true,
|
|
1031
|
-
uid,
|
|
1032
|
-
width: 800,
|
|
1033
|
-
x: 0,
|
|
1034
|
-
y: 0
|
|
1035
|
-
});
|
|
903
|
+
const Button$1 = 1;
|
|
904
|
+
const Div = 4;
|
|
905
|
+
const Span = 8;
|
|
906
|
+
const Text = 12;
|
|
907
|
+
const I = 16;
|
|
908
|
+
const Img = 17;
|
|
1036
909
|
|
|
1037
|
-
const
|
|
1038
|
-
const
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1041
|
-
return key;
|
|
1042
|
-
}
|
|
1043
|
-
const replacer = (match, rest) => {
|
|
1044
|
-
return placeholders[rest];
|
|
1045
|
-
};
|
|
1046
|
-
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1047
|
-
};
|
|
910
|
+
const Button = 'event.button';
|
|
911
|
+
const ClientX = 'event.clientX';
|
|
912
|
+
const ClientY = 'event.clientY';
|
|
913
|
+
const TargetName = 'event.target.name';
|
|
1048
914
|
|
|
1049
|
-
const
|
|
1050
|
-
const
|
|
1051
|
-
const
|
|
1052
|
-
const
|
|
1053
|
-
const
|
|
1054
|
-
const
|
|
1055
|
-
const
|
|
1056
|
-
const
|
|
1057
|
-
const
|
|
1058
|
-
const
|
|
1059
|
-
const
|
|
1060
|
-
const
|
|
1061
|
-
const
|
|
1062
|
-
const
|
|
1063
|
-
const
|
|
1064
|
-
const
|
|
1065
|
-
const
|
|
1066
|
-
const
|
|
1067
|
-
const
|
|
1068
|
-
const
|
|
1069
|
-
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
const
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
const
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
}
|
|
1114
|
-
if (titleBarStyleCustom) {
|
|
1115
|
-
// TODO don't render title bar buttons on windows when electron window controls overlay is enabled
|
|
1116
|
-
return [{
|
|
1117
|
-
icon: 'Minimize',
|
|
1118
|
-
id: 'Minimize',
|
|
1119
|
-
label: minimize$1(),
|
|
1120
|
-
onClick: 'handleClickMinimize'
|
|
1121
|
-
}, {
|
|
1122
|
-
icon: 'Maximize',
|
|
1123
|
-
id: 'ToggleMaximize',
|
|
1124
|
-
label: maximize$1(),
|
|
1125
|
-
onClick: 'handleClickToggleMaximize'
|
|
1126
|
-
}, {
|
|
1127
|
-
icon: 'ChromeClose',
|
|
1128
|
-
id: 'Close',
|
|
1129
|
-
label: close$1(),
|
|
1130
|
-
onClick: 'handleClickClose'
|
|
1131
|
-
}];
|
|
1132
|
-
}
|
|
1133
|
-
return [];
|
|
1134
|
-
};
|
|
1135
|
-
|
|
1136
|
-
const getTitleBarButtonsRemote = () => {
|
|
1137
|
-
return [];
|
|
1138
|
-
};
|
|
1139
|
-
|
|
1140
|
-
const getTitleBarButtonsWeb = () => {
|
|
1141
|
-
return [];
|
|
1142
|
-
};
|
|
1143
|
-
|
|
1144
|
-
const getTitleBarButtons = (platform, controlsOverlayEnabled, titleBarStyleCustom) => {
|
|
1145
|
-
switch (platform) {
|
|
1146
|
-
case Electron:
|
|
1147
|
-
return getTitleBarButtonsElectron(controlsOverlayEnabled, titleBarStyleCustom);
|
|
1148
|
-
case Remote:
|
|
1149
|
-
return getTitleBarButtonsRemote();
|
|
1150
|
-
case Web:
|
|
1151
|
-
return getTitleBarButtonsWeb();
|
|
1152
|
-
default:
|
|
1153
|
-
return [];
|
|
1154
|
-
}
|
|
1155
|
-
};
|
|
1156
|
-
|
|
1157
|
-
const {
|
|
1158
|
-
get: get$1,
|
|
1159
|
-
getCommandIds,
|
|
1160
|
-
registerCommands,
|
|
1161
|
-
set: set$3,
|
|
1162
|
-
wrapCommand,
|
|
1163
|
-
wrapGetter
|
|
1164
|
-
} = create$2();
|
|
1165
|
-
|
|
1166
|
-
const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled, titleBarStyleCustom, assetDir) => {
|
|
1167
|
-
const titleBarButtons = getTitleBarButtons(platform, controlsOverlayEnabled, titleBarStyleCustom);
|
|
1168
|
-
const state = {
|
|
1169
|
-
...createDefaultState(),
|
|
1170
|
-
assetDir,
|
|
1171
|
-
commandCenterEnabled: false,
|
|
1172
|
-
controlsOverlayEnabled,
|
|
1173
|
-
focusedIndex: -1,
|
|
1174
|
-
height,
|
|
1175
|
-
iconWidth: 30,
|
|
1176
|
-
isMenuOpen: false,
|
|
1177
|
-
labelFontFamily: 'system-ui, Ubuntu, Droid Sans, sans-serif',
|
|
1178
|
-
labelFontSize: 13,
|
|
1179
|
-
labelFontWeight: 400,
|
|
1180
|
-
labelLetterSpacing: 0,
|
|
1181
|
-
labelPadding: 8,
|
|
1182
|
-
layoutControlsEnabled: false,
|
|
1183
|
-
menus: [],
|
|
1184
|
-
platform,
|
|
1185
|
-
titleBarButtons,
|
|
1186
|
-
titleBarEntries: [],
|
|
1187
|
-
titleBarHeight: height,
|
|
1188
|
-
titleBarStyleCustom,
|
|
1189
|
-
uid: id,
|
|
1190
|
-
width,
|
|
1191
|
-
x,
|
|
1192
|
-
y
|
|
1193
|
-
};
|
|
1194
|
-
set$3(id, state, state);
|
|
1195
|
-
};
|
|
1196
|
-
|
|
1197
|
-
const RenderEntries = 1;
|
|
1198
|
-
const RenderFocusedIndex = 2;
|
|
1199
|
-
const RenderMenus = 3;
|
|
1200
|
-
|
|
1201
|
-
const isEqual$3 = (oldState, newState) => {
|
|
1202
|
-
return oldState.titleBarEntries === newState.titleBarEntries && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
|
|
1203
|
-
};
|
|
1204
|
-
|
|
1205
|
-
const isEqual$2 = (oldState, newState) => {
|
|
1206
|
-
return oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
|
|
1207
|
-
};
|
|
1208
|
-
|
|
1209
|
-
const isEqual$1 = (oldState, newState) => {
|
|
1210
|
-
return oldState.menus === newState.menus;
|
|
1211
|
-
};
|
|
1212
|
-
|
|
1213
|
-
const modules$1 = [isEqual$3, isEqual$2, isEqual$1];
|
|
1214
|
-
const numbers$1 = [RenderEntries, RenderFocusedIndex, RenderMenus];
|
|
1215
|
-
|
|
1216
|
-
const diff = (oldState, newState) => {
|
|
1217
|
-
const diffResult = [];
|
|
1218
|
-
for (let i = 0; i < modules$1.length; i++) {
|
|
1219
|
-
const fn = modules$1[i];
|
|
1220
|
-
if (!fn(oldState, newState)) {
|
|
1221
|
-
diffResult.push(numbers$1[i]);
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
return diffResult;
|
|
1225
|
-
};
|
|
1226
|
-
|
|
1227
|
-
const diff2 = uid => {
|
|
1228
|
-
const {
|
|
1229
|
-
newState,
|
|
1230
|
-
oldState
|
|
1231
|
-
} = get$1(uid);
|
|
1232
|
-
return diff(oldState, newState);
|
|
1233
|
-
};
|
|
1234
|
-
|
|
1235
|
-
const isEqual = (oldState, newState) => {
|
|
1236
|
-
return oldState.titleBarEntries === newState.titleBarEntries && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen && oldState.assetDir === newState.assetDir && oldState.titleBarIconEnabled === newState.titleBarIconEnabled && oldState.title === newState.title && oldState.titleBarTitleEnabled === newState.titleBarTitleEnabled && oldState.platform === newState.platform && oldState.controlsOverlayEnabled === newState.controlsOverlayEnabled && oldState.titleBarStyleCustom === newState.titleBarStyleCustom && oldState.titleBarButtonsEnabled === newState.titleBarButtonsEnabled && oldState.titleBarButtons === newState.titleBarButtons;
|
|
1237
|
-
};
|
|
1238
|
-
|
|
1239
|
-
const modules = [isEqual, isEqual$2, isEqual$1];
|
|
1240
|
-
const numbers = [RenderEntries, RenderFocusedIndex, RenderMenus];
|
|
1241
|
-
|
|
1242
|
-
const diff3 = uid => {
|
|
1243
|
-
const {
|
|
1244
|
-
newState,
|
|
1245
|
-
oldState
|
|
1246
|
-
} = get$1(uid);
|
|
1247
|
-
const diffResult = [];
|
|
1248
|
-
for (let i = 0; i < modules.length; i++) {
|
|
1249
|
-
const fn = modules[i];
|
|
1250
|
-
if (!fn(oldState, newState)) {
|
|
1251
|
-
diffResult.push(numbers[i]);
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
return diffResult;
|
|
1255
|
-
};
|
|
1256
|
-
|
|
1257
|
-
const ContentInfo = 'contentinfo';
|
|
1258
|
-
const Menu$1 = 'menu';
|
|
1259
|
-
const MenuBar = 'menubar';
|
|
1260
|
-
const MenuItem$1 = 'menuitem';
|
|
1261
|
-
const MenuItemCheckBox = 'menuitemcheckbox';
|
|
1262
|
-
const None$1 = 'none';
|
|
1263
|
-
const Separator$1 = 'separator';
|
|
1264
|
-
|
|
1265
|
-
const Button$1 = 1;
|
|
1266
|
-
const Div = 4;
|
|
1267
|
-
const Span = 8;
|
|
1268
|
-
const Text = 12;
|
|
1269
|
-
const I = 16;
|
|
1270
|
-
const Img = 17;
|
|
1271
|
-
|
|
1272
|
-
const Button = 'event.button';
|
|
1273
|
-
const ClientX = 'event.clientX';
|
|
1274
|
-
const ClientY = 'event.clientY';
|
|
1275
|
-
const TargetName = 'event.target.name';
|
|
1276
|
-
|
|
1277
|
-
const Backspace$1 = 1;
|
|
1278
|
-
const Tab$1 = 2;
|
|
1279
|
-
const Enter$1 = 3;
|
|
1280
|
-
const Escape$1 = 8;
|
|
1281
|
-
const Space$1 = 9;
|
|
1282
|
-
const PageUp$1 = 10;
|
|
1283
|
-
const PageDown$1 = 11;
|
|
1284
|
-
const End$1 = 255;
|
|
1285
|
-
const Home$1 = 12;
|
|
1286
|
-
const LeftArrow$1 = 13;
|
|
1287
|
-
const UpArrow$1 = 14;
|
|
1288
|
-
const RightArrow$1 = 15;
|
|
1289
|
-
const DownArrow$1 = 16;
|
|
1290
|
-
const Insert$1 = 17;
|
|
1291
|
-
const Delete$1 = 18;
|
|
1292
|
-
const Digit0$1 = 19;
|
|
1293
|
-
const Digit1$1 = 20;
|
|
1294
|
-
const Digit2$1 = 21;
|
|
1295
|
-
const Digit3$1 = 22;
|
|
1296
|
-
const Digit4$1 = 23;
|
|
1297
|
-
const Digit5$1 = 24;
|
|
1298
|
-
const Digit6$1 = 25;
|
|
1299
|
-
const Digit7$1 = 26;
|
|
1300
|
-
const Digit8$1 = 27;
|
|
1301
|
-
const Digit9$1 = 28;
|
|
1302
|
-
const KeyA$1 = 29;
|
|
1303
|
-
const KeyB$1 = 30;
|
|
1304
|
-
const KeyC$1 = 31;
|
|
1305
|
-
const KeyD$1 = 32;
|
|
1306
|
-
const KeyE$1 = 33;
|
|
1307
|
-
const KeyF$1 = 34;
|
|
1308
|
-
const KeyG$1 = 35;
|
|
1309
|
-
const KeyH$1 = 36;
|
|
1310
|
-
const KeyI$1 = 37;
|
|
1311
|
-
const KeyJ$1 = 38;
|
|
1312
|
-
const KeyK$1 = 39;
|
|
1313
|
-
const KeyL$1 = 40;
|
|
1314
|
-
const KeyM$1 = 41;
|
|
1315
|
-
const KeyN$1 = 42;
|
|
1316
|
-
const KeyO$1 = 43;
|
|
1317
|
-
const KeyP$1 = 44;
|
|
1318
|
-
const KeyQ$1 = 45;
|
|
1319
|
-
const KeyR$1 = 46;
|
|
1320
|
-
const KeyS$1 = 47;
|
|
1321
|
-
const KeyT$1 = 48;
|
|
1322
|
-
const KeyU$1 = 49;
|
|
1323
|
-
const KeyV$1 = 50;
|
|
1324
|
-
const KeyW$1 = 51;
|
|
1325
|
-
const KeyX$1 = 52;
|
|
1326
|
-
const KeyY$1 = 53;
|
|
1327
|
-
const KeyZ$1 = 54;
|
|
1328
|
-
const F1$1 = 57;
|
|
1329
|
-
const F2$1 = 58;
|
|
1330
|
-
const F3$1 = 59;
|
|
1331
|
-
const F4$1 = 60;
|
|
1332
|
-
const F5$1 = 61;
|
|
1333
|
-
const F6$1 = 62;
|
|
1334
|
-
const Equal$1 = 84;
|
|
1335
|
-
const Comma$1 = 85;
|
|
1336
|
-
const Minus$1 = 86;
|
|
1337
|
-
const Backquote$1 = 89;
|
|
1338
|
-
const Backslash$1 = 91;
|
|
1339
|
-
const Star$1 = 131;
|
|
1340
|
-
const Plus$1 = 132;
|
|
915
|
+
const Backspace$1 = 1;
|
|
916
|
+
const Tab$1 = 2;
|
|
917
|
+
const Enter$1 = 3;
|
|
918
|
+
const Escape$1 = 8;
|
|
919
|
+
const Space$1 = 9;
|
|
920
|
+
const PageUp$1 = 10;
|
|
921
|
+
const PageDown$1 = 11;
|
|
922
|
+
const End$1 = 255;
|
|
923
|
+
const Home$1 = 12;
|
|
924
|
+
const LeftArrow$1 = 13;
|
|
925
|
+
const UpArrow$1 = 14;
|
|
926
|
+
const RightArrow$1 = 15;
|
|
927
|
+
const DownArrow$1 = 16;
|
|
928
|
+
const Insert$1 = 17;
|
|
929
|
+
const Delete$1 = 18;
|
|
930
|
+
const Digit0$1 = 19;
|
|
931
|
+
const Digit1$1 = 20;
|
|
932
|
+
const Digit2$1 = 21;
|
|
933
|
+
const Digit3$1 = 22;
|
|
934
|
+
const Digit4$1 = 23;
|
|
935
|
+
const Digit5$1 = 24;
|
|
936
|
+
const Digit6$1 = 25;
|
|
937
|
+
const Digit7$1 = 26;
|
|
938
|
+
const Digit8$1 = 27;
|
|
939
|
+
const Digit9$1 = 28;
|
|
940
|
+
const KeyA$1 = 29;
|
|
941
|
+
const KeyB$1 = 30;
|
|
942
|
+
const KeyC$1 = 31;
|
|
943
|
+
const KeyD$1 = 32;
|
|
944
|
+
const KeyE$1 = 33;
|
|
945
|
+
const KeyF$1 = 34;
|
|
946
|
+
const KeyG$1 = 35;
|
|
947
|
+
const KeyH$1 = 36;
|
|
948
|
+
const KeyI$1 = 37;
|
|
949
|
+
const KeyJ$1 = 38;
|
|
950
|
+
const KeyK$1 = 39;
|
|
951
|
+
const KeyL$1 = 40;
|
|
952
|
+
const KeyM$1 = 41;
|
|
953
|
+
const KeyN$1 = 42;
|
|
954
|
+
const KeyO$1 = 43;
|
|
955
|
+
const KeyP$1 = 44;
|
|
956
|
+
const KeyQ$1 = 45;
|
|
957
|
+
const KeyR$1 = 46;
|
|
958
|
+
const KeyS$1 = 47;
|
|
959
|
+
const KeyT$1 = 48;
|
|
960
|
+
const KeyU$1 = 49;
|
|
961
|
+
const KeyV$1 = 50;
|
|
962
|
+
const KeyW$1 = 51;
|
|
963
|
+
const KeyX$1 = 52;
|
|
964
|
+
const KeyY$1 = 53;
|
|
965
|
+
const KeyZ$1 = 54;
|
|
966
|
+
const F1$1 = 57;
|
|
967
|
+
const F2$1 = 58;
|
|
968
|
+
const F3$1 = 59;
|
|
969
|
+
const F4$1 = 60;
|
|
970
|
+
const F5$1 = 61;
|
|
971
|
+
const F6$1 = 62;
|
|
972
|
+
const Equal$1 = 84;
|
|
973
|
+
const Comma$1 = 85;
|
|
974
|
+
const Minus$1 = 86;
|
|
975
|
+
const Backquote$1 = 89;
|
|
976
|
+
const Backslash$1 = 91;
|
|
977
|
+
const Star$1 = 131;
|
|
978
|
+
const Plus$1 = 132;
|
|
1341
979
|
|
|
1342
980
|
const Unknown = 'Unknown';
|
|
1343
981
|
const Backspace = 'Backspace';
|
|
@@ -1532,435 +1170,64 @@ const getKeyCodeString = keyCode => {
|
|
|
1532
1170
|
case Plus$1:
|
|
1533
1171
|
return Plus;
|
|
1534
1172
|
case Star$1:
|
|
1535
|
-
return Star;
|
|
1536
|
-
case Minus$1:
|
|
1537
|
-
return Minus;
|
|
1538
|
-
default:
|
|
1539
|
-
return Unknown;
|
|
1540
|
-
}
|
|
1541
|
-
};
|
|
1542
|
-
|
|
1543
|
-
const Script = 2;
|
|
1544
|
-
|
|
1545
|
-
const CtrlCmd = 1 << 11 >>> 0;
|
|
1546
|
-
const Shift = 1 << 10 >>> 0;
|
|
1547
|
-
|
|
1548
|
-
const Edit$1 = 2;
|
|
1549
|
-
const File$2 = 5;
|
|
1550
|
-
const Go$1 = 6;
|
|
1551
|
-
const Help$1 = 7;
|
|
1552
|
-
const OpenRecent$1 = 9;
|
|
1553
|
-
const Run$1 = 10;
|
|
1554
|
-
const Selection$1 = 11;
|
|
1555
|
-
const Terminal$1 = 14;
|
|
1556
|
-
const TitleBar$1 = 15;
|
|
1557
|
-
const View$1 = 16;
|
|
1558
|
-
|
|
1559
|
-
const parseKey = rawKey => {
|
|
1560
|
-
const isCtrl = Boolean(rawKey & CtrlCmd);
|
|
1561
|
-
const isShift = Boolean(rawKey & Shift);
|
|
1562
|
-
const keyCode = rawKey & 0x00_00_00_ff;
|
|
1563
|
-
const key = getKeyCodeString(keyCode);
|
|
1564
|
-
return {
|
|
1565
|
-
key,
|
|
1566
|
-
isCtrl,
|
|
1567
|
-
isShift
|
|
1568
|
-
};
|
|
1569
|
-
};
|
|
1570
|
-
|
|
1571
|
-
const DebugWorker = 55;
|
|
1572
|
-
const RendererWorker$1 = 1;
|
|
1573
|
-
|
|
1574
|
-
const FocusTitleBarMenuBar = 26;
|
|
1575
|
-
|
|
1576
|
-
const mergeClassNames = (...classNames) => {
|
|
1577
|
-
return classNames.filter(Boolean).join(' ');
|
|
1578
|
-
};
|
|
1579
|
-
|
|
1580
|
-
const px = value => {
|
|
1581
|
-
return `${value}px`;
|
|
1582
|
-
};
|
|
1583
|
-
|
|
1584
|
-
const text = data => {
|
|
1585
|
-
return {
|
|
1586
|
-
type: Text,
|
|
1587
|
-
text: data,
|
|
1588
|
-
childCount: 0
|
|
1589
|
-
};
|
|
1590
|
-
};
|
|
1591
|
-
|
|
1592
|
-
const getKeyBindings$1 = () => {
|
|
1593
|
-
return [{
|
|
1594
|
-
command: 'TitleBar.handleKeyArrowDown',
|
|
1595
|
-
key: DownArrow$1,
|
|
1596
|
-
when: FocusTitleBarMenuBar
|
|
1597
|
-
}, {
|
|
1598
|
-
command: 'TitleBar.handleKeyArrowUp',
|
|
1599
|
-
key: UpArrow$1,
|
|
1600
|
-
when: FocusTitleBarMenuBar
|
|
1601
|
-
}, {
|
|
1602
|
-
command: 'TitleBar.handleKeyArrowRight',
|
|
1603
|
-
key: RightArrow$1,
|
|
1604
|
-
when: FocusTitleBarMenuBar
|
|
1605
|
-
}, {
|
|
1606
|
-
command: 'TitleBar.handleKeyArrowLeft',
|
|
1607
|
-
key: LeftArrow$1,
|
|
1608
|
-
when: FocusTitleBarMenuBar
|
|
1609
|
-
}, {
|
|
1610
|
-
command: 'TitleBar.handleKeySpace',
|
|
1611
|
-
key: Space$1,
|
|
1612
|
-
when: FocusTitleBarMenuBar
|
|
1613
|
-
}, {
|
|
1614
|
-
command: 'TitleBar.handleKeyHome',
|
|
1615
|
-
key: Home$1,
|
|
1616
|
-
when: FocusTitleBarMenuBar
|
|
1617
|
-
}, {
|
|
1618
|
-
command: 'TitleBar.handleKeyEnd',
|
|
1619
|
-
key: End$1,
|
|
1620
|
-
when: FocusTitleBarMenuBar
|
|
1621
|
-
}, {
|
|
1622
|
-
command: 'TitleBar.handleKeyEscape',
|
|
1623
|
-
key: Escape$1,
|
|
1624
|
-
when: FocusTitleBarMenuBar
|
|
1625
|
-
}];
|
|
1626
|
-
};
|
|
1627
|
-
|
|
1628
|
-
const Separator = 1;
|
|
1629
|
-
const None = 0;
|
|
1630
|
-
const SubMenu = 4;
|
|
1631
|
-
const Checked = 2;
|
|
1632
|
-
const Unchecked = 3;
|
|
1633
|
-
const Disabled = 5;
|
|
1634
|
-
const RestoreFocus = 6;
|
|
1635
|
-
const Ignore = 7;
|
|
1636
|
-
|
|
1637
|
-
const getMenuEntriesTitleBarContextMenu = async state => {
|
|
1638
|
-
const {
|
|
1639
|
-
commandCenterEnabled,
|
|
1640
|
-
titleBarMenuBarEnabled
|
|
1641
|
-
} = state;
|
|
1642
|
-
// TODO checked state should be depending on whether or not that feature is currently visible or not
|
|
1643
|
-
return [{
|
|
1644
|
-
command: titleBarMenuBarEnabled ? 'TitleBar.hideMenuBar' : 'TitleBar.showMenuBar',
|
|
1645
|
-
flags: titleBarMenuBarEnabled ? Checked : Unchecked,
|
|
1646
|
-
id: 'MenuBar',
|
|
1647
|
-
label: menuBar()
|
|
1648
|
-
}, {
|
|
1649
|
-
command: commandCenterEnabled ? 'TitleBar.hideCommandCenter' : 'TitleBar.showCommandCenter',
|
|
1650
|
-
flags: commandCenterEnabled ? Checked : Unchecked,
|
|
1651
|
-
id: 'Command center',
|
|
1652
|
-
label: commandCenter()
|
|
1653
|
-
}, {
|
|
1654
|
-
command: '',
|
|
1655
|
-
flags: Checked,
|
|
1656
|
-
id: 'layout controls',
|
|
1657
|
-
label: 'layout controls'
|
|
1658
|
-
}];
|
|
1659
|
-
};
|
|
1660
|
-
|
|
1661
|
-
/**
|
|
1662
|
-
* @enum {string}
|
|
1663
|
-
*/
|
|
1664
|
-
const UiStrings$1 = {
|
|
1665
|
-
Copy: 'Copy',
|
|
1666
|
-
CopyLineDown: 'Copy Line Down',
|
|
1667
|
-
CopyLineUp: 'Copy Line Up',
|
|
1668
|
-
Cut: 'Cut',
|
|
1669
|
-
MoveLineDown: 'Move Line Down',
|
|
1670
|
-
MoveLineUp: 'Move Line Up',
|
|
1671
|
-
Paste: 'Paste',
|
|
1672
|
-
Redo: 'Redo',
|
|
1673
|
-
SelectAll: 'Select All',
|
|
1674
|
-
ToggleBlockComment: 'Toggle Block Comment',
|
|
1675
|
-
ToggleLineComment: 'Toggle Line Comment',
|
|
1676
|
-
Undo: 'Undo'
|
|
1677
|
-
};
|
|
1678
|
-
const cut = () => {
|
|
1679
|
-
return i18nString(UiStrings$1.Cut);
|
|
1680
|
-
};
|
|
1681
|
-
const copy = () => {
|
|
1682
|
-
return i18nString(UiStrings$1.Copy);
|
|
1683
|
-
};
|
|
1684
|
-
const paste = () => {
|
|
1685
|
-
return i18nString(UiStrings$1.Paste);
|
|
1686
|
-
};
|
|
1687
|
-
const undo = () => {
|
|
1688
|
-
return i18nString(UiStrings$1.Undo);
|
|
1689
|
-
};
|
|
1690
|
-
const redo = () => {
|
|
1691
|
-
return i18nString(UiStrings$1.Redo);
|
|
1692
|
-
};
|
|
1693
|
-
const toggleLineComment = () => {
|
|
1694
|
-
return i18nString(UiStrings$1.ToggleLineComment);
|
|
1695
|
-
};
|
|
1696
|
-
const toggleBlockComment = () => {
|
|
1697
|
-
return i18nString(UiStrings$1.ToggleBlockComment);
|
|
1698
|
-
};
|
|
1699
|
-
const selectAll = () => {
|
|
1700
|
-
return i18nString(UiStrings$1.SelectAll);
|
|
1701
|
-
};
|
|
1702
|
-
const copyLineUp = () => {
|
|
1703
|
-
return i18nString(UiStrings$1.CopyLineUp);
|
|
1704
|
-
};
|
|
1705
|
-
const copyLineDown = () => {
|
|
1706
|
-
return i18nString(UiStrings$1.CopyLineDown);
|
|
1707
|
-
};
|
|
1708
|
-
const moveLineUp = () => {
|
|
1709
|
-
return i18nString(UiStrings$1.MoveLineUp);
|
|
1710
|
-
};
|
|
1711
|
-
const moveLineDown = () => {
|
|
1712
|
-
return i18nString(UiStrings$1.MoveLineDown);
|
|
1713
|
-
};
|
|
1714
|
-
|
|
1715
|
-
const Edit = 2;
|
|
1716
|
-
const File$1 = 5;
|
|
1717
|
-
const Go = 6;
|
|
1718
|
-
const Help = 7;
|
|
1719
|
-
const OpenRecent = 9;
|
|
1720
|
-
const Run = 10;
|
|
1721
|
-
const Selection = 11;
|
|
1722
|
-
const Terminal = 14;
|
|
1723
|
-
const TitleBar = 15;
|
|
1724
|
-
const View = 16;
|
|
1725
|
-
|
|
1726
|
-
const menuEntrySeparator = {
|
|
1727
|
-
command: '',
|
|
1728
|
-
flags: Separator,
|
|
1729
|
-
id: 'separator',
|
|
1730
|
-
label: ''
|
|
1731
|
-
};
|
|
1732
|
-
|
|
1733
|
-
const id$9 = Edit;
|
|
1734
|
-
const getMenuEntries$d = () => {
|
|
1735
|
-
return [{
|
|
1736
|
-
command: /* TODO */'-1',
|
|
1737
|
-
flags: Disabled,
|
|
1738
|
-
id: 'undo',
|
|
1739
|
-
label: undo()
|
|
1740
|
-
}, {
|
|
1741
|
-
command: /* TODO */'-1',
|
|
1742
|
-
flags: Disabled,
|
|
1743
|
-
id: 'redo',
|
|
1744
|
-
label: redo()
|
|
1745
|
-
}, menuEntrySeparator, {
|
|
1746
|
-
command: /* Editor.cut */'Editor.cut',
|
|
1747
|
-
flags: None,
|
|
1748
|
-
id: 'cut',
|
|
1749
|
-
label: cut()
|
|
1750
|
-
}, {
|
|
1751
|
-
command: /* Editor.copy */'Editor.copy',
|
|
1752
|
-
flags: None,
|
|
1753
|
-
id: 'copy',
|
|
1754
|
-
label: copy()
|
|
1755
|
-
}, {
|
|
1756
|
-
command: /* Editor.paste */'Editor.paste',
|
|
1757
|
-
flags: None,
|
|
1758
|
-
id: 'paste',
|
|
1759
|
-
label: paste()
|
|
1760
|
-
}, menuEntrySeparator, {
|
|
1761
|
-
command: /* Editor.toggleLineComment */'Editor.toggleLineComment',
|
|
1762
|
-
flags: None,
|
|
1763
|
-
id: 'toggle-line-comment',
|
|
1764
|
-
label: toggleLineComment()
|
|
1765
|
-
}, {
|
|
1766
|
-
command: /* Editor.toggleBlockComment */'Editor.toggleBlockComment',
|
|
1767
|
-
flags: None,
|
|
1768
|
-
id: 'toggle-block-comment',
|
|
1769
|
-
label: toggleBlockComment()
|
|
1770
|
-
}];
|
|
1771
|
-
};
|
|
1772
|
-
|
|
1773
|
-
const MenuEntriesEdit = {
|
|
1774
|
-
__proto__: null,
|
|
1775
|
-
getMenuEntries: getMenuEntries$d,
|
|
1776
|
-
id: id$9
|
|
1777
|
-
};
|
|
1778
|
-
|
|
1779
|
-
/**
|
|
1780
|
-
* @enum {string}
|
|
1781
|
-
*/
|
|
1782
|
-
const UiStrings = {
|
|
1783
|
-
Exit: 'Exit',
|
|
1784
|
-
NewFile: 'New File',
|
|
1785
|
-
NewWindow: 'New Window',
|
|
1786
|
-
OpenFile: 'Open File',
|
|
1787
|
-
OpenFolder: 'Open Folder',
|
|
1788
|
-
OpenRecent: 'Open Recent',
|
|
1789
|
-
Save: 'Save',
|
|
1790
|
-
SaveAll: 'Save All'};
|
|
1791
|
-
const newFile = () => {
|
|
1792
|
-
return i18nString(UiStrings.NewFile);
|
|
1793
|
-
};
|
|
1794
|
-
const newWindow = () => {
|
|
1795
|
-
return i18nString(UiStrings.NewWindow);
|
|
1796
|
-
};
|
|
1797
|
-
const openFile = () => {
|
|
1798
|
-
return i18nString(UiStrings.OpenFile);
|
|
1799
|
-
};
|
|
1800
|
-
const openFolder = () => {
|
|
1801
|
-
return i18nString(UiStrings.OpenFolder);
|
|
1802
|
-
};
|
|
1803
|
-
const openRecent = () => {
|
|
1804
|
-
return i18nString(UiStrings.OpenRecent);
|
|
1805
|
-
};
|
|
1806
|
-
const save = () => {
|
|
1807
|
-
return i18nString(UiStrings.Save);
|
|
1808
|
-
};
|
|
1809
|
-
const saveAll = () => {
|
|
1810
|
-
return i18nString(UiStrings.SaveAll);
|
|
1811
|
-
};
|
|
1812
|
-
const exit = () => {
|
|
1813
|
-
return i18nString(UiStrings.Exit);
|
|
1814
|
-
};
|
|
1815
|
-
|
|
1816
|
-
const id$8 = File$1;
|
|
1817
|
-
const getMenuEntries$c = platform => {
|
|
1818
|
-
const entries = [{
|
|
1819
|
-
command: '-1',
|
|
1820
|
-
flags: None,
|
|
1821
|
-
id: 'newFile',
|
|
1822
|
-
label: newFile()
|
|
1823
|
-
}, {
|
|
1824
|
-
command: /* Window.openNew */'Window.openNew',
|
|
1825
|
-
flags: None,
|
|
1826
|
-
id: 'newWindow',
|
|
1827
|
-
label: newWindow()
|
|
1828
|
-
}, menuEntrySeparator, {
|
|
1829
|
-
command: 'Dialog.openFile',
|
|
1830
|
-
flags: None,
|
|
1831
|
-
id: 'openFile',
|
|
1832
|
-
label: openFile()
|
|
1833
|
-
}, {
|
|
1834
|
-
command: 'Dialog.openFolder',
|
|
1835
|
-
flags: RestoreFocus,
|
|
1836
|
-
id: 'openFolder',
|
|
1837
|
-
label: openFolder()
|
|
1838
|
-
}, {
|
|
1839
|
-
command: '',
|
|
1840
|
-
flags: SubMenu,
|
|
1841
|
-
id: OpenRecent,
|
|
1842
|
-
label: openRecent()
|
|
1843
|
-
}, menuEntrySeparator, {
|
|
1844
|
-
command: 'Main.save',
|
|
1845
|
-
flags: None,
|
|
1846
|
-
id: 'save',
|
|
1847
|
-
label: save()
|
|
1848
|
-
}, {
|
|
1849
|
-
command: 'Main.saveAll',
|
|
1850
|
-
flags: None,
|
|
1851
|
-
id: 'saveAll',
|
|
1852
|
-
label: saveAll()
|
|
1853
|
-
}];
|
|
1854
|
-
if (platform === Electron) {
|
|
1855
|
-
entries.push(menuEntrySeparator, {
|
|
1856
|
-
command: 'Chrome.exit',
|
|
1857
|
-
flags: Ignore,
|
|
1858
|
-
id: 'exit',
|
|
1859
|
-
label: exit()
|
|
1860
|
-
});
|
|
1861
|
-
}
|
|
1862
|
-
return entries;
|
|
1863
|
-
};
|
|
1864
|
-
|
|
1865
|
-
const MenuEntriesFile = {
|
|
1866
|
-
__proto__: null,
|
|
1867
|
-
getMenuEntries: getMenuEntries$c,
|
|
1868
|
-
id: id$8
|
|
1869
|
-
};
|
|
1870
|
-
|
|
1871
|
-
const id$7 = Go;
|
|
1872
|
-
const getMenuEntries$b = () => {
|
|
1873
|
-
return [];
|
|
1874
|
-
};
|
|
1875
|
-
|
|
1876
|
-
const MenuEntriesGo = {
|
|
1877
|
-
__proto__: null,
|
|
1878
|
-
getMenuEntries: getMenuEntries$b,
|
|
1879
|
-
id: id$7
|
|
1880
|
-
};
|
|
1881
|
-
|
|
1882
|
-
const toggleDeveloperTools = () => {
|
|
1883
|
-
return i18nString(ToggleDeveloperTools);
|
|
1884
|
-
};
|
|
1885
|
-
const openProcessExplorer = () => {
|
|
1886
|
-
return i18nString(OpenProcessExplorer);
|
|
1887
|
-
};
|
|
1888
|
-
const checkForUpdates = () => {
|
|
1889
|
-
return i18nString(CheckForUpdates);
|
|
1890
|
-
};
|
|
1891
|
-
const about = () => {
|
|
1892
|
-
return i18nString(About);
|
|
1893
|
-
};
|
|
1894
|
-
|
|
1895
|
-
const isAutoUpdateSupported = platform => {
|
|
1896
|
-
if (platform !== Electron) {
|
|
1897
|
-
return false;
|
|
1898
|
-
}
|
|
1899
|
-
return false;
|
|
1900
|
-
};
|
|
1901
|
-
|
|
1902
|
-
const id$6 = Help;
|
|
1903
|
-
const getMenuEntries$a = async platform => {
|
|
1904
|
-
const autoUpdateSupported = isAutoUpdateSupported(platform);
|
|
1905
|
-
const entries = [];
|
|
1906
|
-
if (platform !== Web) {
|
|
1907
|
-
entries.push({
|
|
1908
|
-
command: 'Developer.toggleDeveloperTools',
|
|
1909
|
-
flags: None,
|
|
1910
|
-
id: 'toggleDeveloperTools',
|
|
1911
|
-
label: toggleDeveloperTools()
|
|
1912
|
-
}, {
|
|
1913
|
-
command: 'Developer.openProcessExplorer',
|
|
1914
|
-
flags: RestoreFocus,
|
|
1915
|
-
id: 'openProcessExplorer',
|
|
1916
|
-
label: openProcessExplorer()
|
|
1917
|
-
});
|
|
1918
|
-
}
|
|
1919
|
-
if (autoUpdateSupported) {
|
|
1920
|
-
entries.push(menuEntrySeparator, {
|
|
1921
|
-
command: 'AutoUpdater.checkForUpdates',
|
|
1922
|
-
flags: RestoreFocus,
|
|
1923
|
-
id: 'checkForUpdates',
|
|
1924
|
-
label: checkForUpdates()
|
|
1925
|
-
});
|
|
1926
|
-
}
|
|
1927
|
-
if (entries.length > 0) {
|
|
1928
|
-
entries.push(menuEntrySeparator);
|
|
1929
|
-
}
|
|
1930
|
-
entries.push({
|
|
1931
|
-
command: 'About.showAbout',
|
|
1932
|
-
flags: None,
|
|
1933
|
-
id: 'about',
|
|
1934
|
-
label: about()
|
|
1935
|
-
});
|
|
1936
|
-
return entries;
|
|
1173
|
+
return Star;
|
|
1174
|
+
case Minus$1:
|
|
1175
|
+
return Minus;
|
|
1176
|
+
default:
|
|
1177
|
+
return Unknown;
|
|
1178
|
+
}
|
|
1937
1179
|
};
|
|
1938
1180
|
|
|
1939
|
-
const
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1181
|
+
const CtrlCmd = 1 << 11 >>> 0;
|
|
1182
|
+
const Shift = 1 << 10 >>> 0;
|
|
1183
|
+
|
|
1184
|
+
const Edit$2 = 2;
|
|
1185
|
+
const File$3 = 5;
|
|
1186
|
+
const Go$2 = 6;
|
|
1187
|
+
const Help$2 = 7;
|
|
1188
|
+
const OpenRecent$1 = 9;
|
|
1189
|
+
const Run$2 = 10;
|
|
1190
|
+
const Selection$2 = 11;
|
|
1191
|
+
const Terminal$2 = 14;
|
|
1192
|
+
const TitleBar = 15;
|
|
1193
|
+
const View$2 = 16;
|
|
1194
|
+
const TitleBarContextMenu = 90;
|
|
1195
|
+
|
|
1196
|
+
const parseKey = rawKey => {
|
|
1197
|
+
const isCtrl = Boolean(rawKey & CtrlCmd);
|
|
1198
|
+
const isShift = Boolean(rawKey & Shift);
|
|
1199
|
+
const keyCode = rawKey & 0x00_00_00_ff;
|
|
1200
|
+
const key = getKeyCodeString(keyCode);
|
|
1201
|
+
return {
|
|
1202
|
+
key,
|
|
1203
|
+
isCtrl,
|
|
1204
|
+
isShift
|
|
1205
|
+
};
|
|
1943
1206
|
};
|
|
1944
1207
|
|
|
1208
|
+
const RendererWorker = 1;
|
|
1209
|
+
|
|
1210
|
+
const FocusTitleBarMenuBar = 26;
|
|
1211
|
+
|
|
1945
1212
|
const rpcs = Object.create(null);
|
|
1946
1213
|
const set$2 = (id, rpc) => {
|
|
1947
1214
|
rpcs[id] = rpc;
|
|
1948
1215
|
};
|
|
1949
|
-
const get = id => {
|
|
1216
|
+
const get$1 = id => {
|
|
1950
1217
|
return rpcs[id];
|
|
1951
1218
|
};
|
|
1952
1219
|
|
|
1953
|
-
const create$
|
|
1220
|
+
const create$2 = rpcId => {
|
|
1954
1221
|
return {
|
|
1955
1222
|
// @ts-ignore
|
|
1956
1223
|
invoke(method, ...params) {
|
|
1957
|
-
const rpc = get(rpcId);
|
|
1224
|
+
const rpc = get$1(rpcId);
|
|
1958
1225
|
// @ts-ignore
|
|
1959
1226
|
return rpc.invoke(method, ...params);
|
|
1960
1227
|
},
|
|
1961
1228
|
// @ts-ignore
|
|
1962
1229
|
invokeAndTransfer(method, ...params) {
|
|
1963
|
-
const rpc = get(rpcId);
|
|
1230
|
+
const rpc = get$1(rpcId);
|
|
1964
1231
|
// @ts-ignore
|
|
1965
1232
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1966
1233
|
},
|
|
@@ -1968,376 +1235,736 @@ const create$1 = rpcId => {
|
|
|
1968
1235
|
set$2(rpcId, rpc);
|
|
1969
1236
|
},
|
|
1970
1237
|
async dispose() {
|
|
1971
|
-
const rpc = get(rpcId);
|
|
1238
|
+
const rpc = get$1(rpcId);
|
|
1972
1239
|
await rpc.dispose();
|
|
1973
1240
|
}
|
|
1974
1241
|
};
|
|
1975
1242
|
};
|
|
1976
1243
|
|
|
1977
1244
|
const {
|
|
1978
|
-
invoke
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
return invoke$1('ExtensionHost.searchFileWithHtml', uri);
|
|
1985
|
-
};
|
|
1986
|
-
const getFilePathElectron = async file => {
|
|
1987
|
-
return invoke$1('FileSystemHandle.getFilePathElectron', file);
|
|
1245
|
+
invoke,
|
|
1246
|
+
set: set$1} = create$2(RendererWorker);
|
|
1247
|
+
|
|
1248
|
+
const toCommandId = key => {
|
|
1249
|
+
const dotIndex = key.indexOf('.');
|
|
1250
|
+
return key.slice(dotIndex + 1);
|
|
1988
1251
|
};
|
|
1989
|
-
const
|
|
1990
|
-
|
|
1252
|
+
const create$1 = () => {
|
|
1253
|
+
const states = Object.create(null);
|
|
1254
|
+
const commandMapRef = {};
|
|
1255
|
+
return {
|
|
1256
|
+
get(uid) {
|
|
1257
|
+
return states[uid];
|
|
1258
|
+
},
|
|
1259
|
+
set(uid, oldState, newState) {
|
|
1260
|
+
states[uid] = {
|
|
1261
|
+
oldState,
|
|
1262
|
+
newState
|
|
1263
|
+
};
|
|
1264
|
+
},
|
|
1265
|
+
dispose(uid) {
|
|
1266
|
+
delete states[uid];
|
|
1267
|
+
},
|
|
1268
|
+
getKeys() {
|
|
1269
|
+
return Object.keys(states).map(key => {
|
|
1270
|
+
return Number.parseInt(key);
|
|
1271
|
+
});
|
|
1272
|
+
},
|
|
1273
|
+
clear() {
|
|
1274
|
+
for (const key of Object.keys(states)) {
|
|
1275
|
+
delete states[key];
|
|
1276
|
+
}
|
|
1277
|
+
},
|
|
1278
|
+
wrapCommand(fn) {
|
|
1279
|
+
const wrapped = async (uid, ...args) => {
|
|
1280
|
+
const {
|
|
1281
|
+
oldState,
|
|
1282
|
+
newState
|
|
1283
|
+
} = states[uid];
|
|
1284
|
+
const newerState = await fn(newState, ...args);
|
|
1285
|
+
if (oldState === newerState || newState === newerState) {
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
const latest = states[uid];
|
|
1289
|
+
states[uid] = {
|
|
1290
|
+
oldState: latest.oldState,
|
|
1291
|
+
newState: newerState
|
|
1292
|
+
};
|
|
1293
|
+
};
|
|
1294
|
+
return wrapped;
|
|
1295
|
+
},
|
|
1296
|
+
wrapGetter(fn) {
|
|
1297
|
+
const wrapped = (uid, ...args) => {
|
|
1298
|
+
const {
|
|
1299
|
+
newState
|
|
1300
|
+
} = states[uid];
|
|
1301
|
+
return fn(newState, ...args);
|
|
1302
|
+
};
|
|
1303
|
+
return wrapped;
|
|
1304
|
+
},
|
|
1305
|
+
diff(uid, modules, numbers) {
|
|
1306
|
+
const {
|
|
1307
|
+
oldState,
|
|
1308
|
+
newState
|
|
1309
|
+
} = states[uid];
|
|
1310
|
+
const diffResult = [];
|
|
1311
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1312
|
+
const fn = modules[i];
|
|
1313
|
+
if (!fn(oldState, newState)) {
|
|
1314
|
+
diffResult.push(numbers[i]);
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
return diffResult;
|
|
1318
|
+
},
|
|
1319
|
+
getCommandIds() {
|
|
1320
|
+
const keys = Object.keys(commandMapRef);
|
|
1321
|
+
const ids = keys.map(toCommandId);
|
|
1322
|
+
return ids;
|
|
1323
|
+
},
|
|
1324
|
+
registerCommands(commandMap) {
|
|
1325
|
+
Object.assign(commandMapRef, commandMap);
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1991
1328
|
};
|
|
1992
|
-
const
|
|
1993
|
-
|
|
1994
|
-
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1329
|
+
const terminate = () => {
|
|
1330
|
+
globalThis.close();
|
|
1995
1331
|
};
|
|
1996
|
-
|
|
1997
|
-
|
|
1332
|
+
|
|
1333
|
+
const Web = 1;
|
|
1334
|
+
const Electron = 2;
|
|
1335
|
+
const Remote = 3;
|
|
1336
|
+
|
|
1337
|
+
const DEFAULT_UID = 1;
|
|
1338
|
+
const createDefaultState = (uid = DEFAULT_UID) => ({
|
|
1339
|
+
assetDir: '',
|
|
1340
|
+
buttons: [],
|
|
1341
|
+
commandCenterEnabled: false,
|
|
1342
|
+
controlsOverlayEnabled: false,
|
|
1343
|
+
focusedIndex: -1,
|
|
1344
|
+
height: 30,
|
|
1345
|
+
iconWidth: 30,
|
|
1346
|
+
isMenuOpen: false,
|
|
1347
|
+
labelFontFamily: 'system-ui, Ubuntu, Droid Sans, sans-serif',
|
|
1348
|
+
labelFontSize: 13,
|
|
1349
|
+
labelFontWeight: 400,
|
|
1350
|
+
labelLetterSpacing: 0,
|
|
1351
|
+
labelPadding: 8,
|
|
1352
|
+
layoutControlsEnabled: false,
|
|
1353
|
+
menus: [],
|
|
1354
|
+
platform: Electron,
|
|
1355
|
+
title: '',
|
|
1356
|
+
titleBarButtons: [],
|
|
1357
|
+
titleBarButtonsEnabled: true,
|
|
1358
|
+
titleBarButtonsWidth: 90,
|
|
1359
|
+
titleBarEntries: [],
|
|
1360
|
+
titleBarHeight: 30,
|
|
1361
|
+
titleBarIconEnabled: true,
|
|
1362
|
+
titleBarIconWidth: 30,
|
|
1363
|
+
titleBarMenuBarEnabled: true,
|
|
1364
|
+
titleBarStyleCustom: true,
|
|
1365
|
+
titleBarTitleEnabled: true,
|
|
1366
|
+
uid,
|
|
1367
|
+
width: 800,
|
|
1368
|
+
x: 0,
|
|
1369
|
+
y: 0
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1372
|
+
const emptyObject = {};
|
|
1373
|
+
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
1374
|
+
const i18nString = (key, placeholders = emptyObject) => {
|
|
1375
|
+
if (placeholders === emptyObject) {
|
|
1376
|
+
return key;
|
|
1377
|
+
}
|
|
1378
|
+
const replacer = (match, rest) => {
|
|
1379
|
+
return placeholders[rest];
|
|
1380
|
+
};
|
|
1381
|
+
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1998
1382
|
};
|
|
1999
|
-
|
|
2000
|
-
|
|
1383
|
+
|
|
1384
|
+
const About = 'About';
|
|
1385
|
+
const CheckForUpdates = 'Check For Updates';
|
|
1386
|
+
const ClearRecentlyOpened = 'Clear Recently Opened';
|
|
1387
|
+
const Close = 'Close';
|
|
1388
|
+
const MenuBar = 'Menu Bar';
|
|
1389
|
+
const CommandCenter = 'Command Center';
|
|
1390
|
+
const Edit$1 = 'Edit';
|
|
1391
|
+
const File$2 = 'File';
|
|
1392
|
+
const Go$1 = 'Go';
|
|
1393
|
+
const Help$1 = 'Help';
|
|
1394
|
+
const Maximize = 'Maximize';
|
|
1395
|
+
const Minimize = 'Minimize';
|
|
1396
|
+
const MoreDot = 'More ...';
|
|
1397
|
+
const NewTerminal = 'New Terminal';
|
|
1398
|
+
const OpenProcessExplorer = 'Open Process Explorer';
|
|
1399
|
+
const Run$1 = 'Run';
|
|
1400
|
+
const Selection$1 = 'Selection';
|
|
1401
|
+
const Terminal$1 = 'Terminal';
|
|
1402
|
+
const ToggleDeveloperTools = 'Toggle Developer Tools';
|
|
1403
|
+
const View$1 = 'View';
|
|
1404
|
+
|
|
1405
|
+
const file = () => {
|
|
1406
|
+
return i18nString(File$2);
|
|
2001
1407
|
};
|
|
2002
|
-
const
|
|
2003
|
-
|
|
2004
|
-
return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1408
|
+
const edit = () => {
|
|
1409
|
+
return i18nString(Edit$1);
|
|
2005
1410
|
};
|
|
2006
|
-
const
|
|
2007
|
-
return
|
|
1411
|
+
const selection = () => {
|
|
1412
|
+
return i18nString(Selection$1);
|
|
2008
1413
|
};
|
|
2009
|
-
const
|
|
2010
|
-
return
|
|
1414
|
+
const view = () => {
|
|
1415
|
+
return i18nString(View$1);
|
|
2011
1416
|
};
|
|
2012
|
-
const
|
|
2013
|
-
return
|
|
1417
|
+
const go = () => {
|
|
1418
|
+
return i18nString(Go$1);
|
|
2014
1419
|
};
|
|
2015
|
-
const
|
|
2016
|
-
|
|
2017
|
-
return files;
|
|
1420
|
+
const run = () => {
|
|
1421
|
+
return i18nString(Run$1);
|
|
2018
1422
|
};
|
|
2019
|
-
const
|
|
2020
|
-
|
|
1423
|
+
const terminal = () => {
|
|
1424
|
+
return i18nString(Terminal$1);
|
|
2021
1425
|
};
|
|
2022
|
-
const
|
|
2023
|
-
|
|
1426
|
+
const help = () => {
|
|
1427
|
+
return i18nString(Help$1);
|
|
2024
1428
|
};
|
|
2025
|
-
const
|
|
2026
|
-
|
|
1429
|
+
const minimize$1 = () => {
|
|
1430
|
+
return i18nString(Minimize);
|
|
2027
1431
|
};
|
|
2028
|
-
const
|
|
2029
|
-
|
|
2030
|
-
// @ts-ignore
|
|
2031
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1432
|
+
const maximize$1 = () => {
|
|
1433
|
+
return i18nString(Maximize);
|
|
2032
1434
|
};
|
|
2033
|
-
const
|
|
2034
|
-
|
|
2035
|
-
// @ts-ignore
|
|
2036
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1435
|
+
const close$1 = () => {
|
|
1436
|
+
return i18nString(Close);
|
|
2037
1437
|
};
|
|
2038
|
-
const
|
|
2039
|
-
|
|
2040
|
-
// @ts-ignore
|
|
2041
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1438
|
+
const menuBar = () => {
|
|
1439
|
+
return i18nString(MenuBar);
|
|
2042
1440
|
};
|
|
2043
|
-
const
|
|
2044
|
-
|
|
2045
|
-
// @ts-ignore
|
|
2046
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1441
|
+
const commandCenter = () => {
|
|
1442
|
+
return i18nString(CommandCenter);
|
|
2047
1443
|
};
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
1444
|
+
|
|
1445
|
+
const getTitleBarButtonsElectron = (controlsOverlayEnabled, titleBarStyleCustom) => {
|
|
1446
|
+
if (controlsOverlayEnabled) {
|
|
1447
|
+
return [];
|
|
1448
|
+
}
|
|
1449
|
+
if (titleBarStyleCustom) {
|
|
1450
|
+
// TODO don't render title bar buttons on windows when electron window controls overlay is enabled
|
|
1451
|
+
return [{
|
|
1452
|
+
icon: 'Minimize',
|
|
1453
|
+
id: 'Minimize',
|
|
1454
|
+
label: minimize$1(),
|
|
1455
|
+
onClick: 'handleClickMinimize'
|
|
1456
|
+
}, {
|
|
1457
|
+
icon: 'Maximize',
|
|
1458
|
+
id: 'ToggleMaximize',
|
|
1459
|
+
label: maximize$1(),
|
|
1460
|
+
onClick: 'handleClickToggleMaximize'
|
|
1461
|
+
}, {
|
|
1462
|
+
icon: 'ChromeClose',
|
|
1463
|
+
id: 'Close',
|
|
1464
|
+
label: close$1(),
|
|
1465
|
+
onClick: 'handleClickClose'
|
|
1466
|
+
}];
|
|
1467
|
+
}
|
|
1468
|
+
return [];
|
|
2052
1469
|
};
|
|
2053
|
-
|
|
2054
|
-
|
|
1470
|
+
|
|
1471
|
+
const getTitleBarButtonsRemote = () => {
|
|
1472
|
+
return [];
|
|
2055
1473
|
};
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
return
|
|
1474
|
+
|
|
1475
|
+
const getTitleBarButtonsWeb = () => {
|
|
1476
|
+
return [];
|
|
2059
1477
|
};
|
|
2060
|
-
|
|
2061
|
-
|
|
1478
|
+
|
|
1479
|
+
const getTitleBarButtons = (platform, controlsOverlayEnabled, titleBarStyleCustom) => {
|
|
1480
|
+
switch (platform) {
|
|
1481
|
+
case Electron:
|
|
1482
|
+
return getTitleBarButtonsElectron(controlsOverlayEnabled, titleBarStyleCustom);
|
|
1483
|
+
case Remote:
|
|
1484
|
+
return getTitleBarButtonsRemote();
|
|
1485
|
+
case Web:
|
|
1486
|
+
return getTitleBarButtonsWeb();
|
|
1487
|
+
default:
|
|
1488
|
+
return [];
|
|
1489
|
+
}
|
|
2062
1490
|
};
|
|
2063
|
-
|
|
2064
|
-
|
|
1491
|
+
|
|
1492
|
+
const {
|
|
1493
|
+
get,
|
|
1494
|
+
getCommandIds,
|
|
1495
|
+
registerCommands,
|
|
1496
|
+
set,
|
|
1497
|
+
wrapCommand,
|
|
1498
|
+
wrapGetter
|
|
1499
|
+
} = create$1();
|
|
1500
|
+
|
|
1501
|
+
const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled, titleBarStyleCustom, assetDir) => {
|
|
1502
|
+
const titleBarButtons = getTitleBarButtons(platform, controlsOverlayEnabled, titleBarStyleCustom);
|
|
1503
|
+
const state = {
|
|
1504
|
+
...createDefaultState(),
|
|
1505
|
+
assetDir,
|
|
1506
|
+
commandCenterEnabled: false,
|
|
1507
|
+
controlsOverlayEnabled,
|
|
1508
|
+
focusedIndex: -1,
|
|
1509
|
+
height,
|
|
1510
|
+
iconWidth: 30,
|
|
1511
|
+
isMenuOpen: false,
|
|
1512
|
+
labelFontFamily: 'system-ui, Ubuntu, Droid Sans, sans-serif',
|
|
1513
|
+
labelFontSize: 13,
|
|
1514
|
+
labelFontWeight: 400,
|
|
1515
|
+
labelLetterSpacing: 0,
|
|
1516
|
+
labelPadding: 8,
|
|
1517
|
+
layoutControlsEnabled: false,
|
|
1518
|
+
menus: [],
|
|
1519
|
+
platform,
|
|
1520
|
+
titleBarButtons,
|
|
1521
|
+
titleBarEntries: [],
|
|
1522
|
+
titleBarHeight: height,
|
|
1523
|
+
titleBarStyleCustom,
|
|
1524
|
+
uid: id,
|
|
1525
|
+
width,
|
|
1526
|
+
x,
|
|
1527
|
+
y
|
|
1528
|
+
};
|
|
1529
|
+
set(id, state, state);
|
|
2065
1530
|
};
|
|
2066
|
-
|
|
2067
|
-
|
|
1531
|
+
|
|
1532
|
+
const RenderEntries = 1;
|
|
1533
|
+
const RenderFocusedIndex = 2;
|
|
1534
|
+
const RenderMenus = 3;
|
|
1535
|
+
|
|
1536
|
+
const isEqual$3 = (oldState, newState) => {
|
|
1537
|
+
return oldState.titleBarEntries === newState.titleBarEntries && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
|
|
2068
1538
|
};
|
|
2069
|
-
|
|
2070
|
-
|
|
1539
|
+
|
|
1540
|
+
const isEqual$2 = (oldState, newState) => {
|
|
1541
|
+
return oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
|
|
2071
1542
|
};
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
return
|
|
1543
|
+
|
|
1544
|
+
const isEqual$1 = (oldState, newState) => {
|
|
1545
|
+
return oldState.menus === newState.menus;
|
|
2075
1546
|
};
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
1547
|
+
|
|
1548
|
+
const modules$1 = [isEqual$3, isEqual$2, isEqual$1];
|
|
1549
|
+
const numbers$1 = [RenderEntries, RenderFocusedIndex, RenderMenus];
|
|
1550
|
+
|
|
1551
|
+
const diff = (oldState, newState) => {
|
|
1552
|
+
const diffResult = [];
|
|
1553
|
+
for (let i = 0; i < modules$1.length; i++) {
|
|
1554
|
+
const fn = modules$1[i];
|
|
1555
|
+
if (!fn(oldState, newState)) {
|
|
1556
|
+
diffResult.push(numbers$1[i]);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
return diffResult;
|
|
2079
1560
|
};
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
1561
|
+
|
|
1562
|
+
const diff2 = uid => {
|
|
1563
|
+
const {
|
|
1564
|
+
newState,
|
|
1565
|
+
oldState
|
|
1566
|
+
} = get(uid);
|
|
1567
|
+
return diff(oldState, newState);
|
|
2083
1568
|
};
|
|
2084
|
-
|
|
2085
|
-
|
|
1569
|
+
|
|
1570
|
+
const isEqual = (oldState, newState) => {
|
|
1571
|
+
return oldState.titleBarEntries === newState.titleBarEntries && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen && oldState.assetDir === newState.assetDir && oldState.titleBarIconEnabled === newState.titleBarIconEnabled && oldState.title === newState.title && oldState.titleBarTitleEnabled === newState.titleBarTitleEnabled && oldState.platform === newState.platform && oldState.controlsOverlayEnabled === newState.controlsOverlayEnabled && oldState.titleBarStyleCustom === newState.titleBarStyleCustom && oldState.titleBarButtonsEnabled === newState.titleBarButtonsEnabled && oldState.titleBarButtons === newState.titleBarButtons;
|
|
2086
1572
|
};
|
|
2087
|
-
|
|
2088
|
-
|
|
1573
|
+
|
|
1574
|
+
const modules = [isEqual, isEqual$2, isEqual$1];
|
|
1575
|
+
const numbers = [RenderEntries, RenderFocusedIndex, RenderMenus];
|
|
1576
|
+
|
|
1577
|
+
const diff3 = uid => {
|
|
1578
|
+
const {
|
|
1579
|
+
newState,
|
|
1580
|
+
oldState
|
|
1581
|
+
} = get(uid);
|
|
1582
|
+
const diffResult = [];
|
|
1583
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1584
|
+
const fn = modules[i];
|
|
1585
|
+
if (!fn(oldState, newState)) {
|
|
1586
|
+
diffResult.push(numbers[i]);
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
return diffResult;
|
|
2089
1590
|
};
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
1591
|
+
|
|
1592
|
+
const mergeClassNames = (...classNames) => {
|
|
1593
|
+
return classNames.filter(Boolean).join(' ');
|
|
2093
1594
|
};
|
|
2094
|
-
|
|
2095
|
-
|
|
1595
|
+
|
|
1596
|
+
const px = value => {
|
|
1597
|
+
return `${value}px`;
|
|
2096
1598
|
};
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
1599
|
+
|
|
1600
|
+
const text = data => {
|
|
1601
|
+
return {
|
|
1602
|
+
type: Text,
|
|
1603
|
+
text: data,
|
|
1604
|
+
childCount: 0
|
|
1605
|
+
};
|
|
2101
1606
|
};
|
|
2102
|
-
|
|
2103
|
-
|
|
1607
|
+
|
|
1608
|
+
const getKeyBindings = () => {
|
|
1609
|
+
return [{
|
|
1610
|
+
command: 'TitleBar.handleKeyArrowDown',
|
|
1611
|
+
key: DownArrow$1,
|
|
1612
|
+
when: FocusTitleBarMenuBar
|
|
1613
|
+
}, {
|
|
1614
|
+
command: 'TitleBar.handleKeyArrowUp',
|
|
1615
|
+
key: UpArrow$1,
|
|
1616
|
+
when: FocusTitleBarMenuBar
|
|
1617
|
+
}, {
|
|
1618
|
+
command: 'TitleBar.handleKeyArrowRight',
|
|
1619
|
+
key: RightArrow$1,
|
|
1620
|
+
when: FocusTitleBarMenuBar
|
|
1621
|
+
}, {
|
|
1622
|
+
command: 'TitleBar.handleKeyArrowLeft',
|
|
1623
|
+
key: LeftArrow$1,
|
|
1624
|
+
when: FocusTitleBarMenuBar
|
|
1625
|
+
}, {
|
|
1626
|
+
command: 'TitleBar.handleKeySpace',
|
|
1627
|
+
key: Space$1,
|
|
1628
|
+
when: FocusTitleBarMenuBar
|
|
1629
|
+
}, {
|
|
1630
|
+
command: 'TitleBar.handleKeyHome',
|
|
1631
|
+
key: Home$1,
|
|
1632
|
+
when: FocusTitleBarMenuBar
|
|
1633
|
+
}, {
|
|
1634
|
+
command: 'TitleBar.handleKeyEnd',
|
|
1635
|
+
key: End$1,
|
|
1636
|
+
when: FocusTitleBarMenuBar
|
|
1637
|
+
}, {
|
|
1638
|
+
command: 'TitleBar.handleKeyEscape',
|
|
1639
|
+
key: Escape$1,
|
|
1640
|
+
when: FocusTitleBarMenuBar
|
|
1641
|
+
}];
|
|
2104
1642
|
};
|
|
2105
|
-
|
|
2106
|
-
|
|
1643
|
+
|
|
1644
|
+
const Separator = 1;
|
|
1645
|
+
const None = 0;
|
|
1646
|
+
const SubMenu = 4;
|
|
1647
|
+
const Checked = 2;
|
|
1648
|
+
const Unchecked = 3;
|
|
1649
|
+
const Disabled = 5;
|
|
1650
|
+
const RestoreFocus = 6;
|
|
1651
|
+
const Ignore = 7;
|
|
1652
|
+
|
|
1653
|
+
const getMenuEntriesTitleBarContextMenu = async state => {
|
|
1654
|
+
const {
|
|
1655
|
+
commandCenterEnabled,
|
|
1656
|
+
titleBarMenuBarEnabled
|
|
1657
|
+
} = state;
|
|
1658
|
+
// TODO checked state should be depending on whether or not that feature is currently visible or not
|
|
1659
|
+
return [{
|
|
1660
|
+
command: titleBarMenuBarEnabled ? 'TitleBar.hideMenuBar' : 'TitleBar.showMenuBar',
|
|
1661
|
+
flags: titleBarMenuBarEnabled ? Checked : Unchecked,
|
|
1662
|
+
id: 'MenuBar',
|
|
1663
|
+
label: menuBar()
|
|
1664
|
+
}, {
|
|
1665
|
+
command: commandCenterEnabled ? 'TitleBar.hideCommandCenter' : 'TitleBar.showCommandCenter',
|
|
1666
|
+
flags: commandCenterEnabled ? Checked : Unchecked,
|
|
1667
|
+
id: 'Command center',
|
|
1668
|
+
label: commandCenter()
|
|
1669
|
+
}, {
|
|
1670
|
+
command: '',
|
|
1671
|
+
flags: Checked,
|
|
1672
|
+
id: 'layout controls',
|
|
1673
|
+
label: 'layout controls'
|
|
1674
|
+
}];
|
|
2107
1675
|
};
|
|
2108
|
-
|
|
2109
|
-
|
|
1676
|
+
|
|
1677
|
+
const MenuIdTitleBarContextMenu = 50;
|
|
1678
|
+
const getMenuIds = () => {
|
|
1679
|
+
return [Edit$2, File$3, Go$2, Help$2, OpenRecent$1, Run$2, Selection$2, Terminal$2, TitleBar, View$2, MenuIdTitleBarContextMenu, TitleBarContextMenu];
|
|
2110
1680
|
};
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
1681
|
+
|
|
1682
|
+
/**
|
|
1683
|
+
* @enum {string}
|
|
1684
|
+
*/
|
|
1685
|
+
const UiStrings$1 = {
|
|
1686
|
+
AddCursorAbove: 'Add Cursor Above',
|
|
1687
|
+
AddNextOccurrence: 'Add Next Occurrence',
|
|
1688
|
+
AddPreviousOccurrence: 'Add Previous Occurrence',
|
|
1689
|
+
Copy: 'Copy',
|
|
1690
|
+
CopyLineDown: 'Copy Line Down',
|
|
1691
|
+
CopyLineUp: 'Copy Line Up',
|
|
1692
|
+
Cut: 'Cut',
|
|
1693
|
+
MoveLineDown: 'Move Line Down',
|
|
1694
|
+
MoveLineUp: 'Move Line Up',
|
|
1695
|
+
Paste: 'Paste',
|
|
1696
|
+
Redo: 'Redo',
|
|
1697
|
+
SelectAll: 'Select All',
|
|
1698
|
+
SelectAllOccurrences: 'Select All Occurrences',
|
|
1699
|
+
ShrinkSelection: 'Shrink Selection',
|
|
1700
|
+
ToggleBlockComment: 'Toggle Block Comment',
|
|
1701
|
+
ToggleLineComment: 'Toggle Line Comment',
|
|
1702
|
+
Undo: 'Undo'
|
|
2114
1703
|
};
|
|
2115
|
-
const
|
|
2116
|
-
|
|
2117
|
-
return invoke$1('ExtensionHost.searchFileWithMemory', uri);
|
|
1704
|
+
const cut = () => {
|
|
1705
|
+
return i18nString(UiStrings$1.Cut);
|
|
2118
1706
|
};
|
|
2119
|
-
const
|
|
2120
|
-
return
|
|
1707
|
+
const copy = () => {
|
|
1708
|
+
return i18nString(UiStrings$1.Copy);
|
|
2121
1709
|
};
|
|
2122
|
-
const
|
|
2123
|
-
return
|
|
1710
|
+
const paste = () => {
|
|
1711
|
+
return i18nString(UiStrings$1.Paste);
|
|
2124
1712
|
};
|
|
2125
|
-
const
|
|
2126
|
-
|
|
1713
|
+
const undo = () => {
|
|
1714
|
+
return i18nString(UiStrings$1.Undo);
|
|
2127
1715
|
};
|
|
2128
|
-
const
|
|
2129
|
-
|
|
1716
|
+
const redo = () => {
|
|
1717
|
+
return i18nString(UiStrings$1.Redo);
|
|
2130
1718
|
};
|
|
2131
|
-
const
|
|
2132
|
-
|
|
2133
|
-
return icons;
|
|
1719
|
+
const toggleLineComment = () => {
|
|
1720
|
+
return i18nString(UiStrings$1.ToggleLineComment);
|
|
2134
1721
|
};
|
|
2135
|
-
const
|
|
2136
|
-
return
|
|
1722
|
+
const toggleBlockComment = () => {
|
|
1723
|
+
return i18nString(UiStrings$1.ToggleBlockComment);
|
|
2137
1724
|
};
|
|
2138
|
-
const
|
|
2139
|
-
|
|
2140
|
-
return invoke$1('Focus.setAdditionalFocus', focusKey);
|
|
1725
|
+
const selectAll = () => {
|
|
1726
|
+
return i18nString(UiStrings$1.SelectAll);
|
|
2141
1727
|
};
|
|
2142
|
-
const
|
|
2143
|
-
|
|
2144
|
-
return invoke$1('GetActiveEditor.getActiveEditorId');
|
|
1728
|
+
const expandSelection = () => {
|
|
1729
|
+
return i18nString(UiStrings$1.SelectAll);
|
|
2145
1730
|
};
|
|
2146
|
-
const
|
|
2147
|
-
return
|
|
1731
|
+
const shrinkSelection = () => {
|
|
1732
|
+
return i18nString(UiStrings$1.ShrinkSelection);
|
|
2148
1733
|
};
|
|
2149
|
-
const
|
|
2150
|
-
|
|
2151
|
-
// @ts-ignore
|
|
2152
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
1734
|
+
const copyLineUp = () => {
|
|
1735
|
+
return i18nString(UiStrings$1.CopyLineUp);
|
|
2153
1736
|
};
|
|
2154
|
-
const
|
|
2155
|
-
return
|
|
1737
|
+
const copyLineDown = () => {
|
|
1738
|
+
return i18nString(UiStrings$1.CopyLineDown);
|
|
2156
1739
|
};
|
|
2157
|
-
const
|
|
2158
|
-
return
|
|
1740
|
+
const moveLineUp = () => {
|
|
1741
|
+
return i18nString(UiStrings$1.MoveLineUp);
|
|
2159
1742
|
};
|
|
2160
|
-
const
|
|
2161
|
-
|
|
2162
|
-
return invoke$1('Editor.rerender', key);
|
|
1743
|
+
const moveLineDown = () => {
|
|
1744
|
+
return i18nString(UiStrings$1.MoveLineDown);
|
|
2163
1745
|
};
|
|
2164
|
-
const
|
|
2165
|
-
|
|
1746
|
+
const duplicateSelection = () => {
|
|
1747
|
+
return i18nString(UiStrings$1.MoveLineDown);
|
|
2166
1748
|
};
|
|
2167
|
-
const
|
|
2168
|
-
|
|
1749
|
+
const addCursorAbove = () => {
|
|
1750
|
+
return i18nString(UiStrings$1.AddCursorAbove);
|
|
2169
1751
|
};
|
|
2170
|
-
const
|
|
2171
|
-
|
|
2172
|
-
// @ts-ignore
|
|
2173
|
-
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1752
|
+
const addCursorBelow = () => {
|
|
1753
|
+
return i18nString(UiStrings$1.AddCursorAbove);
|
|
2174
1754
|
};
|
|
2175
|
-
const
|
|
2176
|
-
|
|
1755
|
+
const addCursorsToLineEnds = () => {
|
|
1756
|
+
return i18nString(UiStrings$1.AddCursorAbove);
|
|
2177
1757
|
};
|
|
2178
|
-
const
|
|
2179
|
-
return
|
|
1758
|
+
const addNextOccurrence = () => {
|
|
1759
|
+
return i18nString(UiStrings$1.AddNextOccurrence);
|
|
2180
1760
|
};
|
|
2181
|
-
const
|
|
2182
|
-
|
|
2183
|
-
return invoke$1('FileSystem.getBlob', uri);
|
|
1761
|
+
const addPreviousOccurrence = () => {
|
|
1762
|
+
return i18nString(UiStrings$1.AddPreviousOccurrence);
|
|
2184
1763
|
};
|
|
2185
|
-
const
|
|
2186
|
-
return
|
|
1764
|
+
const selectAllOccurrences = () => {
|
|
1765
|
+
return i18nString(UiStrings$1.SelectAllOccurrences);
|
|
2187
1766
|
};
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
1767
|
+
|
|
1768
|
+
const menuEntrySeparator = {
|
|
1769
|
+
command: '',
|
|
1770
|
+
flags: Separator,
|
|
1771
|
+
id: 'separator',
|
|
1772
|
+
label: ''
|
|
2191
1773
|
};
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
return
|
|
1774
|
+
|
|
1775
|
+
const getMenuEntries$c = () => {
|
|
1776
|
+
return [{
|
|
1777
|
+
command: /* TODO */'-1',
|
|
1778
|
+
flags: Disabled,
|
|
1779
|
+
id: 'undo',
|
|
1780
|
+
label: undo()
|
|
1781
|
+
}, {
|
|
1782
|
+
command: /* TODO */'-1',
|
|
1783
|
+
flags: Disabled,
|
|
1784
|
+
id: 'redo',
|
|
1785
|
+
label: redo()
|
|
1786
|
+
}, menuEntrySeparator, {
|
|
1787
|
+
command: /* Editor.cut */'Editor.cut',
|
|
1788
|
+
flags: None,
|
|
1789
|
+
id: 'cut',
|
|
1790
|
+
label: cut()
|
|
1791
|
+
}, {
|
|
1792
|
+
command: /* Editor.copy */'Editor.copy',
|
|
1793
|
+
flags: None,
|
|
1794
|
+
id: 'copy',
|
|
1795
|
+
label: copy()
|
|
1796
|
+
}, {
|
|
1797
|
+
command: /* Editor.paste */'Editor.paste',
|
|
1798
|
+
flags: None,
|
|
1799
|
+
id: 'paste',
|
|
1800
|
+
label: paste()
|
|
1801
|
+
}, menuEntrySeparator, {
|
|
1802
|
+
command: /* Editor.toggleLineComment */'Editor.toggleLineComment',
|
|
1803
|
+
flags: None,
|
|
1804
|
+
id: 'toggle-line-comment',
|
|
1805
|
+
label: toggleLineComment()
|
|
1806
|
+
}, {
|
|
1807
|
+
command: /* Editor.toggleBlockComment */'Editor.toggleBlockComment',
|
|
1808
|
+
flags: None,
|
|
1809
|
+
id: 'toggle-block-comment',
|
|
1810
|
+
label: toggleBlockComment()
|
|
1811
|
+
}];
|
|
2195
1812
|
};
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
1813
|
+
|
|
1814
|
+
/**
|
|
1815
|
+
* @enum {string}
|
|
1816
|
+
*/
|
|
1817
|
+
const UiStrings = {
|
|
1818
|
+
Exit: 'Exit',
|
|
1819
|
+
NewFile: 'New File',
|
|
1820
|
+
NewWindow: 'New Window',
|
|
1821
|
+
OpenFile: 'Open File',
|
|
1822
|
+
OpenFolder: 'Open Folder',
|
|
1823
|
+
OpenRecent: 'Open Recent',
|
|
1824
|
+
Save: 'Save',
|
|
1825
|
+
SaveAll: 'Save All'};
|
|
1826
|
+
const newFile = () => {
|
|
1827
|
+
return i18nString(UiStrings.NewFile);
|
|
2199
1828
|
};
|
|
2200
|
-
const
|
|
2201
|
-
|
|
2202
|
-
return invoke$1('Markdown.getVirtualDom', html);
|
|
1829
|
+
const newWindow = () => {
|
|
1830
|
+
return i18nString(UiStrings.NewWindow);
|
|
2203
1831
|
};
|
|
2204
|
-
const
|
|
2205
|
-
|
|
2206
|
-
return invoke$1('Markdown.renderMarkdown', markdown, options);
|
|
1832
|
+
const openFile = () => {
|
|
1833
|
+
return i18nString(UiStrings.OpenFile);
|
|
2207
1834
|
};
|
|
2208
|
-
const
|
|
2209
|
-
|
|
2210
|
-
await invoke$1('OpenNativeFolder.openNativeFolder', uri);
|
|
1835
|
+
const openFolder = () => {
|
|
1836
|
+
return i18nString(UiStrings.OpenFolder);
|
|
2211
1837
|
};
|
|
2212
|
-
const
|
|
2213
|
-
return
|
|
1838
|
+
const openRecent = () => {
|
|
1839
|
+
return i18nString(UiStrings.OpenRecent);
|
|
2214
1840
|
};
|
|
2215
|
-
const
|
|
2216
|
-
|
|
2217
|
-
return invoke$1('ExtensionManagement.install', id);
|
|
1841
|
+
const save = () => {
|
|
1842
|
+
return i18nString(UiStrings.Save);
|
|
2218
1843
|
};
|
|
2219
|
-
const
|
|
2220
|
-
|
|
2221
|
-
return invoke$1('SideBar.openViewlet', 'Extensions');
|
|
1844
|
+
const saveAll = () => {
|
|
1845
|
+
return i18nString(UiStrings.SaveAll);
|
|
2222
1846
|
};
|
|
2223
|
-
const
|
|
2224
|
-
|
|
2225
|
-
return invoke$1('Extensions.handleInput', searchValue, Script);
|
|
1847
|
+
const exit = () => {
|
|
1848
|
+
return i18nString(UiStrings.Exit);
|
|
2226
1849
|
};
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
1850
|
+
|
|
1851
|
+
const Edit = 2;
|
|
1852
|
+
const File$1 = 5;
|
|
1853
|
+
const Go = 6;
|
|
1854
|
+
const Help = 7;
|
|
1855
|
+
const OpenRecent = 9;
|
|
1856
|
+
const Run = 10;
|
|
1857
|
+
const Selection = 11;
|
|
1858
|
+
const Terminal = 14;
|
|
1859
|
+
const View = 16;
|
|
1860
|
+
|
|
1861
|
+
const getMenuEntries$b = platform => {
|
|
1862
|
+
const entries = [{
|
|
1863
|
+
command: '-1',
|
|
1864
|
+
flags: None,
|
|
1865
|
+
id: 'newFile',
|
|
1866
|
+
label: newFile()
|
|
1867
|
+
}, {
|
|
1868
|
+
command: 'Window.openNew',
|
|
1869
|
+
flags: None,
|
|
1870
|
+
id: 'newWindow',
|
|
1871
|
+
label: newWindow()
|
|
1872
|
+
}, menuEntrySeparator, {
|
|
1873
|
+
command: 'Dialog.openFile',
|
|
1874
|
+
flags: None,
|
|
1875
|
+
id: 'openFile',
|
|
1876
|
+
label: openFile()
|
|
1877
|
+
}, {
|
|
1878
|
+
command: 'Dialog.openFolder',
|
|
1879
|
+
flags: RestoreFocus,
|
|
1880
|
+
id: 'openFolder',
|
|
1881
|
+
label: openFolder()
|
|
1882
|
+
}, {
|
|
1883
|
+
command: '',
|
|
1884
|
+
flags: SubMenu,
|
|
1885
|
+
id: OpenRecent,
|
|
1886
|
+
label: openRecent()
|
|
1887
|
+
}, menuEntrySeparator, {
|
|
1888
|
+
command: 'Main.save',
|
|
1889
|
+
flags: None,
|
|
1890
|
+
id: 'save',
|
|
1891
|
+
label: save()
|
|
1892
|
+
}, {
|
|
1893
|
+
command: 'Main.saveAll',
|
|
1894
|
+
flags: None,
|
|
1895
|
+
id: 'saveAll',
|
|
1896
|
+
label: saveAll()
|
|
1897
|
+
}];
|
|
1898
|
+
if (platform === Electron) {
|
|
1899
|
+
entries.push(menuEntrySeparator, {
|
|
1900
|
+
command: 'Chrome.exit',
|
|
1901
|
+
flags: Ignore,
|
|
1902
|
+
id: 'exit',
|
|
1903
|
+
label: exit()
|
|
1904
|
+
});
|
|
1905
|
+
}
|
|
1906
|
+
return entries;
|
|
2230
1907
|
};
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
1908
|
+
|
|
1909
|
+
const getMenuEntries$a = () => {
|
|
1910
|
+
return [];
|
|
2234
1911
|
};
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
return
|
|
1912
|
+
|
|
1913
|
+
const toggleDeveloperTools = () => {
|
|
1914
|
+
return i18nString(ToggleDeveloperTools);
|
|
2238
1915
|
};
|
|
2239
|
-
const
|
|
2240
|
-
|
|
2241
|
-
return invoke$1('FilePicker.showSaveFilePicker');
|
|
1916
|
+
const openProcessExplorer = () => {
|
|
1917
|
+
return i18nString(OpenProcessExplorer);
|
|
2242
1918
|
};
|
|
2243
|
-
const
|
|
2244
|
-
|
|
2245
|
-
return invoke$1('PlatformPaths.getLogsDir');
|
|
1919
|
+
const checkForUpdates = () => {
|
|
1920
|
+
return i18nString(CheckForUpdates);
|
|
2246
1921
|
};
|
|
2247
|
-
const
|
|
2248
|
-
|
|
2249
|
-
commandMap
|
|
2250
|
-
});
|
|
2251
|
-
set$1(mockRpc);
|
|
2252
|
-
return mockRpc;
|
|
1922
|
+
const about = () => {
|
|
1923
|
+
return i18nString(About);
|
|
2253
1924
|
};
|
|
2254
1925
|
|
|
2255
|
-
const
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
confirm,
|
|
2261
|
-
disableExtension,
|
|
2262
|
-
dispose,
|
|
2263
|
-
enableExtension,
|
|
2264
|
-
getActiveEditorId,
|
|
2265
|
-
getAllExtensions,
|
|
2266
|
-
getAllPreferences,
|
|
2267
|
-
getBlob,
|
|
2268
|
-
getChromeVersion,
|
|
2269
|
-
getColorThemeNames,
|
|
2270
|
-
getElectronVersion,
|
|
2271
|
-
getExtension,
|
|
2272
|
-
getExtensionCommands,
|
|
2273
|
-
getFileHandles,
|
|
2274
|
-
getFileIcon,
|
|
2275
|
-
getFilePathElectron,
|
|
2276
|
-
getFolderIcon,
|
|
2277
|
-
getFolderSize,
|
|
2278
|
-
getIcons,
|
|
2279
|
-
getKeyBindings,
|
|
2280
|
-
getLogsDir,
|
|
2281
|
-
getMarkdownDom,
|
|
2282
|
-
getNodeVersion,
|
|
2283
|
-
getPreference,
|
|
2284
|
-
getRecentlyOpened: getRecentlyOpened$1,
|
|
2285
|
-
getV8Version,
|
|
2286
|
-
getWebViewSecret,
|
|
2287
|
-
getWindowId,
|
|
2288
|
-
getWorkspacePath,
|
|
2289
|
-
handleDebugChange,
|
|
2290
|
-
handleDebugPaused,
|
|
2291
|
-
handleDebugResumed,
|
|
2292
|
-
handleDebugScriptParsed,
|
|
2293
|
-
installExtension,
|
|
2294
|
-
invoke: invoke$1,
|
|
2295
|
-
invokeAndTransfer,
|
|
2296
|
-
openExtensionSearch,
|
|
2297
|
-
openExternal,
|
|
2298
|
-
openNativeFolder,
|
|
2299
|
-
openUri,
|
|
2300
|
-
openUrl,
|
|
2301
|
-
openWidget,
|
|
2302
|
-
readFile,
|
|
2303
|
-
registerMockRpc,
|
|
2304
|
-
registerWebViewInterceptor,
|
|
2305
|
-
renderMarkdown,
|
|
2306
|
-
rerenderEditor,
|
|
2307
|
-
searchFileFetch,
|
|
2308
|
-
searchFileHtml,
|
|
2309
|
-
searchFileMemory,
|
|
2310
|
-
sendMessagePortToEditorWorker,
|
|
2311
|
-
sendMessagePortToErrorWorker,
|
|
2312
|
-
sendMessagePortToExtensionHostWorker,
|
|
2313
|
-
sendMessagePortToFileSystemWorker,
|
|
2314
|
-
sendMessagePortToIconThemeWorker,
|
|
2315
|
-
sendMessagePortToMarkdownWorker,
|
|
2316
|
-
sendMessagePortToRendererProcess,
|
|
2317
|
-
sendMessagePortToSearchProcess,
|
|
2318
|
-
sendMessagePortToSyntaxHighlightingWorker,
|
|
2319
|
-
set: set$1,
|
|
2320
|
-
setAdditionalFocus,
|
|
2321
|
-
setColorTheme,
|
|
2322
|
-
setExtensionsSearchValue,
|
|
2323
|
-
setFocus: setFocus$1,
|
|
2324
|
-
setWebViewPort,
|
|
2325
|
-
setWorkspacePath,
|
|
2326
|
-
showContextMenu,
|
|
2327
|
-
showContextMenu2,
|
|
2328
|
-
showErrorDialog,
|
|
2329
|
-
showMessageBox,
|
|
2330
|
-
showSaveFilePicker,
|
|
2331
|
-
uninstallExtension,
|
|
2332
|
-
unregisterWebViewInterceptor,
|
|
2333
|
-
writeClipBoardImage,
|
|
2334
|
-
writeClipBoardText
|
|
1926
|
+
const isAutoUpdateSupported = platform => {
|
|
1927
|
+
if (platform !== Electron) {
|
|
1928
|
+
return false;
|
|
1929
|
+
}
|
|
1930
|
+
return false;
|
|
2335
1931
|
};
|
|
2336
1932
|
|
|
2337
|
-
const {
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
1933
|
+
const getMenuEntries$9 = async platform => {
|
|
1934
|
+
const autoUpdateSupported = isAutoUpdateSupported(platform);
|
|
1935
|
+
const entries = [];
|
|
1936
|
+
if (platform !== Web) {
|
|
1937
|
+
entries.push({
|
|
1938
|
+
command: 'Developer.toggleDeveloperTools',
|
|
1939
|
+
flags: None,
|
|
1940
|
+
id: 'toggleDeveloperTools',
|
|
1941
|
+
label: toggleDeveloperTools()
|
|
1942
|
+
}, {
|
|
1943
|
+
command: 'Developer.openProcessExplorer',
|
|
1944
|
+
flags: RestoreFocus,
|
|
1945
|
+
id: 'openProcessExplorer',
|
|
1946
|
+
label: openProcessExplorer()
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
if (autoUpdateSupported) {
|
|
1950
|
+
entries.push(menuEntrySeparator, {
|
|
1951
|
+
command: 'AutoUpdater.checkForUpdates',
|
|
1952
|
+
flags: RestoreFocus,
|
|
1953
|
+
id: 'checkForUpdates',
|
|
1954
|
+
label: checkForUpdates()
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1957
|
+
if (entries.length > 0) {
|
|
1958
|
+
entries.push(menuEntrySeparator);
|
|
1959
|
+
}
|
|
1960
|
+
entries.push({
|
|
1961
|
+
command: 'About.showAbout',
|
|
1962
|
+
flags: None,
|
|
1963
|
+
id: 'about',
|
|
1964
|
+
label: about()
|
|
1965
|
+
});
|
|
1966
|
+
return entries;
|
|
1967
|
+
};
|
|
2341
1968
|
|
|
2342
1969
|
const getRecentlyOpened = () => {
|
|
2343
1970
|
return invoke(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
@@ -2377,8 +2004,7 @@ const toMenuItem = folder => {
|
|
|
2377
2004
|
label
|
|
2378
2005
|
};
|
|
2379
2006
|
};
|
|
2380
|
-
const
|
|
2381
|
-
const getMenuEntries$9 = async () => {
|
|
2007
|
+
const getMenuEntries$8 = async () => {
|
|
2382
2008
|
const allItems = await getRecentlyOpened();
|
|
2383
2009
|
const itemsToShow = allItems.slice(0, MAX_MENU_RECENT_ENTRIES);
|
|
2384
2010
|
const items = [];
|
|
@@ -2399,208 +2025,124 @@ const getMenuEntries$9 = async () => {
|
|
|
2399
2025
|
return items;
|
|
2400
2026
|
};
|
|
2401
2027
|
|
|
2402
|
-
const
|
|
2403
|
-
__proto__: null,
|
|
2404
|
-
getMenuEntries: getMenuEntries$9,
|
|
2405
|
-
id: id$5
|
|
2406
|
-
};
|
|
2407
|
-
|
|
2408
|
-
const id$4 = Run;
|
|
2409
|
-
const getMenuEntries$8 = () => {
|
|
2028
|
+
const getMenuEntries$7 = () => {
|
|
2410
2029
|
return [];
|
|
2411
2030
|
};
|
|
2412
2031
|
|
|
2413
|
-
const
|
|
2414
|
-
__proto__: null,
|
|
2415
|
-
getMenuEntries: getMenuEntries$8,
|
|
2416
|
-
id: id$4
|
|
2417
|
-
};
|
|
2418
|
-
|
|
2419
|
-
const id$3 = Selection;
|
|
2420
|
-
const getMenuEntries$7 = () => {
|
|
2032
|
+
const getMenuEntries$6 = () => {
|
|
2421
2033
|
return [{
|
|
2422
2034
|
command: 'Editor.selectAll',
|
|
2423
2035
|
flags: None,
|
|
2424
2036
|
id: 'selectAll',
|
|
2425
2037
|
label: selectAll()
|
|
2426
2038
|
}, {
|
|
2427
|
-
command: 'Editor.
|
|
2428
|
-
flags: None,
|
|
2429
|
-
id: 'copyLineUp',
|
|
2430
|
-
label: copyLineUp()
|
|
2431
|
-
}, {
|
|
2432
|
-
command: 'Editor.copyLineDown',
|
|
2433
|
-
flags: None,
|
|
2434
|
-
id: 'copyLineDown',
|
|
2435
|
-
label: copyLineDown()
|
|
2436
|
-
}, {
|
|
2437
|
-
command: 'Editor.moveLineUp',
|
|
2438
|
-
flags: Disabled,
|
|
2439
|
-
id: 'moveLineUp',
|
|
2440
|
-
label: moveLineUp()
|
|
2441
|
-
}, {
|
|
2442
|
-
command: 'Editor.moveLineDown',
|
|
2443
|
-
flags: Disabled,
|
|
2444
|
-
id: 'moveLineDown',
|
|
2445
|
-
label: moveLineDown()
|
|
2446
|
-
}];
|
|
2447
|
-
};
|
|
2448
|
-
|
|
2449
|
-
const MenuEntriesSelection = {
|
|
2450
|
-
__proto__: null,
|
|
2451
|
-
getMenuEntries: getMenuEntries$7,
|
|
2452
|
-
id: id$3
|
|
2453
|
-
};
|
|
2454
|
-
|
|
2455
|
-
const id$2 = Terminal;
|
|
2456
|
-
const getMenuEntries$6 = () => {
|
|
2457
|
-
return [{
|
|
2458
|
-
args: ['Terminal'],
|
|
2459
|
-
command: 'Layout.togglePanel',
|
|
2460
|
-
flags: None,
|
|
2461
|
-
id: 'newTerminal',
|
|
2462
|
-
label: i18nString(NewTerminal)
|
|
2463
|
-
}];
|
|
2464
|
-
};
|
|
2465
|
-
|
|
2466
|
-
const MenuEntriesTerminal = {
|
|
2467
|
-
__proto__: null,
|
|
2468
|
-
getMenuEntries: getMenuEntries$6,
|
|
2469
|
-
id: id$2
|
|
2470
|
-
};
|
|
2471
|
-
|
|
2472
|
-
const getMenuEntries$5 = () => {
|
|
2473
|
-
return [{
|
|
2474
|
-
command: '',
|
|
2475
|
-
flags: SubMenu,
|
|
2476
|
-
id: File$1,
|
|
2477
|
-
label: file()
|
|
2478
|
-
}, {
|
|
2479
|
-
command: '',
|
|
2480
|
-
flags: SubMenu,
|
|
2481
|
-
id: Edit,
|
|
2482
|
-
label: edit()
|
|
2483
|
-
}, {
|
|
2484
|
-
command: '',
|
|
2485
|
-
flags: SubMenu,
|
|
2486
|
-
id: Selection,
|
|
2487
|
-
label: selection()
|
|
2488
|
-
}, {
|
|
2489
|
-
command: '',
|
|
2490
|
-
flags: SubMenu,
|
|
2491
|
-
id: View,
|
|
2492
|
-
label: view()
|
|
2493
|
-
}, {
|
|
2494
|
-
command: '',
|
|
2495
|
-
flags: SubMenu,
|
|
2496
|
-
id: Go,
|
|
2497
|
-
label: go()
|
|
2498
|
-
}, {
|
|
2499
|
-
command: '',
|
|
2500
|
-
flags: SubMenu,
|
|
2501
|
-
id: Run,
|
|
2502
|
-
keyboardShortCut: 'Alt+r',
|
|
2503
|
-
label: run()
|
|
2504
|
-
}, {
|
|
2505
|
-
command: '',
|
|
2506
|
-
flags: SubMenu,
|
|
2507
|
-
id: Terminal,
|
|
2508
|
-
keyboardShortCut: 'Alt+t',
|
|
2509
|
-
label: terminal()
|
|
2510
|
-
}, {
|
|
2511
|
-
command: '',
|
|
2512
|
-
flags: SubMenu,
|
|
2513
|
-
id: Help,
|
|
2514
|
-
keyboardShortCut: 'Alt+h',
|
|
2515
|
-
label: help()
|
|
2516
|
-
}];
|
|
2517
|
-
};
|
|
2518
|
-
|
|
2519
|
-
const getMenuEntries$4 = () => {
|
|
2520
|
-
return [{
|
|
2521
|
-
command: '',
|
|
2522
|
-
flags: None,
|
|
2523
|
-
id: File$1,
|
|
2524
|
-
label: file()
|
|
2525
|
-
}, {
|
|
2526
|
-
command: '',
|
|
2527
|
-
flags: None,
|
|
2528
|
-
id: Edit,
|
|
2529
|
-
label: edit()
|
|
2530
|
-
}, {
|
|
2531
|
-
command: '',
|
|
2532
|
-
flags: None,
|
|
2533
|
-
id: Selection,
|
|
2534
|
-
label: selection()
|
|
2535
|
-
}, {
|
|
2536
|
-
command: '',
|
|
2039
|
+
command: 'Editor.expandSelection',
|
|
2537
2040
|
flags: None,
|
|
2538
|
-
id:
|
|
2539
|
-
label:
|
|
2041
|
+
id: 'expandSelection',
|
|
2042
|
+
label: expandSelection()
|
|
2540
2043
|
}, {
|
|
2541
|
-
command: '',
|
|
2044
|
+
command: 'Editor.shrinkSelection',
|
|
2542
2045
|
flags: None,
|
|
2543
|
-
id:
|
|
2544
|
-
label:
|
|
2046
|
+
id: 'shrinkSelection',
|
|
2047
|
+
label: shrinkSelection()
|
|
2048
|
+
}, menuEntrySeparator, {
|
|
2049
|
+
command: 'Editor.copyLineUp',
|
|
2050
|
+
flags: None,
|
|
2051
|
+
id: 'copyLineUp',
|
|
2052
|
+
label: copyLineUp()
|
|
2545
2053
|
}, {
|
|
2546
|
-
command: '',
|
|
2054
|
+
command: 'Editor.copyLineDown',
|
|
2547
2055
|
flags: None,
|
|
2548
|
-
id:
|
|
2549
|
-
label:
|
|
2056
|
+
id: 'copyLineDown',
|
|
2057
|
+
label: copyLineDown()
|
|
2058
|
+
}, {
|
|
2059
|
+
command: 'Editor.moveLineUp',
|
|
2060
|
+
flags: Disabled,
|
|
2061
|
+
id: 'moveLineUp',
|
|
2062
|
+
label: moveLineUp()
|
|
2063
|
+
}, {
|
|
2064
|
+
command: 'Editor.moveLineDown',
|
|
2065
|
+
flags: Disabled,
|
|
2066
|
+
id: 'moveLineDown',
|
|
2067
|
+
label: moveLineDown()
|
|
2068
|
+
}, {
|
|
2069
|
+
command: 'Editor.duplicateSelection',
|
|
2070
|
+
flags: Disabled,
|
|
2071
|
+
id: 'duplicateSelection',
|
|
2072
|
+
label: duplicateSelection()
|
|
2073
|
+
}, menuEntrySeparator, {
|
|
2074
|
+
command: 'Editor.addCursorAbove',
|
|
2075
|
+
flags: Disabled,
|
|
2076
|
+
id: 'addCursorAbove',
|
|
2077
|
+
label: addCursorAbove()
|
|
2078
|
+
}, {
|
|
2079
|
+
command: 'Editor.addCursorBelow',
|
|
2080
|
+
flags: Disabled,
|
|
2081
|
+
id: 'addCursorBelow',
|
|
2082
|
+
label: addCursorBelow()
|
|
2083
|
+
}, {
|
|
2084
|
+
command: 'Editor.addCursorsToLineEnds',
|
|
2085
|
+
flags: Disabled,
|
|
2086
|
+
id: 'addCursorsToLineEnds',
|
|
2087
|
+
label: addCursorsToLineEnds()
|
|
2088
|
+
}, {
|
|
2089
|
+
command: 'Editor.addNextOccurrence',
|
|
2090
|
+
flags: Disabled,
|
|
2091
|
+
id: 'addNextOccurrence',
|
|
2092
|
+
label: addNextOccurrence()
|
|
2093
|
+
}, {
|
|
2094
|
+
command: 'Editor.addPreviousOccurrence',
|
|
2095
|
+
flags: Disabled,
|
|
2096
|
+
id: 'addPreviousOccurrence',
|
|
2097
|
+
label: addPreviousOccurrence()
|
|
2098
|
+
}, {
|
|
2099
|
+
command: 'Editor.selectAllOccurrences',
|
|
2100
|
+
flags: Disabled,
|
|
2101
|
+
id: 'selectAllOccurrences',
|
|
2102
|
+
label: selectAllOccurrences()
|
|
2550
2103
|
}];
|
|
2551
2104
|
};
|
|
2552
2105
|
|
|
2553
|
-
const
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
};
|
|
2561
|
-
const id$1 = TitleBar;
|
|
2562
|
-
const getMenuEntries$3 = async platform => {
|
|
2563
|
-
const fn = getFn$1(platform);
|
|
2564
|
-
return fn();
|
|
2565
|
-
};
|
|
2566
|
-
|
|
2567
|
-
const MenuEntriesTitleBar = {
|
|
2568
|
-
__proto__: null,
|
|
2569
|
-
getMenuEntries: getMenuEntries$3,
|
|
2570
|
-
id: id$1
|
|
2106
|
+
const getMenuEntries$5 = () => {
|
|
2107
|
+
return [{
|
|
2108
|
+
args: ['Terminal'],
|
|
2109
|
+
command: 'Layout.togglePanel',
|
|
2110
|
+
flags: None,
|
|
2111
|
+
id: 'newTerminal',
|
|
2112
|
+
label: i18nString(NewTerminal)
|
|
2113
|
+
}];
|
|
2571
2114
|
};
|
|
2572
2115
|
|
|
2573
|
-
const
|
|
2574
|
-
const getMenuEntries$2 = () => {
|
|
2116
|
+
const getMenuEntries$4 = () => {
|
|
2575
2117
|
return [];
|
|
2576
2118
|
};
|
|
2577
2119
|
|
|
2578
|
-
const MenuEntriesView = {
|
|
2579
|
-
__proto__: null,
|
|
2580
|
-
getMenuEntries: getMenuEntries$2,
|
|
2581
|
-
id
|
|
2582
|
-
};
|
|
2583
|
-
|
|
2584
|
-
const menus = [MenuEntriesEdit, MenuEntriesFile, MenuEntriesGo, MenuEntriesHelp, MenuEntriesRun, MenuEntriesSelection, MenuEntriesTerminal, MenuEntriesTitleBar, MenuEntriesView, MenuEntriesOpenRecent];
|
|
2585
|
-
|
|
2586
|
-
const MenuIdTitleBarContextMenu = 50;
|
|
2587
|
-
const getMenuIds = () => {
|
|
2588
|
-
return [...menus.map(menu => menu.id), MenuIdTitleBarContextMenu];
|
|
2589
|
-
};
|
|
2590
|
-
const getMenuEntries$1 = async (id, platform) => {
|
|
2591
|
-
const menu = menus.find(item => item.id === id);
|
|
2592
|
-
if (!menu) {
|
|
2593
|
-
return [];
|
|
2594
|
-
}
|
|
2595
|
-
return menu.getMenuEntries(platform);
|
|
2596
|
-
};
|
|
2597
|
-
|
|
2598
2120
|
const getMenuEntries2 = async (state, props) => {
|
|
2599
|
-
|
|
2600
|
-
|
|
2121
|
+
switch (props.menuId) {
|
|
2122
|
+
case Edit$2:
|
|
2123
|
+
return getMenuEntries$c();
|
|
2124
|
+
case File$3:
|
|
2125
|
+
return getMenuEntries$b(props.platform);
|
|
2126
|
+
case Go$2:
|
|
2127
|
+
return getMenuEntries$a();
|
|
2128
|
+
case Help$2:
|
|
2129
|
+
return getMenuEntries$9(props.platform);
|
|
2130
|
+
case OpenRecent$1:
|
|
2131
|
+
return getMenuEntries$8();
|
|
2132
|
+
case Run$2:
|
|
2133
|
+
return getMenuEntries$7();
|
|
2134
|
+
case Selection$2:
|
|
2135
|
+
return getMenuEntries$6();
|
|
2136
|
+
case Terminal$2:
|
|
2137
|
+
return getMenuEntries$5();
|
|
2138
|
+
case TitleBarContextMenu:
|
|
2139
|
+
case MenuIdTitleBarContextMenu:
|
|
2140
|
+
return getMenuEntriesTitleBarContextMenu(state);
|
|
2141
|
+
case View$2:
|
|
2142
|
+
return getMenuEntries$4();
|
|
2143
|
+
default:
|
|
2144
|
+
return [];
|
|
2601
2145
|
}
|
|
2602
|
-
// TODO
|
|
2603
|
-
return [];
|
|
2604
2146
|
};
|
|
2605
2147
|
|
|
2606
2148
|
const maximize = async () => {
|
|
@@ -2645,7 +2187,7 @@ const handleClick$1 = async (state, className) => {
|
|
|
2645
2187
|
|
|
2646
2188
|
const show2 = async (uid, menuId, x, y, args) => {
|
|
2647
2189
|
// @ts-ignore
|
|
2648
|
-
await invoke
|
|
2190
|
+
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
2649
2191
|
};
|
|
2650
2192
|
|
|
2651
2193
|
const handleContextMenu = async (state, button, eventX, eventY) => {
|
|
@@ -2684,6 +2226,7 @@ const getTotalWidth = entries => {
|
|
|
2684
2226
|
};
|
|
2685
2227
|
|
|
2686
2228
|
// TODO lazyload menuEntries and use Command.execute (maybe)
|
|
2229
|
+
|
|
2687
2230
|
const CONTEXT_MENU_ITEM_HEIGHT = 26;
|
|
2688
2231
|
const CONTEXT_MENU_SEPARATOR_HEIGHT = 11;
|
|
2689
2232
|
const CONTEXT_MENU_PADDING = 8;
|
|
@@ -2765,52 +2308,10 @@ const getIndexToFocusNext = menu => {
|
|
|
2765
2308
|
|
|
2766
2309
|
// TODO more tests
|
|
2767
2310
|
|
|
2768
|
-
/**
|
|
2769
|
-
* @deprecated
|
|
2770
|
-
* @returns
|
|
2771
|
-
*/
|
|
2772
|
-
const getMenus = () => {
|
|
2773
|
-
return [];
|
|
2774
|
-
};
|
|
2775
|
-
const getFn = id => {
|
|
2776
|
-
switch (id) {
|
|
2777
|
-
case Edit$1:
|
|
2778
|
-
return getMenuEntries$d;
|
|
2779
|
-
case File$2:
|
|
2780
|
-
return getMenuEntries$c;
|
|
2781
|
-
case Go$1:
|
|
2782
|
-
return getMenuEntries$b;
|
|
2783
|
-
case Help$1:
|
|
2784
|
-
return getMenuEntries$a;
|
|
2785
|
-
case OpenRecent$1:
|
|
2786
|
-
return getMenuEntries$9;
|
|
2787
|
-
case Run$1:
|
|
2788
|
-
return getMenuEntries$8;
|
|
2789
|
-
case Selection$1:
|
|
2790
|
-
return getMenuEntries$7;
|
|
2791
|
-
case Terminal$1:
|
|
2792
|
-
return getMenuEntries$6;
|
|
2793
|
-
case TitleBar$1:
|
|
2794
|
-
return getMenuEntries$3;
|
|
2795
|
-
case View$1:
|
|
2796
|
-
return getMenuEntries$2;
|
|
2797
|
-
default:
|
|
2798
|
-
return undefined;
|
|
2799
|
-
}
|
|
2800
|
-
};
|
|
2801
|
-
const getMenuEntries = async (id, ...args) => {
|
|
2802
|
-
try {
|
|
2803
|
-
const fn = getFn(id);
|
|
2804
|
-
// @ts-ignore
|
|
2805
|
-
return fn(...args);
|
|
2806
|
-
} catch (error) {
|
|
2807
|
-
throw new VError(error, `Failed to load menu entries for id ${id}`);
|
|
2808
|
-
}
|
|
2809
|
-
};
|
|
2810
|
-
|
|
2811
2311
|
const openMenuAtIndex = async (state, index, shouldBeFocused) => {
|
|
2812
2312
|
const {
|
|
2813
2313
|
iconWidth,
|
|
2314
|
+
platform,
|
|
2814
2315
|
titleBarEntries,
|
|
2815
2316
|
titleBarHeight,
|
|
2816
2317
|
x
|
|
@@ -2823,7 +2324,10 @@ const openMenuAtIndex = async (state, index, shouldBeFocused) => {
|
|
|
2823
2324
|
const {
|
|
2824
2325
|
id
|
|
2825
2326
|
} = titleBarEntry;
|
|
2826
|
-
const items = await
|
|
2327
|
+
const items = await getMenuEntries2(state, {
|
|
2328
|
+
menuId: id,
|
|
2329
|
+
platform
|
|
2330
|
+
});
|
|
2827
2331
|
const relevantEntries = titleBarEntries.slice(0, index);
|
|
2828
2332
|
const totalWidths = getTotalWidth(relevantEntries);
|
|
2829
2333
|
const offset = totalWidths;
|
|
@@ -2934,8 +2438,10 @@ const handlePointerOver = (state, name) => {
|
|
|
2934
2438
|
};
|
|
2935
2439
|
|
|
2936
2440
|
const hideCommandCenter = async state => {
|
|
2937
|
-
|
|
2938
|
-
|
|
2441
|
+
return {
|
|
2442
|
+
...state,
|
|
2443
|
+
commandCenterEnabled: false
|
|
2444
|
+
};
|
|
2939
2445
|
};
|
|
2940
2446
|
|
|
2941
2447
|
const hideMenuBar = async state => {
|
|
@@ -3009,6 +2515,100 @@ const getTitle = workspaceUri => {
|
|
|
3009
2515
|
return baseName;
|
|
3010
2516
|
};
|
|
3011
2517
|
|
|
2518
|
+
const getMenuEntries$3 = () => {
|
|
2519
|
+
return [{
|
|
2520
|
+
command: '',
|
|
2521
|
+
flags: SubMenu,
|
|
2522
|
+
id: File$1,
|
|
2523
|
+
label: file()
|
|
2524
|
+
}, {
|
|
2525
|
+
command: '',
|
|
2526
|
+
flags: SubMenu,
|
|
2527
|
+
id: Edit,
|
|
2528
|
+
label: edit()
|
|
2529
|
+
}, {
|
|
2530
|
+
command: '',
|
|
2531
|
+
flags: SubMenu,
|
|
2532
|
+
id: Selection,
|
|
2533
|
+
label: selection()
|
|
2534
|
+
}, {
|
|
2535
|
+
command: '',
|
|
2536
|
+
flags: SubMenu,
|
|
2537
|
+
id: View,
|
|
2538
|
+
label: view()
|
|
2539
|
+
}, {
|
|
2540
|
+
command: '',
|
|
2541
|
+
flags: SubMenu,
|
|
2542
|
+
id: Go,
|
|
2543
|
+
label: go()
|
|
2544
|
+
}, {
|
|
2545
|
+
command: '',
|
|
2546
|
+
flags: SubMenu,
|
|
2547
|
+
id: Run,
|
|
2548
|
+
keyboardShortCut: 'Alt+r',
|
|
2549
|
+
label: run()
|
|
2550
|
+
}, {
|
|
2551
|
+
command: '',
|
|
2552
|
+
flags: SubMenu,
|
|
2553
|
+
id: Terminal,
|
|
2554
|
+
keyboardShortCut: 'Alt+t',
|
|
2555
|
+
label: terminal()
|
|
2556
|
+
}, {
|
|
2557
|
+
command: '',
|
|
2558
|
+
flags: SubMenu,
|
|
2559
|
+
id: Help,
|
|
2560
|
+
keyboardShortCut: 'Alt+h',
|
|
2561
|
+
label: help()
|
|
2562
|
+
}];
|
|
2563
|
+
};
|
|
2564
|
+
|
|
2565
|
+
const getMenuEntries$2 = () => {
|
|
2566
|
+
return [{
|
|
2567
|
+
command: '',
|
|
2568
|
+
flags: None,
|
|
2569
|
+
id: File$1,
|
|
2570
|
+
label: file()
|
|
2571
|
+
}, {
|
|
2572
|
+
command: '',
|
|
2573
|
+
flags: None,
|
|
2574
|
+
id: Edit,
|
|
2575
|
+
label: edit()
|
|
2576
|
+
}, {
|
|
2577
|
+
command: '',
|
|
2578
|
+
flags: None,
|
|
2579
|
+
id: Selection,
|
|
2580
|
+
label: selection()
|
|
2581
|
+
}, {
|
|
2582
|
+
command: '',
|
|
2583
|
+
flags: None,
|
|
2584
|
+
id: View,
|
|
2585
|
+
label: view()
|
|
2586
|
+
}, {
|
|
2587
|
+
command: '',
|
|
2588
|
+
flags: None,
|
|
2589
|
+
id: Go,
|
|
2590
|
+
label: go()
|
|
2591
|
+
}, {
|
|
2592
|
+
command: '',
|
|
2593
|
+
flags: None,
|
|
2594
|
+
id: Help,
|
|
2595
|
+
label: help()
|
|
2596
|
+
}];
|
|
2597
|
+
};
|
|
2598
|
+
|
|
2599
|
+
const getFn$1 = platform => {
|
|
2600
|
+
switch (platform) {
|
|
2601
|
+
case Web:
|
|
2602
|
+
return getMenuEntries$2;
|
|
2603
|
+
default:
|
|
2604
|
+
return getMenuEntries$3;
|
|
2605
|
+
}
|
|
2606
|
+
};
|
|
2607
|
+
const getMenuEntries$1 = async platform => {
|
|
2608
|
+
const fn = getFn$1(platform);
|
|
2609
|
+
return fn();
|
|
2610
|
+
};
|
|
2611
|
+
|
|
3012
2612
|
const loadContent2 = async state => {
|
|
3013
2613
|
const {
|
|
3014
2614
|
controlsOverlayEnabled,
|
|
@@ -3020,10 +2620,9 @@ const loadContent2 = async state => {
|
|
|
3020
2620
|
platform,
|
|
3021
2621
|
titleBarStyleCustom
|
|
3022
2622
|
} = state;
|
|
3023
|
-
const titleBarEntries = await getMenuEntries
|
|
2623
|
+
const titleBarEntries = await getMenuEntries$1(platform);
|
|
3024
2624
|
const withWidths = addWidths(titleBarEntries, labelPadding, labelFontWeight, labelFontSize, labelFontFamily, labelLetterSpacing);
|
|
3025
2625
|
const buttons = getTitleBarButtons(platform, controlsOverlayEnabled, titleBarStyleCustom);
|
|
3026
|
-
// @ts-ignore
|
|
3027
2626
|
const workspaceUri = await invoke('Workspace.getUri');
|
|
3028
2627
|
const title = getTitle(workspaceUri);
|
|
3029
2628
|
const iconWidth = 30;
|
|
@@ -3292,7 +2891,10 @@ const renderMenus = (oldState, newState) => {
|
|
|
3292
2891
|
} else if (difference < 0) {
|
|
3293
2892
|
changes.push(['closeMenus', newLength]);
|
|
3294
2893
|
}
|
|
3295
|
-
|
|
2894
|
+
const {
|
|
2895
|
+
uid
|
|
2896
|
+
} = newState;
|
|
2897
|
+
return ['Viewlet.send', uid, /* method */SetMenus, /* changes */changes, uid];
|
|
3296
2898
|
};
|
|
3297
2899
|
|
|
3298
2900
|
const getIcon = assetDir => {
|
|
@@ -3413,7 +3015,7 @@ const getTitleBarMenuBarVirtualDom = (visibleItems, focusedIndex) => {
|
|
|
3413
3015
|
onMouseDown: HandleClick,
|
|
3414
3016
|
onPointerOut: HandlePointerOut,
|
|
3415
3017
|
onPointerOver: HandlePointerOver,
|
|
3416
|
-
role: MenuBar,
|
|
3018
|
+
role: MenuBar$1,
|
|
3417
3019
|
tabIndex: 0,
|
|
3418
3020
|
type: Div
|
|
3419
3021
|
}, ...getTitleBarMenuBarItemsVirtualDom(visibleItems)];
|
|
@@ -3537,8 +3139,8 @@ const render3 = async (uid, diffResult) => {
|
|
|
3537
3139
|
const {
|
|
3538
3140
|
newState,
|
|
3539
3141
|
oldState
|
|
3540
|
-
} = get
|
|
3541
|
-
set
|
|
3142
|
+
} = get(uid);
|
|
3143
|
+
set(uid, newState, newState);
|
|
3542
3144
|
const commands = [];
|
|
3543
3145
|
for (const item of diffResult) {
|
|
3544
3146
|
const fn = getRenderer3(item);
|
|
@@ -3618,9 +3220,18 @@ const saveState = state => {
|
|
|
3618
3220
|
};
|
|
3619
3221
|
};
|
|
3620
3222
|
|
|
3223
|
+
const setPlatform = (state, platform) => {
|
|
3224
|
+
return {
|
|
3225
|
+
...state,
|
|
3226
|
+
platform
|
|
3227
|
+
};
|
|
3228
|
+
};
|
|
3229
|
+
|
|
3621
3230
|
const showCommandCenter = async state => {
|
|
3622
|
-
|
|
3623
|
-
|
|
3231
|
+
return {
|
|
3232
|
+
...state,
|
|
3233
|
+
commandCenterEnabled: true
|
|
3234
|
+
};
|
|
3624
3235
|
};
|
|
3625
3236
|
|
|
3626
3237
|
const showMenuBar = async state => {
|
|
@@ -3650,7 +3261,7 @@ const create = (id, uri, x, y, width, height) => {
|
|
|
3650
3261
|
x,
|
|
3651
3262
|
y
|
|
3652
3263
|
};
|
|
3653
|
-
set
|
|
3264
|
+
set(id, state, state);
|
|
3654
3265
|
return state;
|
|
3655
3266
|
};
|
|
3656
3267
|
|
|
@@ -3833,6 +3444,42 @@ const handleKeyArrowLeftMenuOpen = async state => {
|
|
|
3833
3444
|
|
|
3834
3445
|
const handleKeyArrowLeft = ifElse(handleKeyArrowLeftMenuOpen, handleKeyArrowLeftMenuClosed);
|
|
3835
3446
|
|
|
3447
|
+
const getFn = id => {
|
|
3448
|
+
switch (id) {
|
|
3449
|
+
case Edit$2:
|
|
3450
|
+
return getMenuEntries$c;
|
|
3451
|
+
case File$3:
|
|
3452
|
+
return getMenuEntries$b;
|
|
3453
|
+
case Go$2:
|
|
3454
|
+
return getMenuEntries$a;
|
|
3455
|
+
case Help$2:
|
|
3456
|
+
return getMenuEntries$9;
|
|
3457
|
+
case OpenRecent$1:
|
|
3458
|
+
return getMenuEntries$8;
|
|
3459
|
+
case Run$2:
|
|
3460
|
+
return getMenuEntries$7;
|
|
3461
|
+
case Selection$2:
|
|
3462
|
+
return getMenuEntries$6;
|
|
3463
|
+
case Terminal$2:
|
|
3464
|
+
return getMenuEntries$5;
|
|
3465
|
+
case TitleBar:
|
|
3466
|
+
return getMenuEntries$1;
|
|
3467
|
+
case View$2:
|
|
3468
|
+
return getMenuEntries$4;
|
|
3469
|
+
default:
|
|
3470
|
+
return undefined;
|
|
3471
|
+
}
|
|
3472
|
+
};
|
|
3473
|
+
const getMenuEntries = async (id, ...args) => {
|
|
3474
|
+
try {
|
|
3475
|
+
const fn = getFn(id);
|
|
3476
|
+
// @ts-ignore
|
|
3477
|
+
return fn(...args);
|
|
3478
|
+
} catch (error) {
|
|
3479
|
+
throw new VError(error, `Failed to load menu entries for id ${id}`);
|
|
3480
|
+
}
|
|
3481
|
+
};
|
|
3482
|
+
|
|
3836
3483
|
// TODO menu should not be needed initially, only when item is selected and menu is opened
|
|
3837
3484
|
const handleKeyArrowRightMenuOpen = async state => {
|
|
3838
3485
|
const {
|
|
@@ -4059,6 +3706,9 @@ const handleMenuMouseOver = async (state, level, index) => {
|
|
|
4059
3706
|
menus
|
|
4060
3707
|
} = state;
|
|
4061
3708
|
const menu = menus[level];
|
|
3709
|
+
if (!menu) {
|
|
3710
|
+
return state;
|
|
3711
|
+
}
|
|
4062
3712
|
const {
|
|
4063
3713
|
focusedIndex,
|
|
4064
3714
|
items,
|
|
@@ -4136,7 +3786,6 @@ const toggleMenu = async state => {
|
|
|
4136
3786
|
return openMenu(state, /* focus */false);
|
|
4137
3787
|
};
|
|
4138
3788
|
|
|
4139
|
-
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
4140
3789
|
const commandMap = {
|
|
4141
3790
|
'TitleBar.closeMenu': closeMenu,
|
|
4142
3791
|
'TitleBar.create': create,
|
|
@@ -4152,11 +3801,9 @@ const commandMap = {
|
|
|
4152
3801
|
'TitleBar.focusPrevious': wrapCommand(focusPrevious),
|
|
4153
3802
|
'TitleBar.getCommandIds': getCommandIds,
|
|
4154
3803
|
'TitleBar.getCommands': getCommandIds,
|
|
4155
|
-
'TitleBar.getKeyBindings': getKeyBindings
|
|
4156
|
-
'TitleBar.getMenuEntries': getMenuEntries$1,
|
|
3804
|
+
'TitleBar.getKeyBindings': getKeyBindings,
|
|
4157
3805
|
'TitleBar.getMenuEntries2': getMenuEntries2,
|
|
4158
3806
|
'TitleBar.getMenuIds': getMenuIds,
|
|
4159
|
-
'TitleBar.getMenus': getMenus,
|
|
4160
3807
|
'TitleBar.handleButtonsClick': handleClick$1,
|
|
4161
3808
|
'TitleBar.handleClick': wrapCommand(handleClick),
|
|
4162
3809
|
'TitleBar.handleClickAt': wrapCommand(handleClickAt),
|
|
@@ -4188,6 +3835,7 @@ const commandMap = {
|
|
|
4188
3835
|
'TitleBar.renderEventListeners': renderEventListeners,
|
|
4189
3836
|
'TitleBar.resize': wrapCommand(resize),
|
|
4190
3837
|
'TitleBar.saveState': wrapGetter(saveState),
|
|
3838
|
+
'TitleBar.setPlatform': wrapCommand(setPlatform),
|
|
4191
3839
|
'TitleBar.showCommandCenter': wrapCommand(showCommandCenter),
|
|
4192
3840
|
'TitleBar.showMenuBar': wrapCommand(showMenuBar),
|
|
4193
3841
|
'TitleBar.terminate': terminate,
|
|
@@ -4195,23 +3843,12 @@ const commandMap = {
|
|
|
4195
3843
|
'TitleBar.toggleMenu': wrapCommand(toggleMenu)
|
|
4196
3844
|
};
|
|
4197
3845
|
|
|
4198
|
-
// deprecated, can be removed in the future.
|
|
4199
|
-
// currently enabled for backwards compatability
|
|
4200
|
-
for (const [key, value] of Object.entries(commandMap)) {
|
|
4201
|
-
const [prefix, name] = key.split('.');
|
|
4202
|
-
if (prefix === 'TitleBar') {
|
|
4203
|
-
const alternate = `TitleBarMenuBar.${name}`;
|
|
4204
|
-
// @ts-ignore
|
|
4205
|
-
commandMap[alternate] = value;
|
|
4206
|
-
}
|
|
4207
|
-
}
|
|
4208
|
-
|
|
4209
3846
|
const listen = async () => {
|
|
4210
3847
|
registerCommands(commandMap);
|
|
4211
3848
|
const rpc = await WebWorkerRpcClient.create({
|
|
4212
3849
|
commandMap: commandMap
|
|
4213
3850
|
});
|
|
4214
|
-
set(rpc);
|
|
3851
|
+
set$1(rpc);
|
|
4215
3852
|
};
|
|
4216
3853
|
|
|
4217
3854
|
const main = async () => {
|