@lvce-editor/title-bar-worker 3.3.0 → 3.4.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.
@@ -237,8 +237,8 @@ const getModuleNotFoundError = stderr => {
237
237
  const messageIndex = lines.findIndex(isModuleNotFoundMessage);
238
238
  const message = lines[messageIndex];
239
239
  return {
240
- message,
241
- code: ERR_MODULE_NOT_FOUND
240
+ code: ERR_MODULE_NOT_FOUND,
241
+ message
242
242
  };
243
243
  };
244
244
  const isModuleNotFoundError = stderr => {
@@ -261,14 +261,14 @@ const isUnhelpfulNativeModuleError = stderr => {
261
261
  const getNativeModuleErrorMessage = stderr => {
262
262
  const message = getMessageCodeBlock(stderr);
263
263
  return {
264
- message: `Incompatible native node module: ${message}`,
265
- code: E_INCOMPATIBLE_NATIVE_MODULE
264
+ code: E_INCOMPATIBLE_NATIVE_MODULE,
265
+ message: `Incompatible native node module: ${message}`
266
266
  };
267
267
  };
268
268
  const getModuleSyntaxError = () => {
269
269
  return {
270
- message: `ES Modules are not supported in electron`,
271
- code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
270
+ code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
271
+ message: `ES Modules are not supported in electron`
272
272
  };
273
273
  };
274
274
  const getHelpfulChildProcessError = (stdout, stderr) => {
@@ -287,8 +287,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
287
287
  rest
288
288
  } = getDetails(lines);
289
289
  return {
290
- message: actualMessage,
291
290
  code: '',
291
+ message: actualMessage,
292
292
  stack: rest
293
293
  };
294
294
  };
@@ -298,8 +298,8 @@ class IpcError extends VError {
298
298
  if (stdout || stderr) {
299
299
  // @ts-ignore
300
300
  const {
301
- message,
302
301
  code,
302
+ message,
303
303
  stack
304
304
  } = getHelpfulChildProcessError(stdout, stderr);
305
305
  const cause = new Error(message);
@@ -360,8 +360,8 @@ const wrap$f = global => {
360
360
  };
361
361
  const waitForFirstMessage = async port => {
362
362
  const {
363
- resolve,
364
- promise
363
+ promise,
364
+ resolve
365
365
  } = Promise.withResolvers();
366
366
  port.addEventListener('message', resolve, {
367
367
  once: true
@@ -381,8 +381,8 @@ const listen$6 = async () => {
381
381
  const type = firstMessage.params[0];
382
382
  if (type === 'message-port') {
383
383
  parentIpc.send({
384
- jsonrpc: '2.0',
385
384
  id: firstMessage.id,
385
+ jsonrpc: '2.0',
386
386
  result: null
387
387
  });
388
388
  parentIpc.dispose();
@@ -893,21 +893,10 @@ const WebWorkerRpcClient = {
893
893
  };
894
894
 
895
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';
902
896
 
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;
897
+ const Div$1 = 4;
909
898
 
910
- const Button = 'event.button';
899
+ const Button$1 = 'event.button';
911
900
  const ClientX = 'event.clientX';
912
901
  const ClientY = 'event.clientY';
913
902
  const TargetName = 'event.target.name';
@@ -915,16 +904,16 @@ const TargetName = 'event.target.name';
915
904
  const Backspace$1 = 1;
916
905
  const Tab$1 = 2;
917
906
  const Enter$1 = 3;
918
- const Escape$1 = 8;
919
- const Space$1 = 9;
907
+ const Escape$2 = 8;
908
+ const Space$2 = 9;
920
909
  const PageUp$1 = 10;
921
910
  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;
911
+ const End$2 = 255;
912
+ const Home$2 = 12;
913
+ const LeftArrow$2 = 13;
914
+ const UpArrow$2 = 14;
915
+ const RightArrow$2 = 15;
916
+ const DownArrow$2 = 16;
928
917
  const Insert$1 = 17;
929
918
  const Delete$1 = 18;
930
919
  const Digit0$1 = 19;
@@ -981,16 +970,16 @@ const Unknown = 'Unknown';
981
970
  const Backspace = 'Backspace';
982
971
  const Tab = 'Tab';
983
972
  const Enter = 'Enter';
984
- const Escape = 'Escape';
985
- const Space = 'Space';
973
+ const Escape$1 = 'Escape';
974
+ const Space$1 = 'Space';
986
975
  const PageUp = 'PageUp';
987
976
  const PageDown = 'PageDown';
988
- const End = 'End';
989
- const Home = 'Home';
990
- const LeftArrow = 'LeftArrow';
991
- const UpArrow = 'UpArrow';
992
- const RightArrow = 'RightArrow';
993
- const DownArrow = 'DownArrow';
977
+ const End$1 = 'End';
978
+ const Home$1 = 'Home';
979
+ const LeftArrow$1 = 'LeftArrow';
980
+ const UpArrow$1 = 'UpArrow';
981
+ const RightArrow$1 = 'RightArrow';
982
+ const DownArrow$1 = 'DownArrow';
994
983
  const Insert = 'Insert';
995
984
  const Delete = 'Delete';
996
985
  const Digit0 = '0';
@@ -1045,34 +1034,14 @@ const Plus = '+';
1045
1034
 
1046
1035
  const getKeyCodeString = keyCode => {
1047
1036
  switch (keyCode) {
1037
+ case Backquote$1:
1038
+ return Backquote;
1039
+ case Backslash$1:
1040
+ return Backslash;
1048
1041
  case Backspace$1:
1049
1042
  return Backspace;
1050
- case Tab$1:
1051
- return Tab;
1052
- case Escape$1:
1053
- return Escape;
1054
- case Enter$1:
1055
- return Enter;
1056
- case Space$1:
1057
- return Space;
1058
- case PageUp$1:
1059
- return PageUp;
1060
- case PageDown$1:
1061
- return PageDown;
1062
- case End$1:
1063
- return End;
1064
- case Home$1:
1065
- return Home;
1066
- case LeftArrow$1:
1067
- return LeftArrow;
1068
- case UpArrow$1:
1069
- return UpArrow;
1070
- case RightArrow$1:
1071
- return RightArrow;
1072
- case DownArrow$1:
1073
- return DownArrow;
1074
- case Insert$1:
1075
- return Insert;
1043
+ case Comma$1:
1044
+ return Comma;
1076
1045
  case Delete$1:
1077
1046
  return Delete;
1078
1047
  case Digit0$1:
@@ -1095,6 +1064,32 @@ const getKeyCodeString = keyCode => {
1095
1064
  return Digit8;
1096
1065
  case Digit9$1:
1097
1066
  return Digit9;
1067
+ case DownArrow$2:
1068
+ return DownArrow$1;
1069
+ case End$2:
1070
+ return End$1;
1071
+ case Enter$1:
1072
+ return Enter;
1073
+ case Equal$1:
1074
+ return Equal;
1075
+ case Escape$2:
1076
+ return Escape$1;
1077
+ case F1$1:
1078
+ return F1;
1079
+ case F2$1:
1080
+ return F2;
1081
+ case F3$1:
1082
+ return F3;
1083
+ case F4$1:
1084
+ return F4;
1085
+ case F5$1:
1086
+ return F5;
1087
+ case F6$1:
1088
+ return F6;
1089
+ case Home$2:
1090
+ return Home$1;
1091
+ case Insert$1:
1092
+ return Insert;
1098
1093
  case KeyA$1:
1099
1094
  return KeyA;
1100
1095
  case KeyB$1:
@@ -1147,32 +1142,26 @@ const getKeyCodeString = keyCode => {
1147
1142
  return KeyY;
1148
1143
  case KeyZ$1:
1149
1144
  return KeyZ;
1150
- case F1$1:
1151
- return F1;
1152
- case F2$1:
1153
- return F2;
1154
- case F3$1:
1155
- return F3;
1156
- case F4$1:
1157
- return F4;
1158
- case F5$1:
1159
- return F5;
1160
- case F6$1:
1161
- return F6;
1162
- case Backslash$1:
1163
- return Backslash;
1164
- case Equal$1:
1165
- return Equal;
1166
- case Comma$1:
1167
- return Comma;
1168
- case Backquote$1:
1169
- return Backquote;
1145
+ case LeftArrow$2:
1146
+ return LeftArrow$1;
1147
+ case Minus$1:
1148
+ return Minus;
1149
+ case PageDown$1:
1150
+ return PageDown;
1151
+ case PageUp$1:
1152
+ return PageUp;
1170
1153
  case Plus$1:
1171
1154
  return Plus;
1155
+ case RightArrow$2:
1156
+ return RightArrow$1;
1157
+ case Space$2:
1158
+ return Space$1;
1172
1159
  case Star$1:
1173
1160
  return Star;
1174
- case Minus$1:
1175
- return Minus;
1161
+ case Tab$1:
1162
+ return Tab;
1163
+ case UpArrow$2:
1164
+ return UpArrow$1;
1176
1165
  default:
1177
1166
  return Unknown;
1178
1167
  }
@@ -1184,24 +1173,26 @@ const Shift = 1 << 10 >>> 0;
1184
1173
  const Edit$2 = 2;
1185
1174
  const File$3 = 5;
1186
1175
  const Go$2 = 6;
1187
- const Help$2 = 7;
1176
+ const Help$3 = 7;
1188
1177
  const OpenRecent$1 = 9;
1189
1178
  const Run$2 = 10;
1190
1179
  const Selection$2 = 11;
1191
1180
  const Terminal$2 = 14;
1192
- const TitleBar = 15;
1181
+ const TitleBar$1 = 15;
1193
1182
  const View$2 = 16;
1194
1183
  const TitleBarContextMenu = 90;
1195
1184
 
1185
+ const SubMenu$2 = 4;
1186
+
1196
1187
  const parseKey = rawKey => {
1197
1188
  const isCtrl = Boolean(rawKey & CtrlCmd);
1198
1189
  const isShift = Boolean(rawKey & Shift);
1199
1190
  const keyCode = rawKey & 0x00_00_00_ff;
1200
1191
  const key = getKeyCodeString(keyCode);
1201
1192
  return {
1202
- key,
1203
1193
  isCtrl,
1204
- isShift
1194
+ isShift,
1195
+ key
1205
1196
  };
1206
1197
  };
1207
1198
 
@@ -1219,6 +1210,10 @@ const get$1 = id => {
1219
1210
 
1220
1211
  const create$2 = rpcId => {
1221
1212
  return {
1213
+ async dispose() {
1214
+ const rpc = get$1(rpcId);
1215
+ await rpc.dispose();
1216
+ },
1222
1217
  // @ts-ignore
1223
1218
  invoke(method, ...params) {
1224
1219
  const rpc = get$1(rpcId);
@@ -1233,17 +1228,14 @@ const create$2 = rpcId => {
1233
1228
  },
1234
1229
  set(rpc) {
1235
1230
  set$2(rpcId, rpc);
1236
- },
1237
- async dispose() {
1238
- const rpc = get$1(rpcId);
1239
- await rpc.dispose();
1240
1231
  }
1241
1232
  };
1242
1233
  };
1243
1234
 
1244
1235
  const {
1245
1236
  invoke,
1246
- set: set$1} = create$2(RendererWorker);
1237
+ set: set$1
1238
+ } = create$2(RendererWorker);
1247
1239
 
1248
1240
  const toCommandId = key => {
1249
1241
  const dotIndex = key.indexOf('.');
@@ -1339,6 +1331,7 @@ const createDefaultState = (uid = DEFAULT_UID) => ({
1339
1331
  assetDir: '',
1340
1332
  buttons: [],
1341
1333
  commandCenterEnabled: false,
1334
+ commandMap: {},
1342
1335
  controlsOverlayEnabled: false,
1343
1336
  focusedIndex: -1,
1344
1337
  height: 30,
@@ -1385,12 +1378,13 @@ const About = 'About';
1385
1378
  const CheckForUpdates = 'Check For Updates';
1386
1379
  const ClearRecentlyOpened = 'Clear Recently Opened';
1387
1380
  const Close = 'Close';
1388
- const MenuBar = 'Menu Bar';
1381
+ const Exit = 'Exit';
1382
+ const MenuBar$1 = 'Menu Bar';
1389
1383
  const CommandCenter = 'Command Center';
1390
1384
  const Edit$1 = 'Edit';
1391
1385
  const File$2 = 'File';
1392
1386
  const Go$1 = 'Go';
1393
- const Help$1 = 'Help';
1387
+ const Help$2 = 'Help';
1394
1388
  const Maximize = 'Maximize';
1395
1389
  const Minimize = 'Minimize';
1396
1390
  const MoreDot = 'More ...';
@@ -1406,22 +1400,22 @@ const AddCursorBelow = 'Add Cursor Below';
1406
1400
  const AddCursorsToLineEnds = 'Add Cursors to Line ends';
1407
1401
  const AddNextOccurrence = 'Add Next Occurrence';
1408
1402
  const AddPreviousOccurrence = 'Add Previous Occurrence';
1409
- const Copy = 'Copy';
1403
+ const Copy$1 = 'Copy';
1410
1404
  const CopyLineDown = 'Copy Line Down';
1411
1405
  const CopyLineUp = 'Copy Line Up';
1412
- const Cut = 'Cut';
1406
+ const Cut$1 = 'Cut';
1413
1407
  const DuplicateSelection = 'Duplicate Selection';
1414
1408
  const ExpandSelection = 'Expand Selection';
1415
1409
  const MoveLineDown = 'Move Line Down';
1416
1410
  const MoveLineUp = 'Move Line Up';
1417
- const Paste = 'Paste';
1418
- const Redo = 'Redo';
1419
- const SelectAll = 'Select All';
1411
+ const Paste$1 = 'Paste';
1412
+ const Redo$1 = 'Redo';
1413
+ const SelectAll$1 = 'Select All';
1420
1414
  const SelectAllOccurrences = 'Select All Occurrences';
1421
1415
  const ShrinkSelection = 'Shrink Selection';
1422
1416
  const ToggleBlockComment = 'Toggle Block Comment';
1423
1417
  const ToggleLineComment = 'Toggle Line Comment';
1424
- const Undo = 'Undo';
1418
+ const Undo$1 = 'Undo';
1425
1419
 
1426
1420
  const file = () => {
1427
1421
  return i18nString(File$2);
@@ -1445,7 +1439,7 @@ const terminal = () => {
1445
1439
  return i18nString(Terminal$1);
1446
1440
  };
1447
1441
  const help = () => {
1448
- return i18nString(Help$1);
1442
+ return i18nString(Help$2);
1449
1443
  };
1450
1444
  const minimize$1 = () => {
1451
1445
  return i18nString(Minimize);
@@ -1457,11 +1451,35 @@ const close$1 = () => {
1457
1451
  return i18nString(Close);
1458
1452
  };
1459
1453
  const menuBar = () => {
1460
- return i18nString(MenuBar);
1454
+ return i18nString(MenuBar$1);
1461
1455
  };
1462
1456
  const commandCenter = () => {
1463
1457
  return i18nString(CommandCenter);
1464
1458
  };
1459
+ const copy$1 = () => {
1460
+ return i18nString(Copy$1);
1461
+ };
1462
+ const cut$1 = () => {
1463
+ return i18nString(Cut$1);
1464
+ };
1465
+ const exit$1 = () => {
1466
+ return i18nString(Exit);
1467
+ };
1468
+ const paste$1 = () => {
1469
+ return i18nString(Paste$1);
1470
+ };
1471
+ const redo$1 = () => {
1472
+ return i18nString(Redo$1);
1473
+ };
1474
+ const selectAll$1 = () => {
1475
+ return i18nString(SelectAll$1);
1476
+ };
1477
+ const toggleDeveloperTools$1 = () => {
1478
+ return i18nString(ToggleDeveloperTools);
1479
+ };
1480
+ const undo$1 = () => {
1481
+ return i18nString(Undo$1);
1482
+ };
1465
1483
 
1466
1484
  const getTitleBarButtonsElectron = (controlsOverlayEnabled, titleBarStyleCustom) => {
1467
1485
  if (controlsOverlayEnabled) {
@@ -1525,6 +1543,7 @@ const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled,
1525
1543
  ...createDefaultState(),
1526
1544
  assetDir,
1527
1545
  commandCenterEnabled: false,
1546
+ commandMap: {},
1528
1547
  controlsOverlayEnabled,
1529
1548
  focusedIndex: -1,
1530
1549
  height,
@@ -1610,110 +1629,39 @@ const diff3 = uid => {
1610
1629
  return diffResult;
1611
1630
  };
1612
1631
 
1613
- const mergeClassNames = (...classNames) => {
1614
- return classNames.filter(Boolean).join(' ');
1615
- };
1616
-
1617
- const px = value => {
1618
- return `${value}px`;
1619
- };
1620
-
1621
- const text = data => {
1622
- return {
1623
- type: Text,
1624
- text: data,
1625
- childCount: 0
1626
- };
1627
- };
1628
-
1629
- const getKeyBindings = () => {
1630
- return [{
1631
- command: 'TitleBar.handleKeyArrowDown',
1632
- key: DownArrow$1,
1633
- when: FocusTitleBarMenuBar
1634
- }, {
1635
- command: 'TitleBar.handleKeyArrowUp',
1636
- key: UpArrow$1,
1637
- when: FocusTitleBarMenuBar
1638
- }, {
1639
- command: 'TitleBar.handleKeyArrowRight',
1640
- key: RightArrow$1,
1641
- when: FocusTitleBarMenuBar
1642
- }, {
1643
- command: 'TitleBar.handleKeyArrowLeft',
1644
- key: LeftArrow$1,
1645
- when: FocusTitleBarMenuBar
1646
- }, {
1647
- command: 'TitleBar.handleKeySpace',
1648
- key: Space$1,
1649
- when: FocusTitleBarMenuBar
1650
- }, {
1651
- command: 'TitleBar.handleKeyHome',
1652
- key: Home$1,
1653
- when: FocusTitleBarMenuBar
1654
- }, {
1655
- command: 'TitleBar.handleKeyEnd',
1656
- key: End$1,
1657
- when: FocusTitleBarMenuBar
1658
- }, {
1659
- command: 'TitleBar.handleKeyEscape',
1660
- key: Escape$1,
1661
- when: FocusTitleBarMenuBar
1662
- }];
1632
+ const getEntryMap = async modules => {
1633
+ const map = Object.create(null);
1634
+ for (const module of modules) {
1635
+ const {
1636
+ id
1637
+ } = module;
1638
+ const entries = await module.getMenuEntries();
1639
+ map[id] = entries;
1640
+ }
1641
+ return map;
1663
1642
  };
1664
1643
 
1665
- const Separator = 1;
1666
- const None = 0;
1667
- const SubMenu = 4;
1668
- const Checked = 2;
1669
- const Unchecked = 3;
1670
- const Disabled = 5;
1671
- const RestoreFocus = 6;
1672
- const Ignore = 7;
1644
+ // TODO cache window id
1673
1645
 
1674
- const getMenuEntriesTitleBarContextMenu = async state => {
1675
- const {
1676
- commandCenterEnabled,
1677
- titleBarMenuBarEnabled
1678
- } = state;
1679
- // TODO checked state should be depending on whether or not that feature is currently visible or not
1680
- return [{
1681
- command: titleBarMenuBarEnabled ? 'TitleBar.hideMenuBar' : 'TitleBar.showMenuBar',
1682
- flags: titleBarMenuBarEnabled ? Checked : Unchecked,
1683
- id: 'MenuBar',
1684
- label: menuBar()
1685
- }, {
1686
- command: commandCenterEnabled ? 'TitleBar.hideCommandCenter' : 'TitleBar.showCommandCenter',
1687
- flags: commandCenterEnabled ? Checked : Unchecked,
1688
- id: 'Command center',
1689
- label: commandCenter()
1690
- }, {
1691
- command: '',
1692
- flags: Checked,
1693
- id: 'layout controls',
1694
- label: 'layout controls'
1695
- }];
1696
- };
1697
-
1698
- const MenuIdTitleBarContextMenu = 50;
1699
- const getMenuIds = () => {
1700
- return [Edit$2, File$3, Go$2, Help$2, OpenRecent$1, Run$2, Selection$2, Terminal$2, TitleBar, View$2, MenuIdTitleBarContextMenu, TitleBarContextMenu];
1646
+ const getWindowId = async () => {
1647
+ const windowId = await invoke('GetWindowId.getWindowId');
1648
+ return windowId;
1701
1649
  };
1702
1650
 
1703
1651
  const cut = () => {
1704
- return i18nString(Cut);
1652
+ return i18nString(Cut$1);
1705
1653
  };
1706
1654
  const copy = () => {
1707
- return i18nString(Copy);
1655
+ return i18nString(Copy$1);
1708
1656
  };
1709
1657
  const paste = () => {
1710
- return i18nString(Paste);
1658
+ return i18nString(Paste$1);
1711
1659
  };
1712
1660
  const undo = () => {
1713
- return i18nString(Undo);
1661
+ return i18nString(Undo$1);
1714
1662
  };
1715
1663
  const redo = () => {
1716
- return i18nString(Redo);
1664
+ return i18nString(Redo$1);
1717
1665
  };
1718
1666
  const toggleLineComment = () => {
1719
1667
  return i18nString(ToggleLineComment);
@@ -1722,7 +1670,7 @@ const toggleBlockComment = () => {
1722
1670
  return i18nString(ToggleBlockComment);
1723
1671
  };
1724
1672
  const selectAll = () => {
1725
- return i18nString(SelectAll);
1673
+ return i18nString(SelectAll$1);
1726
1674
  };
1727
1675
  const expandSelection = () => {
1728
1676
  return i18nString(ExpandSelection);
@@ -1764,9 +1712,18 @@ const selectAllOccurrences = () => {
1764
1712
  return i18nString(SelectAllOccurrences);
1765
1713
  };
1766
1714
 
1715
+ const Separator$2 = 1;
1716
+ const None$1 = 0;
1717
+ const SubMenu$1 = 4;
1718
+ const Checked = 2;
1719
+ const Unchecked = 3;
1720
+ const Disabled = 5;
1721
+ const RestoreFocus = 6;
1722
+ const Ignore = 7;
1723
+
1767
1724
  const menuEntrySeparator = {
1768
1725
  command: '',
1769
- flags: Separator,
1726
+ flags: Separator$2,
1770
1727
  id: 'separator',
1771
1728
  label: ''
1772
1729
  };
@@ -1774,42 +1731,47 @@ const menuEntrySeparator = {
1774
1731
  const getMenuEntries$c = () => {
1775
1732
  return [{
1776
1733
  command: /* TODO */'-1',
1777
- flags: None,
1734
+ flags: None$1,
1778
1735
  id: 'undo',
1779
1736
  label: undo()
1780
1737
  }, {
1781
1738
  command: /* TODO */'-1',
1782
- flags: None,
1739
+ flags: None$1,
1783
1740
  id: 'redo',
1784
1741
  label: redo()
1785
1742
  }, menuEntrySeparator, {
1786
1743
  command: /* Editor.cut */'Editor.cut',
1787
- flags: None,
1744
+ flags: None$1,
1788
1745
  id: 'cut',
1789
1746
  label: cut()
1790
1747
  }, {
1791
1748
  command: /* Editor.copy */'Editor.copy',
1792
- flags: None,
1749
+ flags: None$1,
1793
1750
  id: 'copy',
1794
1751
  label: copy()
1795
1752
  }, {
1796
1753
  command: /* Editor.paste */'Editor.paste',
1797
- flags: None,
1754
+ flags: None$1,
1798
1755
  id: 'paste',
1799
1756
  label: paste()
1800
1757
  }, menuEntrySeparator, {
1801
1758
  command: /* Editor.toggleLineComment */'Editor.toggleLineComment',
1802
- flags: None,
1759
+ flags: None$1,
1803
1760
  id: 'toggle-line-comment',
1804
1761
  label: toggleLineComment()
1805
1762
  }, {
1806
1763
  command: /* Editor.toggleBlockComment */'Editor.toggleBlockComment',
1807
- flags: None,
1764
+ flags: None$1,
1808
1765
  id: 'toggle-block-comment',
1809
1766
  label: toggleBlockComment()
1810
1767
  }];
1811
1768
  };
1812
1769
 
1770
+ const MenuEntriesEdit = {
1771
+ __proto__: null,
1772
+ getMenuEntries: getMenuEntries$c
1773
+ };
1774
+
1813
1775
  /**
1814
1776
  * @enum {string}
1815
1777
  */
@@ -1850,27 +1812,28 @@ const exit = () => {
1850
1812
  const Edit = 2;
1851
1813
  const File$1 = 5;
1852
1814
  const Go = 6;
1853
- const Help = 7;
1815
+ const Help$1 = 7;
1854
1816
  const OpenRecent = 9;
1855
1817
  const Run = 10;
1856
1818
  const Selection = 11;
1857
1819
  const Terminal = 14;
1820
+ const TitleBar = 15;
1858
1821
  const View = 16;
1859
1822
 
1860
1823
  const getMenuEntries$b = platform => {
1861
1824
  const entries = [{
1862
1825
  command: '-1',
1863
- flags: None,
1826
+ flags: None$1,
1864
1827
  id: 'newFile',
1865
1828
  label: newFile()
1866
1829
  }, {
1867
1830
  command: 'Window.openNew',
1868
- flags: None,
1831
+ flags: None$1,
1869
1832
  id: 'newWindow',
1870
1833
  label: newWindow()
1871
1834
  }, menuEntrySeparator, {
1872
1835
  command: 'Dialog.openFile',
1873
- flags: None,
1836
+ flags: None$1,
1874
1837
  id: 'openFile',
1875
1838
  label: openFile()
1876
1839
  }, {
@@ -1880,17 +1843,17 @@ const getMenuEntries$b = platform => {
1880
1843
  label: openFolder()
1881
1844
  }, {
1882
1845
  command: '',
1883
- flags: SubMenu,
1846
+ flags: SubMenu$1,
1884
1847
  id: OpenRecent,
1885
1848
  label: openRecent()
1886
1849
  }, menuEntrySeparator, {
1887
1850
  command: 'Main.save',
1888
- flags: None,
1851
+ flags: None$1,
1889
1852
  id: 'save',
1890
1853
  label: save()
1891
1854
  }, {
1892
1855
  command: 'Main.saveAll',
1893
- flags: None,
1856
+ flags: None$1,
1894
1857
  id: 'saveAll',
1895
1858
  label: saveAll()
1896
1859
  }];
@@ -1905,10 +1868,20 @@ const getMenuEntries$b = platform => {
1905
1868
  return entries;
1906
1869
  };
1907
1870
 
1871
+ const MenuEntriesFile = {
1872
+ __proto__: null,
1873
+ getMenuEntries: getMenuEntries$b
1874
+ };
1875
+
1908
1876
  const getMenuEntries$a = () => {
1909
1877
  return [];
1910
1878
  };
1911
1879
 
1880
+ const MenuEntriesGo = {
1881
+ __proto__: null,
1882
+ getMenuEntries: getMenuEntries$a
1883
+ };
1884
+
1912
1885
  const toggleDeveloperTools = () => {
1913
1886
  return i18nString(ToggleDeveloperTools);
1914
1887
  };
@@ -1935,7 +1908,7 @@ const getMenuEntries$9 = async platform => {
1935
1908
  if (platform !== Web) {
1936
1909
  entries.push({
1937
1910
  command: 'Developer.toggleDeveloperTools',
1938
- flags: None,
1911
+ flags: None$1,
1939
1912
  id: 'toggleDeveloperTools',
1940
1913
  label: toggleDeveloperTools()
1941
1914
  }, {
@@ -1958,164 +1931,449 @@ const getMenuEntries$9 = async platform => {
1958
1931
  }
1959
1932
  entries.push({
1960
1933
  command: 'About.showAbout',
1961
- flags: None,
1934
+ flags: None$1,
1962
1935
  id: 'about',
1963
1936
  label: about()
1964
1937
  });
1965
1938
  return entries;
1966
1939
  };
1967
1940
 
1968
- const getRecentlyOpened = () => {
1969
- return invoke(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
1970
- };
1971
-
1972
- const File = 'file://';
1973
-
1974
- const getTitle$1 = (homeDir, uri) => {
1975
- if (!uri) {
1976
- return '';
1977
- }
1978
- if (uri.startsWith(File)) {
1979
- return uri.slice(File.length);
1980
- }
1981
- return uri;
1982
- };
1983
-
1984
- const moreDot = () => {
1985
- return i18nString(MoreDot);
1986
- };
1987
- const clearRecentlyOpened = () => {
1988
- return i18nString(ClearRecentlyOpened);
1941
+ const MenuEntriesHelp = {
1942
+ __proto__: null,
1943
+ getMenuEntries: getMenuEntries$9
1989
1944
  };
1990
1945
 
1991
- const getHomeDir = () => {
1992
- return '';
1946
+ const getMenuEntries$8 = () => {
1947
+ return [];
1993
1948
  };
1994
1949
 
1995
- const MAX_MENU_RECENT_ENTRIES = 10;
1996
- const toMenuItem = folder => {
1997
- const homeDir = getHomeDir();
1998
- const label = getTitle$1(homeDir, folder);
1999
- return {
2000
- args: [folder],
2001
- command: 'Workspace.setPath',
2002
- flags: None,
2003
- label
2004
- };
2005
- };
2006
- const getMenuEntries$8 = async () => {
2007
- const allItems = await getRecentlyOpened();
2008
- const itemsToShow = allItems.slice(0, MAX_MENU_RECENT_ENTRIES);
2009
- const items = [];
2010
- if (itemsToShow.length > 0) {
2011
- items.push(...itemsToShow.map(toMenuItem), menuEntrySeparator);
2012
- }
2013
- items.push({
2014
- command: 'QuickPick.showRecent',
2015
- flags: None,
2016
- id: 'more',
2017
- label: moreDot()
2018
- }, menuEntrySeparator, {
2019
- command: 'RecentlyOpened.clearRecentlyOpened',
2020
- flags: None,
2021
- id: 'clearRecentlyOpened',
2022
- label: clearRecentlyOpened()
2023
- });
2024
- return items;
1950
+ const MenuEntriesRun = {
1951
+ __proto__: null,
1952
+ getMenuEntries: getMenuEntries$8
2025
1953
  };
2026
1954
 
2027
1955
  const getMenuEntries$7 = () => {
2028
- return [];
2029
- };
2030
-
2031
- const getMenuEntries$6 = () => {
2032
1956
  return [{
2033
1957
  command: 'Editor.selectAll',
2034
- flags: None,
1958
+ flags: None$1,
2035
1959
  id: 'selectAll',
2036
1960
  label: selectAll()
2037
1961
  }, {
2038
1962
  command: 'Editor.expandSelection',
2039
- flags: None,
1963
+ flags: None$1,
2040
1964
  id: 'expandSelection',
2041
1965
  label: expandSelection()
2042
1966
  }, {
2043
1967
  command: 'Editor.shrinkSelection',
2044
- flags: None,
1968
+ flags: None$1,
2045
1969
  id: 'shrinkSelection',
2046
1970
  label: shrinkSelection()
2047
1971
  }, menuEntrySeparator, {
2048
1972
  command: 'Editor.copyLineUp',
2049
- flags: None,
1973
+ flags: None$1,
2050
1974
  id: 'copyLineUp',
2051
1975
  label: copyLineUp()
2052
1976
  }, {
2053
1977
  command: 'Editor.copyLineDown',
2054
- flags: None,
1978
+ flags: None$1,
2055
1979
  id: 'copyLineDown',
2056
1980
  label: copyLineDown()
2057
1981
  }, {
2058
1982
  command: 'Editor.moveLineUp',
2059
- flags: None,
1983
+ flags: None$1,
2060
1984
  id: 'moveLineUp',
2061
1985
  label: moveLineUp()
2062
1986
  }, {
2063
1987
  command: 'Editor.moveLineDown',
2064
- flags: None,
1988
+ flags: None$1,
2065
1989
  id: 'moveLineDown',
2066
1990
  label: moveLineDown()
2067
1991
  }, {
2068
1992
  command: 'Editor.duplicateSelection',
2069
- flags: None,
1993
+ flags: None$1,
2070
1994
  id: 'duplicateSelection',
2071
1995
  label: duplicateSelection()
2072
1996
  }, menuEntrySeparator, {
2073
1997
  command: 'Editor.addCursorAbove',
2074
- flags: None,
1998
+ flags: None$1,
2075
1999
  id: 'addCursorAbove',
2076
2000
  label: addCursorAbove()
2077
2001
  }, {
2078
2002
  command: 'Editor.addCursorBelow',
2079
- flags: None,
2003
+ flags: None$1,
2080
2004
  id: 'addCursorBelow',
2081
2005
  label: addCursorBelow()
2082
2006
  }, {
2083
2007
  command: 'Editor.addCursorsToLineEnds',
2084
- flags: None,
2008
+ flags: None$1,
2085
2009
  id: 'addCursorsToLineEnds',
2086
2010
  label: addCursorsToLineEnds()
2087
2011
  }, {
2088
2012
  command: 'Editor.addNextOccurrence',
2089
- flags: None,
2013
+ flags: None$1,
2090
2014
  id: 'addNextOccurrence',
2091
2015
  label: addNextOccurrence()
2092
2016
  }, {
2093
2017
  command: 'Editor.addPreviousOccurrence',
2094
- flags: None,
2018
+ flags: None$1,
2095
2019
  id: 'addPreviousOccurrence',
2096
2020
  label: addPreviousOccurrence()
2097
2021
  }, {
2098
2022
  command: 'Editor.selectAllOccurrences',
2099
- flags: None,
2023
+ flags: None$1,
2100
2024
  id: 'selectAllOccurrences',
2101
2025
  label: selectAllOccurrences()
2102
2026
  }];
2103
2027
  };
2104
2028
 
2105
- const getMenuEntries$5 = () => {
2029
+ const MenuEntriesSelection = {
2030
+ __proto__: null,
2031
+ getMenuEntries: getMenuEntries$7
2032
+ };
2033
+
2034
+ const getMenuEntries$6 = () => {
2106
2035
  return [{
2107
2036
  args: ['Terminal'],
2108
2037
  command: 'Layout.togglePanel',
2109
- flags: None,
2038
+ flags: None$1,
2110
2039
  id: 'newTerminal',
2111
2040
  label: i18nString(NewTerminal)
2112
2041
  }];
2113
2042
  };
2114
2043
 
2115
- const getMenuEntries$4 = () => {
2044
+ const MenuEntriesTerminal = {
2045
+ __proto__: null,
2046
+ getMenuEntries: getMenuEntries$6
2047
+ };
2048
+
2049
+ const getMenuEntries$5 = () => {
2116
2050
  return [];
2117
2051
  };
2118
2052
 
2053
+ const MenuEntriesView = {
2054
+ __proto__: null,
2055
+ getMenuEntries: getMenuEntries$5
2056
+ };
2057
+
2058
+ // based on https://www.electronjs.org/docs/latest/api/menu-item#new-menuitemoptions
2059
+
2060
+ const Undo = 'undo';
2061
+ const Redo = 'redo';
2062
+ const Cut = 'cut';
2063
+ const Copy = 'copy';
2064
+ const Paste = 'paste';
2065
+ const SelectAll = 'selectAll';
2066
+ const ToggleDevTools = 'toggleDevTools';
2067
+ const Help = 'help';
2068
+ const Quit = 'quit';
2069
+ const FileMenu = 'fileMenu';
2070
+ const EditMenu = 'editMenu';
2071
+
2072
+ // based on https://www.electronjs.org/docs/latest/api/menu-item#new-menuitemoptions
2073
+ const Separator$1 = 'separator';
2074
+ const SubMenu = 'submenu';
2075
+
2076
+ const toElectronMenuItem = entry => {
2077
+ switch (entry.label) {
2078
+ case copy$1():
2079
+ return {
2080
+ label: entry.label,
2081
+ role: Copy
2082
+ };
2083
+ case cut$1():
2084
+ return {
2085
+ label: entry.label,
2086
+ role: Cut
2087
+ };
2088
+ case edit():
2089
+ return {
2090
+ label: entry.label,
2091
+ role: EditMenu,
2092
+ submenu: []
2093
+ };
2094
+ case exit$1():
2095
+ return {
2096
+ label: entry.label,
2097
+ role: Quit
2098
+ };
2099
+ case file():
2100
+ return {
2101
+ label: entry.label,
2102
+ role: FileMenu,
2103
+ submenu: []
2104
+ };
2105
+ case help():
2106
+ return {
2107
+ label: entry.label,
2108
+ role: Help,
2109
+ submenu: []
2110
+ };
2111
+ case paste$1():
2112
+ return {
2113
+ label: entry.label,
2114
+ role: Paste
2115
+ };
2116
+ case redo$1():
2117
+ return {
2118
+ label: entry.label,
2119
+ role: Redo
2120
+ };
2121
+ case selectAll$1():
2122
+ return {
2123
+ label: entry.label,
2124
+ role: SelectAll
2125
+ };
2126
+ case toggleDeveloperTools$1():
2127
+ return {
2128
+ label: entry.label,
2129
+ role: ToggleDevTools
2130
+ };
2131
+ case undo$1():
2132
+ return {
2133
+ label: entry.label,
2134
+ role: Undo
2135
+ };
2136
+ }
2137
+ switch (entry.flags) {
2138
+ case Separator$2:
2139
+ return {
2140
+ type: Separator$1
2141
+ };
2142
+ case SubMenu$1:
2143
+ return {
2144
+ label: entry.label,
2145
+ submenu: [],
2146
+ type: SubMenu
2147
+ };
2148
+ default:
2149
+ return {
2150
+ label: entry.label
2151
+ };
2152
+ }
2153
+ };
2154
+
2155
+ const toElectronMenuInternal = (commandMap, map, id, electronMenu) => {
2156
+ object(commandMap);
2157
+ object(map);
2158
+ number(id);
2159
+ array(electronMenu);
2160
+ const entries = map[id];
2161
+ array(entries);
2162
+ for (const entry of entries) {
2163
+ if (entry.command) {
2164
+ commandMap[entry.label] = {
2165
+ args: entry.args,
2166
+ command: entry.command
2167
+ };
2168
+ }
2169
+ const electronEntry = toElectronMenuItem(entry);
2170
+ if (entry.flags === SubMenu$2) {
2171
+ toElectronMenuInternal(commandMap, map, entry.id, electronEntry.submenu);
2172
+ }
2173
+ electronMenu.push(electronEntry);
2174
+ }
2175
+ return {
2176
+ commandMap,
2177
+ electronMenu
2178
+ };
2179
+ };
2180
+
2181
+ const toElectronMenu = (map, rootId) => {
2182
+ const electronMenu = [];
2183
+ const commandMap = Object.create(null);
2184
+ toElectronMenuInternal(commandMap, map, rootId, electronMenu);
2185
+ return {
2186
+ commandMap,
2187
+ electronMenu
2188
+ };
2189
+ };
2190
+
2191
+ const menuEntries = [MenuEntriesFile, MenuEntriesEdit, MenuEntriesSelection, MenuEntriesView, MenuEntriesGo, MenuEntriesRun, MenuEntriesTerminal, MenuEntriesHelp
2192
+ // MenuEntriesTitleBar,
2193
+ ];
2194
+ const setItems = async items => {
2195
+ const windowId = await getWindowId();
2196
+ return invoke('ElectronApplicationMenu.setItems', windowId, items);
2197
+ };
2198
+ const hydrate = async state => {
2199
+ const map = await getEntryMap(menuEntries);
2200
+ const {
2201
+ commandMap,
2202
+ electronMenu
2203
+ } = toElectronMenu(map, TitleBar);
2204
+ await setItems(electronMenu);
2205
+ // TODO get all menu items
2206
+ // TODO send menu items to electron
2207
+ // TODO add listener for when menu items change
2208
+ return {
2209
+ ...state,
2210
+ commandMap
2211
+ };
2212
+ };
2213
+
2214
+ const Menu$1 = 'menu';
2215
+ const MenuBar = 'menubar';
2216
+ const MenuItem$1 = 'menuitem';
2217
+ const MenuItemCheckBox = 'menuitemcheckbox';
2218
+ const None = 'none';
2219
+ const Separator = 'separator';
2220
+
2221
+ const Button = 1;
2222
+ const Div = 4;
2223
+ const Span = 8;
2224
+ const Text = 12;
2225
+ const I = 16;
2226
+ const Img = 17;
2227
+
2228
+ const Escape = 8;
2229
+ const Space = 9;
2230
+ const End = 255;
2231
+ const Home = 12;
2232
+ const LeftArrow = 13;
2233
+ const UpArrow = 14;
2234
+ const RightArrow = 15;
2235
+ const DownArrow = 16;
2236
+
2237
+ const mergeClassNames = (...classNames) => {
2238
+ return classNames.filter(Boolean).join(' ');
2239
+ };
2240
+
2241
+ const px = value => {
2242
+ return `${value}px`;
2243
+ };
2244
+
2245
+ const text = data => {
2246
+ return {
2247
+ type: Text,
2248
+ text: data,
2249
+ childCount: 0
2250
+ };
2251
+ };
2252
+
2253
+ const getKeyBindings = () => {
2254
+ return [{
2255
+ command: 'TitleBar.handleKeyArrowDown',
2256
+ key: DownArrow,
2257
+ when: FocusTitleBarMenuBar
2258
+ }, {
2259
+ command: 'TitleBar.handleKeyArrowUp',
2260
+ key: UpArrow,
2261
+ when: FocusTitleBarMenuBar
2262
+ }, {
2263
+ command: 'TitleBar.handleKeyArrowRight',
2264
+ key: RightArrow,
2265
+ when: FocusTitleBarMenuBar
2266
+ }, {
2267
+ command: 'TitleBar.handleKeyArrowLeft',
2268
+ key: LeftArrow,
2269
+ when: FocusTitleBarMenuBar
2270
+ }, {
2271
+ command: 'TitleBar.handleKeySpace',
2272
+ key: Space,
2273
+ when: FocusTitleBarMenuBar
2274
+ }, {
2275
+ command: 'TitleBar.handleKeyHome',
2276
+ key: Home,
2277
+ when: FocusTitleBarMenuBar
2278
+ }, {
2279
+ command: 'TitleBar.handleKeyEnd',
2280
+ key: End,
2281
+ when: FocusTitleBarMenuBar
2282
+ }, {
2283
+ command: 'TitleBar.handleKeyEscape',
2284
+ key: Escape,
2285
+ when: FocusTitleBarMenuBar
2286
+ }];
2287
+ };
2288
+
2289
+ const getMenuEntriesTitleBarContextMenu = async state => {
2290
+ const {
2291
+ commandCenterEnabled,
2292
+ titleBarMenuBarEnabled
2293
+ } = state;
2294
+ // TODO checked state should be depending on whether or not that feature is currently visible or not
2295
+ return [{
2296
+ command: titleBarMenuBarEnabled ? 'TitleBar.hideMenuBar' : 'TitleBar.showMenuBar',
2297
+ flags: titleBarMenuBarEnabled ? Checked : Unchecked,
2298
+ id: 'MenuBar',
2299
+ label: menuBar()
2300
+ }, {
2301
+ command: commandCenterEnabled ? 'TitleBar.hideCommandCenter' : 'TitleBar.showCommandCenter',
2302
+ flags: commandCenterEnabled ? Checked : Unchecked,
2303
+ id: 'Command center',
2304
+ label: commandCenter()
2305
+ }, {
2306
+ command: '',
2307
+ flags: Checked,
2308
+ id: 'layout controls',
2309
+ label: 'layout controls'
2310
+ }];
2311
+ };
2312
+
2313
+ const MenuIdTitleBarContextMenu = 50;
2314
+ const getMenuIds = () => {
2315
+ return [Edit$2, File$3, Go$2, Help$3, OpenRecent$1, Run$2, Selection$2, Terminal$2, TitleBar$1, View$2, MenuIdTitleBarContextMenu, TitleBarContextMenu];
2316
+ };
2317
+
2318
+ const getRecentlyOpened = () => {
2319
+ return invoke(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
2320
+ };
2321
+
2322
+ const File = 'file://';
2323
+
2324
+ const getTitle$1 = (homeDir, uri) => {
2325
+ if (!uri) {
2326
+ return '';
2327
+ }
2328
+ if (uri.startsWith(File)) {
2329
+ return uri.slice(File.length);
2330
+ }
2331
+ return uri;
2332
+ };
2333
+
2334
+ const moreDot = () => {
2335
+ return i18nString(MoreDot);
2336
+ };
2337
+ const clearRecentlyOpened = () => {
2338
+ return i18nString(ClearRecentlyOpened);
2339
+ };
2340
+
2341
+ const getHomeDir = () => {
2342
+ return '';
2343
+ };
2344
+
2345
+ const MAX_MENU_RECENT_ENTRIES = 10;
2346
+ const toMenuItem = folder => {
2347
+ const homeDir = getHomeDir();
2348
+ const label = getTitle$1(homeDir, folder);
2349
+ return {
2350
+ args: [folder],
2351
+ command: 'Workspace.setPath',
2352
+ flags: None$1,
2353
+ label
2354
+ };
2355
+ };
2356
+ const getMenuEntries$4 = async () => {
2357
+ const allItems = await getRecentlyOpened();
2358
+ const itemsToShow = allItems.slice(0, MAX_MENU_RECENT_ENTRIES);
2359
+ const items = [];
2360
+ if (itemsToShow.length > 0) {
2361
+ items.push(...itemsToShow.map(toMenuItem), menuEntrySeparator);
2362
+ }
2363
+ items.push({
2364
+ command: 'QuickPick.showRecent',
2365
+ flags: None$1,
2366
+ id: 'more',
2367
+ label: moreDot()
2368
+ }, menuEntrySeparator, {
2369
+ command: 'RecentlyOpened.clearRecentlyOpened',
2370
+ flags: None$1,
2371
+ id: 'clearRecentlyOpened',
2372
+ label: clearRecentlyOpened()
2373
+ });
2374
+ return items;
2375
+ };
2376
+
2119
2377
  const getMenuEntries2 = async (state, props) => {
2120
2378
  switch (props.menuId) {
2121
2379
  case Edit$2:
@@ -2124,21 +2382,21 @@ const getMenuEntries2 = async (state, props) => {
2124
2382
  return getMenuEntries$b(props.platform);
2125
2383
  case Go$2:
2126
2384
  return getMenuEntries$a();
2127
- case Help$2:
2385
+ case Help$3:
2128
2386
  return getMenuEntries$9(props.platform);
2129
2387
  case OpenRecent$1:
2130
- return getMenuEntries$8();
2388
+ return getMenuEntries$4();
2131
2389
  case Run$2:
2132
- return getMenuEntries$7();
2390
+ return getMenuEntries$8();
2133
2391
  case Selection$2:
2134
- return getMenuEntries$6();
2392
+ return getMenuEntries$7();
2135
2393
  case Terminal$2:
2136
- return getMenuEntries$5();
2394
+ return getMenuEntries$6();
2137
2395
  case TitleBarContextMenu:
2138
2396
  case MenuIdTitleBarContextMenu:
2139
2397
  return getMenuEntriesTitleBarContextMenu(state);
2140
2398
  case View$2:
2141
- return getMenuEntries$4();
2399
+ return getMenuEntries$5();
2142
2400
  default:
2143
2401
  return [];
2144
2402
  }
@@ -2199,6 +2457,22 @@ const handleContextMenu = async (state, button, eventX, eventY) => {
2199
2457
  return state;
2200
2458
  };
2201
2459
 
2460
+ const handleElectronMenuClick = async (state, label) => {
2461
+ const {
2462
+ commandMap
2463
+ } = state;
2464
+ const commandPair = commandMap[label];
2465
+ if (!commandPair) {
2466
+ throw new Error(`no command found for ${label}`);
2467
+ }
2468
+ const {
2469
+ args = [],
2470
+ command
2471
+ } = commandPair;
2472
+ await invoke(command, ...args);
2473
+ return state;
2474
+ };
2475
+
2202
2476
  const getMenuOffset = (x, clientX, iconWidth) => {
2203
2477
  return clientX - x - iconWidth;
2204
2478
  };
@@ -2233,7 +2507,7 @@ const getMenuHeight = items => {
2233
2507
  let height = CONTEXT_MENU_PADDING;
2234
2508
  for (const item of items) {
2235
2509
  switch (item.flags) {
2236
- case Separator:
2510
+ case Separator$2:
2237
2511
  height += CONTEXT_MENU_SEPARATOR_HEIGHT;
2238
2512
  break;
2239
2513
  default:
@@ -2290,7 +2564,7 @@ const getIndexToFocusPrevious = menu => {
2290
2564
  const canBeFocused = item => {
2291
2565
  switch (item.flags) {
2292
2566
  case Disabled:
2293
- case Separator:
2567
+ case Separator$2:
2294
2568
  return false;
2295
2569
  default:
2296
2570
  return true;
@@ -2517,45 +2791,45 @@ const getTitle = workspaceUri => {
2517
2791
  const getMenuEntries$3 = () => {
2518
2792
  return [{
2519
2793
  command: '',
2520
- flags: SubMenu,
2794
+ flags: SubMenu$1,
2521
2795
  id: File$1,
2522
2796
  label: file()
2523
2797
  }, {
2524
2798
  command: '',
2525
- flags: SubMenu,
2799
+ flags: SubMenu$1,
2526
2800
  id: Edit,
2527
2801
  label: edit()
2528
2802
  }, {
2529
2803
  command: '',
2530
- flags: SubMenu,
2804
+ flags: SubMenu$1,
2531
2805
  id: Selection,
2532
2806
  label: selection()
2533
2807
  }, {
2534
2808
  command: '',
2535
- flags: SubMenu,
2809
+ flags: SubMenu$1,
2536
2810
  id: View,
2537
2811
  label: view()
2538
2812
  }, {
2539
2813
  command: '',
2540
- flags: SubMenu,
2814
+ flags: SubMenu$1,
2541
2815
  id: Go,
2542
2816
  label: go()
2543
2817
  }, {
2544
2818
  command: '',
2545
- flags: SubMenu,
2819
+ flags: SubMenu$1,
2546
2820
  id: Run,
2547
2821
  keyboardShortCut: 'Alt+r',
2548
2822
  label: run()
2549
2823
  }, {
2550
2824
  command: '',
2551
- flags: SubMenu,
2825
+ flags: SubMenu$1,
2552
2826
  id: Terminal,
2553
2827
  keyboardShortCut: 'Alt+t',
2554
2828
  label: terminal()
2555
2829
  }, {
2556
2830
  command: '',
2557
- flags: SubMenu,
2558
- id: Help,
2831
+ flags: SubMenu$1,
2832
+ id: Help$1,
2559
2833
  keyboardShortCut: 'Alt+h',
2560
2834
  label: help()
2561
2835
  }];
@@ -2564,33 +2838,33 @@ const getMenuEntries$3 = () => {
2564
2838
  const getMenuEntries$2 = () => {
2565
2839
  return [{
2566
2840
  command: '',
2567
- flags: None,
2841
+ flags: None$1,
2568
2842
  id: File$1,
2569
2843
  label: file()
2570
2844
  }, {
2571
2845
  command: '',
2572
- flags: None,
2846
+ flags: None$1,
2573
2847
  id: Edit,
2574
2848
  label: edit()
2575
2849
  }, {
2576
2850
  command: '',
2577
- flags: None,
2851
+ flags: None$1,
2578
2852
  id: Selection,
2579
2853
  label: selection()
2580
2854
  }, {
2581
2855
  command: '',
2582
- flags: None,
2856
+ flags: None$1,
2583
2857
  id: View,
2584
2858
  label: view()
2585
2859
  }, {
2586
2860
  command: '',
2587
- flags: None,
2861
+ flags: None$1,
2588
2862
  id: Go,
2589
2863
  label: go()
2590
2864
  }, {
2591
2865
  command: '',
2592
- flags: None,
2593
- id: Help,
2866
+ flags: None$1,
2867
+ id: Help$1,
2594
2868
  label: help()
2595
2869
  }];
2596
2870
  };
@@ -2750,7 +3024,7 @@ const getMenuItemsNoopDom = () => {
2750
3024
  const separator = {
2751
3025
  childCount: 1,
2752
3026
  className: MenuItemSeparator,
2753
- role: Separator$1,
3027
+ role: Separator,
2754
3028
  type: Div
2755
3029
  };
2756
3030
  const separatorLine = {
@@ -2810,12 +3084,12 @@ const getMenuItemRenderer = flags => {
2810
3084
  case Disabled:
2811
3085
  return getMenuItemDisabledDom;
2812
3086
  case Ignore:
2813
- case None:
3087
+ case None$1:
2814
3088
  case RestoreFocus:
2815
3089
  return getMenuItemDefaultDom;
2816
- case Separator:
3090
+ case Separator$2:
2817
3091
  return getMenuItemSeparatorDom;
2818
- case SubMenu:
3092
+ case SubMenu$1:
2819
3093
  return getMenuItemSubMenuDom;
2820
3094
  case Unchecked:
2821
3095
  return getMenuItemUncheckedDom;
@@ -2908,7 +3182,7 @@ const getIconVirtualDom = (icon, type = Div) => {
2908
3182
  return {
2909
3183
  childCount: 0,
2910
3184
  className: `MaskIcon MaskIcon${icon}`,
2911
- role: None$1,
3185
+ role: None,
2912
3186
  type
2913
3187
  };
2914
3188
  };
@@ -2925,7 +3199,7 @@ const createTitleBarButton = button => {
2925
3199
  childCount: 1,
2926
3200
  className: `TitleBarButton TitleBarButton${id}`,
2927
3201
  onClick,
2928
- type: Button$1
3202
+ type: Button
2929
3203
  }, getIconVirtualDom(icon, I)];
2930
3204
  return dom;
2931
3205
  };
@@ -2994,7 +3268,7 @@ const getItemVirtualDom = item => {
2994
3268
  name: label,
2995
3269
  // TODO have separate name attribute
2996
3270
  role: MenuItem$1,
2997
- type: Button$1
3271
+ type: Button
2998
3272
  }, ...(isFocused ? [{
2999
3273
  childCount: 1,
3000
3274
  className: TitleBarTopLevelEntryLabel,
@@ -3020,7 +3294,7 @@ const getTitleBarMenuBarVirtualDom = (menuBarEnabled, visibleItems, focusedIndex
3020
3294
  onMouseDown: HandleClick,
3021
3295
  onPointerOut: HandlePointerOut,
3022
3296
  onPointerOver: HandlePointerOver,
3023
- role: MenuBar$1,
3297
+ role: MenuBar,
3024
3298
  tabIndex: 0,
3025
3299
  type: Div
3026
3300
  }, ...getTitleBarMenuBarItemsVirtualDom(visibleItems)];
@@ -3029,7 +3303,7 @@ const getTitleBarMenuBarVirtualDom = (menuBarEnabled, visibleItems, focusedIndex
3029
3303
  const parentNode = {
3030
3304
  childCount: 1,
3031
3305
  className: 'TitleBarTitle',
3032
- type: Div
3306
+ type: Div$1
3033
3307
  };
3034
3308
  const getTitleVirtualDom = (titleBarTitleEnabled, title) => {
3035
3309
  if (!titleBarTitleEnabled) {
@@ -3101,7 +3375,7 @@ const getTitleBarVirtualDom = state => {
3101
3375
  className: 'Viewlet TitleBar',
3102
3376
  id: 'TitleBar',
3103
3377
  role: ContentInfo,
3104
- type: Div
3378
+ type: Div$1
3105
3379
  }, ...getTitleBarIconVirtualDom(titleBarIconEnabled, iconSrc), ...getTitleBarMenuBarVirtualDom(titleBarMenuBarEnabled, visibleEntries, focusedIndex), ...getTitleVirtualDom(titleBarTitleEnabled, title), ...getTitleBarButtonsVirtualDom(titleBarButtonsEnabled, titleBarButtons)];
3106
3380
  };
3107
3381
 
@@ -3146,7 +3420,7 @@ const renderEventListeners = () => {
3146
3420
  params: ['handleClickMinimize']
3147
3421
  }, {
3148
3422
  name: HandleContextMenu,
3149
- params: ['handleContextMenu', Button, ClientX, ClientY]
3423
+ params: ['handleContextMenu', Button$1, ClientX, ClientY]
3150
3424
  }, {
3151
3425
  name: HandleClickToggleClose,
3152
3426
  params: ['handleClickClose']
@@ -3164,7 +3438,7 @@ const renderEventListeners = () => {
3164
3438
  params: ['handleMenuMouseOver', ClientX, ClientY]
3165
3439
  }, {
3166
3440
  name: HandleClick,
3167
- params: ['handleClickAt', Button, ClientX, ClientY]
3441
+ params: ['handleClickAt', Button$1, ClientX, ClientY]
3168
3442
  }, {
3169
3443
  name: HandlePointerOut,
3170
3444
  params: ['handlePointerOut', ClientX, ClientY]
@@ -3446,20 +3720,20 @@ const getFn = id => {
3446
3720
  return getMenuEntries$b;
3447
3721
  case Go$2:
3448
3722
  return getMenuEntries$a;
3449
- case Help$2:
3723
+ case Help$3:
3450
3724
  return getMenuEntries$9;
3451
3725
  case OpenRecent$1:
3452
- return getMenuEntries$8;
3726
+ return getMenuEntries$4;
3453
3727
  case Run$2:
3454
- return getMenuEntries$7;
3728
+ return getMenuEntries$8;
3455
3729
  case Selection$2:
3456
- return getMenuEntries$6;
3730
+ return getMenuEntries$7;
3457
3731
  case Terminal$2:
3458
- return getMenuEntries$5;
3459
- case TitleBar:
3732
+ return getMenuEntries$6;
3733
+ case TitleBar$1:
3460
3734
  return getMenuEntries$1;
3461
3735
  case View$2:
3462
- return getMenuEntries$4;
3736
+ return getMenuEntries$5;
3463
3737
  default:
3464
3738
  return undefined;
3465
3739
  }
@@ -3494,7 +3768,7 @@ const handleKeyArrowRightMenuOpen = async state => {
3494
3768
  return focusNext(state);
3495
3769
  }
3496
3770
  const item = items[focusedIndex];
3497
- if (item.flags === SubMenu && item.id !== undefined) {
3771
+ if (item.flags === SubMenu$1 && item.id !== undefined) {
3498
3772
  const subMenuEntries = await getMenuEntries(item.id);
3499
3773
  const subMenu = {
3500
3774
  focusedIndex: 0,
@@ -3690,11 +3964,11 @@ const handleMenuClick = async (state, level, index) => {
3690
3964
  switch (item.flags) {
3691
3965
  case Ignore:
3692
3966
  return selectIndexIgnore(state, item);
3693
- case None:
3967
+ case None$1:
3694
3968
  return selectIndexNone(state, item);
3695
3969
  case RestoreFocus:
3696
3970
  return selectIndexRestoreFocus(state, item);
3697
- case SubMenu:
3971
+ case SubMenu$1:
3698
3972
  return selectIndexSubMenu(state, menu, index);
3699
3973
  default:
3700
3974
  return state;
@@ -3717,7 +3991,7 @@ const getNewMenus = async (menus, level, index, flags) => {
3717
3991
  if (index === -1) {
3718
3992
  return menus;
3719
3993
  }
3720
- if (item.flags === SubMenu && level === menus.length - 2) {
3994
+ if (item.flags === SubMenu$1 && level === menus.length - 2) {
3721
3995
  const subMenu = menus[level + 1];
3722
3996
  if (subMenu.focusedIndex !== -1) {
3723
3997
  const newSubMenu = {
@@ -3737,7 +4011,7 @@ const getNewMenus = async (menus, level, index, flags) => {
3737
4011
  }];
3738
4012
  return newMenus;
3739
4013
  }
3740
- if (item.flags === SubMenu) {
4014
+ if (item.flags === SubMenu$1) {
3741
4015
  const item = items[index];
3742
4016
  if (!item.id) {
3743
4017
  return menus;
@@ -3826,6 +4100,7 @@ const commandMap = {
3826
4100
  'TitleBar.handleClickMinimize': wrapCommand(handleClickMinimize),
3827
4101
  'TitleBar.handleClickToggleMaximize': wrapCommand(handleClickToggleMaximize),
3828
4102
  'TitleBar.handleContextMenu': wrapCommand(handleContextMenu),
4103
+ 'TitleBar.handleElectronMenuClick': wrapCommand(handleElectronMenuClick),
3829
4104
  'TitleBar.handleFocus': wrapCommand(handleFocus),
3830
4105
  'TitleBar.handleFocusOut': wrapCommand(handleFocusOut),
3831
4106
  'TitleBar.handleKeyArrowDown': wrapCommand(handleKeyArrowDown),
@@ -3845,6 +4120,7 @@ const commandMap = {
3845
4120
  'TitleBar.handlePointerOver': wrapCommand(handlePointerOver),
3846
4121
  'TitleBar.hideCommandCenter': wrapCommand(hideCommandCenter),
3847
4122
  'TitleBar.hideMenuBar': wrapCommand(hideMenuBar),
4123
+ 'TitleBar.hydrateElectronApplicationMenu': wrapCommand(hydrate),
3848
4124
  'TitleBar.loadContent2': wrapCommand(loadContent2),
3849
4125
  'TitleBar.render3': render3,
3850
4126
  'TitleBar.renderEventListeners': renderEventListeners,