@lvce-editor/activity-bar-worker 7.9.3 → 7.9.4
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 -99
- package/package.json +1 -1
|
@@ -249,7 +249,7 @@ const {
|
|
|
249
249
|
get: get$2,
|
|
250
250
|
getCommandIds,
|
|
251
251
|
registerCommands,
|
|
252
|
-
set: set$
|
|
252
|
+
set: set$3,
|
|
253
253
|
wrapCommand,
|
|
254
254
|
wrapGetter
|
|
255
255
|
} = create$a();
|
|
@@ -283,7 +283,7 @@ const create$9 = (id, uri, x, y, width, height, args, parentUid, platform = 0) =
|
|
|
283
283
|
x,
|
|
284
284
|
y
|
|
285
285
|
};
|
|
286
|
-
set$
|
|
286
|
+
set$3(id, state, state);
|
|
287
287
|
return state;
|
|
288
288
|
};
|
|
289
289
|
|
|
@@ -1993,7 +1993,7 @@ const createMockRpc = ({
|
|
|
1993
1993
|
};
|
|
1994
1994
|
|
|
1995
1995
|
const rpcs = Object.create(null);
|
|
1996
|
-
const set$
|
|
1996
|
+
const set$2 = (id, rpc) => {
|
|
1997
1997
|
rpcs[id] = rpc;
|
|
1998
1998
|
};
|
|
1999
1999
|
const get = id => {
|
|
@@ -2026,7 +2026,7 @@ const create = rpcId => {
|
|
|
2026
2026
|
const mockRpc = createMockRpc({
|
|
2027
2027
|
commandMap
|
|
2028
2028
|
});
|
|
2029
|
-
set$
|
|
2029
|
+
set$2(rpcId, mockRpc);
|
|
2030
2030
|
// @ts-ignore
|
|
2031
2031
|
mockRpc[Symbol.dispose] = () => {
|
|
2032
2032
|
remove(rpcId);
|
|
@@ -2035,15 +2035,11 @@ const create = rpcId => {
|
|
|
2035
2035
|
return mockRpc;
|
|
2036
2036
|
},
|
|
2037
2037
|
set(rpc) {
|
|
2038
|
-
set$
|
|
2038
|
+
set$2(rpcId, rpc);
|
|
2039
2039
|
}
|
|
2040
2040
|
};
|
|
2041
2041
|
};
|
|
2042
2042
|
|
|
2043
|
-
const {
|
|
2044
|
-
set: set$2
|
|
2045
|
-
} = create(6010);
|
|
2046
|
-
|
|
2047
2043
|
const {
|
|
2048
2044
|
invoke: invoke$1,
|
|
2049
2045
|
set: set$1
|
|
@@ -2061,10 +2057,6 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
|
2061
2057
|
number(y);
|
|
2062
2058
|
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
2063
2059
|
};
|
|
2064
|
-
const sendMessagePortToAuthWorker = async (port, rpcId) => {
|
|
2065
|
-
const command = 'HandleMessagePort.handleMessagePort';
|
|
2066
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToAuthWorker', port, command, rpcId);
|
|
2067
|
-
};
|
|
2068
2060
|
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
2069
2061
|
const command = 'Extensions.handleMessagePort';
|
|
2070
2062
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
@@ -2080,6 +2072,11 @@ const handleClickAccount = async (state, eventX, eventY, viewletId) => {
|
|
|
2080
2072
|
sideBarLocation,
|
|
2081
2073
|
uid
|
|
2082
2074
|
} = state;
|
|
2075
|
+
try {
|
|
2076
|
+
await invoke('Layout.refreshAuthState');
|
|
2077
|
+
} catch {
|
|
2078
|
+
// Keep the account menu available when auth is unavailable.
|
|
2079
|
+
}
|
|
2083
2080
|
await show2(uid, ACCOUNT_MENU_ID, eventX, eventY, {
|
|
2084
2081
|
menuId: ACCOUNT_MENU_ID,
|
|
2085
2082
|
openSubMenuToLeft: sideBarLocation === Right
|
|
@@ -2715,40 +2712,6 @@ const handleUpdateStateChange = async (state, config) => {
|
|
|
2715
2712
|
};
|
|
2716
2713
|
};
|
|
2717
2714
|
|
|
2718
|
-
const providerKeys = ['userLoginProvider', 'loginProvider', 'authProvider', 'provider'];
|
|
2719
|
-
const getUserLoginProvider = userInfo => {
|
|
2720
|
-
if (!userInfo || typeof userInfo !== 'object') {
|
|
2721
|
-
return 'GitHub';
|
|
2722
|
-
}
|
|
2723
|
-
const record = userInfo;
|
|
2724
|
-
for (const key of providerKeys) {
|
|
2725
|
-
if (typeof record[key] === 'string' && record[key]) {
|
|
2726
|
-
return record[key];
|
|
2727
|
-
}
|
|
2728
|
-
}
|
|
2729
|
-
return 'GitHub';
|
|
2730
|
-
};
|
|
2731
|
-
|
|
2732
|
-
const getUserName = userInfo => {
|
|
2733
|
-
if (!userInfo || typeof userInfo !== 'object') {
|
|
2734
|
-
return '';
|
|
2735
|
-
}
|
|
2736
|
-
if (!('userName' in userInfo) || typeof userInfo.userName !== 'string') {
|
|
2737
|
-
return '';
|
|
2738
|
-
}
|
|
2739
|
-
return userInfo.userName;
|
|
2740
|
-
};
|
|
2741
|
-
|
|
2742
|
-
const getUserState = userInfo => {
|
|
2743
|
-
if (!userInfo || typeof userInfo !== 'object') {
|
|
2744
|
-
return undefined;
|
|
2745
|
-
}
|
|
2746
|
-
if (!('userState' in userInfo)) {
|
|
2747
|
-
return undefined;
|
|
2748
|
-
}
|
|
2749
|
-
return userInfo.userState;
|
|
2750
|
-
};
|
|
2751
|
-
|
|
2752
2715
|
const getActiveView = async () => {
|
|
2753
2716
|
try {
|
|
2754
2717
|
const activeView = await invoke('Layout.getActiveSideBarView');
|
|
@@ -2758,39 +2721,17 @@ const getActiveView = async () => {
|
|
|
2758
2721
|
}
|
|
2759
2722
|
};
|
|
2760
2723
|
|
|
2761
|
-
const getUserInfo = async () => {
|
|
2762
|
-
try {
|
|
2763
|
-
return await invoke('Layout.getUserInfo');
|
|
2764
|
-
} catch {
|
|
2765
|
-
return undefined;
|
|
2766
|
-
}
|
|
2767
|
-
};
|
|
2768
|
-
|
|
2769
2724
|
const loadPreferences = async (accountEnabled, platform) => {
|
|
2770
|
-
const [accountEnabledNew, activeView, contributedViews, sidebarLocation, sideBarVisible
|
|
2725
|
+
const [accountEnabledNew, activeView, contributedViews, sidebarLocation, sideBarVisible] = await Promise.all([getAccountEnabled(accountEnabled), getActiveView(), getContributedViews(platform), getSideBarPosition(), getSideBarVisible()]);
|
|
2771
2726
|
return {
|
|
2772
2727
|
accountEnabled: accountEnabledNew,
|
|
2773
2728
|
activeView,
|
|
2774
2729
|
contributedViews,
|
|
2775
2730
|
sidebarLocation,
|
|
2776
|
-
sideBarVisible
|
|
2777
|
-
userInfo
|
|
2731
|
+
sideBarVisible
|
|
2778
2732
|
};
|
|
2779
2733
|
};
|
|
2780
2734
|
|
|
2781
|
-
const toUserLoginState = userState => {
|
|
2782
|
-
switch (userState) {
|
|
2783
|
-
case 'loggedIn':
|
|
2784
|
-
return 'logged in';
|
|
2785
|
-
case 'loggingIn':
|
|
2786
|
-
return 'logging in';
|
|
2787
|
-
case 'loggingOut':
|
|
2788
|
-
return 'logging out';
|
|
2789
|
-
default:
|
|
2790
|
-
return 'logged out';
|
|
2791
|
-
}
|
|
2792
|
-
};
|
|
2793
|
-
|
|
2794
2735
|
const loadContent = async state => {
|
|
2795
2736
|
const {
|
|
2796
2737
|
accountEnabled,
|
|
@@ -2803,15 +2744,11 @@ const loadContent = async state => {
|
|
|
2803
2744
|
activeView,
|
|
2804
2745
|
contributedViews,
|
|
2805
2746
|
sidebarLocation,
|
|
2806
|
-
sideBarVisible
|
|
2807
|
-
userInfo
|
|
2747
|
+
sideBarVisible
|
|
2808
2748
|
} = await loadPreferences(accountEnabled, platform);
|
|
2809
2749
|
const newState = {
|
|
2810
2750
|
...state,
|
|
2811
|
-
accountEnabled: accountEnabledNew
|
|
2812
|
-
userLoginProvider: getUserLoginProvider(userInfo),
|
|
2813
|
-
userLoginState: toUserLoginState(getUserState(userInfo)),
|
|
2814
|
-
userName: getUserName(userInfo)
|
|
2751
|
+
accountEnabled: accountEnabledNew
|
|
2815
2752
|
};
|
|
2816
2753
|
const items = getActivityBarItems(newState, contributedViews);
|
|
2817
2754
|
const index = items.findIndex(item => item.id === activeView);
|
|
@@ -3396,15 +3333,7 @@ const renderItems = (oldState, newState) => {
|
|
|
3396
3333
|
return [SetDom2, uid, dom];
|
|
3397
3334
|
};
|
|
3398
3335
|
|
|
3399
|
-
const hasSameItemIds = (oldState, newState) => {
|
|
3400
|
-
const oldItems = oldState.filteredItems;
|
|
3401
|
-
const newItems = newState.filteredItems;
|
|
3402
|
-
return oldItems.length === newItems.length && oldItems.every((item, index) => item.id === newItems[index].id);
|
|
3403
|
-
};
|
|
3404
3336
|
const renderIncremental = (oldState, newState) => {
|
|
3405
|
-
if (!hasSameItemIds(oldState, newState)) {
|
|
3406
|
-
return renderItems(oldState, newState);
|
|
3407
|
-
}
|
|
3408
3337
|
const oldDom = renderItems(oldState, oldState)[2];
|
|
3409
3338
|
const newDom = renderItems(newState, newState)[2];
|
|
3410
3339
|
const patches = diffTree(oldDom, newDom);
|
|
@@ -3448,7 +3377,7 @@ const render2 = (uid, diffResult) => {
|
|
|
3448
3377
|
newState,
|
|
3449
3378
|
oldState
|
|
3450
3379
|
} = get$2(uid);
|
|
3451
|
-
set$
|
|
3380
|
+
set$3(uid, newState, newState);
|
|
3452
3381
|
const commands = applyRender(oldState, newState, diffResult);
|
|
3453
3382
|
return commands;
|
|
3454
3383
|
};
|
|
@@ -3496,6 +3425,30 @@ const setAccountEnabled = (state, enabled) => {
|
|
|
3496
3425
|
};
|
|
3497
3426
|
};
|
|
3498
3427
|
|
|
3428
|
+
const providerKeys = ['userLoginProvider', 'loginProvider', 'authProvider', 'provider'];
|
|
3429
|
+
const getUserLoginProvider = userInfo => {
|
|
3430
|
+
if (!userInfo || typeof userInfo !== 'object') {
|
|
3431
|
+
return 'GitHub';
|
|
3432
|
+
}
|
|
3433
|
+
const record = userInfo;
|
|
3434
|
+
for (const key of providerKeys) {
|
|
3435
|
+
if (typeof record[key] === 'string' && record[key]) {
|
|
3436
|
+
return record[key];
|
|
3437
|
+
}
|
|
3438
|
+
}
|
|
3439
|
+
return 'GitHub';
|
|
3440
|
+
};
|
|
3441
|
+
|
|
3442
|
+
const getUserName = userInfo => {
|
|
3443
|
+
if (!userInfo || typeof userInfo !== 'object') {
|
|
3444
|
+
return '';
|
|
3445
|
+
}
|
|
3446
|
+
if (!('userName' in userInfo) || typeof userInfo.userName !== 'string') {
|
|
3447
|
+
return '';
|
|
3448
|
+
}
|
|
3449
|
+
return userInfo.userName;
|
|
3450
|
+
};
|
|
3451
|
+
|
|
3499
3452
|
const setUserLoginState = (state, userLoginState, userInfo) => {
|
|
3500
3453
|
return {
|
|
3501
3454
|
...state,
|
|
@@ -3569,18 +3522,6 @@ const commandMap = {
|
|
|
3569
3522
|
'ActivityBar.toggleActivityBarItem': wrapCommand(toggleActivityBarItem)
|
|
3570
3523
|
};
|
|
3571
3524
|
|
|
3572
|
-
const send$1 = async port => {
|
|
3573
|
-
// @ts-ignore
|
|
3574
|
-
await sendMessagePortToAuthWorker(port);
|
|
3575
|
-
};
|
|
3576
|
-
const initializeAuthWorker = async () => {
|
|
3577
|
-
const rpc = await create$2({
|
|
3578
|
-
commandMap: {},
|
|
3579
|
-
send: send$1
|
|
3580
|
-
});
|
|
3581
|
-
set$2(rpc);
|
|
3582
|
-
};
|
|
3583
|
-
|
|
3584
3525
|
const send = async port => {
|
|
3585
3526
|
await sendMessagePortToExtensionManagementWorker(port, 0);
|
|
3586
3527
|
};
|
|
@@ -3601,7 +3542,7 @@ const initializeRendererWorker = async () => {
|
|
|
3601
3542
|
|
|
3602
3543
|
const listen = async () => {
|
|
3603
3544
|
registerCommands(commandMap);
|
|
3604
|
-
await Promise.all([initializeRendererWorker(),
|
|
3545
|
+
await Promise.all([initializeRendererWorker(), initializeExtensionManagementWorker()]);
|
|
3605
3546
|
};
|
|
3606
3547
|
|
|
3607
3548
|
const main = async () => {
|