@lvce-editor/status-bar-worker 1.15.0 → 2.1.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.
@@ -1182,7 +1182,7 @@ const RenderItems = 4;
1182
1182
  const RenderIncremental = 11;
1183
1183
 
1184
1184
  const modules = [isEqual];
1185
- const numbers = [RenderItems];
1185
+ const numbers = [RenderIncremental];
1186
1186
 
1187
1187
  const diff = (oldState, newState) => {
1188
1188
  const diffResult = [];
@@ -1261,6 +1261,10 @@ const handleClick = async (state, name) => {
1261
1261
  return state;
1262
1262
  };
1263
1263
 
1264
+ const handleContextMenu = async state => {
1265
+ return state;
1266
+ };
1267
+
1264
1268
  const id = 7201;
1265
1269
  const sendMessagePortToExtensionHostWorker = async port => {
1266
1270
  await sendMessagePortToExtensionHostWorker$1(port, id);
@@ -1813,6 +1817,7 @@ const diffTree = (oldNodes, newNodes) => {
1813
1817
  return removeTrailingNavigationPatches(patches);
1814
1818
  };
1815
1819
 
1820
+ const HandleContextMenu = 2;
1816
1821
  const HandleClick = 11;
1817
1822
 
1818
1823
  const getTextVirtualDom = element => {
@@ -1871,6 +1876,14 @@ const getStatusBarItemsVirtualDom = (items, className) => {
1871
1876
  }, ...items.flatMap(getStatusBarItemVirtualDom)];
1872
1877
  };
1873
1878
 
1879
+ const getStatusBarItemsLeftDom = statusBarItemsLeft => {
1880
+ return getStatusBarItemsVirtualDom(statusBarItemsLeft, StatusBarItemsLeft);
1881
+ };
1882
+
1883
+ const getStatusBarItemsRightDom = statusBarItemsRight => {
1884
+ return getStatusBarItemsVirtualDom(statusBarItemsRight, StatusBarItemsRight);
1885
+ };
1886
+
1874
1887
  const getChildCount = (leftCount, rightCount) => {
1875
1888
  let count = 0;
1876
1889
  if (leftCount > 0) {
@@ -1886,23 +1899,28 @@ const getStatusBarVirtualDom = (statusBarItemsLeft, statusBarItemsRight) => {
1886
1899
  childCount: getChildCount(statusBarItemsLeft.length, statusBarItemsRight.length),
1887
1900
  className: 'StatusBar',
1888
1901
  onClick: HandleClick,
1902
+ onContextMenu: HandleContextMenu,
1889
1903
  role: Status,
1890
1904
  type: Div
1891
- }, ...getStatusBarItemsVirtualDom(statusBarItemsLeft, StatusBarItemsLeft), ...getStatusBarItemsVirtualDom(statusBarItemsRight, StatusBarItemsRight)];
1905
+ }, ...getStatusBarItemsLeftDom(statusBarItemsLeft), ...getStatusBarItemsRightDom(statusBarItemsRight)];
1892
1906
  return dom;
1893
1907
  };
1894
1908
 
1895
1909
  const renderItems = (oldState, newState) => {
1896
1910
  const {
1911
+ initial,
1897
1912
  statusBarItemsLeft,
1898
1913
  statusBarItemsRight,
1899
1914
  uid
1900
1915
  } = newState;
1916
+ if (initial) {
1917
+ return [SetDom2, uid, []];
1918
+ }
1901
1919
  const dom = getStatusBarVirtualDom(statusBarItemsLeft, statusBarItemsRight);
1902
1920
  return [SetDom2, uid, dom];
1903
1921
  };
1904
1922
 
1905
- const renderIcremental = (oldState, newState) => {
1923
+ const renderIncremental = (oldState, newState) => {
1906
1924
  const oldDom = renderItems(oldState, oldState)[2];
1907
1925
  const newDom = renderItems(newState, newState)[2];
1908
1926
  const patches = diffTree(oldDom, newDom);
@@ -1912,7 +1930,7 @@ const renderIcremental = (oldState, newState) => {
1912
1930
  const getRenderer = diffType => {
1913
1931
  switch (diffType) {
1914
1932
  case RenderIncremental:
1915
- return renderIcremental;
1933
+ return renderIncremental;
1916
1934
  case RenderItems:
1917
1935
  return renderItems;
1918
1936
  default:
@@ -1944,6 +1962,10 @@ const render2 = (uid, diffResult) => {
1944
1962
 
1945
1963
  const renderEventListeners = () => {
1946
1964
  return [{
1965
+ name: HandleContextMenu,
1966
+ params: ['handleContextMenu'],
1967
+ preventDefault: true
1968
+ }, {
1947
1969
  name: HandleClick,
1948
1970
  params: ['handleClick', TargetName]
1949
1971
  }];
@@ -1972,6 +1994,7 @@ const commandMap = {
1972
1994
  'StatusBar.diff2': diff2,
1973
1995
  'StatusBar.getCommandIds': getCommandIds,
1974
1996
  'StatusBar.handleClick': wrapCommand(handleClick),
1997
+ 'StatusBar.handleContextMenu': wrapCommand(handleContextMenu),
1975
1998
  'StatusBar.initialize': initialize,
1976
1999
  'StatusBar.itemLeftUpdate': wrapCommand(itemLeftUpdate),
1977
2000
  'StatusBar.itemRightCreate': wrapCommand(itemRightCreate),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/status-bar-worker",
3
- "version": "1.15.0",
3
+ "version": "2.1.0",
4
4
  "description": "Status Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,8 +9,5 @@
9
9
  "license": "MIT",
10
10
  "author": "Lvce Editor",
11
11
  "type": "module",
12
- "main": "dist/statusBarWorkerMain.js",
13
- "dependencies": {
14
- "@lvce-editor/virtual-dom-worker": "^6.8.0"
15
- }
12
+ "main": "dist/statusBarWorkerMain.js"
16
13
  }