@lvce-editor/title-bar-worker 4.14.0 → 4.14.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.
@@ -3399,29 +3399,33 @@ const handleClick$1 = async (state, buttonName) => {
3399
3399
  };
3400
3400
 
3401
3401
  const commandCenterItems = [{
3402
- label: 'Go to File',
3403
- value: 'file'
3402
+ command: 'QuickPick.showFile',
3403
+ label: 'Go to File'
3404
3404
  }, {
3405
- label: 'Show and Run Commands',
3406
- value: 'commands'
3405
+ command: 'QuickPick.showCommands',
3406
+ label: 'Show and Run Commands'
3407
3407
  }, {
3408
- label: 'Search for Text',
3409
- value: 'search'
3408
+ args: ['Search'],
3409
+ command: 'Layout.openSideBarViewlet',
3410
+ label: 'Search for Text'
3410
3411
  }, {
3411
- label: 'Go to Symbol in Editor',
3412
- value: 'symbol'
3412
+ args: ['symbol'],
3413
+ command: 'QuickPick.show',
3414
+ label: 'Go to Symbol in Editor'
3413
3415
  }, {
3414
- label: 'Start Debugging',
3415
- value: 'debug'
3416
+ args: ['Run And Debug'],
3417
+ command: 'Layout.openSideBarViewlet',
3418
+ label: 'Start Debugging'
3416
3419
  }, {
3417
- label: 'Run Task',
3418
- value: 'task'
3420
+ command: 'QuickPick.showCommands',
3421
+ label: 'Run Task'
3419
3422
  }, {
3420
- label: 'More',
3421
- value: 'more'
3423
+ command: 'QuickPick.showEverything',
3424
+ label: 'More'
3422
3425
  }];
3423
3426
  const handleCommandCenterClick = async state => {
3424
- await invoke('QuickPick.showCustom', commandCenterItems, {
3427
+ await invoke('QuickPick.show', 'custom', commandCenterItems, undefined, {
3428
+ executeItemCommand: true,
3425
3429
  mode: 'quickPick',
3426
3430
  placeholder: 'Search files by name (append : to go to line or @ to go to symbol)',
3427
3431
  waitUntil: 'visible'
@@ -3481,6 +3485,21 @@ const getTotalWidth$1 = entries => {
3481
3485
  }
3482
3486
  return total;
3483
3487
  };
3488
+ const createOverflowEntry = (hiddenEntries, overflowIndex, focusedIndex, isMenuOpen) => {
3489
+ return {
3490
+ ariaLabel: moreDot(),
3491
+ hiddenEntries,
3492
+ icon: Ellipsis,
3493
+ id: OverflowMenuId,
3494
+ isFocused: overflowIndex === focusedIndex,
3495
+ isOpen: overflowIndex === focusedIndex && isMenuOpen,
3496
+ label: '...',
3497
+ width: MoreEntryWidth
3498
+ };
3499
+ };
3500
+ const isOverflowTitleBarEntry = entry => {
3501
+ return entry.id === OverflowMenuId;
3502
+ };
3484
3503
  const getVisibleTitleBarEntries = (entries, width, focusedIndex, isMenuOpen) => {
3485
3504
  array(entries);
3486
3505
  number(width);
@@ -3509,23 +3528,11 @@ const getVisibleTitleBarEntries = (entries, width, focusedIndex, isMenuOpen) =>
3509
3528
  }
3510
3529
  const hiddenEntries = entries.slice(visible.length);
3511
3530
  const overflowIndex = visible.length;
3512
- visible.push({
3513
- ariaLabel: moreDot(),
3514
- hiddenEntries,
3515
- icon: Ellipsis,
3516
- id: OverflowMenuId,
3517
- isFocused: overflowIndex === focusedIndex,
3518
- isOpen: overflowIndex === focusedIndex && isMenuOpen,
3519
- label: '...',
3520
- width: MoreEntryWidth
3521
- });
3531
+ visible.push(createOverflowEntry(hiddenEntries, overflowIndex, focusedIndex, isMenuOpen));
3522
3532
  }
3523
3533
  return visible;
3524
3534
  };
3525
3535
 
3526
- const hasOverflowEntry = entries => {
3527
- return entries.some(entry => entry?.id === OverflowMenuId);
3528
- };
3529
3536
  const getNavigableTitleBarEntries = state => {
3530
3537
  const {
3531
3538
  focusedIndex,
@@ -3533,9 +3540,6 @@ const getNavigableTitleBarEntries = state => {
3533
3540
  titleBarEntries,
3534
3541
  width
3535
3542
  } = state;
3536
- if (hasOverflowEntry(titleBarEntries)) {
3537
- return titleBarEntries;
3538
- }
3539
3543
  return getVisibleTitleBarEntries(titleBarEntries, width, focusedIndex, isMenuOpen);
3540
3544
  };
3541
3545
 
@@ -3688,14 +3692,28 @@ const openMenuAtIndex = async (state, index, shouldBeFocused) => {
3688
3692
  if (!titleBarEntry) {
3689
3693
  return state;
3690
3694
  }
3691
- const {
3692
- id
3693
- } = titleBarEntry;
3694
- const rawItems = id === OverflowMenuId ? getOverflowMenuItems(titleBarEntry.hiddenEntries || []) : await getMenuEntries2(state, {
3695
- menuId: id,
3696
- platform
3697
- });
3698
- const items = id === OverflowMenuId ? rawItems : await addMenuEntryKeyBindings(rawItems);
3695
+ let rawItems;
3696
+ let menuId;
3697
+ const isOverflow = isOverflowTitleBarEntry(titleBarEntry);
3698
+ if (isOverflow) {
3699
+ rawItems = getOverflowMenuItems(titleBarEntry.hiddenEntries);
3700
+ menuId = undefined;
3701
+ } else {
3702
+ if (titleBarEntry.id === undefined) {
3703
+ return {
3704
+ ...state,
3705
+ focusedIndex: index,
3706
+ isMenuOpen: true,
3707
+ menus: []
3708
+ };
3709
+ }
3710
+ rawItems = await getMenuEntries2(state, {
3711
+ menuId: titleBarEntry.id,
3712
+ platform
3713
+ });
3714
+ menuId = titleBarEntry.id;
3715
+ }
3716
+ const items = isOverflow ? rawItems : await addMenuEntryKeyBindings(rawItems);
3699
3717
  const relevantEntries = titleBarEntries.slice(0, index);
3700
3718
  const totalWidths = getTotalWidth(relevantEntries);
3701
3719
  const offset = totalWidths;
@@ -3709,7 +3727,7 @@ const openMenuAtIndex = async (state, index, shouldBeFocused) => {
3709
3727
  const menu = {
3710
3728
  focusedIndex: menuFocusedIndex,
3711
3729
  height,
3712
- id: id === OverflowMenuId ? undefined : id,
3730
+ id: menuId,
3713
3731
  items,
3714
3732
  level: 0,
3715
3733
  width,
@@ -4413,7 +4431,6 @@ const getActiveEntryLabelDom = isFocused => {
4413
4431
  return [activeEntryLabelNode];
4414
4432
  };
4415
4433
  const getItemVirtualDom = item => {
4416
- // @ts-ignore
4417
4434
  const {
4418
4435
  ariaLabel,
4419
4436
  isFocused,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "4.14.0",
3
+ "version": "4.14.1",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",