@lvce-editor/title-bar-worker 2.29.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -433,7 +433,7 @@ const create$4 = (method, params) => {
433
433
  };
434
434
  };
435
435
  const callbacks = Object.create(null);
436
- const set$4 = (id, fn) => {
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$a = 0;
445
+ let id = 0;
446
446
  const create$3$1 = () => {
447
- return ++id$a;
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$4(id, resolve);
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$2 = (ipc, method, ...params) => {
800
+ const invoke$1 = (ipc, method, ...params) => {
801
801
  return invokeHelper(ipc, method, params, false);
802
802
  };
803
- const invokeAndTransfer$1 = (ipc, method, ...params) => {
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$2(ipc, method, ...params);
839
+ return invoke$1(ipc, method, ...params);
840
840
  },
841
841
  invokeAndTransfer(method, ...params) {
842
- return invokeAndTransfer$1(ipc, method, ...params);
842
+ return invokeAndTransfer(ipc, method, ...params);
843
843
  },
844
844
  async dispose() {
845
845
  await ipc?.dispose();
@@ -891,372 +891,10 @@ 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
-
998
- const Web = 1;
999
- const Electron = 2;
1000
- const Remote = 3;
1001
-
1002
- const DEFAULT_UID = 1;
1003
- const createDefaultState = (uid = DEFAULT_UID) => ({
1004
- assetDir: '',
1005
- buttons: [],
1006
- commandCenterEnabled: false,
1007
- controlsOverlayEnabled: false,
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
- });
1036
-
1037
- const emptyObject = {};
1038
- const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1039
- const i18nString = (key, placeholders = emptyObject) => {
1040
- if (placeholders === emptyObject) {
1041
- return key;
1042
- }
1043
- const replacer = (match, rest) => {
1044
- return placeholders[rest];
1045
- };
1046
- return key.replaceAll(RE_PLACEHOLDER, replacer);
1047
- };
1048
-
1049
- const About = 'About';
1050
- const CheckForUpdates = 'Check For Updates';
1051
- const ClearRecentlyOpened = 'Clear Recently Opened';
1052
- const Close = 'Close';
1053
- const MenuBar$1 = 'Menu Bar';
1054
- const CommandCenter = 'Command Center';
1055
- const Edit$2 = 'Edit';
1056
- const File$3 = 'File';
1057
- const Go$2 = 'Go';
1058
- const Help$2 = 'Help';
1059
- const Maximize = 'Maximize';
1060
- const Minimize = 'Minimize';
1061
- const MoreDot = 'More ...';
1062
- const NewTerminal = 'New Terminal';
1063
- const OpenProcessExplorer = 'Open Process Explorer';
1064
- const Run$2 = 'Run';
1065
- const Selection$2 = 'Selection';
1066
- const Terminal$2 = 'Terminal';
1067
- const ToggleDeveloperTools = 'Toggle Developer Tools';
1068
- const View$2 = 'View';
1069
-
1070
- const file = () => {
1071
- return i18nString(File$3);
1072
- };
1073
- const edit = () => {
1074
- return i18nString(Edit$2);
1075
- };
1076
- const selection = () => {
1077
- return i18nString(Selection$2);
1078
- };
1079
- const view = () => {
1080
- return i18nString(View$2);
1081
- };
1082
- const go = () => {
1083
- return i18nString(Go$2);
1084
- };
1085
- const run = () => {
1086
- return i18nString(Run$2);
1087
- };
1088
- const terminal = () => {
1089
- return i18nString(Terminal$2);
1090
- };
1091
- const help = () => {
1092
- return i18nString(Help$2);
1093
- };
1094
- const minimize$1 = () => {
1095
- return i18nString(Minimize);
1096
- };
1097
- const maximize$1 = () => {
1098
- return i18nString(Maximize);
1099
- };
1100
- const close$1 = () => {
1101
- return i18nString(Close);
1102
- };
1103
- const menuBar = () => {
1104
- return i18nString(MenuBar$1);
1105
- };
1106
- const commandCenter = () => {
1107
- return i18nString(CommandCenter);
1108
- };
1109
-
1110
- const getTitleBarButtonsElectron = (controlsOverlayEnabled, titleBarStyleCustom) => {
1111
- if (controlsOverlayEnabled) {
1112
- return [];
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
894
 
1257
895
  const ContentInfo = 'contentinfo';
1258
896
  const Menu$1 = 'menu';
1259
- const MenuBar = 'menubar';
897
+ const MenuBar$1 = 'menubar';
1260
898
  const MenuItem$1 = 'menuitem';
1261
899
  const MenuItemCheckBox = 'menuitemcheckbox';
1262
900
  const None$1 = 'none';
@@ -1540,38 +1178,415 @@ const getKeyCodeString = keyCode => {
1540
1178
  }
1541
1179
  };
1542
1180
 
1543
- const Script = 2;
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
+ };
1206
+ };
1207
+
1208
+ const RendererWorker = 1;
1209
+
1210
+ const FocusTitleBarMenuBar = 26;
1211
+
1212
+ const rpcs = Object.create(null);
1213
+ const set$2 = (id, rpc) => {
1214
+ rpcs[id] = rpc;
1215
+ };
1216
+ const get$1 = id => {
1217
+ return rpcs[id];
1218
+ };
1219
+
1220
+ const create$2 = rpcId => {
1221
+ return {
1222
+ // @ts-ignore
1223
+ invoke(method, ...params) {
1224
+ const rpc = get$1(rpcId);
1225
+ // @ts-ignore
1226
+ return rpc.invoke(method, ...params);
1227
+ },
1228
+ // @ts-ignore
1229
+ invokeAndTransfer(method, ...params) {
1230
+ const rpc = get$1(rpcId);
1231
+ // @ts-ignore
1232
+ return rpc.invokeAndTransfer(method, ...params);
1233
+ },
1234
+ set(rpc) {
1235
+ set$2(rpcId, rpc);
1236
+ },
1237
+ async dispose() {
1238
+ const rpc = get$1(rpcId);
1239
+ await rpc.dispose();
1240
+ }
1241
+ };
1242
+ };
1243
+
1244
+ const {
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);
1251
+ };
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
+ newState
1282
+ } = states[uid];
1283
+ const newerState = await fn(newState, ...args);
1284
+ if (newState === newerState) {
1285
+ return;
1286
+ }
1287
+ const latest = states[uid];
1288
+ states[uid] = {
1289
+ oldState: latest.oldState,
1290
+ newState: newerState
1291
+ };
1292
+ };
1293
+ return wrapped;
1294
+ },
1295
+ wrapGetter(fn) {
1296
+ const wrapped = (uid, ...args) => {
1297
+ const {
1298
+ newState
1299
+ } = states[uid];
1300
+ return fn(newState, ...args);
1301
+ };
1302
+ return wrapped;
1303
+ },
1304
+ diff(uid, modules, numbers) {
1305
+ const {
1306
+ oldState,
1307
+ newState
1308
+ } = states[uid];
1309
+ const diffResult = [];
1310
+ for (let i = 0; i < modules.length; i++) {
1311
+ const fn = modules[i];
1312
+ if (!fn(oldState, newState)) {
1313
+ diffResult.push(numbers[i]);
1314
+ }
1315
+ }
1316
+ return diffResult;
1317
+ },
1318
+ getCommandIds() {
1319
+ const keys = Object.keys(commandMapRef);
1320
+ const ids = keys.map(toCommandId);
1321
+ return ids;
1322
+ },
1323
+ registerCommands(commandMap) {
1324
+ Object.assign(commandMapRef, commandMap);
1325
+ }
1326
+ };
1327
+ };
1328
+ const terminate = () => {
1329
+ globalThis.close();
1330
+ };
1331
+
1332
+ const Web = 1;
1333
+ const Electron = 2;
1334
+ const Remote = 3;
1335
+
1336
+ const DEFAULT_UID = 1;
1337
+ const createDefaultState = (uid = DEFAULT_UID) => ({
1338
+ assetDir: '',
1339
+ buttons: [],
1340
+ commandCenterEnabled: false,
1341
+ controlsOverlayEnabled: false,
1342
+ focusedIndex: -1,
1343
+ height: 30,
1344
+ iconWidth: 30,
1345
+ isMenuOpen: false,
1346
+ labelFontFamily: 'system-ui, Ubuntu, Droid Sans, sans-serif',
1347
+ labelFontSize: 13,
1348
+ labelFontWeight: 400,
1349
+ labelLetterSpacing: 0,
1350
+ labelPadding: 8,
1351
+ layoutControlsEnabled: false,
1352
+ menus: [],
1353
+ platform: Electron,
1354
+ title: '',
1355
+ titleBarButtons: [],
1356
+ titleBarButtonsEnabled: true,
1357
+ titleBarButtonsWidth: 90,
1358
+ titleBarEntries: [],
1359
+ titleBarHeight: 30,
1360
+ titleBarIconEnabled: true,
1361
+ titleBarIconWidth: 30,
1362
+ titleBarMenuBarEnabled: true,
1363
+ titleBarStyleCustom: true,
1364
+ titleBarTitleEnabled: true,
1365
+ uid,
1366
+ width: 800,
1367
+ x: 0,
1368
+ y: 0
1369
+ });
1370
+
1371
+ const emptyObject = {};
1372
+ const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1373
+ const i18nString = (key, placeholders = emptyObject) => {
1374
+ if (placeholders === emptyObject) {
1375
+ return key;
1376
+ }
1377
+ const replacer = (match, rest) => {
1378
+ return placeholders[rest];
1379
+ };
1380
+ return key.replaceAll(RE_PLACEHOLDER, replacer);
1381
+ };
1382
+
1383
+ const About = 'About';
1384
+ const CheckForUpdates = 'Check For Updates';
1385
+ const ClearRecentlyOpened = 'Clear Recently Opened';
1386
+ const Close = 'Close';
1387
+ const MenuBar = 'Menu Bar';
1388
+ const CommandCenter = 'Command Center';
1389
+ const Edit$1 = 'Edit';
1390
+ const File$2 = 'File';
1391
+ const Go$1 = 'Go';
1392
+ const Help$1 = 'Help';
1393
+ const Maximize = 'Maximize';
1394
+ const Minimize = 'Minimize';
1395
+ const MoreDot = 'More ...';
1396
+ const NewTerminal = 'New Terminal';
1397
+ const OpenProcessExplorer = 'Open Process Explorer';
1398
+ const Run$1 = 'Run';
1399
+ const Selection$1 = 'Selection';
1400
+ const Terminal$1 = 'Terminal';
1401
+ const ToggleDeveloperTools = 'Toggle Developer Tools';
1402
+ const View$1 = 'View';
1544
1403
 
1545
- const CtrlCmd = 1 << 11 >>> 0;
1546
- const Shift = 1 << 10 >>> 0;
1404
+ const file = () => {
1405
+ return i18nString(File$2);
1406
+ };
1407
+ const edit = () => {
1408
+ return i18nString(Edit$1);
1409
+ };
1410
+ const selection = () => {
1411
+ return i18nString(Selection$1);
1412
+ };
1413
+ const view = () => {
1414
+ return i18nString(View$1);
1415
+ };
1416
+ const go = () => {
1417
+ return i18nString(Go$1);
1418
+ };
1419
+ const run = () => {
1420
+ return i18nString(Run$1);
1421
+ };
1422
+ const terminal = () => {
1423
+ return i18nString(Terminal$1);
1424
+ };
1425
+ const help = () => {
1426
+ return i18nString(Help$1);
1427
+ };
1428
+ const minimize$1 = () => {
1429
+ return i18nString(Minimize);
1430
+ };
1431
+ const maximize$1 = () => {
1432
+ return i18nString(Maximize);
1433
+ };
1434
+ const close$1 = () => {
1435
+ return i18nString(Close);
1436
+ };
1437
+ const menuBar = () => {
1438
+ return i18nString(MenuBar);
1439
+ };
1440
+ const commandCenter = () => {
1441
+ return i18nString(CommandCenter);
1442
+ };
1547
1443
 
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;
1444
+ const getTitleBarButtonsElectron = (controlsOverlayEnabled, titleBarStyleCustom) => {
1445
+ if (controlsOverlayEnabled) {
1446
+ return [];
1447
+ }
1448
+ if (titleBarStyleCustom) {
1449
+ // TODO don't render title bar buttons on windows when electron window controls overlay is enabled
1450
+ return [{
1451
+ icon: 'Minimize',
1452
+ id: 'Minimize',
1453
+ label: minimize$1(),
1454
+ onClick: 'handleClickMinimize'
1455
+ }, {
1456
+ icon: 'Maximize',
1457
+ id: 'ToggleMaximize',
1458
+ label: maximize$1(),
1459
+ onClick: 'handleClickToggleMaximize'
1460
+ }, {
1461
+ icon: 'ChromeClose',
1462
+ id: 'Close',
1463
+ label: close$1(),
1464
+ onClick: 'handleClickClose'
1465
+ }];
1466
+ }
1467
+ return [];
1468
+ };
1558
1469
 
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
1470
+ const getTitleBarButtonsRemote = () => {
1471
+ return [];
1472
+ };
1473
+
1474
+ const getTitleBarButtonsWeb = () => {
1475
+ return [];
1476
+ };
1477
+
1478
+ const getTitleBarButtons = (platform, controlsOverlayEnabled, titleBarStyleCustom) => {
1479
+ switch (platform) {
1480
+ case Electron:
1481
+ return getTitleBarButtonsElectron(controlsOverlayEnabled, titleBarStyleCustom);
1482
+ case Remote:
1483
+ return getTitleBarButtonsRemote();
1484
+ case Web:
1485
+ return getTitleBarButtonsWeb();
1486
+ default:
1487
+ return [];
1488
+ }
1489
+ };
1490
+
1491
+ const {
1492
+ get,
1493
+ getCommandIds,
1494
+ registerCommands,
1495
+ set,
1496
+ wrapCommand,
1497
+ wrapGetter
1498
+ } = create$1();
1499
+
1500
+ const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled, titleBarStyleCustom, assetDir) => {
1501
+ const titleBarButtons = getTitleBarButtons(platform, controlsOverlayEnabled, titleBarStyleCustom);
1502
+ const state = {
1503
+ ...createDefaultState(),
1504
+ assetDir,
1505
+ commandCenterEnabled: false,
1506
+ controlsOverlayEnabled,
1507
+ focusedIndex: -1,
1508
+ height,
1509
+ iconWidth: 30,
1510
+ isMenuOpen: false,
1511
+ labelFontFamily: 'system-ui, Ubuntu, Droid Sans, sans-serif',
1512
+ labelFontSize: 13,
1513
+ labelFontWeight: 400,
1514
+ labelLetterSpacing: 0,
1515
+ labelPadding: 8,
1516
+ layoutControlsEnabled: false,
1517
+ menus: [],
1518
+ platform,
1519
+ titleBarButtons,
1520
+ titleBarEntries: [],
1521
+ titleBarHeight: height,
1522
+ titleBarStyleCustom,
1523
+ uid: id,
1524
+ width,
1525
+ x,
1526
+ y
1568
1527
  };
1528
+ set(id, state, state);
1529
+ };
1530
+
1531
+ const RenderEntries = 1;
1532
+ const RenderFocusedIndex = 2;
1533
+ const RenderMenus = 3;
1534
+
1535
+ const isEqual$3 = (oldState, newState) => {
1536
+ return oldState.titleBarEntries === newState.titleBarEntries && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
1537
+ };
1538
+
1539
+ const isEqual$2 = (oldState, newState) => {
1540
+ return oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
1569
1541
  };
1570
1542
 
1571
- const DebugWorker = 55;
1572
- const RendererWorker$1 = 1;
1543
+ const isEqual$1 = (oldState, newState) => {
1544
+ return oldState.menus === newState.menus;
1545
+ };
1573
1546
 
1574
- const FocusTitleBarMenuBar = 26;
1547
+ const modules$1 = [isEqual$3, isEqual$2, isEqual$1];
1548
+ const numbers$1 = [RenderEntries, RenderFocusedIndex, RenderMenus];
1549
+
1550
+ const diff = (oldState, newState) => {
1551
+ const diffResult = [];
1552
+ for (let i = 0; i < modules$1.length; i++) {
1553
+ const fn = modules$1[i];
1554
+ if (!fn(oldState, newState)) {
1555
+ diffResult.push(numbers$1[i]);
1556
+ }
1557
+ }
1558
+ return diffResult;
1559
+ };
1560
+
1561
+ const diff2 = uid => {
1562
+ const {
1563
+ newState,
1564
+ oldState
1565
+ } = get(uid);
1566
+ return diff(oldState, newState);
1567
+ };
1568
+
1569
+ const isEqual = (oldState, newState) => {
1570
+ 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;
1571
+ };
1572
+
1573
+ const modules = [isEqual, isEqual$2, isEqual$1];
1574
+ const numbers = [RenderEntries, RenderFocusedIndex, RenderMenus];
1575
+
1576
+ const diff3 = uid => {
1577
+ const {
1578
+ newState,
1579
+ oldState
1580
+ } = get(uid);
1581
+ const diffResult = [];
1582
+ for (let i = 0; i < modules.length; i++) {
1583
+ const fn = modules[i];
1584
+ if (!fn(oldState, newState)) {
1585
+ diffResult.push(numbers[i]);
1586
+ }
1587
+ }
1588
+ return diffResult;
1589
+ };
1575
1590
 
1576
1591
  const mergeClassNames = (...classNames) => {
1577
1592
  return classNames.filter(Boolean).join(' ');
@@ -1589,7 +1604,7 @@ const text = data => {
1589
1604
  };
1590
1605
  };
1591
1606
 
1592
- const getKeyBindings$1 = () => {
1607
+ const getKeyBindings = () => {
1593
1608
  return [{
1594
1609
  command: 'TitleBar.handleKeyArrowDown',
1595
1610
  key: DownArrow$1,
@@ -1658,6 +1673,11 @@ const getMenuEntriesTitleBarContextMenu = async state => {
1658
1673
  }];
1659
1674
  };
1660
1675
 
1676
+ const MenuIdTitleBarContextMenu = 50;
1677
+ const getMenuIds = () => {
1678
+ return [Edit$2, File$3, Go$2, Help$2, OpenRecent$1, Run$2, Selection$2, Terminal$2, TitleBar, View$2, MenuIdTitleBarContextMenu, TitleBarContextMenu];
1679
+ };
1680
+
1661
1681
  /**
1662
1682
  * @enum {string}
1663
1683
  */
@@ -1712,17 +1732,6 @@ const moveLineDown = () => {
1712
1732
  return i18nString(UiStrings$1.MoveLineDown);
1713
1733
  };
1714
1734
 
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
1735
  const menuEntrySeparator = {
1727
1736
  command: '',
1728
1737
  flags: Separator,
@@ -1730,8 +1739,7 @@ const menuEntrySeparator = {
1730
1739
  label: ''
1731
1740
  };
1732
1741
 
1733
- const id$9 = Edit;
1734
- const getMenuEntries$d = () => {
1742
+ const getMenuEntries$c = () => {
1735
1743
  return [{
1736
1744
  command: /* TODO */'-1',
1737
1745
  flags: Disabled,
@@ -1770,12 +1778,6 @@ const getMenuEntries$d = () => {
1770
1778
  }];
1771
1779
  };
1772
1780
 
1773
- const MenuEntriesEdit = {
1774
- __proto__: null,
1775
- getMenuEntries: getMenuEntries$d,
1776
- id: id$9
1777
- };
1778
-
1779
1781
  /**
1780
1782
  * @enum {string}
1781
1783
  */
@@ -1813,15 +1815,24 @@ const exit = () => {
1813
1815
  return i18nString(UiStrings.Exit);
1814
1816
  };
1815
1817
 
1816
- const id$8 = File$1;
1817
- const getMenuEntries$c = platform => {
1818
+ const Edit = 2;
1819
+ const File$1 = 5;
1820
+ const Go = 6;
1821
+ const Help = 7;
1822
+ const OpenRecent = 9;
1823
+ const Run = 10;
1824
+ const Selection = 11;
1825
+ const Terminal = 14;
1826
+ const View = 16;
1827
+
1828
+ const getMenuEntries$b = platform => {
1818
1829
  const entries = [{
1819
1830
  command: '-1',
1820
1831
  flags: None,
1821
1832
  id: 'newFile',
1822
1833
  label: newFile()
1823
1834
  }, {
1824
- command: /* Window.openNew */'Window.openNew',
1835
+ command: 'Window.openNew',
1825
1836
  flags: None,
1826
1837
  id: 'newWindow',
1827
1838
  label: newWindow()
@@ -1862,23 +1873,10 @@ const getMenuEntries$c = platform => {
1862
1873
  return entries;
1863
1874
  };
1864
1875
 
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 = () => {
1876
+ const getMenuEntries$a = () => {
1873
1877
  return [];
1874
1878
  };
1875
1879
 
1876
- const MenuEntriesGo = {
1877
- __proto__: null,
1878
- getMenuEntries: getMenuEntries$b,
1879
- id: id$7
1880
- };
1881
-
1882
1880
  const toggleDeveloperTools = () => {
1883
1881
  return i18nString(ToggleDeveloperTools);
1884
1882
  };
@@ -1899,8 +1897,7 @@ const isAutoUpdateSupported = platform => {
1899
1897
  return false;
1900
1898
  };
1901
1899
 
1902
- const id$6 = Help;
1903
- const getMenuEntries$a = async platform => {
1900
+ const getMenuEntries$9 = async platform => {
1904
1901
  const autoUpdateSupported = isAutoUpdateSupported(platform);
1905
1902
  const entries = [];
1906
1903
  if (platform !== Web) {
@@ -1936,409 +1933,6 @@ const getMenuEntries$a = async platform => {
1936
1933
  return entries;
1937
1934
  };
1938
1935
 
1939
- const MenuEntriesHelp = {
1940
- __proto__: null,
1941
- getMenuEntries: getMenuEntries$a,
1942
- id: id$6
1943
- };
1944
-
1945
- const rpcs = Object.create(null);
1946
- const set$2 = (id, rpc) => {
1947
- rpcs[id] = rpc;
1948
- };
1949
- const get = id => {
1950
- return rpcs[id];
1951
- };
1952
-
1953
- const create$1 = rpcId => {
1954
- return {
1955
- // @ts-ignore
1956
- invoke(method, ...params) {
1957
- const rpc = get(rpcId);
1958
- // @ts-ignore
1959
- return rpc.invoke(method, ...params);
1960
- },
1961
- // @ts-ignore
1962
- invokeAndTransfer(method, ...params) {
1963
- const rpc = get(rpcId);
1964
- // @ts-ignore
1965
- return rpc.invokeAndTransfer(method, ...params);
1966
- },
1967
- set(rpc) {
1968
- set$2(rpcId, rpc);
1969
- },
1970
- async dispose() {
1971
- const rpc = get(rpcId);
1972
- await rpc.dispose();
1973
- }
1974
- };
1975
- };
1976
-
1977
- const {
1978
- invoke: invoke$1,
1979
- invokeAndTransfer,
1980
- set: set$1,
1981
- dispose
1982
- } = create$1(RendererWorker$1);
1983
- const searchFileHtml = async uri => {
1984
- return invoke$1('ExtensionHost.searchFileWithHtml', uri);
1985
- };
1986
- const getFilePathElectron = async file => {
1987
- return invoke$1('FileSystemHandle.getFilePathElectron', file);
1988
- };
1989
- const showContextMenu = async (x, y, id, ...args) => {
1990
- return invoke$1('ContextMenu.show', x, y, id, ...args);
1991
- };
1992
- const showContextMenu2 = async (uid, menuId, x, y, args) => {
1993
- // @ts-ignore
1994
- await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
1995
- };
1996
- const getElectronVersion = async () => {
1997
- return invoke$1('Process.getElectronVersion');
1998
- };
1999
- const applyBulkReplacement = async bulkEdits => {
2000
- await invoke$1('BulkReplacement.applyBulkReplacement', bulkEdits);
2001
- };
2002
- const setColorTheme = async id => {
2003
- // @ts-ignore
2004
- return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
2005
- };
2006
- const getNodeVersion = async () => {
2007
- return invoke$1('Process.getNodeVersion');
2008
- };
2009
- const getChromeVersion = async () => {
2010
- return invoke$1('Process.getChromeVersion');
2011
- };
2012
- const getV8Version = async () => {
2013
- return invoke$1('Process.getV8Version');
2014
- };
2015
- const getFileHandles = async fileIds => {
2016
- const files = await invoke$1('FileSystemHandle.getFileHandles', fileIds);
2017
- return files;
2018
- };
2019
- const setWorkspacePath = async path => {
2020
- await invoke$1('Workspace.setPath', path);
2021
- };
2022
- const registerWebViewInterceptor = async (id, port) => {
2023
- await invokeAndTransfer('WebView.registerInterceptor', id, port);
2024
- };
2025
- const unregisterWebViewInterceptor = async id => {
2026
- await invoke$1('WebView.unregisterInterceptor', id);
2027
- };
2028
- const sendMessagePortToEditorWorker = async (port, rpcId) => {
2029
- const command = 'HandleMessagePort.handleMessagePort';
2030
- // @ts-ignore
2031
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
2032
- };
2033
- const sendMessagePortToErrorWorker = async (port, rpcId) => {
2034
- const command = 'Errors.handleMessagePort';
2035
- // @ts-ignore
2036
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
2037
- };
2038
- const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
2039
- const command = 'Markdown.handleMessagePort';
2040
- // @ts-ignore
2041
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
2042
- };
2043
- const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
2044
- const command = 'IconTheme.handleMessagePort';
2045
- // @ts-ignore
2046
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
2047
- };
2048
- const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
2049
- const command = 'FileSystem.handleMessagePort';
2050
- // @ts-ignore
2051
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
2052
- };
2053
- const readFile = async uri => {
2054
- return invoke$1('FileSystem.readFile', uri);
2055
- };
2056
- const getWebViewSecret = async key => {
2057
- // @ts-ignore
2058
- return invoke$1('WebView.getSecret', key);
2059
- };
2060
- const setWebViewPort = async (uid, port, origin, portType) => {
2061
- return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
2062
- };
2063
- const setFocus$1 = key => {
2064
- return invoke$1('Focus.setFocus', key);
2065
- };
2066
- const getFileIcon = async options => {
2067
- return invoke$1('IconTheme.getFileIcon', options);
2068
- };
2069
- const getColorThemeNames = async () => {
2070
- return invoke$1('ColorTheme.getColorThemeNames');
2071
- };
2072
- const disableExtension = async id => {
2073
- // @ts-ignore
2074
- return invoke$1('ExtensionManagement.disable', id);
2075
- };
2076
- const enableExtension = async id => {
2077
- // @ts-ignore
2078
- return invoke$1('ExtensionManagement.enable', id);
2079
- };
2080
- const handleDebugChange = async params => {
2081
- // @ts-ignore
2082
- return invoke$1('Run And Debug.handleChange', params);
2083
- };
2084
- const getFolderIcon = async options => {
2085
- return invoke$1('IconTheme.getFolderIcon', options);
2086
- };
2087
- const closeWidget = async widgetId => {
2088
- return invoke$1('Viewlet.closeWidget', widgetId);
2089
- };
2090
- const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
2091
- const command = 'HandleMessagePort.handleMessagePort2';
2092
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
2093
- };
2094
- const sendMessagePortToSearchProcess = async port => {
2095
- await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
2096
- };
2097
- const confirm = async (message, options) => {
2098
- // @ts-ignore
2099
- const result = await invoke$1('ConfirmPrompt.prompt', message, options);
2100
- return result;
2101
- };
2102
- const getRecentlyOpened$1 = async () => {
2103
- return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
2104
- };
2105
- const getKeyBindings = async () => {
2106
- return invoke$1('KeyBindingsInitial.getKeyBindings');
2107
- };
2108
- const writeClipBoardText = async text => {
2109
- await invoke$1('ClipBoard.writeText', /* text */text);
2110
- };
2111
- const writeClipBoardImage = async blob => {
2112
- // @ts-ignore
2113
- await invoke$1('ClipBoard.writeImage', /* text */blob);
2114
- };
2115
- const searchFileMemory = async uri => {
2116
- // @ts-ignore
2117
- return invoke$1('ExtensionHost.searchFileWithMemory', uri);
2118
- };
2119
- const searchFileFetch = async uri => {
2120
- return invoke$1('ExtensionHost.searchFileWithFetch', uri);
2121
- };
2122
- const showMessageBox = async options => {
2123
- return invoke$1('ElectronDialog.showMessageBox', options);
2124
- };
2125
- const handleDebugResumed = async params => {
2126
- await invoke$1('Run And Debug.handleResumed', params);
2127
- };
2128
- const openWidget = async name => {
2129
- await invoke$1('Viewlet.openWidget', name);
2130
- };
2131
- const getIcons = async requests => {
2132
- const icons = await invoke$1('IconTheme.getIcons', requests);
2133
- return icons;
2134
- };
2135
- const activateByEvent = event => {
2136
- return invoke$1('ExtensionHostManagement.activateByEvent', event);
2137
- };
2138
- const setAdditionalFocus = focusKey => {
2139
- // @ts-ignore
2140
- return invoke$1('Focus.setAdditionalFocus', focusKey);
2141
- };
2142
- const getActiveEditorId = () => {
2143
- // @ts-ignore
2144
- return invoke$1('GetActiveEditor.getActiveEditorId');
2145
- };
2146
- const getWorkspacePath = () => {
2147
- return invoke$1('Workspace.getPath');
2148
- };
2149
- const sendMessagePortToRendererProcess = async port => {
2150
- const command = 'HandleMessagePort.handleMessagePort';
2151
- // @ts-ignore
2152
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
2153
- };
2154
- const getPreference = async key => {
2155
- return await invoke$1('Preferences.get', key);
2156
- };
2157
- const getAllExtensions = async () => {
2158
- return invoke$1('ExtensionManagement.getAllExtensions');
2159
- };
2160
- const rerenderEditor = async key => {
2161
- // @ts-ignore
2162
- return invoke$1('Editor.rerender', key);
2163
- };
2164
- const handleDebugPaused = async params => {
2165
- await invoke$1('Run And Debug.handlePaused', params);
2166
- };
2167
- const openUri = async (uri, focus, options) => {
2168
- await invoke$1('Main.openUri', uri, focus, options);
2169
- };
2170
- const sendMessagePortToSyntaxHighlightingWorker = async port => {
2171
- await invokeAndTransfer(
2172
- // @ts-ignore
2173
- 'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
2174
- };
2175
- const handleDebugScriptParsed = async script => {
2176
- await invoke$1('Run And Debug.handleScriptParsed', script);
2177
- };
2178
- const getWindowId = async () => {
2179
- return invoke$1('GetWindowId.getWindowId');
2180
- };
2181
- const getBlob = async uri => {
2182
- // @ts-ignore
2183
- return invoke$1('FileSystem.getBlob', uri);
2184
- };
2185
- const getExtensionCommands = async () => {
2186
- return invoke$1('ExtensionHost.getCommands');
2187
- };
2188
- const showErrorDialog = async errorInfo => {
2189
- // @ts-ignore
2190
- await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
2191
- };
2192
- const getFolderSize = async uri => {
2193
- // @ts-ignore
2194
- return await invoke$1('FileSystem.getFolderSize', uri);
2195
- };
2196
- const getExtension = async id => {
2197
- // @ts-ignore
2198
- return invoke$1('ExtensionManagement.getExtension', id);
2199
- };
2200
- const getMarkdownDom = async html => {
2201
- // @ts-ignore
2202
- return invoke$1('Markdown.getVirtualDom', html);
2203
- };
2204
- const renderMarkdown = async (markdown, options) => {
2205
- // @ts-ignore
2206
- return invoke$1('Markdown.renderMarkdown', markdown, options);
2207
- };
2208
- const openNativeFolder = async uri => {
2209
- // @ts-ignore
2210
- await invoke$1('OpenNativeFolder.openNativeFolder', uri);
2211
- };
2212
- const uninstallExtension = async id => {
2213
- return invoke$1('ExtensionManagement.uninstall', id);
2214
- };
2215
- const installExtension = async id => {
2216
- // @ts-ignore
2217
- return invoke$1('ExtensionManagement.install', id);
2218
- };
2219
- const openExtensionSearch = async () => {
2220
- // @ts-ignore
2221
- return invoke$1('SideBar.openViewlet', 'Extensions');
2222
- };
2223
- const setExtensionsSearchValue = async searchValue => {
2224
- // @ts-ignore
2225
- return invoke$1('Extensions.handleInput', searchValue, Script);
2226
- };
2227
- const openExternal = async uri => {
2228
- // @ts-ignore
2229
- await invoke$1('Open.openExternal', uri);
2230
- };
2231
- const openUrl = async uri => {
2232
- // @ts-ignore
2233
- await invoke$1('Open.openUrl', uri);
2234
- };
2235
- const getAllPreferences = async () => {
2236
- // @ts-ignore
2237
- return invoke$1('Preferences.getAll');
2238
- };
2239
- const showSaveFilePicker = async () => {
2240
- // @ts-ignore
2241
- return invoke$1('FilePicker.showSaveFilePicker');
2242
- };
2243
- const getLogsDir = async () => {
2244
- // @ts-ignore
2245
- return invoke$1('PlatformPaths.getLogsDir');
2246
- };
2247
- const registerMockRpc = commandMap => {
2248
- const mockRpc = createMockRpc({
2249
- commandMap
2250
- });
2251
- set$1(mockRpc);
2252
- return mockRpc;
2253
- };
2254
-
2255
- const RendererWorker = {
2256
- __proto__: null,
2257
- activateByEvent,
2258
- applyBulkReplacement,
2259
- closeWidget,
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
2335
- };
2336
-
2337
- const {
2338
- invoke,
2339
- set
2340
- } = RendererWorker;
2341
-
2342
1936
  const getRecentlyOpened = () => {
2343
1937
  return invoke(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
2344
1938
  };
@@ -2377,8 +1971,7 @@ const toMenuItem = folder => {
2377
1971
  label
2378
1972
  };
2379
1973
  };
2380
- const id$5 = OpenRecent;
2381
- const getMenuEntries$9 = async () => {
1974
+ const getMenuEntries$8 = async () => {
2382
1975
  const allItems = await getRecentlyOpened();
2383
1976
  const itemsToShow = allItems.slice(0, MAX_MENU_RECENT_ENTRIES);
2384
1977
  const items = [];
@@ -2398,209 +1991,80 @@ const getMenuEntries$9 = async () => {
2398
1991
  });
2399
1992
  return items;
2400
1993
  };
2401
-
2402
- const MenuEntriesOpenRecent = {
2403
- __proto__: null,
2404
- getMenuEntries: getMenuEntries$9,
2405
- id: id$5
2406
- };
2407
-
2408
- const id$4 = Run;
2409
- const getMenuEntries$8 = () => {
2410
- return [];
2411
- };
2412
-
2413
- const MenuEntriesRun = {
2414
- __proto__: null,
2415
- getMenuEntries: getMenuEntries$8,
2416
- id: id$4
2417
- };
2418
-
2419
- const id$3 = Selection;
2420
- const getMenuEntries$7 = () => {
2421
- return [{
2422
- command: 'Editor.selectAll',
2423
- flags: None,
2424
- id: 'selectAll',
2425
- label: selectAll()
2426
- }, {
2427
- command: 'Editor.copyLineUp',
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
- }];
1994
+
1995
+ const getMenuEntries$7 = () => {
1996
+ return [];
2517
1997
  };
2518
1998
 
2519
- const getMenuEntries$4 = () => {
1999
+ const getMenuEntries$6 = () => {
2520
2000
  return [{
2521
- command: '',
2522
- flags: None,
2523
- id: File$1,
2524
- label: file()
2525
- }, {
2526
- command: '',
2001
+ command: 'Editor.selectAll',
2527
2002
  flags: None,
2528
- id: Edit,
2529
- label: edit()
2003
+ id: 'selectAll',
2004
+ label: selectAll()
2530
2005
  }, {
2531
- command: '',
2006
+ command: 'Editor.copyLineUp',
2532
2007
  flags: None,
2533
- id: Selection,
2534
- label: selection()
2008
+ id: 'copyLineUp',
2009
+ label: copyLineUp()
2535
2010
  }, {
2536
- command: '',
2011
+ command: 'Editor.copyLineDown',
2537
2012
  flags: None,
2538
- id: View,
2539
- label: view()
2013
+ id: 'copyLineDown',
2014
+ label: copyLineDown()
2540
2015
  }, {
2541
- command: '',
2542
- flags: None,
2543
- id: Go,
2544
- label: go()
2016
+ command: 'Editor.moveLineUp',
2017
+ flags: Disabled,
2018
+ id: 'moveLineUp',
2019
+ label: moveLineUp()
2545
2020
  }, {
2546
- command: '',
2547
- flags: None,
2548
- id: Help,
2549
- label: help()
2021
+ command: 'Editor.moveLineDown',
2022
+ flags: Disabled,
2023
+ id: 'moveLineDown',
2024
+ label: moveLineDown()
2550
2025
  }];
2551
2026
  };
2552
2027
 
2553
- const getFn$1 = platform => {
2554
- switch (platform) {
2555
- case Web:
2556
- return getMenuEntries$4;
2557
- default:
2558
- return getMenuEntries$5;
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
2028
+ const getMenuEntries$5 = () => {
2029
+ return [{
2030
+ args: ['Terminal'],
2031
+ command: 'Layout.togglePanel',
2032
+ flags: None,
2033
+ id: 'newTerminal',
2034
+ label: i18nString(NewTerminal)
2035
+ }];
2571
2036
  };
2572
2037
 
2573
- const id = View;
2574
- const getMenuEntries$2 = () => {
2038
+ const getMenuEntries$4 = () => {
2575
2039
  return [];
2576
2040
  };
2577
2041
 
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
2042
  const getMenuEntries2 = async (state, props) => {
2599
- if (props.menuId === MenuIdTitleBarContextMenu) {
2600
- return getMenuEntriesTitleBarContextMenu(state);
2043
+ switch (props.menuId) {
2044
+ case Edit$2:
2045
+ return getMenuEntries$c();
2046
+ case File$3:
2047
+ return getMenuEntries$b(props.platform);
2048
+ case Go$2:
2049
+ return getMenuEntries$a();
2050
+ case Help$2:
2051
+ return getMenuEntries$9(props.platform);
2052
+ case OpenRecent$1:
2053
+ return getMenuEntries$8();
2054
+ case Run$2:
2055
+ return getMenuEntries$7();
2056
+ case Selection$2:
2057
+ return getMenuEntries$6();
2058
+ case Terminal$2:
2059
+ return getMenuEntries$5();
2060
+ case TitleBarContextMenu:
2061
+ case MenuIdTitleBarContextMenu:
2062
+ return getMenuEntriesTitleBarContextMenu(state);
2063
+ case View$2:
2064
+ return getMenuEntries$4();
2065
+ default:
2066
+ return [];
2601
2067
  }
2602
- // TODO
2603
- return [];
2604
2068
  };
2605
2069
 
2606
2070
  const maximize = async () => {
@@ -2645,7 +2109,7 @@ const handleClick$1 = async (state, className) => {
2645
2109
 
2646
2110
  const show2 = async (uid, menuId, x, y, args) => {
2647
2111
  // @ts-ignore
2648
- await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
2112
+ await invoke('ContextMenu.show2', uid, menuId, x, y, args);
2649
2113
  };
2650
2114
 
2651
2115
  const handleContextMenu = async (state, button, eventX, eventY) => {
@@ -2684,6 +2148,7 @@ const getTotalWidth = entries => {
2684
2148
  };
2685
2149
 
2686
2150
  // TODO lazyload menuEntries and use Command.execute (maybe)
2151
+
2687
2152
  const CONTEXT_MENU_ITEM_HEIGHT = 26;
2688
2153
  const CONTEXT_MENU_SEPARATOR_HEIGHT = 11;
2689
2154
  const CONTEXT_MENU_PADDING = 8;
@@ -2765,52 +2230,10 @@ const getIndexToFocusNext = menu => {
2765
2230
 
2766
2231
  // TODO more tests
2767
2232
 
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
2233
  const openMenuAtIndex = async (state, index, shouldBeFocused) => {
2812
2234
  const {
2813
2235
  iconWidth,
2236
+ platform,
2814
2237
  titleBarEntries,
2815
2238
  titleBarHeight,
2816
2239
  x
@@ -2823,7 +2246,10 @@ const openMenuAtIndex = async (state, index, shouldBeFocused) => {
2823
2246
  const {
2824
2247
  id
2825
2248
  } = titleBarEntry;
2826
- const items = await getMenuEntries(id);
2249
+ const items = await getMenuEntries2(state, {
2250
+ menuId: id,
2251
+ platform
2252
+ });
2827
2253
  const relevantEntries = titleBarEntries.slice(0, index);
2828
2254
  const totalWidths = getTotalWidth(relevantEntries);
2829
2255
  const offset = totalWidths;
@@ -2934,8 +2360,10 @@ const handlePointerOver = (state, name) => {
2934
2360
  };
2935
2361
 
2936
2362
  const hideCommandCenter = async state => {
2937
- // TODO
2938
- return state;
2363
+ return {
2364
+ ...state,
2365
+ commandCenterEnabled: false
2366
+ };
2939
2367
  };
2940
2368
 
2941
2369
  const hideMenuBar = async state => {
@@ -3009,6 +2437,136 @@ const getTitle = workspaceUri => {
3009
2437
  return baseName;
3010
2438
  };
3011
2439
 
2440
+ const getMenuEntries$3 = () => {
2441
+ return [{
2442
+ command: '',
2443
+ flags: SubMenu,
2444
+ id: File$1,
2445
+ label: file()
2446
+ }, {
2447
+ command: '',
2448
+ flags: SubMenu,
2449
+ id: Edit,
2450
+ label: edit()
2451
+ }, {
2452
+ command: '',
2453
+ flags: SubMenu,
2454
+ id: Selection,
2455
+ label: selection()
2456
+ }, {
2457
+ command: '',
2458
+ flags: SubMenu,
2459
+ id: View,
2460
+ label: view()
2461
+ }, {
2462
+ command: '',
2463
+ flags: SubMenu,
2464
+ id: Go,
2465
+ label: go()
2466
+ }, {
2467
+ command: '',
2468
+ flags: SubMenu,
2469
+ id: Run,
2470
+ keyboardShortCut: 'Alt+r',
2471
+ label: run()
2472
+ }, {
2473
+ command: '',
2474
+ flags: SubMenu,
2475
+ id: Terminal,
2476
+ keyboardShortCut: 'Alt+t',
2477
+ label: terminal()
2478
+ }, {
2479
+ command: '',
2480
+ flags: SubMenu,
2481
+ id: Help,
2482
+ keyboardShortCut: 'Alt+h',
2483
+ label: help()
2484
+ }];
2485
+ };
2486
+
2487
+ const getMenuEntries$2 = () => {
2488
+ return [{
2489
+ command: '',
2490
+ flags: None,
2491
+ id: File$1,
2492
+ label: file()
2493
+ }, {
2494
+ command: '',
2495
+ flags: None,
2496
+ id: Edit,
2497
+ label: edit()
2498
+ }, {
2499
+ command: '',
2500
+ flags: None,
2501
+ id: Selection,
2502
+ label: selection()
2503
+ }, {
2504
+ command: '',
2505
+ flags: None,
2506
+ id: View,
2507
+ label: view()
2508
+ }, {
2509
+ command: '',
2510
+ flags: None,
2511
+ id: Go,
2512
+ label: go()
2513
+ }, {
2514
+ command: '',
2515
+ flags: None,
2516
+ id: Help,
2517
+ label: help()
2518
+ }];
2519
+ };
2520
+
2521
+ const getFn$1 = platform => {
2522
+ switch (platform) {
2523
+ case Web:
2524
+ return getMenuEntries$2;
2525
+ default:
2526
+ return getMenuEntries$3;
2527
+ }
2528
+ };
2529
+ const getMenuEntries$1 = async platform => {
2530
+ const fn = getFn$1(platform);
2531
+ return fn();
2532
+ };
2533
+
2534
+ const getFn = id => {
2535
+ switch (id) {
2536
+ case Edit$2:
2537
+ return getMenuEntries$c;
2538
+ case File$3:
2539
+ return getMenuEntries$b;
2540
+ case Go$2:
2541
+ return getMenuEntries$a;
2542
+ case Help$2:
2543
+ return getMenuEntries$9;
2544
+ case OpenRecent$1:
2545
+ return getMenuEntries$8;
2546
+ case Run$2:
2547
+ return getMenuEntries$7;
2548
+ case Selection$2:
2549
+ return getMenuEntries$6;
2550
+ case Terminal$2:
2551
+ return getMenuEntries$5;
2552
+ case TitleBar:
2553
+ return getMenuEntries$1;
2554
+ case View$2:
2555
+ return getMenuEntries$4;
2556
+ default:
2557
+ return undefined;
2558
+ }
2559
+ };
2560
+ const getMenuEntries = async (id, ...args) => {
2561
+ try {
2562
+ const fn = getFn(id);
2563
+ // @ts-ignore
2564
+ return fn(...args);
2565
+ } catch (error) {
2566
+ throw new VError(error, `Failed to load menu entries for id ${id}`);
2567
+ }
2568
+ };
2569
+
3012
2570
  const loadContent2 = async state => {
3013
2571
  const {
3014
2572
  controlsOverlayEnabled,
@@ -3020,10 +2578,9 @@ const loadContent2 = async state => {
3020
2578
  platform,
3021
2579
  titleBarStyleCustom
3022
2580
  } = state;
3023
- const titleBarEntries = await getMenuEntries(TitleBar$1);
2581
+ const titleBarEntries = await getMenuEntries(TitleBar);
3024
2582
  const withWidths = addWidths(titleBarEntries, labelPadding, labelFontWeight, labelFontSize, labelFontFamily, labelLetterSpacing);
3025
2583
  const buttons = getTitleBarButtons(platform, controlsOverlayEnabled, titleBarStyleCustom);
3026
- // @ts-ignore
3027
2584
  const workspaceUri = await invoke('Workspace.getUri');
3028
2585
  const title = getTitle(workspaceUri);
3029
2586
  const iconWidth = 30;
@@ -3292,7 +2849,10 @@ const renderMenus = (oldState, newState) => {
3292
2849
  } else if (difference < 0) {
3293
2850
  changes.push(['closeMenus', newLength]);
3294
2851
  }
3295
- return ['Viewlet.send', newState.uid, /* method */SetMenus, /* changes */changes, newState.uid];
2852
+ const {
2853
+ uid
2854
+ } = newState;
2855
+ return ['Viewlet.send', uid, /* method */SetMenus, /* changes */changes, uid];
3296
2856
  };
3297
2857
 
3298
2858
  const getIcon = assetDir => {
@@ -3413,7 +2973,7 @@ const getTitleBarMenuBarVirtualDom = (visibleItems, focusedIndex) => {
3413
2973
  onMouseDown: HandleClick,
3414
2974
  onPointerOut: HandlePointerOut,
3415
2975
  onPointerOver: HandlePointerOver,
3416
- role: MenuBar,
2976
+ role: MenuBar$1,
3417
2977
  tabIndex: 0,
3418
2978
  type: Div
3419
2979
  }, ...getTitleBarMenuBarItemsVirtualDom(visibleItems)];
@@ -3537,8 +3097,8 @@ const render3 = async (uid, diffResult) => {
3537
3097
  const {
3538
3098
  newState,
3539
3099
  oldState
3540
- } = get$1(uid);
3541
- set$3(uid, newState, newState);
3100
+ } = get(uid);
3101
+ set(uid, newState, newState);
3542
3102
  const commands = [];
3543
3103
  for (const item of diffResult) {
3544
3104
  const fn = getRenderer3(item);
@@ -3618,9 +3178,18 @@ const saveState = state => {
3618
3178
  };
3619
3179
  };
3620
3180
 
3181
+ const setPlatform = (state, platform) => {
3182
+ return {
3183
+ ...state,
3184
+ platform
3185
+ };
3186
+ };
3187
+
3621
3188
  const showCommandCenter = async state => {
3622
- // TODO
3623
- return state;
3189
+ return {
3190
+ ...state,
3191
+ commandCenterEnabled: true
3192
+ };
3624
3193
  };
3625
3194
 
3626
3195
  const showMenuBar = async state => {
@@ -3650,7 +3219,7 @@ const create = (id, uri, x, y, width, height) => {
3650
3219
  x,
3651
3220
  y
3652
3221
  };
3653
- set$3(id, state, state);
3222
+ set(id, state, state);
3654
3223
  return state;
3655
3224
  };
3656
3225
 
@@ -4136,7 +3705,6 @@ const toggleMenu = async state => {
4136
3705
  return openMenu(state, /* focus */false);
4137
3706
  };
4138
3707
 
4139
- /* eslint-disable @typescript-eslint/no-deprecated */
4140
3708
  const commandMap = {
4141
3709
  'TitleBar.closeMenu': closeMenu,
4142
3710
  'TitleBar.create': create,
@@ -4152,11 +3720,9 @@ const commandMap = {
4152
3720
  'TitleBar.focusPrevious': wrapCommand(focusPrevious),
4153
3721
  'TitleBar.getCommandIds': getCommandIds,
4154
3722
  'TitleBar.getCommands': getCommandIds,
4155
- 'TitleBar.getKeyBindings': getKeyBindings$1,
4156
- 'TitleBar.getMenuEntries': getMenuEntries$1,
3723
+ 'TitleBar.getKeyBindings': getKeyBindings,
4157
3724
  'TitleBar.getMenuEntries2': getMenuEntries2,
4158
3725
  'TitleBar.getMenuIds': getMenuIds,
4159
- 'TitleBar.getMenus': getMenus,
4160
3726
  'TitleBar.handleButtonsClick': handleClick$1,
4161
3727
  'TitleBar.handleClick': wrapCommand(handleClick),
4162
3728
  'TitleBar.handleClickAt': wrapCommand(handleClickAt),
@@ -4188,6 +3754,7 @@ const commandMap = {
4188
3754
  'TitleBar.renderEventListeners': renderEventListeners,
4189
3755
  'TitleBar.resize': wrapCommand(resize),
4190
3756
  'TitleBar.saveState': wrapGetter(saveState),
3757
+ 'TitleBar.setPlatform': wrapCommand(setPlatform),
4191
3758
  'TitleBar.showCommandCenter': wrapCommand(showCommandCenter),
4192
3759
  'TitleBar.showMenuBar': wrapCommand(showMenuBar),
4193
3760
  'TitleBar.terminate': terminate,
@@ -4195,23 +3762,12 @@ const commandMap = {
4195
3762
  'TitleBar.toggleMenu': wrapCommand(toggleMenu)
4196
3763
  };
4197
3764
 
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
3765
  const listen = async () => {
4210
3766
  registerCommands(commandMap);
4211
3767
  const rpc = await WebWorkerRpcClient.create({
4212
3768
  commandMap: commandMap
4213
3769
  });
4214
- set(rpc);
3770
+ set$1(rpc);
4215
3771
  };
4216
3772
 
4217
3773
  const main = async () => {