@lvce-editor/status-bar-worker 3.30.3 → 3.31.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.
@@ -1337,7 +1337,7 @@ const applyDirectProperties = (restoredError, error) => {
1337
1337
  }
1338
1338
  };
1339
1339
  const restoreMessageError = (error, _currentStack) => {
1340
- const restoredError = constructError(error.message, error.type, error.name);
1340
+ const restoredError = constructError(error.message, error.type || error.data?.type, error.name);
1341
1341
  if (typeof error.code === 'string' || typeof error.code === 'number') {
1342
1342
  Object.defineProperty(restoredError, 'code', {
1343
1343
  configurable: true,
@@ -1425,7 +1425,7 @@ const getErrorProperty = (error, prettyError) => {
1425
1425
  data: {
1426
1426
  code: prettyError.code ?? error?.code,
1427
1427
  codeFrame: prettyError.codeFrame,
1428
- name: prettyError.name,
1428
+ name: prettyError.name ?? error?.name,
1429
1429
  stack: getStack(prettyError),
1430
1430
  type: getErrorType(prettyError)
1431
1431
  },
@@ -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
  }),
@@ -2319,6 +2342,7 @@ const handleExtensionsChanged = async state => {
2319
2342
  assetDir,
2320
2343
  errorCount,
2321
2344
  platform,
2345
+ statusBarItemsLeft,
2322
2346
  uid,
2323
2347
  warningCount
2324
2348
  } = state;
@@ -2337,9 +2361,10 @@ const handleExtensionsChanged = async state => {
2337
2361
  if (refreshVersions[uid] !== refreshVersion) {
2338
2362
  return state;
2339
2363
  }
2364
+ const builtinProblemsItem = statusBarItemsLeft.find(item => item.name === Problems);
2340
2365
  return {
2341
2366
  ...state,
2342
- statusBarItemsLeft: [...statusBarItems]
2367
+ statusBarItemsLeft: builtinProblemsItem ? [...statusBarItems, builtinProblemsItem] : [...statusBarItems]
2343
2368
  };
2344
2369
  };
2345
2370
 
@@ -2609,7 +2634,7 @@ const refreshExtensionItems = wrapSerialAsyncCommand(async context => {
2609
2634
  const renderEventListeners = () => {
2610
2635
  return [{
2611
2636
  name: HandleContextMenu,
2612
- params: ['handleContextMenu', Button, ClientX, ClientY],
2637
+ params: ['handleContextMenu', Button, ClientX, ClientY, TargetName],
2613
2638
  preventDefault: true
2614
2639
  }, {
2615
2640
  name: HandleClick,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/status-bar-worker",
3
- "version": "3.30.3",
3
+ "version": "3.31.0",
4
4
  "description": "Status Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",