@lvce-editor/title-bar-worker 1.4.0 → 1.5.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.
@@ -1459,9 +1459,11 @@ const File$1 = 'File';
1459
1459
  const Go$1 = 'Go';
1460
1460
  const Help$1 = 'Help';
1461
1461
  const MoreDot = 'More ...';
1462
+ const OpenProcessExplorer = 'Open Process Explorer';
1462
1463
  const Run$1 = 'Run';
1463
1464
  const Selection$1 = 'Selection';
1464
1465
  const Terminal$1 = 'Terminal';
1466
+ const ToggleDeveloperTools = 'Toggle Developer Tools';
1465
1467
  const View$1 = 'View';
1466
1468
 
1467
1469
  const moreDot = () => {
@@ -1767,6 +1769,7 @@ const UiStrings$1 = {
1767
1769
  OpenFile: 'Open File',
1768
1770
  OpenFolder: 'Open Folder',
1769
1771
  OpenRecent: 'Open Recent',
1772
+ Exit: 'Exit',
1770
1773
  Save: 'Save',
1771
1774
  SaveAll: 'Save All'
1772
1775
  };
@@ -1791,13 +1794,15 @@ const save = () => {
1791
1794
  const saveAll = () => {
1792
1795
  return i18nString(UiStrings$1.SaveAll);
1793
1796
  };
1794
-
1795
- const platform = 1;
1797
+ const exit = () => {
1798
+ return i18nString(UiStrings$1.Exit);
1799
+ };
1796
1800
 
1797
1801
  const Web = 1;
1802
+ const Electron = 2;
1798
1803
 
1799
1804
  const id$8 = File;
1800
- const getMenuEntries$c = () => {
1805
+ const getMenuEntries$c = platform => {
1801
1806
  const entries = [{
1802
1807
  id: 'newFile',
1803
1808
  label: newFile(),
@@ -1834,6 +1839,14 @@ const getMenuEntries$c = () => {
1834
1839
  flags: None,
1835
1840
  command: 'Main.saveAll'
1836
1841
  }];
1842
+ if (platform === Electron) {
1843
+ entries.push(menuEntrySeparator, {
1844
+ id: 'exit',
1845
+ label: exit(),
1846
+ flags: Ignore,
1847
+ command: 'Chrome.exit'
1848
+ });
1849
+ }
1837
1850
  return entries;
1838
1851
  };
1839
1852
 
@@ -1854,6 +1867,12 @@ const MenuEntriesGo = {
1854
1867
  id: id$7
1855
1868
  };
1856
1869
 
1870
+ const toggleDeveloperTools = () => {
1871
+ return i18nString(ToggleDeveloperTools);
1872
+ };
1873
+ const openProcessExplorer = () => {
1874
+ return i18nString(OpenProcessExplorer);
1875
+ };
1857
1876
  const checkForUpdates = () => {
1858
1877
  return i18nString(CheckForUpdates);
1859
1878
  };
@@ -1861,16 +1880,30 @@ const about = () => {
1861
1880
  return i18nString(About);
1862
1881
  };
1863
1882
 
1864
- const isAutoUpdateSupported = () => {
1865
- {
1883
+ const isAutoUpdateSupported = platform => {
1884
+ if (platform !== Electron) {
1866
1885
  return false;
1867
1886
  }
1887
+ return false;
1868
1888
  };
1869
1889
 
1870
1890
  const id$6 = Help;
1871
- const getMenuEntries$a = async () => {
1872
- const autoUpdateSupported = isAutoUpdateSupported();
1891
+ const getMenuEntries$a = async platform => {
1892
+ const autoUpdateSupported = isAutoUpdateSupported(platform);
1873
1893
  const entries = [];
1894
+ if (platform !== Web) {
1895
+ entries.push({
1896
+ id: 'toggleDeveloperTools',
1897
+ label: toggleDeveloperTools(),
1898
+ flags: None,
1899
+ command: 'Developer.toggleDeveloperTools'
1900
+ }, {
1901
+ id: 'openProcessExplorer',
1902
+ label: openProcessExplorer(),
1903
+ flags: RestoreFocus,
1904
+ command: 'Developer.openProcessExplorer'
1905
+ });
1906
+ }
1874
1907
  if (autoUpdateSupported) {
1875
1908
  entries.push(menuEntrySeparator, {
1876
1909
  id: 'checkForUpdates',
@@ -2126,7 +2159,7 @@ const getMenuEntries$4 = () => {
2126
2159
  }];
2127
2160
  };
2128
2161
 
2129
- const getFn = () => {
2162
+ const getFn = platform => {
2130
2163
  switch (platform) {
2131
2164
  case Web:
2132
2165
  return getMenuEntries$4;
@@ -2135,8 +2168,8 @@ const getFn = () => {
2135
2168
  }
2136
2169
  };
2137
2170
  const id$1 = TitleBar;
2138
- const getMenuEntries$3 = async () => {
2139
- const fn = getFn();
2171
+ const getMenuEntries$3 = async platform => {
2172
+ const fn = getFn(platform);
2140
2173
  return fn();
2141
2174
  };
2142
2175
 
@@ -2158,15 +2191,16 @@ const MenuEntriesView = {
2158
2191
  };
2159
2192
 
2160
2193
  const menus$1 = [MenuEntriesEdit, MenuEntriesFile, MenuEntriesGo, MenuEntriesHelp, MenuEntriesRun, MenuEntriesSelection, MenuEntriesTerminal, MenuEntriesTitleBar, MenuEntriesView, MenuEntriesOpenRecent];
2194
+
2161
2195
  const getMenuIds = () => {
2162
2196
  return menus$1.map(menu => menu.id);
2163
2197
  };
2164
- const getMenuEntries$1 = id => {
2198
+ const getMenuEntries$1 = (id, platform) => {
2165
2199
  const menu = menus$1.find(item => item.id === id);
2166
2200
  if (!menu) {
2167
2201
  return [];
2168
2202
  }
2169
- return menu.getMenuEntries();
2203
+ return menu.getMenuEntries(platform);
2170
2204
  };
2171
2205
 
2172
2206
  const getIconVirtualDom = (icon, type = Div) => {
@@ -2250,6 +2284,10 @@ const handleClick$1 = (state, className) => {
2250
2284
  return state;
2251
2285
  };
2252
2286
 
2287
+ const handleContextMenu = state => {
2288
+ return state;
2289
+ };
2290
+
2253
2291
  const getFontString = (fontWeight, fontSize, fontFamily) => {
2254
2292
  return `${fontWeight} ${fontSize}px ${fontFamily}`;
2255
2293
  };
@@ -3069,6 +3107,7 @@ const wrapCommand = fn => {
3069
3107
 
3070
3108
  const commandMap = {
3071
3109
  'TitleBar.getButtonsVirtualDom': getTitleBarButtonsVirtualDom,
3110
+ 'TitleBar.handleContextMenu': handleContextMenu,
3072
3111
  'TitleBar.getIconVirtualDom': getTitleBarIconVirtualDom,
3073
3112
  'TitleBar.getMenuEntries': getMenuEntries$1,
3074
3113
  'TitleBar.getMenuIds': getMenuIds,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",