@lvce-editor/activity-bar-worker 1.16.0 → 1.17.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.
@@ -1179,12 +1179,12 @@ const handleClickOther = async (state, x, y, viewletId) => {
1179
1179
  if (sideBarVisible) {
1180
1180
  if (currentViewletId === viewletId) {
1181
1181
  await hide();
1182
- } else {
1183
- await show(sideBarVisible, viewletId);
1182
+ return state;
1184
1183
  }
1185
- } else {
1186
- await show(sideBarVisible, currentViewletId);
1184
+ await show(sideBarVisible, viewletId);
1185
+ return state;
1187
1186
  }
1187
+ await show(sideBarVisible, currentViewletId);
1188
1188
  return state;
1189
1189
  };
1190
1190
 
@@ -1234,11 +1234,32 @@ const handleResize = state => {
1234
1234
  return state;
1235
1235
  };
1236
1236
 
1237
+ const Tab = 1;
1238
+ const Button = 1 << 1;
1239
+ const Progress = 1 << 2;
1240
+ const Enabled = 1 << 3;
1241
+ const Selected = 1 << 4;
1242
+ const Focused = 1 << 5;
1243
+ const MarginTop = 1 << 6;
1244
+
1245
+ const setFlag = (item, flag, enabled) => {
1246
+ return {
1247
+ ...item,
1248
+ flags: enabled ? item.flags | flag : item.flags & ~flag
1249
+ };
1250
+ };
1251
+
1237
1252
  const handleSideBarHidden = state => {
1253
+ const itemsCleared = state.activityBarItems.map(item => {
1254
+ const withoutSelected = setFlag(item, Selected, false);
1255
+ return setFlag(withoutSelected, Focused, false);
1256
+ });
1238
1257
  return {
1239
1258
  ...state,
1259
+ activityBarItems: itemsCleared,
1240
1260
  focusedIndex: -1,
1241
- selectedIndex: -1
1261
+ selectedIndex: -1,
1262
+ sideBarVisible: false
1242
1263
  };
1243
1264
  };
1244
1265
 
@@ -1251,21 +1272,6 @@ const findIndex = (activityBarItems, id) => {
1251
1272
  return -1;
1252
1273
  };
1253
1274
 
1254
- const Tab = 1;
1255
- const Button = 1 << 1;
1256
- const Progress = 1 << 2;
1257
- const Enabled = 1 << 3;
1258
- const Selected = 1 << 4;
1259
- const Focused = 1 << 5;
1260
- const MarginTop = 1 << 6;
1261
-
1262
- const setFlag = (item, flag, enabled) => {
1263
- return {
1264
- ...item,
1265
- flags: enabled ? item.flags | flag : item.flags & ~flag
1266
- };
1267
- };
1268
-
1269
1275
  const markSelected = (items, selectedIndex) => {
1270
1276
  return items.map((item, index) => {
1271
1277
  const isSelected = index === selectedIndex;
@@ -1283,7 +1289,8 @@ const handleSideBarViewletChange = (state, id, ...args) => {
1283
1289
  ...state,
1284
1290
  selectedIndex: index,
1285
1291
  currentViewletId: id,
1286
- activityBarItems: newActivityBarItems
1292
+ activityBarItems: newActivityBarItems,
1293
+ sideBarVisible: true
1287
1294
  };
1288
1295
  };
1289
1296
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/activity-bar-worker",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",