@lvce-editor/title-bar-worker 2.27.0 → 2.29.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.
@@ -1003,6 +1003,7 @@ const DEFAULT_UID = 1;
1003
1003
  const createDefaultState = (uid = DEFAULT_UID) => ({
1004
1004
  assetDir: '',
1005
1005
  buttons: [],
1006
+ commandCenterEnabled: false,
1006
1007
  controlsOverlayEnabled: false,
1007
1008
  focusedIndex: -1,
1008
1009
  height: 30,
@@ -1013,6 +1014,7 @@ const createDefaultState = (uid = DEFAULT_UID) => ({
1013
1014
  labelFontWeight: 400,
1014
1015
  labelLetterSpacing: 0,
1015
1016
  labelPadding: 8,
1017
+ layoutControlsEnabled: false,
1016
1018
  menus: [],
1017
1019
  platform: Electron,
1018
1020
  title: '',
@@ -1029,9 +1031,7 @@ const createDefaultState = (uid = DEFAULT_UID) => ({
1029
1031
  uid,
1030
1032
  width: 800,
1031
1033
  x: 0,
1032
- y: 0,
1033
- layoutControlsEnabled: false,
1034
- commandCenterEnabled: false
1034
+ y: 0
1035
1035
  });
1036
1036
 
1037
1037
  const emptyObject = {};
@@ -1052,44 +1052,44 @@ const ClearRecentlyOpened = 'Clear Recently Opened';
1052
1052
  const Close = 'Close';
1053
1053
  const MenuBar$1 = 'Menu Bar';
1054
1054
  const CommandCenter = 'Command Center';
1055
- const Edit$1 = 'Edit';
1056
- const File$2 = 'File';
1057
- const Go$1 = 'Go';
1058
- const Help$1 = 'Help';
1055
+ const Edit$2 = 'Edit';
1056
+ const File$3 = 'File';
1057
+ const Go$2 = 'Go';
1058
+ const Help$2 = 'Help';
1059
1059
  const Maximize = 'Maximize';
1060
1060
  const Minimize = 'Minimize';
1061
1061
  const MoreDot = 'More ...';
1062
1062
  const NewTerminal = 'New Terminal';
1063
1063
  const OpenProcessExplorer = 'Open Process Explorer';
1064
- const Run$1 = 'Run';
1065
- const Selection$1 = 'Selection';
1066
- const Terminal$1 = 'Terminal';
1064
+ const Run$2 = 'Run';
1065
+ const Selection$2 = 'Selection';
1066
+ const Terminal$2 = 'Terminal';
1067
1067
  const ToggleDeveloperTools = 'Toggle Developer Tools';
1068
- const View$1 = 'View';
1068
+ const View$2 = 'View';
1069
1069
 
1070
1070
  const file = () => {
1071
- return i18nString(File$2);
1071
+ return i18nString(File$3);
1072
1072
  };
1073
1073
  const edit = () => {
1074
- return i18nString(Edit$1);
1074
+ return i18nString(Edit$2);
1075
1075
  };
1076
1076
  const selection = () => {
1077
- return i18nString(Selection$1);
1077
+ return i18nString(Selection$2);
1078
1078
  };
1079
1079
  const view = () => {
1080
- return i18nString(View$1);
1080
+ return i18nString(View$2);
1081
1081
  };
1082
1082
  const go = () => {
1083
- return i18nString(Go$1);
1083
+ return i18nString(Go$2);
1084
1084
  };
1085
1085
  const run = () => {
1086
- return i18nString(Run$1);
1086
+ return i18nString(Run$2);
1087
1087
  };
1088
1088
  const terminal = () => {
1089
- return i18nString(Terminal$1);
1089
+ return i18nString(Terminal$2);
1090
1090
  };
1091
1091
  const help = () => {
1092
- return i18nString(Help$1);
1092
+ return i18nString(Help$2);
1093
1093
  };
1094
1094
  const minimize$1 = () => {
1095
1095
  return i18nString(Minimize);
@@ -1114,19 +1114,19 @@ const getTitleBarButtonsElectron = (controlsOverlayEnabled, titleBarStyleCustom)
1114
1114
  if (titleBarStyleCustom) {
1115
1115
  // TODO don't render title bar buttons on windows when electron window controls overlay is enabled
1116
1116
  return [{
1117
- label: minimize$1(),
1118
1117
  icon: 'Minimize',
1119
1118
  id: 'Minimize',
1119
+ label: minimize$1(),
1120
1120
  onClick: 'handleClickMinimize'
1121
1121
  }, {
1122
- label: maximize$1(),
1123
1122
  icon: 'Maximize',
1124
1123
  id: 'ToggleMaximize',
1124
+ label: maximize$1(),
1125
1125
  onClick: 'handleClickToggleMaximize'
1126
1126
  }, {
1127
- label: close$1(),
1128
1127
  icon: 'ChromeClose',
1129
1128
  id: 'Close',
1129
+ label: close$1(),
1130
1130
  onClick: 'handleClickClose'
1131
1131
  }];
1132
1132
  }
@@ -1145,10 +1145,10 @@ const getTitleBarButtons = (platform, controlsOverlayEnabled, titleBarStyleCusto
1145
1145
  switch (platform) {
1146
1146
  case Electron:
1147
1147
  return getTitleBarButtonsElectron(controlsOverlayEnabled, titleBarStyleCustom);
1148
- case Web:
1149
- return getTitleBarButtonsWeb();
1150
1148
  case Remote:
1151
1149
  return getTitleBarButtonsRemote();
1150
+ case Web:
1151
+ return getTitleBarButtonsWeb();
1152
1152
  default:
1153
1153
  return [];
1154
1154
  }
@@ -1156,9 +1156,9 @@ const getTitleBarButtons = (platform, controlsOverlayEnabled, titleBarStyleCusto
1156
1156
 
1157
1157
  const {
1158
1158
  get: get$1,
1159
- set: set$3,
1160
1159
  getCommandIds,
1161
1160
  registerCommands,
1161
+ set: set$3,
1162
1162
  wrapCommand,
1163
1163
  wrapGetter
1164
1164
  } = create$2();
@@ -1167,29 +1167,29 @@ const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled,
1167
1167
  const titleBarButtons = getTitleBarButtons(platform, controlsOverlayEnabled, titleBarStyleCustom);
1168
1168
  const state = {
1169
1169
  ...createDefaultState(),
1170
- uid: id,
1171
- titleBarEntries: [],
1170
+ assetDir,
1171
+ commandCenterEnabled: false,
1172
+ controlsOverlayEnabled,
1172
1173
  focusedIndex: -1,
1174
+ height,
1175
+ iconWidth: 30,
1173
1176
  isMenuOpen: false,
1174
- menus: [],
1175
- labelFontWeight: 400,
1176
- labelFontSize: 13,
1177
1177
  labelFontFamily: 'system-ui, Ubuntu, Droid Sans, sans-serif',
1178
- labelPadding: 8,
1178
+ labelFontSize: 13,
1179
+ labelFontWeight: 400,
1179
1180
  labelLetterSpacing: 0,
1180
- titleBarHeight: height,
1181
- x,
1182
- y,
1183
- width,
1184
- height,
1185
- iconWidth: 30,
1181
+ labelPadding: 8,
1182
+ layoutControlsEnabled: false,
1183
+ menus: [],
1186
1184
  platform,
1187
- controlsOverlayEnabled,
1188
- titleBarStyleCustom,
1189
1185
  titleBarButtons,
1190
- assetDir,
1191
- layoutControlsEnabled: false,
1192
- commandCenterEnabled: false
1186
+ titleBarEntries: [],
1187
+ titleBarHeight: height,
1188
+ titleBarStyleCustom,
1189
+ uid: id,
1190
+ width,
1191
+ x,
1192
+ y
1193
1193
  };
1194
1194
  set$3(id, state, state);
1195
1195
  };
@@ -1226,8 +1226,8 @@ const diff = (oldState, newState) => {
1226
1226
 
1227
1227
  const diff2 = uid => {
1228
1228
  const {
1229
- oldState,
1230
- newState
1229
+ newState,
1230
+ oldState
1231
1231
  } = get$1(uid);
1232
1232
  return diff(oldState, newState);
1233
1233
  };
@@ -1241,8 +1241,8 @@ const numbers = [RenderEntries, RenderFocusedIndex, RenderMenus];
1241
1241
 
1242
1242
  const diff3 = uid => {
1243
1243
  const {
1244
- oldState,
1245
- newState
1244
+ newState,
1245
+ oldState
1246
1246
  } = get$1(uid);
1247
1247
  const diffResult = [];
1248
1248
  for (let i = 0; i < modules.length; i++) {
@@ -1545,7 +1545,16 @@ const Script = 2;
1545
1545
  const CtrlCmd = 1 << 11 >>> 0;
1546
1546
  const Shift = 1 << 10 >>> 0;
1547
1547
 
1548
+ const Edit$1 = 2;
1549
+ const File$2 = 5;
1550
+ const Go$1 = 6;
1551
+ const Help$1 = 7;
1552
+ const OpenRecent$1 = 9;
1553
+ const Run$1 = 10;
1554
+ const Selection$1 = 11;
1555
+ const Terminal$1 = 14;
1548
1556
  const TitleBar$1 = 15;
1557
+ const View$1 = 16;
1549
1558
 
1550
1559
  const parseKey = rawKey => {
1551
1560
  const isCtrl = Boolean(rawKey & CtrlCmd);
@@ -1582,36 +1591,36 @@ const text = data => {
1582
1591
 
1583
1592
  const getKeyBindings$1 = () => {
1584
1593
  return [{
1585
- key: DownArrow$1,
1586
1594
  command: 'TitleBar.handleKeyArrowDown',
1595
+ key: DownArrow$1,
1587
1596
  when: FocusTitleBarMenuBar
1588
1597
  }, {
1589
- key: UpArrow$1,
1590
1598
  command: 'TitleBar.handleKeyArrowUp',
1599
+ key: UpArrow$1,
1591
1600
  when: FocusTitleBarMenuBar
1592
1601
  }, {
1593
- key: RightArrow$1,
1594
1602
  command: 'TitleBar.handleKeyArrowRight',
1603
+ key: RightArrow$1,
1595
1604
  when: FocusTitleBarMenuBar
1596
1605
  }, {
1597
- key: LeftArrow$1,
1598
1606
  command: 'TitleBar.handleKeyArrowLeft',
1607
+ key: LeftArrow$1,
1599
1608
  when: FocusTitleBarMenuBar
1600
1609
  }, {
1601
- key: Space$1,
1602
1610
  command: 'TitleBar.handleKeySpace',
1611
+ key: Space$1,
1603
1612
  when: FocusTitleBarMenuBar
1604
1613
  }, {
1605
- key: Home$1,
1606
1614
  command: 'TitleBar.handleKeyHome',
1615
+ key: Home$1,
1607
1616
  when: FocusTitleBarMenuBar
1608
1617
  }, {
1609
- key: End$1,
1610
1618
  command: 'TitleBar.handleKeyEnd',
1619
+ key: End$1,
1611
1620
  when: FocusTitleBarMenuBar
1612
1621
  }, {
1613
- key: Escape$1,
1614
1622
  command: 'TitleBar.handleKeyEscape',
1623
+ key: Escape$1,
1615
1624
  when: FocusTitleBarMenuBar
1616
1625
  }];
1617
1626
  };
@@ -1627,25 +1636,25 @@ const Ignore = 7;
1627
1636
 
1628
1637
  const getMenuEntriesTitleBarContextMenu = async state => {
1629
1638
  const {
1630
- titleBarMenuBarEnabled,
1631
- commandCenterEnabled
1639
+ commandCenterEnabled,
1640
+ titleBarMenuBarEnabled
1632
1641
  } = state;
1633
1642
  // TODO checked state should be depending on whether or not that feature is currently visible or not
1634
1643
  return [{
1635
- id: 'MenuBar',
1636
- label: menuBar(),
1644
+ command: titleBarMenuBarEnabled ? 'TitleBar.hideMenuBar' : 'TitleBar.showMenuBar',
1637
1645
  flags: titleBarMenuBarEnabled ? Checked : Unchecked,
1638
- command: titleBarMenuBarEnabled ? 'TitleBar.hideMenuBar' : 'TitleBar.showMenuBar'
1646
+ id: 'MenuBar',
1647
+ label: menuBar()
1639
1648
  }, {
1640
- id: 'Command center',
1641
- label: commandCenter(),
1649
+ command: commandCenterEnabled ? 'TitleBar.hideCommandCenter' : 'TitleBar.showCommandCenter',
1642
1650
  flags: commandCenterEnabled ? Checked : Unchecked,
1643
- command: commandCenterEnabled ? 'TitleBar.hideCommandCenter' : 'TitleBar.showCommandCenter'
1651
+ id: 'Command center',
1652
+ label: commandCenter()
1644
1653
  }, {
1645
- id: 'layout controls',
1646
- label: 'layout controls',
1654
+ command: '',
1647
1655
  flags: Checked,
1648
- command: ''
1656
+ id: 'layout controls',
1657
+ label: 'layout controls'
1649
1658
  }];
1650
1659
  };
1651
1660
 
@@ -1664,7 +1673,8 @@ const UiStrings$1 = {
1664
1673
  SelectAll: 'Select All',
1665
1674
  ToggleBlockComment: 'Toggle Block Comment',
1666
1675
  ToggleLineComment: 'Toggle Line Comment',
1667
- Undo: 'Undo'};
1676
+ Undo: 'Undo'
1677
+ };
1668
1678
  const cut = () => {
1669
1679
  return i18nString(UiStrings$1.Cut);
1670
1680
  };
@@ -1714,49 +1724,49 @@ const TitleBar = 15;
1714
1724
  const View = 16;
1715
1725
 
1716
1726
  const menuEntrySeparator = {
1717
- id: 'separator',
1718
- label: '',
1727
+ command: '',
1719
1728
  flags: Separator,
1720
- command: ''
1729
+ id: 'separator',
1730
+ label: ''
1721
1731
  };
1722
1732
 
1723
1733
  const id$9 = Edit;
1724
1734
  const getMenuEntries$d = () => {
1725
1735
  return [{
1726
- id: 'undo',
1727
- label: undo(),
1736
+ command: /* TODO */'-1',
1728
1737
  flags: Disabled,
1729
- command: /* TODO */'-1'
1738
+ id: 'undo',
1739
+ label: undo()
1730
1740
  }, {
1731
- id: 'redo',
1732
- label: redo(),
1741
+ command: /* TODO */'-1',
1733
1742
  flags: Disabled,
1734
- command: /* TODO */'-1'
1743
+ id: 'redo',
1744
+ label: redo()
1735
1745
  }, menuEntrySeparator, {
1736
- id: 'cut',
1737
- label: cut(),
1746
+ command: /* Editor.cut */'Editor.cut',
1738
1747
  flags: None,
1739
- command: /* Editor.cut */'Editor.cut'
1748
+ id: 'cut',
1749
+ label: cut()
1740
1750
  }, {
1741
- id: 'copy',
1742
- label: copy(),
1751
+ command: /* Editor.copy */'Editor.copy',
1743
1752
  flags: None,
1744
- command: /* Editor.copy */'Editor.copy'
1753
+ id: 'copy',
1754
+ label: copy()
1745
1755
  }, {
1746
- id: 'paste',
1747
- label: paste(),
1756
+ command: /* Editor.paste */'Editor.paste',
1748
1757
  flags: None,
1749
- command: /* Editor.paste */'Editor.paste'
1758
+ id: 'paste',
1759
+ label: paste()
1750
1760
  }, menuEntrySeparator, {
1751
- id: 'toggle-line-comment',
1752
- label: toggleLineComment(),
1761
+ command: /* Editor.toggleLineComment */'Editor.toggleLineComment',
1753
1762
  flags: None,
1754
- command: /* Editor.toggleLineComment */'Editor.toggleLineComment'
1763
+ id: 'toggle-line-comment',
1764
+ label: toggleLineComment()
1755
1765
  }, {
1756
- id: 'toggle-block-comment',
1757
- label: toggleBlockComment(),
1766
+ command: /* Editor.toggleBlockComment */'Editor.toggleBlockComment',
1758
1767
  flags: None,
1759
- command: /* Editor.toggleBlockComment */'Editor.toggleBlockComment'
1768
+ id: 'toggle-block-comment',
1769
+ label: toggleBlockComment()
1760
1770
  }];
1761
1771
  };
1762
1772
 
@@ -1770,15 +1780,14 @@ const MenuEntriesEdit = {
1770
1780
  * @enum {string}
1771
1781
  */
1772
1782
  const UiStrings = {
1783
+ Exit: 'Exit',
1773
1784
  NewFile: 'New File',
1774
1785
  NewWindow: 'New Window',
1775
1786
  OpenFile: 'Open File',
1776
1787
  OpenFolder: 'Open Folder',
1777
1788
  OpenRecent: 'Open Recent',
1778
- Exit: 'Exit',
1779
1789
  Save: 'Save',
1780
- SaveAll: 'Save All'
1781
- };
1790
+ SaveAll: 'Save All'};
1782
1791
  const newFile = () => {
1783
1792
  return i18nString(UiStrings.NewFile);
1784
1793
  };
@@ -1807,47 +1816,47 @@ const exit = () => {
1807
1816
  const id$8 = File$1;
1808
1817
  const getMenuEntries$c = platform => {
1809
1818
  const entries = [{
1810
- id: 'newFile',
1811
- label: newFile(),
1819
+ command: '-1',
1812
1820
  flags: None,
1813
- command: '-1'
1821
+ id: 'newFile',
1822
+ label: newFile()
1814
1823
  }, {
1815
- id: 'newWindow',
1816
- label: newWindow(),
1824
+ command: /* Window.openNew */'Window.openNew',
1817
1825
  flags: None,
1818
- command: /* Window.openNew */'Window.openNew'
1826
+ id: 'newWindow',
1827
+ label: newWindow()
1819
1828
  }, menuEntrySeparator, {
1820
- id: 'openFile',
1821
- label: openFile(),
1829
+ command: 'Dialog.openFile',
1822
1830
  flags: None,
1823
- command: 'Dialog.openFile'
1831
+ id: 'openFile',
1832
+ label: openFile()
1824
1833
  }, {
1825
- id: 'openFolder',
1826
- label: openFolder(),
1834
+ command: 'Dialog.openFolder',
1827
1835
  flags: RestoreFocus,
1828
- command: 'Dialog.openFolder'
1836
+ id: 'openFolder',
1837
+ label: openFolder()
1829
1838
  }, {
1830
- id: OpenRecent,
1831
- label: openRecent(),
1839
+ command: '',
1832
1840
  flags: SubMenu,
1833
- command: ''
1841
+ id: OpenRecent,
1842
+ label: openRecent()
1834
1843
  }, menuEntrySeparator, {
1835
- id: 'save',
1836
- label: save(),
1844
+ command: 'Main.save',
1837
1845
  flags: None,
1838
- command: 'Main.save'
1846
+ id: 'save',
1847
+ label: save()
1839
1848
  }, {
1840
- id: 'saveAll',
1841
- label: saveAll(),
1849
+ command: 'Main.saveAll',
1842
1850
  flags: None,
1843
- command: 'Main.saveAll'
1851
+ id: 'saveAll',
1852
+ label: saveAll()
1844
1853
  }];
1845
1854
  if (platform === Electron) {
1846
1855
  entries.push(menuEntrySeparator, {
1847
- id: 'exit',
1848
- label: exit(),
1856
+ command: 'Chrome.exit',
1849
1857
  flags: Ignore,
1850
- command: 'Chrome.exit'
1858
+ id: 'exit',
1859
+ label: exit()
1851
1860
  });
1852
1861
  }
1853
1862
  return entries;
@@ -1896,33 +1905,33 @@ const getMenuEntries$a = async platform => {
1896
1905
  const entries = [];
1897
1906
  if (platform !== Web) {
1898
1907
  entries.push({
1899
- id: 'toggleDeveloperTools',
1900
- label: toggleDeveloperTools(),
1908
+ command: 'Developer.toggleDeveloperTools',
1901
1909
  flags: None,
1902
- command: 'Developer.toggleDeveloperTools'
1910
+ id: 'toggleDeveloperTools',
1911
+ label: toggleDeveloperTools()
1903
1912
  }, {
1904
- id: 'openProcessExplorer',
1905
- label: openProcessExplorer(),
1913
+ command: 'Developer.openProcessExplorer',
1906
1914
  flags: RestoreFocus,
1907
- command: 'Developer.openProcessExplorer'
1915
+ id: 'openProcessExplorer',
1916
+ label: openProcessExplorer()
1908
1917
  });
1909
1918
  }
1910
1919
  if (autoUpdateSupported) {
1911
1920
  entries.push(menuEntrySeparator, {
1912
- id: 'checkForUpdates',
1913
- label: checkForUpdates(),
1921
+ command: 'AutoUpdater.checkForUpdates',
1914
1922
  flags: RestoreFocus,
1915
- command: 'AutoUpdater.checkForUpdates'
1923
+ id: 'checkForUpdates',
1924
+ label: checkForUpdates()
1916
1925
  });
1917
1926
  }
1918
1927
  if (entries.length > 0) {
1919
1928
  entries.push(menuEntrySeparator);
1920
1929
  }
1921
1930
  entries.push({
1922
- id: 'about',
1923
- label: about(),
1931
+ command: 'About.showAbout',
1924
1932
  flags: None,
1925
- command: 'About.showAbout'
1933
+ id: 'about',
1934
+ label: about()
1926
1935
  });
1927
1936
  return entries;
1928
1937
  };
@@ -2362,10 +2371,10 @@ const toMenuItem = folder => {
2362
2371
  const homeDir = getHomeDir();
2363
2372
  const label = getTitle$1(homeDir, folder);
2364
2373
  return {
2365
- label,
2366
- flags: None,
2374
+ args: [folder],
2367
2375
  command: 'Workspace.setPath',
2368
- args: [folder]
2376
+ flags: None,
2377
+ label
2369
2378
  };
2370
2379
  };
2371
2380
  const id$5 = OpenRecent;
@@ -2377,15 +2386,15 @@ const getMenuEntries$9 = async () => {
2377
2386
  items.push(...itemsToShow.map(toMenuItem), menuEntrySeparator);
2378
2387
  }
2379
2388
  items.push({
2380
- id: 'more',
2381
- label: moreDot(),
2389
+ command: 'QuickPick.showRecent',
2382
2390
  flags: None,
2383
- command: 'QuickPick.showRecent'
2391
+ id: 'more',
2392
+ label: moreDot()
2384
2393
  }, menuEntrySeparator, {
2385
- id: 'clearRecentlyOpened',
2386
- label: clearRecentlyOpened(),
2394
+ command: 'RecentlyOpened.clearRecentlyOpened',
2387
2395
  flags: None,
2388
- command: 'RecentlyOpened.clearRecentlyOpened'
2396
+ id: 'clearRecentlyOpened',
2397
+ label: clearRecentlyOpened()
2389
2398
  });
2390
2399
  return items;
2391
2400
  };
@@ -2410,30 +2419,30 @@ const MenuEntriesRun = {
2410
2419
  const id$3 = Selection;
2411
2420
  const getMenuEntries$7 = () => {
2412
2421
  return [{
2413
- id: 'selectAll',
2414
- label: selectAll(),
2422
+ command: 'Editor.selectAll',
2415
2423
  flags: None,
2416
- command: 'Editor.selectAll'
2424
+ id: 'selectAll',
2425
+ label: selectAll()
2417
2426
  }, {
2418
- id: 'copyLineUp',
2419
- label: copyLineUp(),
2427
+ command: 'Editor.copyLineUp',
2420
2428
  flags: None,
2421
- command: 'Editor.copyLineUp'
2429
+ id: 'copyLineUp',
2430
+ label: copyLineUp()
2422
2431
  }, {
2423
- id: 'copyLineDown',
2424
- label: copyLineDown(),
2432
+ command: 'Editor.copyLineDown',
2425
2433
  flags: None,
2426
- command: 'Editor.copyLineDown'
2434
+ id: 'copyLineDown',
2435
+ label: copyLineDown()
2427
2436
  }, {
2428
- id: 'moveLineUp',
2429
- label: moveLineUp(),
2437
+ command: 'Editor.moveLineUp',
2430
2438
  flags: Disabled,
2431
- command: 'Editor.moveLineUp'
2439
+ id: 'moveLineUp',
2440
+ label: moveLineUp()
2432
2441
  }, {
2433
- id: 'moveLineDown',
2434
- label: moveLineDown(),
2442
+ command: 'Editor.moveLineDown',
2435
2443
  flags: Disabled,
2436
- command: 'Editor.moveLineDown'
2444
+ id: 'moveLineDown',
2445
+ label: moveLineDown()
2437
2446
  }];
2438
2447
  };
2439
2448
 
@@ -2446,11 +2455,11 @@ const MenuEntriesSelection = {
2446
2455
  const id$2 = Terminal;
2447
2456
  const getMenuEntries$6 = () => {
2448
2457
  return [{
2449
- id: 'newTerminal',
2450
- label: i18nString(NewTerminal),
2451
- flags: None,
2458
+ args: ['Terminal'],
2452
2459
  command: 'Layout.togglePanel',
2453
- args: ['Terminal']
2460
+ flags: None,
2461
+ id: 'newTerminal',
2462
+ label: i18nString(NewTerminal)
2454
2463
  }];
2455
2464
  };
2456
2465
 
@@ -2462,86 +2471,86 @@ const MenuEntriesTerminal = {
2462
2471
 
2463
2472
  const getMenuEntries$5 = () => {
2464
2473
  return [{
2465
- id: File$1,
2466
- label: file(),
2474
+ command: '',
2467
2475
  flags: SubMenu,
2468
- command: ''
2476
+ id: File$1,
2477
+ label: file()
2469
2478
  }, {
2470
- id: Edit,
2471
- label: edit(),
2479
+ command: '',
2472
2480
  flags: SubMenu,
2473
- command: ''
2481
+ id: Edit,
2482
+ label: edit()
2474
2483
  }, {
2475
- id: Selection,
2476
- label: selection(),
2484
+ command: '',
2477
2485
  flags: SubMenu,
2478
- command: ''
2486
+ id: Selection,
2487
+ label: selection()
2479
2488
  }, {
2480
- id: View,
2481
- label: view(),
2489
+ command: '',
2482
2490
  flags: SubMenu,
2483
- command: ''
2491
+ id: View,
2492
+ label: view()
2484
2493
  }, {
2485
- id: Go,
2486
- label: go(),
2494
+ command: '',
2487
2495
  flags: SubMenu,
2488
- command: ''
2496
+ id: Go,
2497
+ label: go()
2489
2498
  }, {
2499
+ command: '',
2500
+ flags: SubMenu,
2490
2501
  id: Run,
2491
- label: run(),
2492
2502
  keyboardShortCut: 'Alt+r',
2493
- flags: SubMenu,
2494
- command: ''
2503
+ label: run()
2495
2504
  }, {
2505
+ command: '',
2506
+ flags: SubMenu,
2496
2507
  id: Terminal,
2497
- label: terminal(),
2498
2508
  keyboardShortCut: 'Alt+t',
2499
- flags: SubMenu,
2500
- command: ''
2509
+ label: terminal()
2501
2510
  }, {
2511
+ command: '',
2512
+ flags: SubMenu,
2502
2513
  id: Help,
2503
- label: help(),
2504
2514
  keyboardShortCut: 'Alt+h',
2505
- flags: SubMenu,
2506
- command: ''
2515
+ label: help()
2507
2516
  }];
2508
2517
  };
2509
2518
 
2510
2519
  const getMenuEntries$4 = () => {
2511
2520
  return [{
2512
- id: File$1,
2513
- label: file(),
2521
+ command: '',
2514
2522
  flags: None,
2515
- command: ''
2523
+ id: File$1,
2524
+ label: file()
2516
2525
  }, {
2517
- id: Edit,
2518
- label: edit(),
2526
+ command: '',
2519
2527
  flags: None,
2520
- command: ''
2528
+ id: Edit,
2529
+ label: edit()
2521
2530
  }, {
2522
- id: Selection,
2523
- label: selection(),
2531
+ command: '',
2524
2532
  flags: None,
2525
- command: ''
2533
+ id: Selection,
2534
+ label: selection()
2526
2535
  }, {
2527
- id: View,
2528
- label: view(),
2536
+ command: '',
2529
2537
  flags: None,
2530
- command: ''
2538
+ id: View,
2539
+ label: view()
2531
2540
  }, {
2532
- id: Go,
2533
- label: go(),
2541
+ command: '',
2534
2542
  flags: None,
2535
- command: ''
2543
+ id: Go,
2544
+ label: go()
2536
2545
  }, {
2537
- id: Help,
2538
- label: help(),
2546
+ command: '',
2539
2547
  flags: None,
2540
- command: ''
2548
+ id: Help,
2549
+ label: help()
2541
2550
  }];
2542
2551
  };
2543
2552
 
2544
- const getFn = platform => {
2553
+ const getFn$1 = platform => {
2545
2554
  switch (platform) {
2546
2555
  case Web:
2547
2556
  return getMenuEntries$4;
@@ -2551,7 +2560,7 @@ const getFn = platform => {
2551
2560
  };
2552
2561
  const id$1 = TitleBar;
2553
2562
  const getMenuEntries$3 = async platform => {
2554
- const fn = getFn(platform);
2563
+ const fn = getFn$1(platform);
2555
2564
  return fn();
2556
2565
  };
2557
2566
 
@@ -2572,14 +2581,14 @@ const MenuEntriesView = {
2572
2581
  id
2573
2582
  };
2574
2583
 
2575
- const menus$1 = [MenuEntriesEdit, MenuEntriesFile, MenuEntriesGo, MenuEntriesHelp, MenuEntriesRun, MenuEntriesSelection, MenuEntriesTerminal, MenuEntriesTitleBar, MenuEntriesView, MenuEntriesOpenRecent];
2584
+ const menus = [MenuEntriesEdit, MenuEntriesFile, MenuEntriesGo, MenuEntriesHelp, MenuEntriesRun, MenuEntriesSelection, MenuEntriesTerminal, MenuEntriesTitleBar, MenuEntriesView, MenuEntriesOpenRecent];
2576
2585
 
2577
2586
  const MenuIdTitleBarContextMenu = 50;
2578
2587
  const getMenuIds = () => {
2579
- return [...menus$1.map(menu => menu.id), MenuIdTitleBarContextMenu];
2588
+ return [...menus.map(menu => menu.id), MenuIdTitleBarContextMenu];
2580
2589
  };
2581
2590
  const getMenuEntries$1 = async (id, platform) => {
2582
- const menu = menus$1.find(item => item.id === id);
2591
+ const menu = menus.find(item => item.id === id);
2583
2592
  if (!menu) {
2584
2593
  return [];
2585
2594
  }
@@ -2738,8 +2747,8 @@ const getIndexToFocusPrevious = menu => {
2738
2747
  };
2739
2748
  const canBeFocused = item => {
2740
2749
  switch (item.flags) {
2741
- case Separator:
2742
2750
  case Disabled:
2751
+ case Separator:
2743
2752
  return false;
2744
2753
  default:
2745
2754
  return true;
@@ -2756,25 +2765,44 @@ const getIndexToFocusNext = menu => {
2756
2765
 
2757
2766
  // TODO more tests
2758
2767
 
2759
- const menus = [MenuEntriesEdit, MenuEntriesFile, MenuEntriesGo, MenuEntriesHelp, MenuEntriesRun, MenuEntriesSelection, MenuEntriesTerminal, MenuEntriesTitleBar, MenuEntriesView, MenuEntriesOpenRecent];
2768
+ /**
2769
+ * @deprecated
2770
+ * @returns
2771
+ */
2760
2772
  const getMenus = () => {
2761
- return menus;
2773
+ return [];
2762
2774
  };
2763
- const getModule = id => {
2764
- for (const module of menus) {
2765
- if (module.id === id) {
2766
- return module;
2767
- }
2775
+ const getFn = id => {
2776
+ switch (id) {
2777
+ case Edit$1:
2778
+ return getMenuEntries$d;
2779
+ case File$2:
2780
+ return getMenuEntries$c;
2781
+ case Go$1:
2782
+ return getMenuEntries$b;
2783
+ case Help$1:
2784
+ return getMenuEntries$a;
2785
+ case OpenRecent$1:
2786
+ return getMenuEntries$9;
2787
+ case Run$1:
2788
+ return getMenuEntries$8;
2789
+ case Selection$1:
2790
+ return getMenuEntries$7;
2791
+ case Terminal$1:
2792
+ return getMenuEntries$6;
2793
+ case TitleBar$1:
2794
+ return getMenuEntries$3;
2795
+ case View$1:
2796
+ return getMenuEntries$2;
2797
+ default:
2798
+ return undefined;
2768
2799
  }
2769
- return undefined;
2770
2800
  };
2771
2801
  const getMenuEntries = async (id, ...args) => {
2772
2802
  try {
2773
- const module = getModule(id);
2803
+ const fn = getFn(id);
2774
2804
  // @ts-ignore
2775
- const inject = module.inject || [];
2776
- // @ts-ignore
2777
- return module.getMenuEntries(...args);
2805
+ return fn(...args);
2778
2806
  } catch (error) {
2779
2807
  throw new VError(error, `Failed to load menu entries for id ${id}`);
2780
2808
  }
@@ -2782,10 +2810,10 @@ const getMenuEntries = async (id, ...args) => {
2782
2810
 
2783
2811
  const openMenuAtIndex = async (state, index, shouldBeFocused) => {
2784
2812
  const {
2813
+ iconWidth,
2785
2814
  titleBarEntries,
2786
2815
  titleBarHeight,
2787
- x,
2788
- iconWidth
2816
+ x
2789
2817
  } = state;
2790
2818
  // TODO race conditions
2791
2819
  // TODO send renderer process
@@ -2807,20 +2835,20 @@ const openMenuAtIndex = async (state, index, shouldBeFocused) => {
2807
2835
  const height = getMenuHeight(items);
2808
2836
  const menuFocusedIndex = shouldBeFocused ? getIndexToFocusNextStartingAt(items, 0) : -1;
2809
2837
  const menu = {
2838
+ focusedIndex: menuFocusedIndex,
2839
+ height,
2810
2840
  id,
2811
2841
  items,
2812
- focusedIndex: menuFocusedIndex,
2813
2842
  level: 0,
2814
- x: menuX,
2815
- y: menuY,
2816
2843
  width,
2817
- height
2844
+ x: menuX,
2845
+ y: menuY
2818
2846
  };
2819
2847
  const menus = [menu];
2820
2848
  return {
2821
2849
  ...state,
2822
- isMenuOpen: true,
2823
2850
  focusedIndex: index,
2851
+ isMenuOpen: true,
2824
2852
  menus
2825
2853
  };
2826
2854
  };
@@ -2829,8 +2857,8 @@ const focusIndex = async (state, index) => {
2829
2857
  object(state);
2830
2858
  number(index);
2831
2859
  const {
2832
- isMenuOpen,
2833
- focusedIndex
2860
+ focusedIndex,
2861
+ isMenuOpen
2834
2862
  } = state;
2835
2863
  if (index === focusedIndex) {
2836
2864
  return state;
@@ -2869,9 +2897,9 @@ const handleMouseOut = ifElse(handleMouseOutMenuOpen, handleMouseOutMenuClosed);
2869
2897
 
2870
2898
  const handlePointerOut = (state, clientX, clientY) => {
2871
2899
  const {
2872
- x,
2873
2900
  iconWidth,
2874
- titleBarEntries
2901
+ titleBarEntries,
2902
+ x
2875
2903
  } = state;
2876
2904
  const menuX = getMenuOffset(x, clientX, iconWidth);
2877
2905
  const index = getTitleBarIndexFromPosition(titleBarEntries, menuX);
@@ -2983,14 +3011,14 @@ const getTitle = workspaceUri => {
2983
3011
 
2984
3012
  const loadContent2 = async state => {
2985
3013
  const {
2986
- platform,
2987
3014
  controlsOverlayEnabled,
2988
- titleBarStyleCustom,
2989
3015
  labelFontFamily,
2990
3016
  labelFontSize,
2991
3017
  labelFontWeight,
2992
3018
  labelLetterSpacing,
2993
- labelPadding
3019
+ labelPadding,
3020
+ platform,
3021
+ titleBarStyleCustom
2994
3022
  } = state;
2995
3023
  const titleBarEntries = await getMenuEntries(TitleBar$1);
2996
3024
  const withWidths = addWidths(titleBarEntries, labelPadding, labelFontWeight, labelFontSize, labelFontFamily, labelLetterSpacing);
@@ -3001,11 +3029,11 @@ const loadContent2 = async state => {
3001
3029
  const iconWidth = 30;
3002
3030
  return {
3003
3031
  ...state,
3004
- titleBarEntries: withWidths,
3005
- titleBarButtons: buttons,
3006
3032
  buttons,
3033
+ iconWidth,
3007
3034
  title,
3008
- iconWidth
3035
+ titleBarButtons: buttons,
3036
+ titleBarEntries: withWidths
3009
3037
  };
3010
3038
  };
3011
3039
 
@@ -3037,16 +3065,16 @@ const TitleBarTopLevelEntryLabel = 'TitleBarTopLevelEntryLabel';
3037
3065
  const Viewlet = 'Viewlet';
3038
3066
 
3039
3067
  const checkboxChecked = {
3040
- type: Div,
3068
+ ariaChecked: true,
3069
+ childCount: 2,
3041
3070
  className: mergeClassNames(MenuItem, MenuItemCheckMark),
3042
3071
  role: MenuItemCheckBox,
3043
- ariaChecked: true,
3044
3072
  tabIndex: -1,
3045
- childCount: 2
3073
+ type: Div
3046
3074
  };
3047
3075
  const checkMark = {
3048
- type: Div,
3049
- className: mergeClassNames(MenuItemCheckmarkIcon, MaskIconCheck)
3076
+ className: mergeClassNames(MenuItemCheckmarkIcon, MaskIconCheck),
3077
+ type: Div
3050
3078
  };
3051
3079
  const getMenuItemCheckedDom = menuItem => {
3052
3080
  const {
@@ -3071,9 +3099,9 @@ const getKeyDom = key => {
3071
3099
  const parsedKey = parseKey(key);
3072
3100
  const keyBindingsString = getKeyBindingString(parsedKey.key, false, parsedKey.isCtrl, parsedKey.isShift);
3073
3101
  return [{
3074
- type: Span,
3102
+ childCount: 1,
3075
3103
  className: MenuItemKeyBinding,
3076
- childCount: 1
3104
+ type: Span
3077
3105
  }, text(keyBindingsString)];
3078
3106
  };
3079
3107
 
@@ -3086,29 +3114,29 @@ const getMenuItemClassName = isFocused => {
3086
3114
  };
3087
3115
  const getMenuItemDefaultDom = menuItem => {
3088
3116
  const {
3089
- label,
3090
3117
  isFocused,
3091
- key
3118
+ key,
3119
+ label
3092
3120
  } = menuItem;
3093
3121
  const className = getMenuItemClassName(isFocused);
3094
3122
  const keyDom = key ? getKeyDom(key) : [];
3095
3123
  const childCount = key ? 2 : 1;
3096
3124
  return [{
3097
- type: Div,
3125
+ childCount,
3098
3126
  className,
3099
3127
  role: MenuItem$1,
3100
3128
  tabIndex: -1,
3101
- childCount
3129
+ type: Div
3102
3130
  }, text(label), ...keyDom];
3103
3131
  };
3104
3132
 
3105
3133
  const disabled = {
3106
- type: Div,
3134
+ childCount: 1,
3107
3135
  className: MenuItem,
3136
+ disabled: true,
3108
3137
  role: MenuItem$1,
3109
3138
  tabIndex: -1,
3110
- disabled: true,
3111
- childCount: 1
3139
+ type: Div
3112
3140
  };
3113
3141
  const getMenuItemDisabledDom = menuItem => {
3114
3142
  const {
@@ -3122,53 +3150,53 @@ const getMenuItemsNoopDom = () => {
3122
3150
  };
3123
3151
 
3124
3152
  const separator = {
3125
- type: Div,
3153
+ childCount: 1,
3126
3154
  className: MenuItemSeparator,
3127
3155
  role: Separator$1,
3128
- childCount: 1
3156
+ type: Div
3129
3157
  };
3130
3158
  const separatorLine = {
3131
- type: Div,
3159
+ childCount: 0,
3132
3160
  className: MenuItemSeparatorLine,
3133
- childCount: 0
3161
+ type: Div
3134
3162
  };
3135
3163
  const getMenuItemSeparatorDom = menuItem => {
3136
3164
  return [separator, separatorLine];
3137
3165
  };
3138
3166
 
3139
3167
  const arrowRight = {
3140
- type: Div,
3168
+ childCount: 0,
3141
3169
  className: MenuItemSubMenuArrowRight,
3142
- childCount: 0
3170
+ type: Div
3143
3171
  };
3144
3172
  const getMenuItemSubMenuDom = menuItem => {
3145
3173
  const {
3146
- label,
3147
- isFocused,
3148
3174
  isExpanded,
3175
+ isFocused,
3176
+ label,
3149
3177
  level
3150
3178
  } = menuItem;
3151
3179
  const baseClassName = mergeClassNames(MenuItem, MenuItemSubMenu);
3152
3180
  const className = isFocused ? mergeClassNames(baseClassName, MenuItemFocused) : baseClassName;
3153
3181
  return [{
3154
- type: Div,
3182
+ ariaExpanded: isExpanded,
3183
+ ariaHasPopup: true,
3184
+ ariaOwns: isExpanded ? `Menu-${level + 1}` : undefined,
3185
+ childCount: 2,
3155
3186
  className,
3156
3187
  role: MenuItem$1,
3157
3188
  tabIndex: -1,
3158
- ariaHasPopup: true,
3159
- ariaExpanded: isExpanded,
3160
- ariaOwns: isExpanded ? `Menu-${level + 1}` : undefined,
3161
- childCount: 2
3189
+ type: Div
3162
3190
  }, text(label), arrowRight];
3163
3191
  };
3164
3192
 
3165
3193
  const checkboxUnchecked = {
3166
- type: Div,
3194
+ ariaChecked: false,
3195
+ childCount: 1,
3167
3196
  className: MenuItem,
3168
3197
  role: MenuItemCheckBox,
3169
- ariaChecked: false,
3170
3198
  tabIndex: -1,
3171
- childCount: 1
3199
+ type: Div
3172
3200
  };
3173
3201
  const getMenuItemUncheckedDom = menuItem => {
3174
3202
  const {
@@ -3179,20 +3207,20 @@ const getMenuItemUncheckedDom = menuItem => {
3179
3207
 
3180
3208
  const getMenuItemRenderer = flags => {
3181
3209
  switch (flags) {
3210
+ case Checked:
3211
+ return getMenuItemCheckedDom;
3212
+ case Disabled:
3213
+ return getMenuItemDisabledDom;
3214
+ case Ignore:
3182
3215
  case None:
3183
3216
  case RestoreFocus:
3184
- case Ignore:
3185
3217
  return getMenuItemDefaultDom;
3186
3218
  case Separator:
3187
3219
  return getMenuItemSeparatorDom;
3188
- case Checked:
3189
- return getMenuItemCheckedDom;
3190
- case Unchecked:
3191
- return getMenuItemUncheckedDom;
3192
- case Disabled:
3193
- return getMenuItemDisabledDom;
3194
3220
  case SubMenu:
3195
3221
  return getMenuItemSubMenuDom;
3222
+ case Unchecked:
3223
+ return getMenuItemUncheckedDom;
3196
3224
  default:
3197
3225
  return getMenuItemsNoopDom;
3198
3226
  }
@@ -3208,11 +3236,11 @@ const getMenuItemVirtualDom = menuItem => {
3208
3236
 
3209
3237
  const getMenuVirtualDom = menuItems => {
3210
3238
  const dom = [{
3211
- type: Div,
3239
+ childCount: menuItems.length,
3212
3240
  className: Menu,
3213
3241
  role: Menu$1,
3214
3242
  tabIndex: -1,
3215
- childCount: menuItems.length
3243
+ type: Div
3216
3244
  }, ...menuItems.flatMap(getMenuItemVirtualDom)];
3217
3245
  return dom;
3218
3246
  };
@@ -3226,12 +3254,12 @@ const getVisible = (items, focusedIndex, expanded, level) => {
3226
3254
  label
3227
3255
  } = item;
3228
3256
  visibleItems.push({
3229
- label,
3230
3257
  flags,
3231
- isFocused: i === focusedIndex,
3232
3258
  isExpanded: i === focusedIndex && expanded,
3233
- level,
3234
- key: item.key
3259
+ isFocused: i === focusedIndex,
3260
+ key: item.key,
3261
+ label,
3262
+ level
3235
3263
  });
3236
3264
  }
3237
3265
  return visibleItems;
@@ -3273,50 +3301,50 @@ const getIcon = assetDir => {
3273
3301
 
3274
3302
  const getIconVirtualDom = (icon, type = Div) => {
3275
3303
  return {
3276
- type,
3304
+ childCount: 0,
3277
3305
  className: `MaskIcon MaskIcon${icon}`,
3278
3306
  role: None$1,
3279
- childCount: 0
3307
+ type
3280
3308
  };
3281
3309
  };
3282
3310
 
3283
3311
  const createTitleBarButton = button => {
3284
3312
  const {
3285
- id,
3286
3313
  icon,
3314
+ id,
3287
3315
  label,
3288
3316
  onClick
3289
3317
  } = button;
3290
3318
  const dom = [{
3291
- type: Button$1,
3292
- className: `TitleBarButton TitleBarButton${id}`,
3293
3319
  ariaLabel: label,
3294
3320
  childCount: 1,
3295
- onClick
3321
+ className: `TitleBarButton TitleBarButton${id}`,
3322
+ onClick,
3323
+ type: Button$1
3296
3324
  }, getIconVirtualDom(icon, I)];
3297
3325
  return dom;
3298
3326
  };
3299
3327
 
3300
3328
  const getTitleBarButtonsVirtualDom = buttons => {
3301
3329
  return [{
3302
- type: Div,
3330
+ childCount: buttons.length,
3303
3331
  className: mergeClassNames(Viewlet, TitleBarButtons),
3304
- childCount: buttons.length
3332
+ type: Div
3305
3333
  }, ...buttons.flatMap(createTitleBarButton)];
3306
3334
  };
3307
3335
 
3308
3336
  const parentNode$1 = {
3309
- type: Div,
3337
+ childCount: 1,
3310
3338
  className: mergeClassNames(Viewlet, TitleBarIcon),
3311
- childCount: 1
3339
+ type: Div
3312
3340
  };
3313
3341
  const getTitleBarIconVirtualDom = iconSrc => {
3314
3342
  return [parentNode$1, {
3315
- type: Img,
3343
+ alt: '',
3344
+ childCount: 0,
3316
3345
  className: TitleBarIconIcon,
3317
3346
  src: iconSrc,
3318
- alt: '',
3319
- childCount: 0
3347
+ type: Img
3320
3348
  }];
3321
3349
  };
3322
3350
 
@@ -3335,21 +3363,22 @@ const HandleContextMenu = 11;
3335
3363
  const getItemVirtualDom = item => {
3336
3364
  // @ts-ignore
3337
3365
  const {
3338
- keyboardShortCut,
3339
- label,
3366
+ isFocused,
3340
3367
  isOpen,
3341
- isFocused
3368
+ keyboardShortCut,
3369
+ label
3342
3370
  } = item;
3343
3371
  // TODO avoid mutation
3344
3372
  const dom = [{
3345
- type: Button$1,
3346
- className: TitleBarTopLevelEntry,
3347
- ariaHasPopup: true,
3348
3373
  ariaExpanded: isOpen,
3349
- role: MenuItem$1,
3350
- childCount: 1,
3374
+ ariaHasPopup: true,
3351
3375
  ariaKeyShortcuts: keyboardShortCut,
3352
- name: label // TODO have separate name attribute
3376
+ childCount: 1,
3377
+ className: TitleBarTopLevelEntry,
3378
+ name: label,
3379
+ // TODO have separate name attribute
3380
+ role: MenuItem$1,
3381
+ type: Button$1
3353
3382
  }];
3354
3383
  if (isOpen) {
3355
3384
  // @ts-ignore
@@ -3360,9 +3389,9 @@ const getItemVirtualDom = item => {
3360
3389
  // @ts-ignore
3361
3390
  dom[0].id = 'TitleBarEntryActive';
3362
3391
  dom.push({
3363
- type: Div,
3392
+ childCount: 1,
3364
3393
  className: TitleBarTopLevelEntryLabel,
3365
- childCount: 1
3394
+ type: Div
3366
3395
  });
3367
3396
  }
3368
3397
  dom.push(text(label));
@@ -3376,24 +3405,24 @@ const getTitleBarMenuBarItemsVirtualDom = visibleItems => {
3376
3405
  const activeId = 'TitleBarEntryActive';
3377
3406
  const getTitleBarMenuBarVirtualDom = (visibleItems, focusedIndex) => {
3378
3407
  return [{
3379
- type: Div,
3380
- className: mergeClassNames(Viewlet, TitleBarMenuBar),
3381
- role: MenuBar,
3382
- tabIndex: 0,
3408
+ ariaActivedescendant: focusedIndex === -1 ? '' : activeId,
3383
3409
  childCount: visibleItems.length,
3384
- onMouseDown: HandleClick,
3385
- onFocusOut: HandleFocusOut,
3410
+ className: mergeClassNames(Viewlet, TitleBarMenuBar),
3386
3411
  onFocusIn: HandleFocusIn,
3387
- onPointerOver: HandlePointerOver,
3412
+ onFocusOut: HandleFocusOut,
3413
+ onMouseDown: HandleClick,
3388
3414
  onPointerOut: HandlePointerOut,
3389
- ariaActivedescendant: focusedIndex === -1 ? '' : activeId
3415
+ onPointerOver: HandlePointerOver,
3416
+ role: MenuBar,
3417
+ tabIndex: 0,
3418
+ type: Div
3390
3419
  }, ...getTitleBarMenuBarItemsVirtualDom(visibleItems)];
3391
3420
  };
3392
3421
 
3393
3422
  const parentNode = {
3394
- type: Div,
3423
+ childCount: 1,
3395
3424
  className: 'TitleBarTitle',
3396
- childCount: 1
3425
+ type: Div
3397
3426
  };
3398
3427
  const getTitleVirtualDom = title => {
3399
3428
  return [parentNode, text(title)];
@@ -3416,8 +3445,8 @@ const getVisibleTitleBarEntries = (entries, width, focusedIndex, isMenuOpen) =>
3416
3445
  const isFocused = i === focusedIndex;
3417
3446
  visible.push({
3418
3447
  ...entry,
3419
- isOpen,
3420
- isFocused
3448
+ isFocused,
3449
+ isOpen
3421
3450
  });
3422
3451
  }
3423
3452
  const hasOverflow = visible.length < entries.length;
@@ -3441,21 +3470,21 @@ const getVisibleTitleBarEntries = (entries, width, focusedIndex, isMenuOpen) =>
3441
3470
 
3442
3471
  const getTitleBarVirtualDom = state => {
3443
3472
  const {
3444
- titleBarEntries,
3445
- width,
3473
+ assetDir,
3446
3474
  focusedIndex,
3447
3475
  isMenuOpen,
3448
- assetDir,
3449
3476
  title,
3450
- titleBarButtons
3477
+ titleBarButtons,
3478
+ titleBarEntries,
3479
+ width
3451
3480
  } = state;
3452
3481
  const dom = [{
3453
- type: Div,
3482
+ ariaLabel: 'Title Bar',
3483
+ childCount: 4,
3454
3484
  className: 'Viewlet TitleBar',
3455
3485
  id: 'TitleBar',
3456
3486
  role: ContentInfo,
3457
- ariaLabel: 'Title Bar',
3458
- childCount: 4
3487
+ type: Div
3459
3488
  }];
3460
3489
 
3461
3490
  // Add icon if enabled
@@ -3506,8 +3535,8 @@ const getRenderer3 = diffType => {
3506
3535
 
3507
3536
  const render3 = async (uid, diffResult) => {
3508
3537
  const {
3509
- oldState,
3510
- newState
3538
+ newState,
3539
+ oldState
3511
3540
  } = get$1(uid);
3512
3541
  set$3(uid, newState, newState);
3513
3542
  const commands = [];
@@ -3573,10 +3602,10 @@ const resize = async (state, dimensions) => {
3573
3602
  return {
3574
3603
  ...state,
3575
3604
  ...dimensions,
3576
- x: menuBarX,
3577
- y: menuBarY,
3605
+ height: menuBarHeight,
3578
3606
  width: menuBarWidth,
3579
- height: menuBarHeight
3607
+ x: menuBarX,
3608
+ y: menuBarY
3580
3609
  };
3581
3610
  };
3582
3611
 
@@ -3604,22 +3633,22 @@ const showMenuBar = async state => {
3604
3633
  const create = (id, uri, x, y, width, height) => {
3605
3634
  const state = {
3606
3635
  ...createDefaultState(),
3607
- uid: id,
3608
- titleBarEntries: [],
3609
3636
  focusedIndex: -1,
3637
+ height,
3638
+ iconWidth: 30,
3610
3639
  isMenuOpen: false,
3611
- menus: [],
3612
- labelFontWeight: 400,
3613
- labelFontSize: 13,
3614
3640
  labelFontFamily: 'system-ui, Ubuntu, Droid Sans, sans-serif',
3615
- labelPadding: 8,
3641
+ labelFontSize: 13,
3642
+ labelFontWeight: 400,
3616
3643
  labelLetterSpacing: 0,
3644
+ labelPadding: 8,
3645
+ menus: [],
3646
+ titleBarEntries: [],
3617
3647
  titleBarHeight: height,
3618
- x,
3619
- y,
3648
+ uid: id,
3620
3649
  width,
3621
- height,
3622
- iconWidth: 30
3650
+ x,
3651
+ y
3623
3652
  };
3624
3653
  set$3(id, state, state);
3625
3654
  return state;
@@ -3635,9 +3664,9 @@ const closeMenu = (state, keepFocus) => {
3635
3664
  const newFocusedIndex = keepFocus ? focusedIndex : -1;
3636
3665
  return {
3637
3666
  ...state,
3638
- menus: [],
3667
+ focusedIndex: newFocusedIndex,
3639
3668
  isMenuOpen: false,
3640
- focusedIndex: newFocusedIndex
3669
+ menus: []
3641
3670
  };
3642
3671
  };
3643
3672
 
@@ -3673,8 +3702,8 @@ const focusLast = state => {
3673
3702
 
3674
3703
  const focusNext = state => {
3675
3704
  const {
3676
- titleBarEntries,
3677
- focusedIndex
3705
+ focusedIndex,
3706
+ titleBarEntries
3678
3707
  } = state;
3679
3708
  const indexToFocus = next(titleBarEntries, focusedIndex);
3680
3709
  return focusIndex(state, indexToFocus);
@@ -3682,8 +3711,8 @@ const focusNext = state => {
3682
3711
 
3683
3712
  const focusPrevious = state => {
3684
3713
  const {
3685
- titleBarEntries,
3686
- focusedIndex
3714
+ focusedIndex,
3715
+ titleBarEntries
3687
3716
  } = state;
3688
3717
  const indexToFocus = previous(titleBarEntries, focusedIndex);
3689
3718
  return focusIndex(state, indexToFocus);
@@ -3693,8 +3722,8 @@ const LeftClick = 0;
3693
3722
 
3694
3723
  const toggleIndex = async (state, index) => {
3695
3724
  const {
3696
- isMenuOpen,
3697
- focusedIndex
3725
+ focusedIndex,
3726
+ isMenuOpen
3698
3727
  } = state;
3699
3728
  if (isMenuOpen && focusedIndex === index) {
3700
3729
  return closeMenu(state, /* keepFocus */true);
@@ -3714,9 +3743,9 @@ const handleClick = async (state, button, index) => {
3714
3743
 
3715
3744
  const handleClickAt = async (state, button, eventX, eventY) => {
3716
3745
  const {
3746
+ iconWidth,
3717
3747
  titleBarEntries,
3718
- x,
3719
- iconWidth
3748
+ x
3720
3749
  } = state;
3721
3750
  const menuOffset = getMenuOffset(x, eventX, iconWidth);
3722
3751
  const index = getTitleBarIndexFromPosition(titleBarEntries, menuOffset);
@@ -3812,8 +3841,8 @@ const handleKeyArrowRightMenuOpen = async state => {
3812
3841
  // if menu can open sub menu to the right -> do that
3813
3842
  const menu = menus.at(-1);
3814
3843
  const {
3815
- items,
3816
3844
  focusedIndex,
3845
+ items,
3817
3846
  x,
3818
3847
  y
3819
3848
  } = menu;
@@ -3824,11 +3853,11 @@ const handleKeyArrowRightMenuOpen = async state => {
3824
3853
  if (item.flags === SubMenu) {
3825
3854
  const subMenuEntries = await getMenuEntries(item.id);
3826
3855
  const subMenu = {
3827
- level: menus.length,
3828
- items: subMenuEntries,
3829
3856
  focusedIndex: 0,
3830
- y: y + focusedIndex * 25,
3831
- x: x + MENU_WIDTH
3857
+ items: subMenuEntries,
3858
+ level: menus.length,
3859
+ x: x + MENU_WIDTH,
3860
+ y: y + focusedIndex * 25
3832
3861
  };
3833
3862
  const newParentMenu = {
3834
3863
  ...menu,
@@ -3954,9 +3983,9 @@ const selectIndexNone = async (state, item) => {
3954
3983
  await executeMenuItemCommand(item);
3955
3984
  return {
3956
3985
  ...state,
3957
- menus: [],
3986
+ focusedIndex: -1,
3958
3987
  isMenuOpen: false,
3959
- focusedIndex: -1
3988
+ menus: []
3960
3989
  };
3961
3990
  };
3962
3991
 
@@ -3964,8 +3993,8 @@ const selectIndexRestoreFocus = async (state, item) => {
3964
3993
  await executeMenuItemCommand(item);
3965
3994
  return {
3966
3995
  ...state,
3967
- menus: [],
3968
- isMenuOpen: false
3996
+ isMenuOpen: false,
3997
+ menus: []
3969
3998
  };
3970
3999
  };
3971
4000
 
@@ -3975,16 +4004,16 @@ const selectIndexSubMenu = async (state, menu, index) => {
3975
4004
  } = state;
3976
4005
  const {
3977
4006
  items,
4007
+ level,
3978
4008
  x,
3979
- y,
3980
- level
4009
+ y
3981
4010
  } = menu;
3982
4011
  const item = items[index];
3983
4012
  const subMenuEntries = await getMenuEntries(item.id);
3984
4013
  const subMenu = {
3985
- level: menus.length,
3986
- items: subMenuEntries,
3987
4014
  focusedIndex: -1,
4015
+ items: subMenuEntries,
4016
+ level: menus.length,
3988
4017
  x: x + MENU_WIDTH,
3989
4018
  y: y + index * 25
3990
4019
  };
@@ -4009,14 +4038,14 @@ const handleMenuClick = async (state, level, index) => {
4009
4038
  return state;
4010
4039
  }
4011
4040
  switch (item.flags) {
4041
+ case Ignore:
4042
+ return selectIndexIgnore(state, item);
4012
4043
  case None:
4013
4044
  return selectIndexNone(state, item);
4014
- case SubMenu:
4015
- return selectIndexSubMenu(state, menu, index);
4016
4045
  case RestoreFocus:
4017
4046
  return selectIndexRestoreFocus(state, item);
4018
- case Ignore:
4019
- return selectIndexIgnore(state, item);
4047
+ case SubMenu:
4048
+ return selectIndexSubMenu(state, menu, index);
4020
4049
  default:
4021
4050
  return state;
4022
4051
  }
@@ -4031,10 +4060,10 @@ const handleMenuMouseOver = async (state, level, index) => {
4031
4060
  } = state;
4032
4061
  const menu = menus[level];
4033
4062
  const {
4034
- items,
4035
4063
  focusedIndex,
4036
- y,
4037
- x
4064
+ items,
4065
+ x,
4066
+ y
4038
4067
  } = menu;
4039
4068
  const item = items[index];
4040
4069
  if (focusedIndex === index) {
@@ -4071,11 +4100,11 @@ const handleMenuMouseOver = async (state, level, index) => {
4071
4100
  const item = items[index];
4072
4101
  const subMenuEntries = await getMenuEntries(item.id);
4073
4102
  const subMenu = {
4074
- level: menus.length,
4075
- items: subMenuEntries,
4076
4103
  focusedIndex: -1,
4077
- y: y + index * 25,
4078
- x: x + MENU_WIDTH
4104
+ items: subMenuEntries,
4105
+ level: menus.length,
4106
+ x: x + MENU_WIDTH,
4107
+ y: y + index * 25
4079
4108
  };
4080
4109
  const newParentMenu = {
4081
4110
  ...menu,
@@ -4107,6 +4136,7 @@ const toggleMenu = async state => {
4107
4136
  return openMenu(state, /* focus */false);
4108
4137
  };
4109
4138
 
4139
+ /* eslint-disable @typescript-eslint/no-deprecated */
4110
4140
  const commandMap = {
4111
4141
  'TitleBar.closeMenu': closeMenu,
4112
4142
  'TitleBar.create': create,