@lvce-editor/title-bar-worker 3.3.0 → 3.6.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,61 +1629,9 @@ 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
- }];
1663
- };
1664
-
1665
- const Separator = 1;
1666
- const None = 0;
1667
- const SubMenu = 4;
1632
+ const Separator$2 = 1;
1633
+ const None$1 = 0;
1634
+ const SubMenu$1 = 4;
1668
1635
  const Checked = 2;
1669
1636
  const Unchecked = 3;
1670
1637
  const Disabled = 5;
@@ -1697,23 +1664,23 @@ const getMenuEntriesTitleBarContextMenu = async state => {
1697
1664
 
1698
1665
  const MenuIdTitleBarContextMenu = 50;
1699
1666
  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];
1667
+ return [Edit$2, File$3, Go$2, Help$3, OpenRecent$1, Run$2, Selection$2, Terminal$2, TitleBar$1, View$2, MenuIdTitleBarContextMenu, TitleBarContextMenu];
1701
1668
  };
1702
1669
 
1703
1670
  const cut = () => {
1704
- return i18nString(Cut);
1671
+ return i18nString(Cut$1);
1705
1672
  };
1706
1673
  const copy = () => {
1707
- return i18nString(Copy);
1674
+ return i18nString(Copy$1);
1708
1675
  };
1709
1676
  const paste = () => {
1710
- return i18nString(Paste);
1677
+ return i18nString(Paste$1);
1711
1678
  };
1712
1679
  const undo = () => {
1713
- return i18nString(Undo);
1680
+ return i18nString(Undo$1);
1714
1681
  };
1715
1682
  const redo = () => {
1716
- return i18nString(Redo);
1683
+ return i18nString(Redo$1);
1717
1684
  };
1718
1685
  const toggleLineComment = () => {
1719
1686
  return i18nString(ToggleLineComment);
@@ -1722,7 +1689,7 @@ const toggleBlockComment = () => {
1722
1689
  return i18nString(ToggleBlockComment);
1723
1690
  };
1724
1691
  const selectAll = () => {
1725
- return i18nString(SelectAll);
1692
+ return i18nString(SelectAll$1);
1726
1693
  };
1727
1694
  const expandSelection = () => {
1728
1695
  return i18nString(ExpandSelection);
@@ -1766,7 +1733,7 @@ const selectAllOccurrences = () => {
1766
1733
 
1767
1734
  const menuEntrySeparator = {
1768
1735
  command: '',
1769
- flags: Separator,
1736
+ flags: Separator$2,
1770
1737
  id: 'separator',
1771
1738
  label: ''
1772
1739
  };
@@ -1774,37 +1741,37 @@ const menuEntrySeparator = {
1774
1741
  const getMenuEntries$c = () => {
1775
1742
  return [{
1776
1743
  command: /* TODO */'-1',
1777
- flags: None,
1744
+ flags: None$1,
1778
1745
  id: 'undo',
1779
1746
  label: undo()
1780
1747
  }, {
1781
1748
  command: /* TODO */'-1',
1782
- flags: None,
1749
+ flags: None$1,
1783
1750
  id: 'redo',
1784
1751
  label: redo()
1785
1752
  }, menuEntrySeparator, {
1786
1753
  command: /* Editor.cut */'Editor.cut',
1787
- flags: None,
1754
+ flags: None$1,
1788
1755
  id: 'cut',
1789
1756
  label: cut()
1790
1757
  }, {
1791
1758
  command: /* Editor.copy */'Editor.copy',
1792
- flags: None,
1759
+ flags: None$1,
1793
1760
  id: 'copy',
1794
1761
  label: copy()
1795
1762
  }, {
1796
1763
  command: /* Editor.paste */'Editor.paste',
1797
- flags: None,
1764
+ flags: None$1,
1798
1765
  id: 'paste',
1799
1766
  label: paste()
1800
1767
  }, menuEntrySeparator, {
1801
1768
  command: /* Editor.toggleLineComment */'Editor.toggleLineComment',
1802
- flags: None,
1769
+ flags: None$1,
1803
1770
  id: 'toggle-line-comment',
1804
1771
  label: toggleLineComment()
1805
1772
  }, {
1806
1773
  command: /* Editor.toggleBlockComment */'Editor.toggleBlockComment',
1807
- flags: None,
1774
+ flags: None$1,
1808
1775
  id: 'toggle-block-comment',
1809
1776
  label: toggleBlockComment()
1810
1777
  }];
@@ -1850,27 +1817,28 @@ const exit = () => {
1850
1817
  const Edit = 2;
1851
1818
  const File$1 = 5;
1852
1819
  const Go = 6;
1853
- const Help = 7;
1820
+ const Help$1 = 7;
1854
1821
  const OpenRecent = 9;
1855
1822
  const Run = 10;
1856
1823
  const Selection = 11;
1857
1824
  const Terminal = 14;
1825
+ const TitleBar = 15;
1858
1826
  const View = 16;
1859
1827
 
1860
1828
  const getMenuEntries$b = platform => {
1861
1829
  const entries = [{
1862
1830
  command: '-1',
1863
- flags: None,
1831
+ flags: None$1,
1864
1832
  id: 'newFile',
1865
1833
  label: newFile()
1866
1834
  }, {
1867
1835
  command: 'Window.openNew',
1868
- flags: None,
1836
+ flags: None$1,
1869
1837
  id: 'newWindow',
1870
1838
  label: newWindow()
1871
1839
  }, menuEntrySeparator, {
1872
1840
  command: 'Dialog.openFile',
1873
- flags: None,
1841
+ flags: None$1,
1874
1842
  id: 'openFile',
1875
1843
  label: openFile()
1876
1844
  }, {
@@ -1880,17 +1848,17 @@ const getMenuEntries$b = platform => {
1880
1848
  label: openFolder()
1881
1849
  }, {
1882
1850
  command: '',
1883
- flags: SubMenu,
1851
+ flags: SubMenu$1,
1884
1852
  id: OpenRecent,
1885
1853
  label: openRecent()
1886
1854
  }, menuEntrySeparator, {
1887
1855
  command: 'Main.save',
1888
- flags: None,
1856
+ flags: None$1,
1889
1857
  id: 'save',
1890
1858
  label: save()
1891
1859
  }, {
1892
1860
  command: 'Main.saveAll',
1893
- flags: None,
1861
+ flags: None$1,
1894
1862
  id: 'saveAll',
1895
1863
  label: saveAll()
1896
1864
  }];
@@ -1935,7 +1903,7 @@ const getMenuEntries$9 = async platform => {
1935
1903
  if (platform !== Web) {
1936
1904
  entries.push({
1937
1905
  command: 'Developer.toggleDeveloperTools',
1938
- flags: None,
1906
+ flags: None$1,
1939
1907
  id: 'toggleDeveloperTools',
1940
1908
  label: toggleDeveloperTools()
1941
1909
  }, {
@@ -1958,7 +1926,7 @@ const getMenuEntries$9 = async platform => {
1958
1926
  }
1959
1927
  entries.push({
1960
1928
  command: 'About.showAbout',
1961
- flags: None,
1929
+ flags: None$1,
1962
1930
  id: 'about',
1963
1931
  label: about()
1964
1932
  });
@@ -1999,7 +1967,7 @@ const toMenuItem = folder => {
1999
1967
  return {
2000
1968
  args: [folder],
2001
1969
  command: 'Workspace.setPath',
2002
- flags: None,
1970
+ flags: None$1,
2003
1971
  label
2004
1972
  };
2005
1973
  };
@@ -2012,12 +1980,12 @@ const getMenuEntries$8 = async () => {
2012
1980
  }
2013
1981
  items.push({
2014
1982
  command: 'QuickPick.showRecent',
2015
- flags: None,
1983
+ flags: None$1,
2016
1984
  id: 'more',
2017
1985
  label: moreDot()
2018
1986
  }, menuEntrySeparator, {
2019
1987
  command: 'RecentlyOpened.clearRecentlyOpened',
2020
- flags: None,
1988
+ flags: None$1,
2021
1989
  id: 'clearRecentlyOpened',
2022
1990
  label: clearRecentlyOpened()
2023
1991
  });
@@ -2031,72 +1999,72 @@ const getMenuEntries$7 = () => {
2031
1999
  const getMenuEntries$6 = () => {
2032
2000
  return [{
2033
2001
  command: 'Editor.selectAll',
2034
- flags: None,
2002
+ flags: None$1,
2035
2003
  id: 'selectAll',
2036
2004
  label: selectAll()
2037
2005
  }, {
2038
2006
  command: 'Editor.expandSelection',
2039
- flags: None,
2007
+ flags: None$1,
2040
2008
  id: 'expandSelection',
2041
2009
  label: expandSelection()
2042
2010
  }, {
2043
2011
  command: 'Editor.shrinkSelection',
2044
- flags: None,
2012
+ flags: None$1,
2045
2013
  id: 'shrinkSelection',
2046
2014
  label: shrinkSelection()
2047
2015
  }, menuEntrySeparator, {
2048
2016
  command: 'Editor.copyLineUp',
2049
- flags: None,
2017
+ flags: None$1,
2050
2018
  id: 'copyLineUp',
2051
2019
  label: copyLineUp()
2052
2020
  }, {
2053
2021
  command: 'Editor.copyLineDown',
2054
- flags: None,
2022
+ flags: None$1,
2055
2023
  id: 'copyLineDown',
2056
2024
  label: copyLineDown()
2057
2025
  }, {
2058
2026
  command: 'Editor.moveLineUp',
2059
- flags: None,
2027
+ flags: None$1,
2060
2028
  id: 'moveLineUp',
2061
2029
  label: moveLineUp()
2062
2030
  }, {
2063
2031
  command: 'Editor.moveLineDown',
2064
- flags: None,
2032
+ flags: None$1,
2065
2033
  id: 'moveLineDown',
2066
2034
  label: moveLineDown()
2067
2035
  }, {
2068
2036
  command: 'Editor.duplicateSelection',
2069
- flags: None,
2037
+ flags: None$1,
2070
2038
  id: 'duplicateSelection',
2071
2039
  label: duplicateSelection()
2072
2040
  }, menuEntrySeparator, {
2073
2041
  command: 'Editor.addCursorAbove',
2074
- flags: None,
2042
+ flags: None$1,
2075
2043
  id: 'addCursorAbove',
2076
2044
  label: addCursorAbove()
2077
2045
  }, {
2078
2046
  command: 'Editor.addCursorBelow',
2079
- flags: None,
2047
+ flags: None$1,
2080
2048
  id: 'addCursorBelow',
2081
2049
  label: addCursorBelow()
2082
2050
  }, {
2083
2051
  command: 'Editor.addCursorsToLineEnds',
2084
- flags: None,
2052
+ flags: None$1,
2085
2053
  id: 'addCursorsToLineEnds',
2086
2054
  label: addCursorsToLineEnds()
2087
2055
  }, {
2088
2056
  command: 'Editor.addNextOccurrence',
2089
- flags: None,
2057
+ flags: None$1,
2090
2058
  id: 'addNextOccurrence',
2091
2059
  label: addNextOccurrence()
2092
2060
  }, {
2093
2061
  command: 'Editor.addPreviousOccurrence',
2094
- flags: None,
2062
+ flags: None$1,
2095
2063
  id: 'addPreviousOccurrence',
2096
2064
  label: addPreviousOccurrence()
2097
2065
  }, {
2098
2066
  command: 'Editor.selectAllOccurrences',
2099
- flags: None,
2067
+ flags: None$1,
2100
2068
  id: 'selectAllOccurrences',
2101
2069
  label: selectAllOccurrences()
2102
2070
  }];
@@ -2106,13 +2074,107 @@ const getMenuEntries$5 = () => {
2106
2074
  return [{
2107
2075
  args: ['Terminal'],
2108
2076
  command: 'Layout.togglePanel',
2109
- flags: None,
2077
+ flags: None$1,
2110
2078
  id: 'newTerminal',
2111
2079
  label: i18nString(NewTerminal)
2112
2080
  }];
2113
2081
  };
2114
2082
 
2115
2083
  const getMenuEntries$4 = () => {
2084
+ return [{
2085
+ command: '',
2086
+ flags: SubMenu$1,
2087
+ id: File$1,
2088
+ label: file()
2089
+ }, {
2090
+ command: '',
2091
+ flags: SubMenu$1,
2092
+ id: Edit,
2093
+ label: edit()
2094
+ }, {
2095
+ command: '',
2096
+ flags: SubMenu$1,
2097
+ id: Selection,
2098
+ label: selection()
2099
+ }, {
2100
+ command: '',
2101
+ flags: SubMenu$1,
2102
+ id: View,
2103
+ label: view()
2104
+ }, {
2105
+ command: '',
2106
+ flags: SubMenu$1,
2107
+ id: Go,
2108
+ label: go()
2109
+ }, {
2110
+ command: '',
2111
+ flags: SubMenu$1,
2112
+ id: Run,
2113
+ keyboardShortCut: 'Alt+r',
2114
+ label: run()
2115
+ }, {
2116
+ command: '',
2117
+ flags: SubMenu$1,
2118
+ id: Terminal,
2119
+ keyboardShortCut: 'Alt+t',
2120
+ label: terminal()
2121
+ }, {
2122
+ command: '',
2123
+ flags: SubMenu$1,
2124
+ id: Help$1,
2125
+ keyboardShortCut: 'Alt+h',
2126
+ label: help()
2127
+ }];
2128
+ };
2129
+
2130
+ const getMenuEntries$3 = () => {
2131
+ return [{
2132
+ command: '',
2133
+ flags: None$1,
2134
+ id: File$1,
2135
+ label: file()
2136
+ }, {
2137
+ command: '',
2138
+ flags: None$1,
2139
+ id: Edit,
2140
+ label: edit()
2141
+ }, {
2142
+ command: '',
2143
+ flags: None$1,
2144
+ id: Selection,
2145
+ label: selection()
2146
+ }, {
2147
+ command: '',
2148
+ flags: None$1,
2149
+ id: View,
2150
+ label: view()
2151
+ }, {
2152
+ command: '',
2153
+ flags: None$1,
2154
+ id: Go,
2155
+ label: go()
2156
+ }, {
2157
+ command: '',
2158
+ flags: None$1,
2159
+ id: Help$1,
2160
+ label: help()
2161
+ }];
2162
+ };
2163
+
2164
+ const getFn$1 = platform => {
2165
+ switch (platform) {
2166
+ case Web:
2167
+ return getMenuEntries$3;
2168
+ default:
2169
+ return getMenuEntries$4;
2170
+ }
2171
+ };
2172
+ const getMenuEntries$2 = async platform => {
2173
+ const fn = getFn$1(platform);
2174
+ return fn();
2175
+ };
2176
+
2177
+ const getMenuEntries$1 = () => {
2116
2178
  return [];
2117
2179
  };
2118
2180
 
@@ -2124,7 +2186,7 @@ const getMenuEntries2 = async (state, props) => {
2124
2186
  return getMenuEntries$b(props.platform);
2125
2187
  case Go$2:
2126
2188
  return getMenuEntries$a();
2127
- case Help$2:
2189
+ case Help$3:
2128
2190
  return getMenuEntries$9(props.platform);
2129
2191
  case OpenRecent$1:
2130
2192
  return getMenuEntries$8();
@@ -2134,16 +2196,266 @@ const getMenuEntries2 = async (state, props) => {
2134
2196
  return getMenuEntries$6();
2135
2197
  case Terminal$2:
2136
2198
  return getMenuEntries$5();
2199
+ case TitleBar$1:
2200
+ return getMenuEntries$2(props.platform);
2137
2201
  case TitleBarContextMenu:
2138
2202
  case MenuIdTitleBarContextMenu:
2139
2203
  return getMenuEntriesTitleBarContextMenu(state);
2140
2204
  case View$2:
2141
- return getMenuEntries$4();
2205
+ return getMenuEntries$1();
2142
2206
  default:
2143
2207
  return [];
2144
2208
  }
2145
2209
  };
2146
2210
 
2211
+ const getEntryMap = async (state, menuIds) => {
2212
+ const map = Object.create(null);
2213
+ for (const id of menuIds) {
2214
+ const entries = await getMenuEntries2(state, {
2215
+ // @ts-ignore
2216
+ menuId: id
2217
+ });
2218
+ map[id] = entries;
2219
+ }
2220
+ return map;
2221
+ };
2222
+
2223
+ // TODO cache window id
2224
+
2225
+ const getWindowId = async () => {
2226
+ const windowId = await invoke('GetWindowId.getWindowId');
2227
+ return windowId;
2228
+ };
2229
+
2230
+ // based on https://www.electronjs.org/docs/latest/api/menu-item#new-menuitemoptions
2231
+
2232
+ const Undo = 'undo';
2233
+ const Redo = 'redo';
2234
+ const Cut = 'cut';
2235
+ const Copy = 'copy';
2236
+ const Paste = 'paste';
2237
+ const SelectAll = 'selectAll';
2238
+ const ToggleDevTools = 'toggleDevTools';
2239
+ const Help = 'help';
2240
+ const Quit = 'quit';
2241
+ const FileMenu = 'fileMenu';
2242
+ const EditMenu = 'editMenu';
2243
+
2244
+ // based on https://www.electronjs.org/docs/latest/api/menu-item#new-menuitemoptions
2245
+ const Separator$1 = 'separator';
2246
+ const SubMenu = 'submenu';
2247
+
2248
+ const toElectronMenuItem = entry => {
2249
+ switch (entry.label) {
2250
+ case copy$1():
2251
+ return {
2252
+ label: entry.label,
2253
+ role: Copy
2254
+ };
2255
+ case cut$1():
2256
+ return {
2257
+ label: entry.label,
2258
+ role: Cut
2259
+ };
2260
+ case edit():
2261
+ return {
2262
+ label: entry.label,
2263
+ role: EditMenu,
2264
+ submenu: []
2265
+ };
2266
+ case exit$1():
2267
+ return {
2268
+ label: entry.label,
2269
+ role: Quit
2270
+ };
2271
+ case file():
2272
+ return {
2273
+ label: entry.label,
2274
+ role: FileMenu,
2275
+ submenu: []
2276
+ };
2277
+ case help():
2278
+ return {
2279
+ label: entry.label,
2280
+ role: Help,
2281
+ submenu: []
2282
+ };
2283
+ case paste$1():
2284
+ return {
2285
+ label: entry.label,
2286
+ role: Paste
2287
+ };
2288
+ case redo$1():
2289
+ return {
2290
+ label: entry.label,
2291
+ role: Redo
2292
+ };
2293
+ case selectAll$1():
2294
+ return {
2295
+ label: entry.label,
2296
+ role: SelectAll
2297
+ };
2298
+ case toggleDeveloperTools$1():
2299
+ return {
2300
+ label: entry.label,
2301
+ role: ToggleDevTools
2302
+ };
2303
+ case undo$1():
2304
+ return {
2305
+ label: entry.label,
2306
+ role: Undo
2307
+ };
2308
+ }
2309
+ switch (entry.flags) {
2310
+ case Separator$2:
2311
+ return {
2312
+ type: Separator$1
2313
+ };
2314
+ case SubMenu$1:
2315
+ return {
2316
+ label: entry.label,
2317
+ submenu: [],
2318
+ type: SubMenu
2319
+ };
2320
+ default:
2321
+ return {
2322
+ label: entry.label
2323
+ };
2324
+ }
2325
+ };
2326
+
2327
+ const toElectronMenuInternal = (commandMap, map, id, electronMenu) => {
2328
+ object(commandMap);
2329
+ object(map);
2330
+ number(id);
2331
+ array(electronMenu);
2332
+ const entries = map[id];
2333
+ array(entries);
2334
+ for (const entry of entries) {
2335
+ if (entry.command) {
2336
+ commandMap[entry.label] = {
2337
+ args: entry.args,
2338
+ command: entry.command
2339
+ };
2340
+ }
2341
+ const electronEntry = toElectronMenuItem(entry);
2342
+ if (entry.flags === SubMenu$2) {
2343
+ toElectronMenuInternal(commandMap, map, entry.id, electronEntry.submenu);
2344
+ }
2345
+ electronMenu.push(electronEntry);
2346
+ }
2347
+ return {
2348
+ commandMap,
2349
+ electronMenu
2350
+ };
2351
+ };
2352
+
2353
+ const toElectronMenu = (map, rootId) => {
2354
+ const electronMenu = [];
2355
+ const commandMap = Object.create(null);
2356
+ toElectronMenuInternal(commandMap, map, rootId, electronMenu);
2357
+ return {
2358
+ commandMap,
2359
+ electronMenu
2360
+ };
2361
+ };
2362
+
2363
+ const setItems = async items => {
2364
+ const windowId = await getWindowId();
2365
+ return invoke('WebView.compatSharedProcessInvoke', 'ElectronApplicationMenu.setItems', windowId, items);
2366
+ };
2367
+ const hydrate = async state => {
2368
+ const ids = getMenuIds();
2369
+ const map = await getEntryMap(state, ids);
2370
+ const {
2371
+ commandMap,
2372
+ electronMenu
2373
+ } = toElectronMenu(map, TitleBar);
2374
+ await setItems(electronMenu);
2375
+ // TODO get all menu items
2376
+ // TODO send menu items to electron
2377
+ // TODO add listener for when menu items change
2378
+ return {
2379
+ ...state,
2380
+ commandMap
2381
+ };
2382
+ };
2383
+
2384
+ const Menu$1 = 'menu';
2385
+ const MenuBar = 'menubar';
2386
+ const MenuItem$1 = 'menuitem';
2387
+ const MenuItemCheckBox = 'menuitemcheckbox';
2388
+ const None = 'none';
2389
+ const Separator = 'separator';
2390
+
2391
+ const Button = 1;
2392
+ const Div = 4;
2393
+ const Span = 8;
2394
+ const Text = 12;
2395
+ const I = 16;
2396
+ const Img = 17;
2397
+
2398
+ const Escape = 8;
2399
+ const Space = 9;
2400
+ const End = 255;
2401
+ const Home = 12;
2402
+ const LeftArrow = 13;
2403
+ const UpArrow = 14;
2404
+ const RightArrow = 15;
2405
+ const DownArrow = 16;
2406
+
2407
+ const mergeClassNames = (...classNames) => {
2408
+ return classNames.filter(Boolean).join(' ');
2409
+ };
2410
+
2411
+ const px = value => {
2412
+ return `${value}px`;
2413
+ };
2414
+
2415
+ const text = data => {
2416
+ return {
2417
+ type: Text,
2418
+ text: data,
2419
+ childCount: 0
2420
+ };
2421
+ };
2422
+
2423
+ const getKeyBindings = () => {
2424
+ return [{
2425
+ command: 'TitleBar.handleKeyArrowDown',
2426
+ key: DownArrow,
2427
+ when: FocusTitleBarMenuBar
2428
+ }, {
2429
+ command: 'TitleBar.handleKeyArrowUp',
2430
+ key: UpArrow,
2431
+ when: FocusTitleBarMenuBar
2432
+ }, {
2433
+ command: 'TitleBar.handleKeyArrowRight',
2434
+ key: RightArrow,
2435
+ when: FocusTitleBarMenuBar
2436
+ }, {
2437
+ command: 'TitleBar.handleKeyArrowLeft',
2438
+ key: LeftArrow,
2439
+ when: FocusTitleBarMenuBar
2440
+ }, {
2441
+ command: 'TitleBar.handleKeySpace',
2442
+ key: Space,
2443
+ when: FocusTitleBarMenuBar
2444
+ }, {
2445
+ command: 'TitleBar.handleKeyHome',
2446
+ key: Home,
2447
+ when: FocusTitleBarMenuBar
2448
+ }, {
2449
+ command: 'TitleBar.handleKeyEnd',
2450
+ key: End,
2451
+ when: FocusTitleBarMenuBar
2452
+ }, {
2453
+ command: 'TitleBar.handleKeyEscape',
2454
+ key: Escape,
2455
+ when: FocusTitleBarMenuBar
2456
+ }];
2457
+ };
2458
+
2147
2459
  const maximize = async () => {
2148
2460
  await invoke('ElectronWindow.maximize');
2149
2461
  };
@@ -2199,6 +2511,22 @@ const handleContextMenu = async (state, button, eventX, eventY) => {
2199
2511
  return state;
2200
2512
  };
2201
2513
 
2514
+ const handleElectronMenuClick = async (state, label) => {
2515
+ const {
2516
+ commandMap
2517
+ } = state;
2518
+ const commandPair = commandMap[label];
2519
+ if (!commandPair) {
2520
+ throw new Error(`no command found for ${label}`);
2521
+ }
2522
+ const {
2523
+ args = [],
2524
+ command
2525
+ } = commandPair;
2526
+ await invoke(command, ...args);
2527
+ return state;
2528
+ };
2529
+
2202
2530
  const getMenuOffset = (x, clientX, iconWidth) => {
2203
2531
  return clientX - x - iconWidth;
2204
2532
  };
@@ -2233,7 +2561,7 @@ const getMenuHeight = items => {
2233
2561
  let height = CONTEXT_MENU_PADDING;
2234
2562
  for (const item of items) {
2235
2563
  switch (item.flags) {
2236
- case Separator:
2564
+ case Separator$2:
2237
2565
  height += CONTEXT_MENU_SEPARATOR_HEIGHT;
2238
2566
  break;
2239
2567
  default:
@@ -2290,7 +2618,7 @@ const getIndexToFocusPrevious = menu => {
2290
2618
  const canBeFocused = item => {
2291
2619
  switch (item.flags) {
2292
2620
  case Disabled:
2293
- case Separator:
2621
+ case Separator$2:
2294
2622
  return false;
2295
2623
  default:
2296
2624
  return true;
@@ -2514,100 +2842,6 @@ const getTitle = workspaceUri => {
2514
2842
  return baseName;
2515
2843
  };
2516
2844
 
2517
- const getMenuEntries$3 = () => {
2518
- return [{
2519
- command: '',
2520
- flags: SubMenu,
2521
- id: File$1,
2522
- label: file()
2523
- }, {
2524
- command: '',
2525
- flags: SubMenu,
2526
- id: Edit,
2527
- label: edit()
2528
- }, {
2529
- command: '',
2530
- flags: SubMenu,
2531
- id: Selection,
2532
- label: selection()
2533
- }, {
2534
- command: '',
2535
- flags: SubMenu,
2536
- id: View,
2537
- label: view()
2538
- }, {
2539
- command: '',
2540
- flags: SubMenu,
2541
- id: Go,
2542
- label: go()
2543
- }, {
2544
- command: '',
2545
- flags: SubMenu,
2546
- id: Run,
2547
- keyboardShortCut: 'Alt+r',
2548
- label: run()
2549
- }, {
2550
- command: '',
2551
- flags: SubMenu,
2552
- id: Terminal,
2553
- keyboardShortCut: 'Alt+t',
2554
- label: terminal()
2555
- }, {
2556
- command: '',
2557
- flags: SubMenu,
2558
- id: Help,
2559
- keyboardShortCut: 'Alt+h',
2560
- label: help()
2561
- }];
2562
- };
2563
-
2564
- const getMenuEntries$2 = () => {
2565
- return [{
2566
- command: '',
2567
- flags: None,
2568
- id: File$1,
2569
- label: file()
2570
- }, {
2571
- command: '',
2572
- flags: None,
2573
- id: Edit,
2574
- label: edit()
2575
- }, {
2576
- command: '',
2577
- flags: None,
2578
- id: Selection,
2579
- label: selection()
2580
- }, {
2581
- command: '',
2582
- flags: None,
2583
- id: View,
2584
- label: view()
2585
- }, {
2586
- command: '',
2587
- flags: None,
2588
- id: Go,
2589
- label: go()
2590
- }, {
2591
- command: '',
2592
- flags: None,
2593
- id: Help,
2594
- label: help()
2595
- }];
2596
- };
2597
-
2598
- const getFn$1 = platform => {
2599
- switch (platform) {
2600
- case Web:
2601
- return getMenuEntries$2;
2602
- default:
2603
- return getMenuEntries$3;
2604
- }
2605
- };
2606
- const getMenuEntries$1 = async platform => {
2607
- const fn = getFn$1(platform);
2608
- return fn();
2609
- };
2610
-
2611
2845
  const loadContent2 = async state => {
2612
2846
  const {
2613
2847
  controlsOverlayEnabled,
@@ -2619,12 +2853,15 @@ const loadContent2 = async state => {
2619
2853
  platform,
2620
2854
  titleBarStyleCustom
2621
2855
  } = state;
2622
- const titleBarEntries = await getMenuEntries$1(platform);
2856
+ const titleBarEntries = await getMenuEntries$2(platform);
2623
2857
  const withWidths = addWidths(titleBarEntries, labelPadding, labelFontWeight, labelFontSize, labelFontFamily, labelLetterSpacing);
2624
2858
  const buttons = getTitleBarButtons(platform, controlsOverlayEnabled, titleBarStyleCustom);
2625
2859
  const workspaceUri = await invoke('Workspace.getUri');
2626
2860
  const title = getTitle(workspaceUri);
2627
2861
  const iconWidth = 30;
2862
+ if (titleBarStyleCustom === false) {
2863
+ return hydrate(state);
2864
+ }
2628
2865
  return {
2629
2866
  ...state,
2630
2867
  buttons,
@@ -2750,7 +2987,7 @@ const getMenuItemsNoopDom = () => {
2750
2987
  const separator = {
2751
2988
  childCount: 1,
2752
2989
  className: MenuItemSeparator,
2753
- role: Separator$1,
2990
+ role: Separator,
2754
2991
  type: Div
2755
2992
  };
2756
2993
  const separatorLine = {
@@ -2810,12 +3047,12 @@ const getMenuItemRenderer = flags => {
2810
3047
  case Disabled:
2811
3048
  return getMenuItemDisabledDom;
2812
3049
  case Ignore:
2813
- case None:
3050
+ case None$1:
2814
3051
  case RestoreFocus:
2815
3052
  return getMenuItemDefaultDom;
2816
- case Separator:
3053
+ case Separator$2:
2817
3054
  return getMenuItemSeparatorDom;
2818
- case SubMenu:
3055
+ case SubMenu$1:
2819
3056
  return getMenuItemSubMenuDom;
2820
3057
  case Unchecked:
2821
3058
  return getMenuItemUncheckedDom;
@@ -2908,7 +3145,7 @@ const getIconVirtualDom = (icon, type = Div) => {
2908
3145
  return {
2909
3146
  childCount: 0,
2910
3147
  className: `MaskIcon MaskIcon${icon}`,
2911
- role: None$1,
3148
+ role: None,
2912
3149
  type
2913
3150
  };
2914
3151
  };
@@ -2925,7 +3162,7 @@ const createTitleBarButton = button => {
2925
3162
  childCount: 1,
2926
3163
  className: `TitleBarButton TitleBarButton${id}`,
2927
3164
  onClick,
2928
- type: Button$1
3165
+ type: Button
2929
3166
  }, getIconVirtualDom(icon, I)];
2930
3167
  return dom;
2931
3168
  };
@@ -2994,7 +3231,7 @@ const getItemVirtualDom = item => {
2994
3231
  name: label,
2995
3232
  // TODO have separate name attribute
2996
3233
  role: MenuItem$1,
2997
- type: Button$1
3234
+ type: Button
2998
3235
  }, ...(isFocused ? [{
2999
3236
  childCount: 1,
3000
3237
  className: TitleBarTopLevelEntryLabel,
@@ -3020,7 +3257,7 @@ const getTitleBarMenuBarVirtualDom = (menuBarEnabled, visibleItems, focusedIndex
3020
3257
  onMouseDown: HandleClick,
3021
3258
  onPointerOut: HandlePointerOut,
3022
3259
  onPointerOver: HandlePointerOver,
3023
- role: MenuBar$1,
3260
+ role: MenuBar,
3024
3261
  tabIndex: 0,
3025
3262
  type: Div
3026
3263
  }, ...getTitleBarMenuBarItemsVirtualDom(visibleItems)];
@@ -3029,7 +3266,7 @@ const getTitleBarMenuBarVirtualDom = (menuBarEnabled, visibleItems, focusedIndex
3029
3266
  const parentNode = {
3030
3267
  childCount: 1,
3031
3268
  className: 'TitleBarTitle',
3032
- type: Div
3269
+ type: Div$1
3033
3270
  };
3034
3271
  const getTitleVirtualDom = (titleBarTitleEnabled, title) => {
3035
3272
  if (!titleBarTitleEnabled) {
@@ -3089,9 +3326,16 @@ const getTitleBarVirtualDom = state => {
3089
3326
  titleBarEntries,
3090
3327
  titleBarIconEnabled,
3091
3328
  titleBarMenuBarEnabled,
3329
+ titleBarStyleCustom,
3092
3330
  titleBarTitleEnabled,
3093
3331
  width
3094
3332
  } = state;
3333
+ if (titleBarStyleCustom) {
3334
+ return [{
3335
+ childCount: 0,
3336
+ type: Div$1
3337
+ }];
3338
+ }
3095
3339
  const iconSrc = getIcon(assetDir);
3096
3340
  const visibleEntries = getVisibleTitleBarEntries(titleBarEntries, width, focusedIndex, isMenuOpen);
3097
3341
  return [{
@@ -3101,7 +3345,7 @@ const getTitleBarVirtualDom = state => {
3101
3345
  className: 'Viewlet TitleBar',
3102
3346
  id: 'TitleBar',
3103
3347
  role: ContentInfo,
3104
- type: Div
3348
+ type: Div$1
3105
3349
  }, ...getTitleBarIconVirtualDom(titleBarIconEnabled, iconSrc), ...getTitleBarMenuBarVirtualDom(titleBarMenuBarEnabled, visibleEntries, focusedIndex), ...getTitleVirtualDom(titleBarTitleEnabled, title), ...getTitleBarButtonsVirtualDom(titleBarButtonsEnabled, titleBarButtons)];
3106
3350
  };
3107
3351
 
@@ -3146,7 +3390,7 @@ const renderEventListeners = () => {
3146
3390
  params: ['handleClickMinimize']
3147
3391
  }, {
3148
3392
  name: HandleContextMenu,
3149
- params: ['handleContextMenu', Button, ClientX, ClientY]
3393
+ params: ['handleContextMenu', Button$1, ClientX, ClientY]
3150
3394
  }, {
3151
3395
  name: HandleClickToggleClose,
3152
3396
  params: ['handleClickClose']
@@ -3164,7 +3408,7 @@ const renderEventListeners = () => {
3164
3408
  params: ['handleMenuMouseOver', ClientX, ClientY]
3165
3409
  }, {
3166
3410
  name: HandleClick,
3167
- params: ['handleClickAt', Button, ClientX, ClientY]
3411
+ params: ['handleClickAt', Button$1, ClientX, ClientY]
3168
3412
  }, {
3169
3413
  name: HandlePointerOut,
3170
3414
  params: ['handlePointerOut', ClientX, ClientY]
@@ -3446,7 +3690,7 @@ const getFn = id => {
3446
3690
  return getMenuEntries$b;
3447
3691
  case Go$2:
3448
3692
  return getMenuEntries$a;
3449
- case Help$2:
3693
+ case Help$3:
3450
3694
  return getMenuEntries$9;
3451
3695
  case OpenRecent$1:
3452
3696
  return getMenuEntries$8;
@@ -3456,10 +3700,10 @@ const getFn = id => {
3456
3700
  return getMenuEntries$6;
3457
3701
  case Terminal$2:
3458
3702
  return getMenuEntries$5;
3459
- case TitleBar:
3460
- return getMenuEntries$1;
3703
+ case TitleBar$1:
3704
+ return getMenuEntries$2;
3461
3705
  case View$2:
3462
- return getMenuEntries$4;
3706
+ return getMenuEntries$1;
3463
3707
  default:
3464
3708
  return undefined;
3465
3709
  }
@@ -3494,7 +3738,7 @@ const handleKeyArrowRightMenuOpen = async state => {
3494
3738
  return focusNext(state);
3495
3739
  }
3496
3740
  const item = items[focusedIndex];
3497
- if (item.flags === SubMenu && item.id !== undefined) {
3741
+ if (item.flags === SubMenu$1 && item.id !== undefined) {
3498
3742
  const subMenuEntries = await getMenuEntries(item.id);
3499
3743
  const subMenu = {
3500
3744
  focusedIndex: 0,
@@ -3690,11 +3934,11 @@ const handleMenuClick = async (state, level, index) => {
3690
3934
  switch (item.flags) {
3691
3935
  case Ignore:
3692
3936
  return selectIndexIgnore(state, item);
3693
- case None:
3937
+ case None$1:
3694
3938
  return selectIndexNone(state, item);
3695
3939
  case RestoreFocus:
3696
3940
  return selectIndexRestoreFocus(state, item);
3697
- case SubMenu:
3941
+ case SubMenu$1:
3698
3942
  return selectIndexSubMenu(state, menu, index);
3699
3943
  default:
3700
3944
  return state;
@@ -3717,7 +3961,7 @@ const getNewMenus = async (menus, level, index, flags) => {
3717
3961
  if (index === -1) {
3718
3962
  return menus;
3719
3963
  }
3720
- if (item.flags === SubMenu && level === menus.length - 2) {
3964
+ if (item.flags === SubMenu$1 && level === menus.length - 2) {
3721
3965
  const subMenu = menus[level + 1];
3722
3966
  if (subMenu.focusedIndex !== -1) {
3723
3967
  const newSubMenu = {
@@ -3737,7 +3981,7 @@ const getNewMenus = async (menus, level, index, flags) => {
3737
3981
  }];
3738
3982
  return newMenus;
3739
3983
  }
3740
- if (item.flags === SubMenu) {
3984
+ if (item.flags === SubMenu$1) {
3741
3985
  const item = items[index];
3742
3986
  if (!item.id) {
3743
3987
  return menus;
@@ -3826,6 +4070,7 @@ const commandMap = {
3826
4070
  'TitleBar.handleClickMinimize': wrapCommand(handleClickMinimize),
3827
4071
  'TitleBar.handleClickToggleMaximize': wrapCommand(handleClickToggleMaximize),
3828
4072
  'TitleBar.handleContextMenu': wrapCommand(handleContextMenu),
4073
+ 'TitleBar.handleElectronMenuClick': wrapCommand(handleElectronMenuClick),
3829
4074
  'TitleBar.handleFocus': wrapCommand(handleFocus),
3830
4075
  'TitleBar.handleFocusOut': wrapCommand(handleFocusOut),
3831
4076
  'TitleBar.handleKeyArrowDown': wrapCommand(handleKeyArrowDown),
@@ -3845,6 +4090,7 @@ const commandMap = {
3845
4090
  'TitleBar.handlePointerOver': wrapCommand(handlePointerOver),
3846
4091
  'TitleBar.hideCommandCenter': wrapCommand(hideCommandCenter),
3847
4092
  'TitleBar.hideMenuBar': wrapCommand(hideMenuBar),
4093
+ 'TitleBar.hydrateElectronApplicationMenu': wrapCommand(hydrate),
3848
4094
  'TitleBar.loadContent2': wrapCommand(loadContent2),
3849
4095
  'TitleBar.render3': render3,
3850
4096
  'TitleBar.renderEventListeners': renderEventListeners,