@lvce-editor/status-bar-worker 3.30.4 → 3.31.1
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/statusBarWorkerMain.js +31 -5
- package/package.json +1 -1
|
@@ -1876,10 +1876,21 @@ const show2 = async (uid, menuId, x, y, args) => {
|
|
|
1876
1876
|
await showContextMenu2(uid, menuId, x, y, args);
|
|
1877
1877
|
};
|
|
1878
1878
|
|
|
1879
|
+
const getStatusBarItemContextMenuItems = async (extensionId, providerId) => {
|
|
1880
|
+
try {
|
|
1881
|
+
return await invoke$3('Extensions.getStatusBarItemContextMenuItems', extensionId, providerId);
|
|
1882
|
+
} catch {
|
|
1883
|
+
return [];
|
|
1884
|
+
}
|
|
1885
|
+
};
|
|
1886
|
+
|
|
1879
1887
|
const StatusBar = 31;
|
|
1880
1888
|
|
|
1881
|
-
const handleContextMenu = async (state, button, x, y) => {
|
|
1889
|
+
const handleContextMenu = async (state, button, x, y, targetName = '') => {
|
|
1890
|
+
const item = [...state.statusBarItemsLeft, ...state.statusBarItemsRight].find(statusBarItem => statusBarItem.name === targetName);
|
|
1891
|
+
const contextMenuItems = item?.extensionId && item.providerId ? await getStatusBarItemContextMenuItems(item.extensionId, item.providerId) : [];
|
|
1882
1892
|
await show2(state.uid, StatusBar, x, y, {
|
|
1893
|
+
contextMenuItems,
|
|
1883
1894
|
menuId: StatusBar
|
|
1884
1895
|
});
|
|
1885
1896
|
return state;
|
|
@@ -2250,6 +2261,12 @@ const toStatusBarItem = uiStatusBarItem => {
|
|
|
2250
2261
|
command: uiStatusBarItem.command || undefined,
|
|
2251
2262
|
elements,
|
|
2252
2263
|
name: uiStatusBarItem.name,
|
|
2264
|
+
...(uiStatusBarItem.extensionId && {
|
|
2265
|
+
extensionId: uiStatusBarItem.extensionId
|
|
2266
|
+
}),
|
|
2267
|
+
...(uiStatusBarItem.providerId && {
|
|
2268
|
+
providerId: uiStatusBarItem.providerId
|
|
2269
|
+
}),
|
|
2253
2270
|
tooltip
|
|
2254
2271
|
};
|
|
2255
2272
|
};
|
|
@@ -2266,6 +2283,12 @@ const toUiStatusBarItem = extensionStatusBarItem => {
|
|
|
2266
2283
|
command: extensionStatusBarItem.onClick || extensionStatusBarItem.command || '',
|
|
2267
2284
|
icon: getActualIcon(extensionStatusBarItem),
|
|
2268
2285
|
name: extensionStatusBarItem.id || extensionStatusBarItem.name || '',
|
|
2286
|
+
...(extensionStatusBarItem.extensionId && {
|
|
2287
|
+
extensionId: extensionStatusBarItem.extensionId
|
|
2288
|
+
}),
|
|
2289
|
+
...(extensionStatusBarItem.providerId && {
|
|
2290
|
+
providerId: extensionStatusBarItem.providerId
|
|
2291
|
+
}),
|
|
2269
2292
|
...(extensionStatusBarItem.spinning === true && {
|
|
2270
2293
|
spinning: true
|
|
2271
2294
|
}),
|
|
@@ -2359,9 +2382,12 @@ const handleExtensionManagementChange = async () => {
|
|
|
2359
2382
|
if (newState === newerState || oldState === newerState) {
|
|
2360
2383
|
continue;
|
|
2361
2384
|
}
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2385
|
+
// Loading and other updates can finish while the provider query is pending.
|
|
2386
|
+
// Only replace the extension items; retain the current lifecycle and render baseline.
|
|
2387
|
+
const current = get$5(uid);
|
|
2388
|
+
set$6(uid, current.oldState, {
|
|
2389
|
+
...current.newState,
|
|
2390
|
+
statusBarItemsLeft: newerState.statusBarItemsLeft
|
|
2365
2391
|
});
|
|
2366
2392
|
await renderOutOfBand(uid);
|
|
2367
2393
|
}
|
|
@@ -2611,7 +2637,7 @@ const refreshExtensionItems = wrapSerialAsyncCommand(async context => {
|
|
|
2611
2637
|
const renderEventListeners = () => {
|
|
2612
2638
|
return [{
|
|
2613
2639
|
name: HandleContextMenu,
|
|
2614
|
-
params: ['handleContextMenu', Button, ClientX, ClientY],
|
|
2640
|
+
params: ['handleContextMenu', Button, ClientX, ClientY, TargetName],
|
|
2615
2641
|
preventDefault: true
|
|
2616
2642
|
}, {
|
|
2617
2643
|
name: HandleClick,
|