@lvce-editor/activity-bar-worker 7.10.1 → 7.12.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 +94 -25
- package/package.json +1 -1
|
@@ -2149,12 +2149,21 @@ const getMenuEntryIds = () => {
|
|
|
2149
2149
|
return [ActivityBar$3, ActivityBarAdditionalViews, Settings$1, ACCOUNT_MENU_ID, ACCOUNT_SUBMENU_ID];
|
|
2150
2150
|
};
|
|
2151
2151
|
|
|
2152
|
+
const getBadgeText = badgeCount => {
|
|
2153
|
+
if (badgeCount <= 999) {
|
|
2154
|
+
return badgeCount ? String(badgeCount) : '';
|
|
2155
|
+
}
|
|
2156
|
+
const thousands = badgeCount / 1000;
|
|
2157
|
+
const roundedDown = Math.floor(thousands);
|
|
2158
|
+
return thousands > roundedDown ? `${roundedDown}K+` : `${roundedDown}K`;
|
|
2159
|
+
};
|
|
2160
|
+
|
|
2152
2161
|
const updateItemsWithBadgeCount = async items => {
|
|
2153
2162
|
try {
|
|
2154
2163
|
const badgeCounts = await invoke('Layout.getBadgeCounts');
|
|
2155
2164
|
const newItems = items.map(item => {
|
|
2156
2165
|
const badgeCount = badgeCounts[item.id] || 0;
|
|
2157
|
-
const badgeText =
|
|
2166
|
+
const badgeText = getBadgeText(badgeCount);
|
|
2158
2167
|
return {
|
|
2159
2168
|
...item,
|
|
2160
2169
|
badgeText
|
|
@@ -3123,17 +3132,14 @@ const diffTrees = (oldTree, newTree, patches, path) => {
|
|
|
3123
3132
|
};
|
|
3124
3133
|
|
|
3125
3134
|
const removeTrailingNavigationPatches = patches => {
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
for (let i = patches.length - 1; i >= 0; i--) {
|
|
3129
|
-
const patch = patches[i];
|
|
3135
|
+
while (patches.length > 0) {
|
|
3136
|
+
const patch = patches.at(-1);
|
|
3130
3137
|
if (patch.type !== NavigateChild && patch.type !== NavigateParent && patch.type !== NavigateSibling) {
|
|
3131
|
-
lastNonNavigationIndex = i;
|
|
3132
3138
|
break;
|
|
3133
3139
|
}
|
|
3140
|
+
patches.pop();
|
|
3134
3141
|
}
|
|
3135
|
-
|
|
3136
|
-
return lastNonNavigationIndex === -1 ? [] : patches.slice(0, lastNonNavigationIndex + 1);
|
|
3142
|
+
return patches;
|
|
3137
3143
|
};
|
|
3138
3144
|
|
|
3139
3145
|
const diffTree = (oldNodes, newNodes) => {
|
|
@@ -3180,20 +3186,21 @@ const getAriaSelected = (isTab, isSelected) => {
|
|
|
3180
3186
|
return Boolean(isSelected);
|
|
3181
3187
|
};
|
|
3182
3188
|
|
|
3189
|
+
const badgeVirtualDom = [{
|
|
3190
|
+
childCount: 1,
|
|
3191
|
+
className: ActivityBarItemBadge,
|
|
3192
|
+
type: Div
|
|
3193
|
+
}, {
|
|
3194
|
+
childCount: 1,
|
|
3195
|
+
className: BadgeContent,
|
|
3196
|
+
type: Div
|
|
3197
|
+
}, {
|
|
3198
|
+
childCount: 0,
|
|
3199
|
+
className: mergeClassNames(Icon, ActivityBarBadgeIcon, MaskIconProgress),
|
|
3200
|
+
type: Div
|
|
3201
|
+
}];
|
|
3183
3202
|
const getBadgeVirtualDom = () => {
|
|
3184
|
-
return
|
|
3185
|
-
childCount: 1,
|
|
3186
|
-
className: ActivityBarItemBadge,
|
|
3187
|
-
type: Div
|
|
3188
|
-
}, {
|
|
3189
|
-
childCount: 1,
|
|
3190
|
-
className: BadgeContent,
|
|
3191
|
-
type: Div
|
|
3192
|
-
}, {
|
|
3193
|
-
childCount: 0,
|
|
3194
|
-
className: mergeClassNames(Icon, ActivityBarBadgeIcon, MaskIconProgress),
|
|
3195
|
-
type: Div
|
|
3196
|
-
}];
|
|
3203
|
+
return badgeVirtualDom;
|
|
3197
3204
|
};
|
|
3198
3205
|
|
|
3199
3206
|
const getClassName = (isFocused, marginTop, isSelected) => {
|
|
@@ -3229,8 +3236,7 @@ const getActivityBarItemInProgressDom = item => {
|
|
|
3229
3236
|
const ariaSelected = getAriaSelected(isTab, isSelected);
|
|
3230
3237
|
const ariaHasPopup = getActivityBarItemHasPopup(item) || undefined;
|
|
3231
3238
|
const marginTop = flags & MarginTop;
|
|
3232
|
-
|
|
3233
|
-
className += ' ' + ActivityBarItemNested;
|
|
3239
|
+
const className = mergeClassNames(getClassName(isFocused, marginTop, isSelected), ActivityBarItemNested);
|
|
3234
3240
|
return [{
|
|
3235
3241
|
ariaHasPopup,
|
|
3236
3242
|
ariaSelected,
|
|
@@ -3265,8 +3271,7 @@ const getActivityBarItemWithBadgeDom = item => {
|
|
|
3265
3271
|
const ariaSelected = getAriaSelected(isTab, isSelected);
|
|
3266
3272
|
const ariaHasPopup = getActivityBarItemHasPopup(item) || undefined;
|
|
3267
3273
|
const marginTop = flags & MarginTop;
|
|
3268
|
-
|
|
3269
|
-
className += ' ' + ActivityBarItemNested;
|
|
3274
|
+
const className = mergeClassNames(getClassName(isFocused, marginTop, isSelected), ActivityBarItemNested);
|
|
3270
3275
|
return [{
|
|
3271
3276
|
ariaHasPopup,
|
|
3272
3277
|
ariaSelected,
|
|
@@ -3463,6 +3468,69 @@ const renderEventListeners = () => {
|
|
|
3463
3468
|
}];
|
|
3464
3469
|
};
|
|
3465
3470
|
|
|
3471
|
+
const createDefaultState = () => ({
|
|
3472
|
+
accountEnabled: true,
|
|
3473
|
+
activityBarItems: [],
|
|
3474
|
+
currentViewletId: '',
|
|
3475
|
+
filteredItems: [],
|
|
3476
|
+
focus: 0,
|
|
3477
|
+
focused: false,
|
|
3478
|
+
focusedIndex: 0,
|
|
3479
|
+
height: 400,
|
|
3480
|
+
initial: true,
|
|
3481
|
+
itemHeight: 48,
|
|
3482
|
+
numberOfVisibleItems: 0,
|
|
3483
|
+
platform: 0,
|
|
3484
|
+
scrollBarHeight: 0,
|
|
3485
|
+
selectedIndex: -1,
|
|
3486
|
+
sideBarLocation: 0,
|
|
3487
|
+
sideBarVisible: false,
|
|
3488
|
+
uid: 0,
|
|
3489
|
+
updateProgress: 0,
|
|
3490
|
+
updateState: '',
|
|
3491
|
+
userLoginProvider: 'Lvce Editor',
|
|
3492
|
+
userLoginState: 'logged out',
|
|
3493
|
+
userName: '',
|
|
3494
|
+
width: 48,
|
|
3495
|
+
x: 0,
|
|
3496
|
+
y: 0
|
|
3497
|
+
});
|
|
3498
|
+
|
|
3499
|
+
const createResetState = state => {
|
|
3500
|
+
const {
|
|
3501
|
+
accountEnabled,
|
|
3502
|
+
height,
|
|
3503
|
+
itemHeight,
|
|
3504
|
+
platform,
|
|
3505
|
+
uid,
|
|
3506
|
+
userLoginProvider,
|
|
3507
|
+
userLoginState,
|
|
3508
|
+
userName,
|
|
3509
|
+
width,
|
|
3510
|
+
x,
|
|
3511
|
+
y
|
|
3512
|
+
} = state;
|
|
3513
|
+
return {
|
|
3514
|
+
...createDefaultState(),
|
|
3515
|
+
accountEnabled,
|
|
3516
|
+
focusedIndex: -1,
|
|
3517
|
+
height,
|
|
3518
|
+
itemHeight,
|
|
3519
|
+
platform,
|
|
3520
|
+
uid,
|
|
3521
|
+
userLoginProvider,
|
|
3522
|
+
userLoginState,
|
|
3523
|
+
userName,
|
|
3524
|
+
width,
|
|
3525
|
+
x,
|
|
3526
|
+
y
|
|
3527
|
+
};
|
|
3528
|
+
};
|
|
3529
|
+
const reset = async state => {
|
|
3530
|
+
const resetState = createResetState(state);
|
|
3531
|
+
return loadContent(resetState);
|
|
3532
|
+
};
|
|
3533
|
+
|
|
3466
3534
|
const saveState = state => {
|
|
3467
3535
|
return {};
|
|
3468
3536
|
};
|
|
@@ -3611,6 +3679,7 @@ const commandMap = {
|
|
|
3611
3679
|
'ActivityBar.loadContent': wrapCommand(loadContent),
|
|
3612
3680
|
'ActivityBar.render2': render2,
|
|
3613
3681
|
'ActivityBar.renderEventListeners': renderEventListeners,
|
|
3682
|
+
'ActivityBar.reset': wrapCommand(reset),
|
|
3614
3683
|
'ActivityBar.resize': wrapCommand(handleResize),
|
|
3615
3684
|
'ActivityBar.saveState': wrapGetter(saveState),
|
|
3616
3685
|
'ActivityBar.selectCurrent': wrapCommand(selectCurrent),
|