@lvce-editor/running-extensions-view 1.16.0 → 1.18.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.
@@ -1956,6 +1956,19 @@ const getRunningExtensions = async (assetDir, platform) => {
1956
1956
  return invoke$2('Extensions.getRunningExtensions', assetDir, platform);
1957
1957
  };
1958
1958
 
1959
+ const getDisplayName = extension => {
1960
+ return typeof extension.name === 'string' && extension.name ? extension.name : extension.id;
1961
+ };
1962
+ const compareExtension = (extensionA, extensionB) => {
1963
+ return getDisplayName(extensionA).localeCompare(getDisplayName(extensionB)) || extensionA.id.localeCompare(extensionB.id);
1964
+ };
1965
+ const setExtensions = (state, extensions) => {
1966
+ return {
1967
+ ...state,
1968
+ extensions: extensions.toSorted(compareExtension)
1969
+ };
1970
+ };
1971
+
1959
1972
  const loadContent = async state => {
1960
1973
  const {
1961
1974
  assetDir,
@@ -1963,8 +1976,7 @@ const loadContent = async state => {
1963
1976
  } = state;
1964
1977
  const extensions = await getRunningExtensions(assetDir, platform);
1965
1978
  return {
1966
- ...state,
1967
- extensions,
1979
+ ...setExtensions(state, extensions),
1968
1980
  loaded: true
1969
1981
  };
1970
1982
  };
@@ -2287,6 +2299,12 @@ const HandleContextMenu = 3;
2287
2299
  const HandleClick = 4;
2288
2300
  const HandleBlur = 5;
2289
2301
 
2302
+ const defaultIconNode = {
2303
+ childCount: 0,
2304
+ className: mergeClassNames(RunningExtensionIcon, RunningExtensionDefaultIcon, MaskIcon, MaskIconExtensions),
2305
+ role: None,
2306
+ type: Div
2307
+ };
2290
2308
  const getIconVirtualDom = extension => {
2291
2309
  if (extension.icon) {
2292
2310
  return [{
@@ -2296,12 +2314,7 @@ const getIconVirtualDom = extension => {
2296
2314
  type: Img
2297
2315
  }];
2298
2316
  }
2299
- return [{
2300
- childCount: 0,
2301
- className: mergeClassNames(RunningExtensionIcon, RunningExtensionDefaultIcon, MaskIcon, MaskIconExtensions),
2302
- role: None,
2303
- type: Div
2304
- }];
2317
+ return [defaultIconNode];
2305
2318
  };
2306
2319
 
2307
2320
  const sshRemotePrefix = 'ssh-remote+';
@@ -2330,6 +2343,11 @@ const idNode = {
2330
2343
  className: RunningExtensionId,
2331
2344
  type: Div
2332
2345
  };
2346
+ const remoteAuthorityNode = {
2347
+ childCount: 1,
2348
+ className: mergeClassNames(RunningExtensionId, RunningExtensionRemoteAuthority),
2349
+ type: Div
2350
+ };
2333
2351
  const activationTimeNode = {
2334
2352
  childCount: 1,
2335
2353
  className: RunningExtensionActivationTime,
@@ -2365,11 +2383,7 @@ const getRemoteAuthorityVirtualDom = remoteAuthority => {
2365
2383
  return [];
2366
2384
  }
2367
2385
  const host = remoteAuthority.startsWith(sshRemotePrefix) ? remoteAuthority.slice(sshRemotePrefix.length) : remoteAuthority;
2368
- return [{
2369
- childCount: 1,
2370
- className: mergeClassNames(RunningExtensionId, RunningExtensionRemoteAuthority),
2371
- type: Div
2372
- }, text(ssh(host))];
2386
+ return [remoteAuthorityNode, text(ssh(host))];
2373
2387
  };
2374
2388
  const getClassName = (focused, selected) => {
2375
2389
  let className = RunningExtension;
@@ -2392,7 +2406,7 @@ const getExtensionVirtualDom = (extension, focused = false, selected = false) =>
2392
2406
  childCount: 3,
2393
2407
  className,
2394
2408
  role: ListItem,
2395
- type: Div
2409
+ type: Li
2396
2410
  }, ...getIconVirtualDom(extension), {
2397
2411
  childCount: remoteAuthorityDom.length > 0 ? 3 : 2,
2398
2412
  className: RunningExtensionDetails,
@@ -2406,10 +2420,20 @@ const getExtensionVirtualDom = (extension, focused = false, selected = false) =>
2406
2420
 
2407
2421
  const Focusable = 0;
2408
2422
 
2423
+ const runningExtensionsNode = {
2424
+ childCount: 1,
2425
+ className: mergeClassNames(RunningExtensions, Grow),
2426
+ onBlur: HandleBlur,
2427
+ onClick: HandleClick,
2428
+ onContextMenu: HandleContextMenu,
2429
+ role: List,
2430
+ tabIndex: Focusable,
2431
+ type: Ul
2432
+ };
2409
2433
  const emptyNode = {
2410
2434
  childCount: 1,
2411
2435
  className: RunningExtensionsEmpty,
2412
- type: Div
2436
+ type: Li
2413
2437
  };
2414
2438
  const getMessage = loaded => {
2415
2439
  const message = loaded ? noRunningExtensions() : loadingRunningExtensions();
@@ -2417,16 +2441,7 @@ const getMessage = loaded => {
2417
2441
  };
2418
2442
  const getRunningExtensionsEmptyDom = loaded => {
2419
2443
  const message = getMessage(loaded);
2420
- return [{
2421
- childCount: 1,
2422
- className: mergeClassNames(RunningExtensions, Grow),
2423
- onBlur: HandleBlur,
2424
- onClick: HandleClick,
2425
- onContextMenu: HandleContextMenu,
2426
- role: List,
2427
- tabIndex: Focusable,
2428
- type: Div
2429
- }, emptyNode, text(message)];
2444
+ return [runningExtensionsNode, emptyNode, text(message)];
2430
2445
  };
2431
2446
 
2432
2447
  const getRunningExtensionsVirtualDom = (extensions, loaded, focusedIndex = -1, selectedIndex = -1, focusOutline = false) => {
@@ -2441,7 +2456,7 @@ const getRunningExtensionsVirtualDom = (extensions, loaded, focusedIndex = -1, s
2441
2456
  onContextMenu: HandleContextMenu,
2442
2457
  role: List,
2443
2458
  tabIndex: Focusable,
2444
- type: Div
2459
+ type: Ul
2445
2460
  }, ...extensions.flatMap((extension, index) => getExtensionVirtualDom(extension, focusOutline && index === focusedIndex, index === selectedIndex))];
2446
2461
  };
2447
2462
 
@@ -2556,13 +2571,6 @@ const resize = (state, dimensions) => {
2556
2571
  };
2557
2572
  };
2558
2573
 
2559
- const setExtensions = (state, extensions) => {
2560
- return {
2561
- ...state,
2562
- extensions
2563
- };
2564
- };
2565
-
2566
2574
  const startProfile = async (state, index) => {
2567
2575
  const {
2568
2576
  extensions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/running-extensions-view",
3
- "version": "1.16.0",
3
+ "version": "1.18.0",
4
4
  "description": "Running Extensions View Worker",
5
5
  "repository": {
6
6
  "type": "git",