@lvce-editor/activity-bar-worker 7.19.0 → 7.20.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 +183 -87
- 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$5,
|
|
253
253
|
wrapAsyncCommand,
|
|
254
254
|
wrapCommand,
|
|
255
255
|
wrapGetter
|
|
@@ -284,7 +284,7 @@ const create$9 = (id, uri, x, y, width, height, args, parentUid, platform = 0) =
|
|
|
284
284
|
x,
|
|
285
285
|
y
|
|
286
286
|
};
|
|
287
|
-
set$
|
|
287
|
+
set$5(id, state, state);
|
|
288
288
|
return state;
|
|
289
289
|
};
|
|
290
290
|
|
|
@@ -594,6 +594,7 @@ const LeftClick = 0;
|
|
|
594
594
|
const Electron = 2;
|
|
595
595
|
|
|
596
596
|
const ExtensionManagementWorker = 9006;
|
|
597
|
+
const RendererProcess = 1670;
|
|
597
598
|
const RendererWorker = 1;
|
|
598
599
|
|
|
599
600
|
const Left = 1;
|
|
@@ -1966,7 +1967,7 @@ const createMockRpc = ({
|
|
|
1966
1967
|
};
|
|
1967
1968
|
|
|
1968
1969
|
const rpcs = Object.create(null);
|
|
1969
|
-
const set$
|
|
1970
|
+
const set$4 = (id, rpc) => {
|
|
1970
1971
|
rpcs[id] = rpc;
|
|
1971
1972
|
};
|
|
1972
1973
|
const get = id => {
|
|
@@ -1999,7 +2000,7 @@ const create = rpcId => {
|
|
|
1999
2000
|
const mockRpc = createMockRpc({
|
|
2000
2001
|
commandMap
|
|
2001
2002
|
});
|
|
2002
|
-
set$
|
|
2003
|
+
set$4(rpcId, mockRpc);
|
|
2003
2004
|
// @ts-ignore
|
|
2004
2005
|
mockRpc[Symbol.dispose] = () => {
|
|
2005
2006
|
remove(rpcId);
|
|
@@ -2008,27 +2009,32 @@ const create = rpcId => {
|
|
|
2008
2009
|
return mockRpc;
|
|
2009
2010
|
},
|
|
2010
2011
|
set(rpc) {
|
|
2011
|
-
set$
|
|
2012
|
+
set$4(rpcId, rpc);
|
|
2012
2013
|
}
|
|
2013
2014
|
};
|
|
2014
2015
|
};
|
|
2015
2016
|
|
|
2016
2017
|
const {
|
|
2017
|
-
invoke: invoke$
|
|
2018
|
-
set: set$
|
|
2018
|
+
invoke: invoke$3,
|
|
2019
|
+
set: set$3
|
|
2019
2020
|
} = create(ExtensionManagementWorker);
|
|
2020
2021
|
|
|
2021
2022
|
const {
|
|
2022
|
-
invoke,
|
|
2023
|
+
invoke: invoke$2,
|
|
2024
|
+
set: set$2
|
|
2025
|
+
} = create(RendererProcess);
|
|
2026
|
+
|
|
2027
|
+
const {
|
|
2028
|
+
invoke: invoke$1,
|
|
2023
2029
|
invokeAndTransfer,
|
|
2024
|
-
set
|
|
2030
|
+
set: set$1
|
|
2025
2031
|
} = create(RendererWorker);
|
|
2026
2032
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
2027
2033
|
number(uid);
|
|
2028
2034
|
number(menuId);
|
|
2029
2035
|
number(x);
|
|
2030
2036
|
number(y);
|
|
2031
|
-
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
2037
|
+
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
2032
2038
|
};
|
|
2033
2039
|
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
2034
2040
|
const command = 'Extensions.handleMessagePort';
|
|
@@ -2046,7 +2052,7 @@ const handleClickAccount = async (state, eventX, eventY, viewletId) => {
|
|
|
2046
2052
|
uid
|
|
2047
2053
|
} = state;
|
|
2048
2054
|
try {
|
|
2049
|
-
await invoke('Layout.refreshAuthState');
|
|
2055
|
+
await invoke$1('Layout.refreshAuthState');
|
|
2050
2056
|
} catch {
|
|
2051
2057
|
// Keep the account menu available when auth is unavailable.
|
|
2052
2058
|
}
|
|
@@ -2164,6 +2170,69 @@ const getMenuEntryIds = () => {
|
|
|
2164
2170
|
return [ActivityBar$3, ActivityBarAdditionalViews, Settings$1, ACCOUNT_MENU_ID, ACCOUNT_SUBMENU_ID];
|
|
2165
2171
|
};
|
|
2166
2172
|
|
|
2173
|
+
const getActiveViewIds = items => {
|
|
2174
|
+
return items.filter(item => item.flags & Selected).map(item => item.id);
|
|
2175
|
+
};
|
|
2176
|
+
|
|
2177
|
+
const Account = 'Account';
|
|
2178
|
+
const DebugAlt2 = 'DebugAlt2';
|
|
2179
|
+
const Extensions$1 = 'Extensions';
|
|
2180
|
+
const Files = 'Files';
|
|
2181
|
+
const References$1 = 'References';
|
|
2182
|
+
const Search$1 = 'Search';
|
|
2183
|
+
const SettingsGear = 'SettingsGear';
|
|
2184
|
+
const SourceControl$1 = 'SourceControl';
|
|
2185
|
+
const Ellipsis = 'Ellipsis';
|
|
2186
|
+
|
|
2187
|
+
const getFilteredActivityBarItems = (items, height, itemHeight) => {
|
|
2188
|
+
const enabledItems = items.filter(item => item.flags & Enabled);
|
|
2189
|
+
const numberOfVisibleItems = getNumberOfVisibleItems({
|
|
2190
|
+
height,
|
|
2191
|
+
itemHeight
|
|
2192
|
+
});
|
|
2193
|
+
if (numberOfVisibleItems >= enabledItems.length) {
|
|
2194
|
+
return enabledItems;
|
|
2195
|
+
}
|
|
2196
|
+
const showMoreItem = {
|
|
2197
|
+
flags: Button,
|
|
2198
|
+
icon: Ellipsis,
|
|
2199
|
+
id: 'Additional Views',
|
|
2200
|
+
keyShortcuts: '',
|
|
2201
|
+
title: additionalViews()
|
|
2202
|
+
};
|
|
2203
|
+
return [...enabledItems.slice(0, numberOfVisibleItems - 2), showMoreItem, enabledItems.at(-1)];
|
|
2204
|
+
};
|
|
2205
|
+
|
|
2206
|
+
const setFlag = (item, flag, enabled) => {
|
|
2207
|
+
return {
|
|
2208
|
+
...item,
|
|
2209
|
+
flags: enabled ? item.flags | flag : item.flags & ~flag
|
|
2210
|
+
};
|
|
2211
|
+
};
|
|
2212
|
+
|
|
2213
|
+
const markActiveViews = (items, activeViewIds) => {
|
|
2214
|
+
const activeViews = new Set(activeViewIds);
|
|
2215
|
+
return items.map(item => setFlag(item, Selected, activeViews.has(item.id)));
|
|
2216
|
+
};
|
|
2217
|
+
|
|
2218
|
+
const handleActiveViewStateChange = (state, id, visible) => {
|
|
2219
|
+
const {
|
|
2220
|
+
activityBarItems,
|
|
2221
|
+
height,
|
|
2222
|
+
itemHeight
|
|
2223
|
+
} = state;
|
|
2224
|
+
const activeViewIds = getActiveViewIds(activityBarItems);
|
|
2225
|
+
const withoutView = activeViewIds.filter(activeViewId => activeViewId !== id);
|
|
2226
|
+
const newActiveViewIds = visible ? [...withoutView, id] : withoutView;
|
|
2227
|
+
const newActivityBarItems = markActiveViews(activityBarItems, newActiveViewIds);
|
|
2228
|
+
const filteredItems = getFilteredActivityBarItems(newActivityBarItems, height, itemHeight);
|
|
2229
|
+
return {
|
|
2230
|
+
...state,
|
|
2231
|
+
activityBarItems: newActivityBarItems,
|
|
2232
|
+
filteredItems
|
|
2233
|
+
};
|
|
2234
|
+
};
|
|
2235
|
+
|
|
2167
2236
|
const getBadgeText = badgeCount => {
|
|
2168
2237
|
if (badgeCount <= 999) {
|
|
2169
2238
|
return badgeCount ? String(badgeCount) : '';
|
|
@@ -2175,7 +2244,7 @@ const getBadgeText = badgeCount => {
|
|
|
2175
2244
|
|
|
2176
2245
|
const updateItemsWithBadgeCount = async items => {
|
|
2177
2246
|
try {
|
|
2178
|
-
const badgeCounts = await invoke('Layout.getBadgeCounts');
|
|
2247
|
+
const badgeCounts = await invoke$1('Layout.getBadgeCounts');
|
|
2179
2248
|
const newItems = items.map(item => {
|
|
2180
2249
|
const badgeCount = badgeCounts[item.id] || 0;
|
|
2181
2250
|
const badgeText = getBadgeText(badgeCount);
|
|
@@ -2306,35 +2375,6 @@ const findIndex = (activityBarItems, id) => {
|
|
|
2306
2375
|
return -1;
|
|
2307
2376
|
};
|
|
2308
2377
|
|
|
2309
|
-
const Account = 'Account';
|
|
2310
|
-
const DebugAlt2 = 'DebugAlt2';
|
|
2311
|
-
const Extensions$1 = 'Extensions';
|
|
2312
|
-
const Files = 'Files';
|
|
2313
|
-
const References$1 = 'References';
|
|
2314
|
-
const Search$1 = 'Search';
|
|
2315
|
-
const SettingsGear = 'SettingsGear';
|
|
2316
|
-
const SourceControl$1 = 'SourceControl';
|
|
2317
|
-
const Ellipsis = 'Ellipsis';
|
|
2318
|
-
|
|
2319
|
-
const getFilteredActivityBarItems = (items, height, itemHeight) => {
|
|
2320
|
-
const enabledItems = items.filter(item => item.flags & Enabled);
|
|
2321
|
-
const numberOfVisibleItems = getNumberOfVisibleItems({
|
|
2322
|
-
height,
|
|
2323
|
-
itemHeight
|
|
2324
|
-
});
|
|
2325
|
-
if (numberOfVisibleItems >= enabledItems.length) {
|
|
2326
|
-
return enabledItems;
|
|
2327
|
-
}
|
|
2328
|
-
const showMoreItem = {
|
|
2329
|
-
flags: Button,
|
|
2330
|
-
icon: Ellipsis,
|
|
2331
|
-
id: 'Additional Views',
|
|
2332
|
-
keyShortcuts: '',
|
|
2333
|
-
title: additionalViews()
|
|
2334
|
-
};
|
|
2335
|
-
return [...enabledItems.slice(0, numberOfVisibleItems - 2), showMoreItem, enabledItems.at(-1)];
|
|
2336
|
-
};
|
|
2337
|
-
|
|
2338
2378
|
const getSideBarChange = (sideBarVisible, currentViewletId, viewletId) => {
|
|
2339
2379
|
if (sideBarVisible) {
|
|
2340
2380
|
if (currentViewletId === viewletId) {
|
|
@@ -2354,22 +2394,8 @@ const getSideBarChange = (sideBarVisible, currentViewletId, viewletId) => {
|
|
|
2354
2394
|
};
|
|
2355
2395
|
};
|
|
2356
2396
|
|
|
2357
|
-
const setFlag = (item, flag, enabled) => {
|
|
2358
|
-
return {
|
|
2359
|
-
...item,
|
|
2360
|
-
flags: enabled ? item.flags | flag : item.flags & ~flag
|
|
2361
|
-
};
|
|
2362
|
-
};
|
|
2363
|
-
|
|
2364
|
-
const markSelected = (items, selectedIndex) => {
|
|
2365
|
-
return items.map((item, index) => {
|
|
2366
|
-
const isSelected = index === selectedIndex;
|
|
2367
|
-
return setFlag(item, Selected, isSelected);
|
|
2368
|
-
});
|
|
2369
|
-
};
|
|
2370
|
-
|
|
2371
2397
|
const toggle = async id => {
|
|
2372
|
-
await invoke('Layout.toggleSideBarView', id);
|
|
2398
|
+
await invoke$1('Layout.toggleSideBarView', id);
|
|
2373
2399
|
};
|
|
2374
2400
|
|
|
2375
2401
|
const handleClickOther = async (state, viewletId) => {
|
|
@@ -2380,10 +2406,24 @@ const handleClickOther = async (state, viewletId) => {
|
|
|
2380
2406
|
itemHeight,
|
|
2381
2407
|
sideBarVisible
|
|
2382
2408
|
} = state;
|
|
2409
|
+
const activeViewIds = getActiveViewIds(activityBarItems);
|
|
2410
|
+
const selectedItem = activityBarItems.find(item => item.id === viewletId);
|
|
2383
2411
|
const sideBarChange = getSideBarChange(sideBarVisible, currentViewletId, viewletId);
|
|
2384
2412
|
await toggle(viewletId);
|
|
2413
|
+
if (selectedItem?.preferredLocation === 'preview') {
|
|
2414
|
+
const isActive = activeViewIds.includes(viewletId);
|
|
2415
|
+
const newActiveViewIds = isActive ? activeViewIds.filter(id => id !== viewletId) : [...activeViewIds, viewletId];
|
|
2416
|
+
const newActivityBarItems = markActiveViews(activityBarItems, newActiveViewIds);
|
|
2417
|
+
const filteredItems = getFilteredActivityBarItems(newActivityBarItems, height, itemHeight);
|
|
2418
|
+
return {
|
|
2419
|
+
...state,
|
|
2420
|
+
activityBarItems: newActivityBarItems,
|
|
2421
|
+
filteredItems
|
|
2422
|
+
};
|
|
2423
|
+
}
|
|
2424
|
+
const withoutCurrentSideBarView = activeViewIds.filter(id => id !== currentViewletId);
|
|
2385
2425
|
if (sideBarChange.type === 'hide') {
|
|
2386
|
-
const newActivityBarItems =
|
|
2426
|
+
const newActivityBarItems = markActiveViews(activityBarItems, withoutCurrentSideBarView);
|
|
2387
2427
|
const filteredItems = getFilteredActivityBarItems(newActivityBarItems, height, itemHeight);
|
|
2388
2428
|
return {
|
|
2389
2429
|
...state,
|
|
@@ -2394,7 +2434,8 @@ const handleClickOther = async (state, viewletId) => {
|
|
|
2394
2434
|
};
|
|
2395
2435
|
}
|
|
2396
2436
|
const selectedIndex = findIndex(activityBarItems, viewletId);
|
|
2397
|
-
const
|
|
2437
|
+
const newActiveViewIds = [...withoutCurrentSideBarView, viewletId];
|
|
2438
|
+
const newActivityBarItems = markActiveViews(activityBarItems, newActiveViewIds);
|
|
2398
2439
|
const filteredItems = getFilteredActivityBarItems(newActivityBarItems, height, itemHeight);
|
|
2399
2440
|
return {
|
|
2400
2441
|
...state,
|
|
@@ -2467,18 +2508,18 @@ const handleClick = async (state, button, eventX, eventY, targetName = '') => {
|
|
|
2467
2508
|
};
|
|
2468
2509
|
|
|
2469
2510
|
const handleClickSignIn = async state => {
|
|
2470
|
-
await invoke('Layout.signIn');
|
|
2511
|
+
await invoke$1('Layout.signIn');
|
|
2471
2512
|
return state;
|
|
2472
2513
|
};
|
|
2473
2514
|
|
|
2474
2515
|
const handleClickSignOut = async state => {
|
|
2475
|
-
await invoke('Layout.signOut');
|
|
2516
|
+
await invoke$1('Layout.signOut');
|
|
2476
2517
|
return state;
|
|
2477
2518
|
};
|
|
2478
2519
|
|
|
2479
2520
|
const getSideBarPosition = async () => {
|
|
2480
2521
|
try {
|
|
2481
|
-
return await invoke('Layout.getSideBarPosition');
|
|
2522
|
+
return await invoke$1('Layout.getSideBarPosition');
|
|
2482
2523
|
} catch {
|
|
2483
2524
|
return Left;
|
|
2484
2525
|
}
|
|
@@ -2507,7 +2548,7 @@ const handleExtensionManagementMessagePort = async port => {
|
|
|
2507
2548
|
commandMap: commandMap$1,
|
|
2508
2549
|
messagePort: port
|
|
2509
2550
|
});
|
|
2510
|
-
set$
|
|
2551
|
+
set$3(rpc);
|
|
2511
2552
|
};
|
|
2512
2553
|
|
|
2513
2554
|
const hashString = value => {
|
|
@@ -2543,6 +2584,9 @@ const toActivityBarItem = view => {
|
|
|
2543
2584
|
icon,
|
|
2544
2585
|
id: view.id,
|
|
2545
2586
|
keyShortcuts: '',
|
|
2587
|
+
...(view.preferredLocation === 'preview' && {
|
|
2588
|
+
preferredLocation: 'preview'
|
|
2589
|
+
}),
|
|
2546
2590
|
title: view.title || view.id
|
|
2547
2591
|
};
|
|
2548
2592
|
if (customIconClass && customIconUrl) {
|
|
@@ -2623,7 +2667,7 @@ const getActivityBarItems = (state, contributedViews = []) => {
|
|
|
2623
2667
|
|
|
2624
2668
|
const getContributedViews = async platform => {
|
|
2625
2669
|
try {
|
|
2626
|
-
const views = await invoke$
|
|
2670
|
+
const views = await invoke$3('Extensions.getViews', '', platform);
|
|
2627
2671
|
if (!Array.isArray(views)) {
|
|
2628
2672
|
return [];
|
|
2629
2673
|
}
|
|
@@ -2633,16 +2677,29 @@ const getContributedViews = async platform => {
|
|
|
2633
2677
|
}
|
|
2634
2678
|
};
|
|
2635
2679
|
|
|
2680
|
+
const resolveActiveViewIds = (state, newItems) => {
|
|
2681
|
+
const {
|
|
2682
|
+
activityBarItems,
|
|
2683
|
+
selectedIndex
|
|
2684
|
+
} = state;
|
|
2685
|
+
const activeViewIds = getActiveViewIds(activityBarItems);
|
|
2686
|
+
if (activeViewIds.length > 0 || selectedIndex === -1) {
|
|
2687
|
+
return activeViewIds;
|
|
2688
|
+
}
|
|
2689
|
+
const selectedItem = activityBarItems[selectedIndex] || newItems[selectedIndex];
|
|
2690
|
+
return selectedItem ? [selectedItem.id] : [];
|
|
2691
|
+
};
|
|
2692
|
+
|
|
2636
2693
|
const handleExtensionsChanged = async state => {
|
|
2637
2694
|
const {
|
|
2638
2695
|
height,
|
|
2639
2696
|
itemHeight,
|
|
2640
|
-
platform
|
|
2641
|
-
selectedIndex
|
|
2697
|
+
platform
|
|
2642
2698
|
} = state;
|
|
2643
2699
|
const contributedViews = await getContributedViews(platform);
|
|
2644
2700
|
const items = getActivityBarItems(state, contributedViews);
|
|
2645
|
-
const
|
|
2701
|
+
const activeViewIds = resolveActiveViewIds(state, items);
|
|
2702
|
+
const itemsWithSelected = markActiveViews(items, activeViewIds);
|
|
2646
2703
|
const activityBarItems = await updateItemsWithBadgeCount(itemsWithSelected);
|
|
2647
2704
|
const filteredItems = getFilteredActivityBarItems(activityBarItems, height, itemHeight);
|
|
2648
2705
|
return {
|
|
@@ -2674,6 +2731,31 @@ const handleFocus = state => {
|
|
|
2674
2731
|
};
|
|
2675
2732
|
};
|
|
2676
2733
|
|
|
2734
|
+
const state = {
|
|
2735
|
+
connected: false
|
|
2736
|
+
};
|
|
2737
|
+
const isConnected = () => {
|
|
2738
|
+
const {
|
|
2739
|
+
connected
|
|
2740
|
+
} = state;
|
|
2741
|
+
return connected;
|
|
2742
|
+
};
|
|
2743
|
+
const invoke = (method, ...params) => {
|
|
2744
|
+
return invoke$2(method, ...params);
|
|
2745
|
+
};
|
|
2746
|
+
const set = rpc => {
|
|
2747
|
+
set$2(rpc);
|
|
2748
|
+
state.connected = true;
|
|
2749
|
+
};
|
|
2750
|
+
|
|
2751
|
+
const handleMessagePort = async port => {
|
|
2752
|
+
const rpc = await create$4({
|
|
2753
|
+
commandMap: {},
|
|
2754
|
+
messagePort: port
|
|
2755
|
+
});
|
|
2756
|
+
set(rpc);
|
|
2757
|
+
};
|
|
2758
|
+
|
|
2677
2759
|
const handleResize = (state, dimensions) => {
|
|
2678
2760
|
const {
|
|
2679
2761
|
activityBarItems,
|
|
@@ -2698,7 +2780,7 @@ const handleResize = (state, dimensions) => {
|
|
|
2698
2780
|
|
|
2699
2781
|
const getAccountEnabled = async defaultValue => {
|
|
2700
2782
|
try {
|
|
2701
|
-
const value = await invoke('Preferences.get', 'activityBar.accountEnabled');
|
|
2783
|
+
const value = await invoke$1('Preferences.get', 'activityBar.accountEnabled');
|
|
2702
2784
|
return typeof value === 'boolean' ? value : defaultValue;
|
|
2703
2785
|
} catch {
|
|
2704
2786
|
return defaultValue;
|
|
@@ -2710,8 +2792,7 @@ const handleSettingsChanged = async state => {
|
|
|
2710
2792
|
accountEnabled: currentAccountEnabled,
|
|
2711
2793
|
height,
|
|
2712
2794
|
itemHeight,
|
|
2713
|
-
platform
|
|
2714
|
-
selectedIndex
|
|
2795
|
+
platform
|
|
2715
2796
|
} = state;
|
|
2716
2797
|
const [accountEnabled, contributedViews, sidebarLocation] = await Promise.all([getAccountEnabled(currentAccountEnabled), getContributedViews(platform), getSideBarPosition()]);
|
|
2717
2798
|
const newState = {
|
|
@@ -2719,7 +2800,8 @@ const handleSettingsChanged = async state => {
|
|
|
2719
2800
|
accountEnabled
|
|
2720
2801
|
};
|
|
2721
2802
|
const items = getActivityBarItems(newState, contributedViews);
|
|
2722
|
-
const
|
|
2803
|
+
const activeViewIds = resolveActiveViewIds(state, items);
|
|
2804
|
+
const itemsWithSelected = markActiveViews(items, activeViewIds);
|
|
2723
2805
|
const activityBarItems = await updateItemsWithBadgeCount(itemsWithSelected);
|
|
2724
2806
|
const filteredItems = getFilteredActivityBarItems(activityBarItems, height, itemHeight);
|
|
2725
2807
|
return {
|
|
@@ -2732,16 +2814,15 @@ const handleSettingsChanged = async state => {
|
|
|
2732
2814
|
|
|
2733
2815
|
const getSideBarVisible = async () => {
|
|
2734
2816
|
try {
|
|
2735
|
-
const visible = await invoke('Layout.getSideBarVisible');
|
|
2817
|
+
const visible = await invoke$1('Layout.getSideBarVisible');
|
|
2736
2818
|
return visible;
|
|
2737
2819
|
} catch {
|
|
2738
2820
|
return true;
|
|
2739
2821
|
}
|
|
2740
2822
|
};
|
|
2741
2823
|
|
|
2742
|
-
const
|
|
2743
|
-
|
|
2744
|
-
return setFlag(withoutSelected, Focused, false);
|
|
2824
|
+
const clearFocus = item => {
|
|
2825
|
+
return setFlag(item, Focused, false);
|
|
2745
2826
|
};
|
|
2746
2827
|
const enableReferencesItem = (items, id) => {
|
|
2747
2828
|
if (id !== References) {
|
|
@@ -2757,10 +2838,12 @@ const handleSideBarStateChange = async (state, id, sideBarVisibleOverride) => {
|
|
|
2757
2838
|
height,
|
|
2758
2839
|
itemHeight
|
|
2759
2840
|
} = state;
|
|
2841
|
+
const activeViewIds = getActiveViewIds(activityBarItems);
|
|
2760
2842
|
const resolvedId = id === undefined ? currentViewletId : id;
|
|
2761
2843
|
const sideBarVisible = typeof sideBarVisibleOverride === 'boolean' ? sideBarVisibleOverride : await getSideBarVisible();
|
|
2844
|
+
const withoutCurrentSideBarView = activeViewIds.filter(activeViewId => activeViewId !== currentViewletId && activeViewId !== resolvedId);
|
|
2762
2845
|
if (!sideBarVisible) {
|
|
2763
|
-
const itemsCleared = activityBarItems.map(
|
|
2846
|
+
const itemsCleared = markActiveViews(activityBarItems.map(clearFocus), withoutCurrentSideBarView);
|
|
2764
2847
|
const filteredItems = getFilteredActivityBarItems(itemsCleared, height, itemHeight);
|
|
2765
2848
|
return {
|
|
2766
2849
|
...state,
|
|
@@ -2773,7 +2856,8 @@ const handleSideBarStateChange = async (state, id, sideBarVisibleOverride) => {
|
|
|
2773
2856
|
}
|
|
2774
2857
|
const enabledItems = enableReferencesItem(activityBarItems, resolvedId);
|
|
2775
2858
|
const selectedIndex = findIndex(enabledItems, resolvedId);
|
|
2776
|
-
const
|
|
2859
|
+
const newActiveViewIds = selectedIndex === -1 ? withoutCurrentSideBarView : [...withoutCurrentSideBarView, resolvedId];
|
|
2860
|
+
const newActivityBarItems = markActiveViews(enabledItems, newActiveViewIds);
|
|
2777
2861
|
const filteredItems = getFilteredActivityBarItems(newActivityBarItems, height, itemHeight);
|
|
2778
2862
|
return {
|
|
2779
2863
|
...state,
|
|
@@ -2826,7 +2910,7 @@ const handleUpdateStateChange = async (state, config) => {
|
|
|
2826
2910
|
|
|
2827
2911
|
const getActiveView = async () => {
|
|
2828
2912
|
try {
|
|
2829
|
-
const activeView = await invoke('Layout.getActiveSideBarView');
|
|
2913
|
+
const activeView = await invoke$1('Layout.getActiveSideBarView');
|
|
2830
2914
|
return activeView;
|
|
2831
2915
|
} catch {
|
|
2832
2916
|
return Explorer;
|
|
@@ -2865,13 +2949,14 @@ const loadContent = async state => {
|
|
|
2865
2949
|
const items = getActivityBarItems(newState, contributedViews);
|
|
2866
2950
|
const index = items.findIndex(item => item.id === activeView);
|
|
2867
2951
|
const selectedIndex = sideBarVisible ? index : -1;
|
|
2868
|
-
const
|
|
2952
|
+
const activeViewIds = sideBarVisible && index !== -1 ? [activeView] : [];
|
|
2953
|
+
const itemsWithSelected = markActiveViews(items, activeViewIds);
|
|
2869
2954
|
const activityBarItems = await updateItemsWithBadgeCount(itemsWithSelected);
|
|
2870
2955
|
const filteredItems = getFilteredActivityBarItems(activityBarItems, height, itemHeight);
|
|
2871
2956
|
return {
|
|
2872
2957
|
...newState,
|
|
2873
2958
|
activityBarItems,
|
|
2874
|
-
currentViewletId: Explorer,
|
|
2959
|
+
currentViewletId: activeView || Explorer,
|
|
2875
2960
|
filteredItems,
|
|
2876
2961
|
initial: false,
|
|
2877
2962
|
selectedIndex,
|
|
@@ -3494,14 +3579,23 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
3494
3579
|
return commands;
|
|
3495
3580
|
};
|
|
3496
3581
|
|
|
3582
|
+
const renderDirect = async (uid, commands) => {
|
|
3583
|
+
const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
|
|
3584
|
+
const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
|
|
3585
|
+
const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
|
|
3586
|
+
return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
|
|
3587
|
+
};
|
|
3497
3588
|
const render2 = (uid, diffResult) => {
|
|
3498
3589
|
const {
|
|
3499
3590
|
newState,
|
|
3500
3591
|
oldState
|
|
3501
3592
|
} = get$2(uid);
|
|
3502
|
-
set$
|
|
3593
|
+
set$5(uid, newState, newState);
|
|
3503
3594
|
const commands = applyRender(oldState, newState, diffResult);
|
|
3504
|
-
|
|
3595
|
+
if (!isConnected()) {
|
|
3596
|
+
return commands;
|
|
3597
|
+
}
|
|
3598
|
+
return renderDirect(uid, commands);
|
|
3505
3599
|
};
|
|
3506
3600
|
|
|
3507
3601
|
const renderEventListeners = () => {
|
|
@@ -3627,15 +3721,15 @@ const selectCurrent = async state => {
|
|
|
3627
3721
|
const setAccountEnabled = (state, enabled) => {
|
|
3628
3722
|
const {
|
|
3629
3723
|
height,
|
|
3630
|
-
itemHeight
|
|
3631
|
-
selectedIndex
|
|
3724
|
+
itemHeight
|
|
3632
3725
|
} = state;
|
|
3633
3726
|
const newState = {
|
|
3634
3727
|
...state,
|
|
3635
3728
|
accountEnabled: enabled
|
|
3636
3729
|
};
|
|
3637
3730
|
const newActivityBarItems = getActivityBarItems(newState);
|
|
3638
|
-
const
|
|
3731
|
+
const activeViewIds = resolveActiveViewIds(state, newActivityBarItems);
|
|
3732
|
+
const markedItems = markActiveViews(newActivityBarItems, activeViewIds);
|
|
3639
3733
|
const filteredItems = getFilteredActivityBarItems(markedItems, height, itemHeight);
|
|
3640
3734
|
return {
|
|
3641
3735
|
...newState,
|
|
@@ -3709,7 +3803,7 @@ const toggleActivityBarItem = async (state, itemId) => {
|
|
|
3709
3803
|
};
|
|
3710
3804
|
|
|
3711
3805
|
const wakeUp = sleepState => {
|
|
3712
|
-
set$
|
|
3806
|
+
set$5(sleepState.uid, sleepState, sleepState);
|
|
3713
3807
|
};
|
|
3714
3808
|
|
|
3715
3809
|
const commandMap = {
|
|
@@ -3726,6 +3820,7 @@ const commandMap = {
|
|
|
3726
3820
|
'ActivityBar.getKeyBindings': getKeyBindings,
|
|
3727
3821
|
'ActivityBar.getMenuEntries': wrapGetter(getMenuEntries),
|
|
3728
3822
|
'ActivityBar.getMenuEntryIds': getMenuEntryIds,
|
|
3823
|
+
'ActivityBar.handleActiveViewStateChange': wrapCommand(handleActiveViewStateChange),
|
|
3729
3824
|
'ActivityBar.handleBadgeCountChange': wrapCommand(handleBadgeCountChange),
|
|
3730
3825
|
'ActivityBar.handleBlur': wrapCommand(handleBlur),
|
|
3731
3826
|
'ActivityBar.handleClick': wrapCommand(handleClick),
|
|
@@ -3740,6 +3835,7 @@ const commandMap = {
|
|
|
3740
3835
|
'ActivityBar.handleExtensionManagementMessagePort': handleExtensionManagementMessagePort,
|
|
3741
3836
|
'ActivityBar.handleExtensionsChanged': wrapCommand(handleExtensionsChanged),
|
|
3742
3837
|
'ActivityBar.handleFocus': wrapCommand(handleFocus),
|
|
3838
|
+
'ActivityBar.handleMessagePort': handleMessagePort,
|
|
3743
3839
|
'ActivityBar.handleSettingsChanged': wrapCommand(handleSettingsChanged),
|
|
3744
3840
|
'ActivityBar.handleSideBarStateChange': wrapCommand(handleSideBarStateChange),
|
|
3745
3841
|
'ActivityBar.handleUpdateStateChange': wrapCommand(handleUpdateStateChange),
|
|
@@ -3766,14 +3862,14 @@ const initializeExtensionManagementWorker = async () => {
|
|
|
3766
3862
|
commandMap: {},
|
|
3767
3863
|
send
|
|
3768
3864
|
});
|
|
3769
|
-
set$
|
|
3865
|
+
set$3(rpc);
|
|
3770
3866
|
};
|
|
3771
3867
|
|
|
3772
3868
|
const initializeRendererWorker = async () => {
|
|
3773
3869
|
const rpc = await create$1({
|
|
3774
3870
|
commandMap: commandMap
|
|
3775
3871
|
});
|
|
3776
|
-
set(rpc);
|
|
3872
|
+
set$1(rpc);
|
|
3777
3873
|
};
|
|
3778
3874
|
|
|
3779
3875
|
const listen = async () => {
|