@lvce-editor/running-extensions-view 1.13.1 → 1.15.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.
@@ -1117,7 +1117,7 @@ const createMockRpc = ({
1117
1117
  };
1118
1118
 
1119
1119
  const rpcs = Object.create(null);
1120
- const set$5 = (id, rpc) => {
1120
+ const set$6 = (id, rpc) => {
1121
1121
  rpcs[id] = rpc;
1122
1122
  };
1123
1123
  const get$1 = id => {
@@ -1150,7 +1150,7 @@ const create$2 = rpcId => {
1150
1150
  const mockRpc = createMockRpc({
1151
1151
  commandMap
1152
1152
  });
1153
- set$5(rpcId, mockRpc);
1153
+ set$6(rpcId, mockRpc);
1154
1154
  // @ts-ignore
1155
1155
  mockRpc[Symbol.dispose] = () => {
1156
1156
  remove(rpcId);
@@ -1159,7 +1159,7 @@ const create$2 = rpcId => {
1159
1159
  return mockRpc;
1160
1160
  },
1161
1161
  set(rpc) {
1162
- set$5(rpcId, rpc);
1162
+ set$6(rpcId, rpc);
1163
1163
  }
1164
1164
  };
1165
1165
  };
@@ -1342,6 +1342,7 @@ const None$1 = 0;
1342
1342
  const Electron = 2;
1343
1343
 
1344
1344
  const ClipBoardWorker = 3400;
1345
+ const DialogWorker = 7014;
1345
1346
  const ExtensionManagementWorker = 9006;
1346
1347
  const MainProcess = -5;
1347
1348
  const RendererWorker = 1;
@@ -1351,13 +1352,18 @@ const SetDom2 = 'Viewlet.setDom2';
1351
1352
  const SetPatches = 'Viewlet.setPatches';
1352
1353
 
1353
1354
  const {
1354
- invoke: invoke$3,
1355
- set: set$4
1355
+ invoke: invoke$4,
1356
+ set: set$5
1356
1357
  } = create$2(ClipBoardWorker);
1357
1358
  const writeText = async text => {
1358
- return invoke$3('ClipBoard.writeText', text);
1359
+ return invoke$4('ClipBoard.writeText', text);
1359
1360
  };
1360
1361
 
1362
+ const {
1363
+ invoke: invoke$3,
1364
+ set: set$4
1365
+ } = create$2(DialogWorker);
1366
+
1361
1367
  const {
1362
1368
  invoke: invoke$2,
1363
1369
  set: set$3
@@ -1387,9 +1393,9 @@ const sendMessagePortToClipBoardWorker = async (port, rpcId) => {
1387
1393
  const command = 'ClipBoard.handleMessagePort';
1388
1394
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToClipBoardWorker', port, command, rpcId);
1389
1395
  };
1390
- const confirm = async (message, options) => {
1391
- const result = await invoke('ConfirmPrompt.prompt', message, options);
1392
- return result;
1396
+ const sendMessagePortToDialogWorker = async port => {
1397
+ const command = 'HandleMessagePort.handleMessagePort';
1398
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker', port, command);
1393
1399
  };
1394
1400
  const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
1395
1401
  const command = 'Extensions.handleMessagePort';
@@ -1749,6 +1755,7 @@ const ActivationTime = 'Activation: {PH1}ms';
1749
1755
  const CopyId = 'Copy id ({PH1})';
1750
1756
  const Disable = 'Disable';
1751
1757
  const DisableWorkspace = 'Disable (Workspace)';
1758
+ const ErrorStatus = 'Error: {PH1}';
1752
1759
  const ExtensionApiElectron = 'Extension API (Electron): {PH1}';
1753
1760
  const ExtensionHostProfilingNotAvailable = 'Extension host profiling is not available yet.';
1754
1761
  const LoadingRunningExtensions = 'Loading running extensions…';
@@ -1758,6 +1765,7 @@ const ReportingIssuesNotSupported = 'Reporting issues is not supported for this
1758
1765
  const Ssh = 'SSH: {PH1}';
1759
1766
  const StartExtensionHostProfile = 'Start Extension Host Profile';
1760
1767
  const TakeHeapSnapshot = 'Take Heap Snapshot';
1768
+ const TerminatedStatus = 'Terminated: {PH1}';
1761
1769
 
1762
1770
  const activationReason = reason => {
1763
1771
  return i18nString(ActivationReason, {
@@ -1780,6 +1788,11 @@ const disable = () => {
1780
1788
  const disableWorkspace = () => {
1781
1789
  return i18nString(DisableWorkspace);
1782
1790
  };
1791
+ const errorStatus = message => {
1792
+ return i18nString(ErrorStatus, {
1793
+ PH1: message
1794
+ });
1795
+ };
1783
1796
  const extensionApiElectron = id => {
1784
1797
  return i18nString(ExtensionApiElectron, {
1785
1798
  PH1: id
@@ -1811,6 +1824,11 @@ const startExtensionHostProfile = () => {
1811
1824
  const takeHeapSnapshot$1 = () => {
1812
1825
  return i18nString(TakeHeapSnapshot);
1813
1826
  };
1827
+ const terminatedStatus = message => {
1828
+ return i18nString(TerminatedStatus, {
1829
+ PH1: message
1830
+ });
1831
+ };
1814
1832
 
1815
1833
  const getMenuEntries = state => {
1816
1834
  const {
@@ -1888,11 +1906,19 @@ const handleBlur = state => {
1888
1906
  };
1889
1907
  };
1890
1908
 
1891
- const handleClickAt = (state, index) => {
1909
+ const getIndex = (state, eventY) => {
1910
+ const {
1911
+ itemHeight,
1912
+ y
1913
+ } = state;
1914
+ return Math.floor((eventY - y) / itemHeight);
1915
+ };
1916
+
1917
+ const handleClickAt = (state, eventY) => {
1892
1918
  const {
1893
1919
  extensions
1894
1920
  } = state;
1895
- const selectedIndex = Number(index);
1921
+ const selectedIndex = getIndex(state, eventY);
1896
1922
  return {
1897
1923
  ...state,
1898
1924
  focusOutline: false,
@@ -1904,12 +1930,12 @@ const show = async (uid, menuId, x, y, args) => {
1904
1930
  await showContextMenu2(uid, menuId, x, y, args);
1905
1931
  };
1906
1932
 
1907
- const handleContextMenu = async (state, index, x = 0, y = 0) => {
1933
+ const handleContextMenu = async (state, eventX, eventY) => {
1908
1934
  const {
1909
1935
  extensions,
1910
1936
  uid
1911
1937
  } = state;
1912
- const focusedIndex = Number(index);
1938
+ const focusedIndex = getIndex(state, eventY);
1913
1939
  if (!extensions[focusedIndex]) {
1914
1940
  return state;
1915
1941
  }
@@ -1919,7 +1945,7 @@ const handleContextMenu = async (state, index, x = 0, y = 0) => {
1919
1945
  focusOutline: true
1920
1946
  };
1921
1947
  set(uid, state, newState);
1922
- await show(uid, RunningExtensions$1, x, y, {
1948
+ await show(uid, RunningExtensions$1, eventX, eventY, {
1923
1949
  menuId: RunningExtensions$1
1924
1950
  });
1925
1951
  return newState;
@@ -2248,6 +2274,9 @@ const RunningExtensionIcon = 'RunningExtensionIcon';
2248
2274
  const RunningExtensionId = 'RunningExtensionId';
2249
2275
  const RunningExtensionName = 'RunningExtensionName';
2250
2276
  const RunningExtensionRemoteAuthority = 'RunningExtensionRemoteAuthority';
2277
+ const RunningExtensionStatus = 'RunningExtensionStatus';
2278
+ const RunningExtensionStatusError = 'RunningExtensionStatusError';
2279
+ const RunningExtensionStatusTerminated = 'RunningExtensionStatusTerminated';
2251
2280
  const RunningExtensions = 'RunningExtensions';
2252
2281
  const RunningExtensionsEmpty = 'RunningExtensionsEmpty';
2253
2282
  const RunningExtensionTitle = 'RunningExtensionTitle';
@@ -2257,12 +2286,11 @@ const HandleContextMenu = 3;
2257
2286
  const HandleClick = 4;
2258
2287
  const HandleBlur = 5;
2259
2288
 
2260
- const getIconVirtualDom = (extension, index) => {
2289
+ const getIconVirtualDom = extension => {
2261
2290
  if (extension.icon) {
2262
2291
  return [{
2263
2292
  childCount: 0,
2264
2293
  className: RunningExtensionIcon,
2265
- 'data-index': index,
2266
2294
  src: extension.icon,
2267
2295
  type: Img
2268
2296
  }];
@@ -2270,25 +2298,68 @@ const getIconVirtualDom = (extension, index) => {
2270
2298
  return [{
2271
2299
  childCount: 0,
2272
2300
  className: mergeClassNames(RunningExtensionIcon, RunningExtensionDefaultIcon, MaskIcon, MaskIconExtensions),
2273
- 'data-index': index,
2274
2301
  role: None,
2275
2302
  type: Div
2276
2303
  }];
2277
2304
  };
2278
2305
 
2279
2306
  const sshRemotePrefix = 'ssh-remote+';
2280
- const getActivationReasonVirtualDom = (activationEvent, index) => {
2307
+ const activationReasonNode = {
2308
+ childCount: 1,
2309
+ className: RunningExtensionActivationReason,
2310
+ type: Div
2311
+ };
2312
+ const titleNode = {
2313
+ childCount: 2,
2314
+ className: RunningExtensionTitle,
2315
+ type: Div
2316
+ };
2317
+ const nameNode = {
2318
+ childCount: 1,
2319
+ className: RunningExtensionName,
2320
+ type: Strong
2321
+ };
2322
+ const versionNode = {
2323
+ childCount: 1,
2324
+ className: RunningExtensionVersion,
2325
+ type: Span
2326
+ };
2327
+ const idNode = {
2328
+ childCount: 1,
2329
+ className: RunningExtensionId,
2330
+ type: Div
2331
+ };
2332
+ const activationTimeNode = {
2333
+ childCount: 1,
2334
+ className: RunningExtensionActivationTime,
2335
+ type: Div
2336
+ };
2337
+ const errorStatusNode = {
2338
+ childCount: 1,
2339
+ className: mergeClassNames(RunningExtensionStatus, RunningExtensionStatusError),
2340
+ type: Div
2341
+ };
2342
+ const terminatedStatusNode = {
2343
+ childCount: 1,
2344
+ className: mergeClassNames(RunningExtensionStatus, RunningExtensionStatusTerminated),
2345
+ type: Div
2346
+ };
2347
+ const getStatusVirtualDom = extension => {
2348
+ if (extension.status === 'error') {
2349
+ return [errorStatusNode, text(errorStatus(extension.error || 'Activation failed'))];
2350
+ }
2351
+ if (extension.status === 'terminated') {
2352
+ return [terminatedStatusNode, text(terminatedStatus(extension.error || 'Extension worker stopped'))];
2353
+ }
2354
+ return [activationTimeNode, text(activationTime(Math.round(extension.activationTime)))];
2355
+ };
2356
+ const getActivationReasonVirtualDom = activationEvent => {
2281
2357
  if (!activationEvent) {
2282
2358
  return [];
2283
2359
  }
2284
- return [{
2285
- childCount: 1,
2286
- className: RunningExtensionActivationReason,
2287
- 'data-index': index,
2288
- type: Div
2289
- }, text(activationReason(activationEvent))];
2360
+ return [activationReasonNode, text(activationReason(activationEvent))];
2290
2361
  };
2291
- const getRemoteAuthorityVirtualDom = (remoteAuthority, index) => {
2362
+ const getRemoteAuthorityVirtualDom = remoteAuthority => {
2292
2363
  if (!remoteAuthority) {
2293
2364
  return [];
2294
2365
  }
@@ -2296,7 +2367,6 @@ const getRemoteAuthorityVirtualDom = (remoteAuthority, index) => {
2296
2367
  return [{
2297
2368
  childCount: 1,
2298
2369
  className: mergeClassNames(RunningExtensionId, RunningExtensionRemoteAuthority),
2299
- 'data-index': index,
2300
2370
  type: Div
2301
2371
  }, text(ssh(host))];
2302
2372
  };
@@ -2310,53 +2380,27 @@ const getClassName = (focused, selected) => {
2310
2380
  }
2311
2381
  return className;
2312
2382
  };
2313
- const getExtensionVirtualDom = (extension, index, focused = false, selected = false) => {
2314
- const displayName = extension.name || extension.id;
2315
- const activationReasonDom = getActivationReasonVirtualDom(extension.activationEvent, index);
2316
- const remoteAuthorityDom = getRemoteAuthorityVirtualDom(extension.remoteAuthority, index);
2383
+ const getExtensionVirtualDom = (extension, focused = false, selected = false) => {
2384
+ const displayName = typeof extension.name === 'string' && extension.name ? extension.name : extension.id;
2385
+ const displayVersion = typeof extension.version === 'string' ? extension.version : '';
2386
+ const activationReasonDom = getActivationReasonVirtualDom(extension.activationEvent);
2387
+ const statusDom = getStatusVirtualDom(extension);
2388
+ const remoteAuthorityDom = getRemoteAuthorityVirtualDom(extension.remoteAuthority);
2317
2389
  const className = getClassName(focused, selected);
2318
2390
  return [{
2319
2391
  childCount: 3,
2320
2392
  className,
2321
- 'data-index': index,
2322
2393
  role: ListItem,
2323
2394
  type: Div
2324
- }, ...getIconVirtualDom(extension, index), {
2395
+ }, ...getIconVirtualDom(extension), {
2325
2396
  childCount: remoteAuthorityDom.length > 0 ? 3 : 2,
2326
2397
  className: RunningExtensionDetails,
2327
- 'data-index': index,
2328
- type: Div
2329
- }, {
2330
- childCount: 2,
2331
- className: RunningExtensionTitle,
2332
- 'data-index': index,
2333
2398
  type: Div
2334
- }, {
2335
- childCount: 1,
2336
- className: RunningExtensionName,
2337
- 'data-index': index,
2338
- type: Strong
2339
- }, text(displayName), {
2340
- childCount: 1,
2341
- className: RunningExtensionVersion,
2342
- 'data-index': index,
2343
- type: Span
2344
- }, text(extension.version), ...remoteAuthorityDom, {
2345
- childCount: 1,
2346
- className: RunningExtensionId,
2347
- 'data-index': index,
2348
- type: Div
2349
- }, text(extension.id), {
2399
+ }, titleNode, nameNode, text(displayName), versionNode, text(displayVersion), ...remoteAuthorityDom, idNode, text(extension.id), {
2350
2400
  childCount: activationReasonDom.length > 0 ? 2 : 1,
2351
2401
  className: RunningExtensionActivationDetails,
2352
- 'data-index': index,
2353
- type: Div
2354
- }, {
2355
- childCount: 1,
2356
- className: RunningExtensionActivationTime,
2357
- 'data-index': index,
2358
2402
  type: Div
2359
- }, text(activationTime(Math.round(extension.activationTime))), ...activationReasonDom];
2403
+ }, ...statusDom, ...activationReasonDom];
2360
2404
  };
2361
2405
 
2362
2406
  const Focusable = 0;
@@ -2397,7 +2441,7 @@ const getRunningExtensionsVirtualDom = (extensions, loaded, focusedIndex = -1, s
2397
2441
  role: List,
2398
2442
  tabIndex: Focusable,
2399
2443
  type: Div
2400
- }, ...extensions.flatMap((extension, index) => getExtensionVirtualDom(extension, index, focusOutline && index === focusedIndex, index === selectedIndex))];
2444
+ }, ...extensions.flatMap((extension, index) => getExtensionVirtualDom(extension, focusOutline && index === focusedIndex, index === selectedIndex))];
2401
2445
  };
2402
2446
 
2403
2447
  const renderDom = (oldState, newState) => {
@@ -2435,11 +2479,11 @@ const render2 = (uid, diffResult) => {
2435
2479
  const renderEventListeners = () => {
2436
2480
  return [{
2437
2481
  name: HandleContextMenu,
2438
- params: ['handleContextMenu', 'event.target.dataset.index', ClientX, ClientY],
2482
+ params: ['handleContextMenu', ClientX, ClientY],
2439
2483
  preventDefault: true
2440
2484
  }, {
2441
2485
  name: HandleClick,
2442
- params: ['handleClickAt', 'event.target.dataset.index'],
2486
+ params: ['handleClickAt', ClientY],
2443
2487
  preventDefault: true
2444
2488
  }, {
2445
2489
  name: HandleBlur,
@@ -2496,7 +2540,7 @@ const reportIssue = async (state, index) => {
2496
2540
  } = state;
2497
2541
  const issuesUrl = getIssuesUrl(extensions[index]?.repository);
2498
2542
  if (!issuesUrl) {
2499
- await confirm(reportingIssuesNotSupported());
2543
+ await invoke$3('ConfirmPrompt.prompt', reportingIssuesNotSupported(), undefined);
2500
2544
  return state;
2501
2545
  }
2502
2546
  const cmd = getOpenCommand(platform);
@@ -2519,7 +2563,7 @@ const setExtensions = (state, extensions) => {
2519
2563
  };
2520
2564
 
2521
2565
  const startProfile = async state => {
2522
- await confirm(extensionHostProfilingNotAvailable());
2566
+ await invoke$3('ConfirmPrompt.prompt', extensionHostProfilingNotAvailable(), undefined);
2523
2567
  return state;
2524
2568
  };
2525
2569
 
@@ -2542,7 +2586,7 @@ const takeHeapSnapshot = async (state, index) => {
2542
2586
  await invoke('Main.openUri', uri);
2543
2587
  } catch (error) {
2544
2588
  const message = error instanceof Error ? error.message : String(error);
2545
- await confirm(message);
2589
+ await invoke$3('ConfirmPrompt.prompt', message, undefined);
2546
2590
  return state;
2547
2591
  }
2548
2592
  return state;
@@ -2579,7 +2623,7 @@ const initializeClipBoardWorker = async () => {
2579
2623
  commandMap: {},
2580
2624
  send: send$2
2581
2625
  });
2582
- set$4(rpc);
2626
+ set$5(rpc);
2583
2627
  };
2584
2628
 
2585
2629
  const send$1 = async port => {
@@ -2614,6 +2658,11 @@ const initializeRendererWorker = async () => {
2614
2658
  const listen = async () => {
2615
2659
  registerCommands(commandMap);
2616
2660
  await Promise.all([initializeRendererWorker(), initializeClipBoardWorker(), initializeExtensionManagementWorker(), initializeMainProcess()]);
2661
+ const dialogRpc = await create$4({
2662
+ commandMap: {},
2663
+ send: sendMessagePortToDialogWorker
2664
+ });
2665
+ set$4(dialogRpc);
2617
2666
  };
2618
2667
 
2619
2668
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/running-extensions-view",
3
- "version": "1.13.1",
3
+ "version": "1.15.0",
4
4
  "description": "Running Extensions View Worker",
5
5
  "repository": {
6
6
  "type": "git",