@lvce-editor/activity-bar-worker 7.6.0 → 7.7.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.
- package/dist/activityBarWorkerMain.js +40 -18
- package/package.json +1 -1
|
@@ -1823,16 +1823,38 @@ const updateItemsWithBadgeCount = async items => {
|
|
|
1823
1823
|
}
|
|
1824
1824
|
};
|
|
1825
1825
|
|
|
1826
|
-
const
|
|
1827
|
-
const
|
|
1828
|
-
|
|
1829
|
-
} = state;
|
|
1830
|
-
const newItems = await updateItemsWithBadgeCount(filteredItems);
|
|
1826
|
+
const updateStateItems = (state, activityBarItems) => {
|
|
1827
|
+
const itemById = new Map(activityBarItems.map(item => [item.id, item]));
|
|
1828
|
+
const filteredItems = state.filteredItems.map(item => itemById.get(item.id) || item);
|
|
1831
1829
|
return {
|
|
1832
1830
|
...state,
|
|
1833
|
-
|
|
1831
|
+
activityBarItems,
|
|
1832
|
+
filteredItems
|
|
1834
1833
|
};
|
|
1835
1834
|
};
|
|
1835
|
+
const applyBadgeCountChanges = (state, badgeCounts) => {
|
|
1836
|
+
const activityBarItems = state.activityBarItems.map(item => {
|
|
1837
|
+
if (!Object.hasOwn(badgeCounts, item.id)) {
|
|
1838
|
+
return item;
|
|
1839
|
+
}
|
|
1840
|
+
const badgeCount = badgeCounts[item.id];
|
|
1841
|
+
return {
|
|
1842
|
+
...item,
|
|
1843
|
+
badgeText: badgeCount ? String(badgeCount) : ''
|
|
1844
|
+
};
|
|
1845
|
+
});
|
|
1846
|
+
return updateStateItems(state, activityBarItems);
|
|
1847
|
+
};
|
|
1848
|
+
const handleBadgeCountChange = async (state, badgeCounts) => {
|
|
1849
|
+
if (badgeCounts) {
|
|
1850
|
+
return applyBadgeCountChanges(state, badgeCounts);
|
|
1851
|
+
}
|
|
1852
|
+
const newActivityBarItems = await updateItemsWithBadgeCount(state.activityBarItems);
|
|
1853
|
+
if (newActivityBarItems === state.activityBarItems) {
|
|
1854
|
+
return state;
|
|
1855
|
+
}
|
|
1856
|
+
return updateStateItems(state, newActivityBarItems);
|
|
1857
|
+
};
|
|
1836
1858
|
|
|
1837
1859
|
const handleBlur = state => {
|
|
1838
1860
|
return {
|
|
@@ -2205,12 +2227,12 @@ const handleExtensionsChanged = async state => {
|
|
|
2205
2227
|
const contributedViews = await getContributedViews(state.platform);
|
|
2206
2228
|
const items = getActivityBarItems(state, contributedViews);
|
|
2207
2229
|
const itemsWithSelected = markSelected(items, selectedIndex);
|
|
2208
|
-
const
|
|
2209
|
-
const
|
|
2230
|
+
const activityBarItems = await updateItemsWithBadgeCount(itemsWithSelected);
|
|
2231
|
+
const filteredItems = getFilteredActivityBarItems(activityBarItems, height, itemHeight);
|
|
2210
2232
|
return {
|
|
2211
2233
|
...state,
|
|
2212
|
-
activityBarItems
|
|
2213
|
-
filteredItems
|
|
2234
|
+
activityBarItems,
|
|
2235
|
+
filteredItems
|
|
2214
2236
|
};
|
|
2215
2237
|
};
|
|
2216
2238
|
|
|
@@ -2273,12 +2295,12 @@ const handleSettingsChanged = async state => {
|
|
|
2273
2295
|
};
|
|
2274
2296
|
const items = getActivityBarItems(newState, contributedViews);
|
|
2275
2297
|
const itemsWithSelected = markSelected(items, selectedIndex);
|
|
2276
|
-
const
|
|
2277
|
-
const
|
|
2298
|
+
const activityBarItems = await updateItemsWithBadgeCount(itemsWithSelected);
|
|
2299
|
+
const filteredItems = getFilteredActivityBarItems(activityBarItems, height, itemHeight);
|
|
2278
2300
|
return {
|
|
2279
2301
|
...newState,
|
|
2280
|
-
activityBarItems
|
|
2281
|
-
filteredItems
|
|
2302
|
+
activityBarItems,
|
|
2303
|
+
filteredItems,
|
|
2282
2304
|
sideBarLocation: sidebarLocation
|
|
2283
2305
|
};
|
|
2284
2306
|
};
|
|
@@ -2468,13 +2490,13 @@ const loadContent = async state => {
|
|
|
2468
2490
|
const index = items.findIndex(item => item.id === activeView);
|
|
2469
2491
|
const selectedIndex = sideBarVisible ? index : -1;
|
|
2470
2492
|
const itemsWithSelected = markSelected(items, selectedIndex);
|
|
2471
|
-
const
|
|
2472
|
-
const
|
|
2493
|
+
const activityBarItems = await updateItemsWithBadgeCount(itemsWithSelected);
|
|
2494
|
+
const filteredItems = getFilteredActivityBarItems(activityBarItems, height, itemHeight);
|
|
2473
2495
|
return {
|
|
2474
2496
|
...newState,
|
|
2475
|
-
activityBarItems
|
|
2497
|
+
activityBarItems,
|
|
2476
2498
|
currentViewletId: Explorer,
|
|
2477
|
-
filteredItems
|
|
2499
|
+
filteredItems,
|
|
2478
2500
|
initial: false,
|
|
2479
2501
|
selectedIndex,
|
|
2480
2502
|
sideBarLocation: sidebarLocation,
|