@lvce-editor/status-bar-worker 3.30.1 → 3.30.3

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.
@@ -1906,6 +1906,12 @@ const applyUpdate = update => {
1906
1906
  return editorStatus;
1907
1907
  };
1908
1908
 
1909
+ let visible = true;
1910
+ const isVisible = () => visible;
1911
+ const setVisible = value => {
1912
+ visible = value;
1913
+ };
1914
+
1909
1915
  const textItem = (name, text, ariaLabel, tooltip) => ({
1910
1916
  ariaLabel,
1911
1917
  command: '',
@@ -2078,7 +2084,51 @@ const handleEditorStatusChangedAll = async update => {
2078
2084
  newState,
2079
2085
  oldState
2080
2086
  } = get$5(uid);
2081
- const newerState = handleEditorStatusChanged(newState, editorStatus, previous);
2087
+ const newerState = isVisible() ? handleEditorStatusChanged(newState, editorStatus, previous) : {
2088
+ ...newState,
2089
+ editorStatus
2090
+ };
2091
+ if (newState === newerState || oldState === newerState) {
2092
+ continue;
2093
+ }
2094
+ set$6(uid, oldState, newerState);
2095
+ changedUids.push(uid);
2096
+ }
2097
+ await Promise.all(changedUids.map(renderOutOfBand));
2098
+ };
2099
+
2100
+ const handleEditorStatusVisibilityChanged = (state, visible) => {
2101
+ const {
2102
+ statusBarItemsRight
2103
+ } = state;
2104
+ setVisible(visible);
2105
+ if (!visible) {
2106
+ const editorItems = statusBarItemsRight.filter(item => isEditorStatus(item.name));
2107
+ if (editorItems.length === 0) {
2108
+ return state;
2109
+ }
2110
+ return {
2111
+ ...state,
2112
+ statusBarItemsRight: statusBarItemsRight.filter(item => !isEditorStatus(item.name))
2113
+ };
2114
+ }
2115
+ return handleEditorStatusChanged(state, get$2(), {
2116
+ editorStatus: undefined
2117
+ });
2118
+ };
2119
+
2120
+ const handleEditorStatusVisibilityChangedAll = async visible => {
2121
+ if (isVisible() === visible) {
2122
+ return;
2123
+ }
2124
+ setVisible(visible);
2125
+ const changedUids = [];
2126
+ for (const uid of getKeys()) {
2127
+ const {
2128
+ newState,
2129
+ oldState
2130
+ } = get$5(uid);
2131
+ const newerState = handleEditorStatusVisibilityChanged(newState, visible);
2082
2132
  if (newState === newerState || oldState === newerState) {
2083
2133
  continue;
2084
2134
  }
@@ -2384,6 +2434,7 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
2384
2434
  const rpc = await create$2({
2385
2435
  commandMap: {
2386
2436
  'StatusBar.handleEditorStatusChanged': handleEditorStatusChangedAll,
2437
+ 'StatusBar.handleEditorStatusVisibilityChanged': handleEditorStatusVisibilityChangedAll,
2387
2438
  'StatusBar.supportsEditorStatusDeltas': supportsEditorStatusDeltas,
2388
2439
  'Viewlet.executeViewletCommand': executeViewletCommand
2389
2440
  },
@@ -2520,7 +2571,14 @@ const loadContent = async state => {
2520
2571
  statusBarItemsRight: statusBarItems.filter(item => isRight(item.name)),
2521
2572
  warningCount: 0
2522
2573
  };
2523
- const currentState = itemsVisible ? handleEditorStatusChanged(loadedState, get$2()) : loadedState;
2574
+ let currentState = loadedState;
2575
+ if (itemsVisible) {
2576
+ if (isVisible()) {
2577
+ currentState = handleEditorStatusChanged(loadedState, get$2());
2578
+ } else {
2579
+ currentState = handleEditorStatusVisibilityChanged(loadedState, false);
2580
+ }
2581
+ }
2524
2582
  const latestNotificationCount = get$1();
2525
2583
  if (latestNotificationCount === undefined) {
2526
2584
  return currentState;
@@ -2610,6 +2668,7 @@ const commandMap = {
2610
2668
  'StatusBar.handleClick': wrapCommand(handleClick),
2611
2669
  'StatusBar.handleContextMenu': wrapCommand(handleContextMenu),
2612
2670
  'StatusBar.handleEditorStatusChanged': handleEditorStatusChangedAll,
2671
+ 'StatusBar.handleEditorStatusVisibilityChanged': handleEditorStatusVisibilityChangedAll,
2613
2672
  'StatusBar.handleExtensionManagementMessagePort': handleExtensionManagementMessagePort,
2614
2673
  'StatusBar.handleExtensionsChanged': refreshExtensionItems,
2615
2674
  'StatusBar.handleItemsChanged': refreshExtensionItems,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/status-bar-worker",
3
- "version": "3.30.1",
3
+ "version": "3.30.3",
4
4
  "description": "Status Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",