@lvce-editor/running-extensions-view 1.14.0 → 1.16.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/runningExtensionsViewMain.js +115 -57
- package/package.json +1 -1
|
@@ -1755,6 +1755,7 @@ const ActivationTime = 'Activation: {PH1}ms';
|
|
|
1755
1755
|
const CopyId = 'Copy id ({PH1})';
|
|
1756
1756
|
const Disable = 'Disable';
|
|
1757
1757
|
const DisableWorkspace = 'Disable (Workspace)';
|
|
1758
|
+
const ErrorStatus = 'Error: {PH1}';
|
|
1758
1759
|
const ExtensionApiElectron = 'Extension API (Electron): {PH1}';
|
|
1759
1760
|
const ExtensionHostProfilingNotAvailable = 'Extension host profiling is not available yet.';
|
|
1760
1761
|
const LoadingRunningExtensions = 'Loading running extensions…';
|
|
@@ -1764,6 +1765,7 @@ const ReportingIssuesNotSupported = 'Reporting issues is not supported for this
|
|
|
1764
1765
|
const Ssh = 'SSH: {PH1}';
|
|
1765
1766
|
const StartExtensionHostProfile = 'Start Extension Host Profile';
|
|
1766
1767
|
const TakeHeapSnapshot = 'Take Heap Snapshot';
|
|
1768
|
+
const TerminatedStatus = 'Terminated: {PH1}';
|
|
1767
1769
|
|
|
1768
1770
|
const activationReason = reason => {
|
|
1769
1771
|
return i18nString(ActivationReason, {
|
|
@@ -1786,6 +1788,11 @@ const disable = () => {
|
|
|
1786
1788
|
const disableWorkspace = () => {
|
|
1787
1789
|
return i18nString(DisableWorkspace);
|
|
1788
1790
|
};
|
|
1791
|
+
const errorStatus = message => {
|
|
1792
|
+
return i18nString(ErrorStatus, {
|
|
1793
|
+
PH1: message
|
|
1794
|
+
});
|
|
1795
|
+
};
|
|
1789
1796
|
const extensionApiElectron = id => {
|
|
1790
1797
|
return i18nString(ExtensionApiElectron, {
|
|
1791
1798
|
PH1: id
|
|
@@ -1817,6 +1824,11 @@ const startExtensionHostProfile = () => {
|
|
|
1817
1824
|
const takeHeapSnapshot$1 = () => {
|
|
1818
1825
|
return i18nString(TakeHeapSnapshot);
|
|
1819
1826
|
};
|
|
1827
|
+
const terminatedStatus = message => {
|
|
1828
|
+
return i18nString(TerminatedStatus, {
|
|
1829
|
+
PH1: message
|
|
1830
|
+
});
|
|
1831
|
+
};
|
|
1820
1832
|
|
|
1821
1833
|
const getMenuEntries = state => {
|
|
1822
1834
|
const {
|
|
@@ -1864,6 +1876,7 @@ const getMenuEntries = state => {
|
|
|
1864
1876
|
id: 'separator2',
|
|
1865
1877
|
label: ''
|
|
1866
1878
|
}, {
|
|
1879
|
+
args,
|
|
1867
1880
|
command: 'RunningExtensions.startProfile',
|
|
1868
1881
|
flags: None$1,
|
|
1869
1882
|
id: 'startProfile',
|
|
@@ -1894,11 +1907,19 @@ const handleBlur = state => {
|
|
|
1894
1907
|
};
|
|
1895
1908
|
};
|
|
1896
1909
|
|
|
1897
|
-
const
|
|
1910
|
+
const getIndex = (state, eventY) => {
|
|
1911
|
+
const {
|
|
1912
|
+
itemHeight,
|
|
1913
|
+
y
|
|
1914
|
+
} = state;
|
|
1915
|
+
return Math.floor((eventY - y) / itemHeight);
|
|
1916
|
+
};
|
|
1917
|
+
|
|
1918
|
+
const handleClickAt = (state, eventY) => {
|
|
1898
1919
|
const {
|
|
1899
1920
|
extensions
|
|
1900
1921
|
} = state;
|
|
1901
|
-
const selectedIndex =
|
|
1922
|
+
const selectedIndex = getIndex(state, eventY);
|
|
1902
1923
|
return {
|
|
1903
1924
|
...state,
|
|
1904
1925
|
focusOutline: false,
|
|
@@ -1910,12 +1931,12 @@ const show = async (uid, menuId, x, y, args) => {
|
|
|
1910
1931
|
await showContextMenu2(uid, menuId, x, y, args);
|
|
1911
1932
|
};
|
|
1912
1933
|
|
|
1913
|
-
const handleContextMenu = async (state,
|
|
1934
|
+
const handleContextMenu = async (state, eventX, eventY) => {
|
|
1914
1935
|
const {
|
|
1915
1936
|
extensions,
|
|
1916
1937
|
uid
|
|
1917
1938
|
} = state;
|
|
1918
|
-
const focusedIndex =
|
|
1939
|
+
const focusedIndex = getIndex(state, eventY);
|
|
1919
1940
|
if (!extensions[focusedIndex]) {
|
|
1920
1941
|
return state;
|
|
1921
1942
|
}
|
|
@@ -1925,7 +1946,7 @@ const handleContextMenu = async (state, index, x = 0, y = 0) => {
|
|
|
1925
1946
|
focusOutline: true
|
|
1926
1947
|
};
|
|
1927
1948
|
set(uid, state, newState);
|
|
1928
|
-
await show(uid, RunningExtensions$1,
|
|
1949
|
+
await show(uid, RunningExtensions$1, eventX, eventY, {
|
|
1929
1950
|
menuId: RunningExtensions$1
|
|
1930
1951
|
});
|
|
1931
1952
|
return newState;
|
|
@@ -2254,6 +2275,9 @@ const RunningExtensionIcon = 'RunningExtensionIcon';
|
|
|
2254
2275
|
const RunningExtensionId = 'RunningExtensionId';
|
|
2255
2276
|
const RunningExtensionName = 'RunningExtensionName';
|
|
2256
2277
|
const RunningExtensionRemoteAuthority = 'RunningExtensionRemoteAuthority';
|
|
2278
|
+
const RunningExtensionStatus = 'RunningExtensionStatus';
|
|
2279
|
+
const RunningExtensionStatusError = 'RunningExtensionStatusError';
|
|
2280
|
+
const RunningExtensionStatusTerminated = 'RunningExtensionStatusTerminated';
|
|
2257
2281
|
const RunningExtensions = 'RunningExtensions';
|
|
2258
2282
|
const RunningExtensionsEmpty = 'RunningExtensionsEmpty';
|
|
2259
2283
|
const RunningExtensionTitle = 'RunningExtensionTitle';
|
|
@@ -2263,12 +2287,11 @@ const HandleContextMenu = 3;
|
|
|
2263
2287
|
const HandleClick = 4;
|
|
2264
2288
|
const HandleBlur = 5;
|
|
2265
2289
|
|
|
2266
|
-
const getIconVirtualDom =
|
|
2290
|
+
const getIconVirtualDom = extension => {
|
|
2267
2291
|
if (extension.icon) {
|
|
2268
2292
|
return [{
|
|
2269
2293
|
childCount: 0,
|
|
2270
2294
|
className: RunningExtensionIcon,
|
|
2271
|
-
'data-index': index,
|
|
2272
2295
|
src: extension.icon,
|
|
2273
2296
|
type: Img
|
|
2274
2297
|
}];
|
|
@@ -2276,25 +2299,68 @@ const getIconVirtualDom = (extension, index) => {
|
|
|
2276
2299
|
return [{
|
|
2277
2300
|
childCount: 0,
|
|
2278
2301
|
className: mergeClassNames(RunningExtensionIcon, RunningExtensionDefaultIcon, MaskIcon, MaskIconExtensions),
|
|
2279
|
-
'data-index': index,
|
|
2280
2302
|
role: None,
|
|
2281
2303
|
type: Div
|
|
2282
2304
|
}];
|
|
2283
2305
|
};
|
|
2284
2306
|
|
|
2285
2307
|
const sshRemotePrefix = 'ssh-remote+';
|
|
2286
|
-
const
|
|
2308
|
+
const activationReasonNode = {
|
|
2309
|
+
childCount: 1,
|
|
2310
|
+
className: RunningExtensionActivationReason,
|
|
2311
|
+
type: Div
|
|
2312
|
+
};
|
|
2313
|
+
const titleNode = {
|
|
2314
|
+
childCount: 2,
|
|
2315
|
+
className: RunningExtensionTitle,
|
|
2316
|
+
type: Div
|
|
2317
|
+
};
|
|
2318
|
+
const nameNode = {
|
|
2319
|
+
childCount: 1,
|
|
2320
|
+
className: RunningExtensionName,
|
|
2321
|
+
type: Strong
|
|
2322
|
+
};
|
|
2323
|
+
const versionNode = {
|
|
2324
|
+
childCount: 1,
|
|
2325
|
+
className: RunningExtensionVersion,
|
|
2326
|
+
type: Span
|
|
2327
|
+
};
|
|
2328
|
+
const idNode = {
|
|
2329
|
+
childCount: 1,
|
|
2330
|
+
className: RunningExtensionId,
|
|
2331
|
+
type: Div
|
|
2332
|
+
};
|
|
2333
|
+
const activationTimeNode = {
|
|
2334
|
+
childCount: 1,
|
|
2335
|
+
className: RunningExtensionActivationTime,
|
|
2336
|
+
type: Div
|
|
2337
|
+
};
|
|
2338
|
+
const errorStatusNode = {
|
|
2339
|
+
childCount: 1,
|
|
2340
|
+
className: mergeClassNames(RunningExtensionStatus, RunningExtensionStatusError),
|
|
2341
|
+
type: Div
|
|
2342
|
+
};
|
|
2343
|
+
const terminatedStatusNode = {
|
|
2344
|
+
childCount: 1,
|
|
2345
|
+
className: mergeClassNames(RunningExtensionStatus, RunningExtensionStatusTerminated),
|
|
2346
|
+
type: Div
|
|
2347
|
+
};
|
|
2348
|
+
const getStatusVirtualDom = extension => {
|
|
2349
|
+
if (extension.status === 'error') {
|
|
2350
|
+
return [errorStatusNode, text(errorStatus(extension.error || 'Activation failed'))];
|
|
2351
|
+
}
|
|
2352
|
+
if (extension.status === 'terminated') {
|
|
2353
|
+
return [terminatedStatusNode, text(terminatedStatus(extension.error || 'Extension worker stopped'))];
|
|
2354
|
+
}
|
|
2355
|
+
return [activationTimeNode, text(activationTime(Math.round(extension.activationTime)))];
|
|
2356
|
+
};
|
|
2357
|
+
const getActivationReasonVirtualDom = activationEvent => {
|
|
2287
2358
|
if (!activationEvent) {
|
|
2288
2359
|
return [];
|
|
2289
2360
|
}
|
|
2290
|
-
return [
|
|
2291
|
-
childCount: 1,
|
|
2292
|
-
className: RunningExtensionActivationReason,
|
|
2293
|
-
'data-index': index,
|
|
2294
|
-
type: Div
|
|
2295
|
-
}, text(activationReason(activationEvent))];
|
|
2361
|
+
return [activationReasonNode, text(activationReason(activationEvent))];
|
|
2296
2362
|
};
|
|
2297
|
-
const getRemoteAuthorityVirtualDom =
|
|
2363
|
+
const getRemoteAuthorityVirtualDom = remoteAuthority => {
|
|
2298
2364
|
if (!remoteAuthority) {
|
|
2299
2365
|
return [];
|
|
2300
2366
|
}
|
|
@@ -2302,7 +2368,6 @@ const getRemoteAuthorityVirtualDom = (remoteAuthority, index) => {
|
|
|
2302
2368
|
return [{
|
|
2303
2369
|
childCount: 1,
|
|
2304
2370
|
className: mergeClassNames(RunningExtensionId, RunningExtensionRemoteAuthority),
|
|
2305
|
-
'data-index': index,
|
|
2306
2371
|
type: Div
|
|
2307
2372
|
}, text(ssh(host))];
|
|
2308
2373
|
};
|
|
@@ -2316,53 +2381,27 @@ const getClassName = (focused, selected) => {
|
|
|
2316
2381
|
}
|
|
2317
2382
|
return className;
|
|
2318
2383
|
};
|
|
2319
|
-
const getExtensionVirtualDom = (extension,
|
|
2320
|
-
const displayName = extension.name
|
|
2321
|
-
const
|
|
2322
|
-
const
|
|
2384
|
+
const getExtensionVirtualDom = (extension, focused = false, selected = false) => {
|
|
2385
|
+
const displayName = typeof extension.name === 'string' && extension.name ? extension.name : extension.id;
|
|
2386
|
+
const displayVersion = typeof extension.version === 'string' ? extension.version : '';
|
|
2387
|
+
const activationReasonDom = getActivationReasonVirtualDom(extension.activationEvent);
|
|
2388
|
+
const statusDom = getStatusVirtualDom(extension);
|
|
2389
|
+
const remoteAuthorityDom = getRemoteAuthorityVirtualDom(extension.remoteAuthority);
|
|
2323
2390
|
const className = getClassName(focused, selected);
|
|
2324
2391
|
return [{
|
|
2325
2392
|
childCount: 3,
|
|
2326
2393
|
className,
|
|
2327
|
-
'data-index': index,
|
|
2328
2394
|
role: ListItem,
|
|
2329
2395
|
type: Div
|
|
2330
|
-
}, ...getIconVirtualDom(extension
|
|
2396
|
+
}, ...getIconVirtualDom(extension), {
|
|
2331
2397
|
childCount: remoteAuthorityDom.length > 0 ? 3 : 2,
|
|
2332
2398
|
className: RunningExtensionDetails,
|
|
2333
|
-
'data-index': index,
|
|
2334
|
-
type: Div
|
|
2335
|
-
}, {
|
|
2336
|
-
childCount: 2,
|
|
2337
|
-
className: RunningExtensionTitle,
|
|
2338
|
-
'data-index': index,
|
|
2339
|
-
type: Div
|
|
2340
|
-
}, {
|
|
2341
|
-
childCount: 1,
|
|
2342
|
-
className: RunningExtensionName,
|
|
2343
|
-
'data-index': index,
|
|
2344
|
-
type: Strong
|
|
2345
|
-
}, text(displayName), {
|
|
2346
|
-
childCount: 1,
|
|
2347
|
-
className: RunningExtensionVersion,
|
|
2348
|
-
'data-index': index,
|
|
2349
|
-
type: Span
|
|
2350
|
-
}, text(extension.version), ...remoteAuthorityDom, {
|
|
2351
|
-
childCount: 1,
|
|
2352
|
-
className: RunningExtensionId,
|
|
2353
|
-
'data-index': index,
|
|
2354
2399
|
type: Div
|
|
2355
|
-
}, text(extension.id), {
|
|
2400
|
+
}, titleNode, nameNode, text(displayName), versionNode, text(displayVersion), ...remoteAuthorityDom, idNode, text(extension.id), {
|
|
2356
2401
|
childCount: activationReasonDom.length > 0 ? 2 : 1,
|
|
2357
2402
|
className: RunningExtensionActivationDetails,
|
|
2358
|
-
'data-index': index,
|
|
2359
2403
|
type: Div
|
|
2360
|
-
},
|
|
2361
|
-
childCount: 1,
|
|
2362
|
-
className: RunningExtensionActivationTime,
|
|
2363
|
-
'data-index': index,
|
|
2364
|
-
type: Div
|
|
2365
|
-
}, text(activationTime(Math.round(extension.activationTime))), ...activationReasonDom];
|
|
2404
|
+
}, ...statusDom, ...activationReasonDom];
|
|
2366
2405
|
};
|
|
2367
2406
|
|
|
2368
2407
|
const Focusable = 0;
|
|
@@ -2403,7 +2442,7 @@ const getRunningExtensionsVirtualDom = (extensions, loaded, focusedIndex = -1, s
|
|
|
2403
2442
|
role: List,
|
|
2404
2443
|
tabIndex: Focusable,
|
|
2405
2444
|
type: Div
|
|
2406
|
-
}, ...extensions.flatMap((extension, index) => getExtensionVirtualDom(extension,
|
|
2445
|
+
}, ...extensions.flatMap((extension, index) => getExtensionVirtualDom(extension, focusOutline && index === focusedIndex, index === selectedIndex))];
|
|
2407
2446
|
};
|
|
2408
2447
|
|
|
2409
2448
|
const renderDom = (oldState, newState) => {
|
|
@@ -2441,11 +2480,11 @@ const render2 = (uid, diffResult) => {
|
|
|
2441
2480
|
const renderEventListeners = () => {
|
|
2442
2481
|
return [{
|
|
2443
2482
|
name: HandleContextMenu,
|
|
2444
|
-
params: ['handleContextMenu',
|
|
2483
|
+
params: ['handleContextMenu', ClientX, ClientY],
|
|
2445
2484
|
preventDefault: true
|
|
2446
2485
|
}, {
|
|
2447
2486
|
name: HandleClick,
|
|
2448
|
-
params: ['handleClickAt',
|
|
2487
|
+
params: ['handleClickAt', ClientY],
|
|
2449
2488
|
preventDefault: true
|
|
2450
2489
|
}, {
|
|
2451
2490
|
name: HandleBlur,
|
|
@@ -2524,8 +2563,27 @@ const setExtensions = (state, extensions) => {
|
|
|
2524
2563
|
};
|
|
2525
2564
|
};
|
|
2526
2565
|
|
|
2527
|
-
const startProfile = async state => {
|
|
2528
|
-
|
|
2566
|
+
const startProfile = async (state, index) => {
|
|
2567
|
+
const {
|
|
2568
|
+
extensions,
|
|
2569
|
+
platform
|
|
2570
|
+
} = state;
|
|
2571
|
+
const extension = extensions[index];
|
|
2572
|
+
if (!extension) {
|
|
2573
|
+
return state;
|
|
2574
|
+
}
|
|
2575
|
+
if (platform !== Electron) {
|
|
2576
|
+
await invoke$3('ConfirmPrompt.prompt', extensionHostProfilingNotAvailable(), undefined);
|
|
2577
|
+
return state;
|
|
2578
|
+
}
|
|
2579
|
+
const windowId = await getWindowId();
|
|
2580
|
+
try {
|
|
2581
|
+
const uri = extension.isolated ? await invoke$1('ElectronDeveloper.takeWorkerCpuProfile', windowId, extension.workerName || extensionApiElectron(extension.id)) : await invoke$1('ElectronDeveloper.takeWindowCpuProfile', windowId);
|
|
2582
|
+
await invoke('Main.openUri', uri);
|
|
2583
|
+
} catch (error) {
|
|
2584
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2585
|
+
await invoke$3('ConfirmPrompt.prompt', message, undefined);
|
|
2586
|
+
}
|
|
2529
2587
|
return state;
|
|
2530
2588
|
};
|
|
2531
2589
|
|