@lvce-editor/main-area-worker 9.9.0 → 9.11.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.
@@ -379,6 +379,26 @@ const closeSaved$1 = state => {
379
379
  return withGroups(state, newGroups);
380
380
  };
381
381
 
382
+ const closeTabsByUris = (state, uris) => {
383
+ let currentState = state;
384
+ for (const uri of uris) {
385
+ while (true) {
386
+ const matchingGroup = currentState.layout.groups.find(group => {
387
+ return group.tabs.some(tab => tab.uri === uri);
388
+ });
389
+ if (!matchingGroup) {
390
+ break;
391
+ }
392
+ const matchingTab = matchingGroup.tabs.find(tab => tab.uri === uri);
393
+ if (!matchingTab) {
394
+ break;
395
+ }
396
+ currentState = closeTab(currentState, matchingGroup.id, matchingTab.id);
397
+ }
398
+ }
399
+ return currentState;
400
+ };
401
+
382
402
  const getGroupById = (state, groupId) => {
383
403
  return state.layout.groups.find(group => group.id === groupId);
384
404
  };
@@ -1947,6 +1967,15 @@ const loadFileContent = async path => {
1947
1967
  const content = await readFile(path);
1948
1968
  return content;
1949
1969
  };
1970
+ const getLoadFileErrorMessage = error => {
1971
+ if (!(error instanceof Error)) {
1972
+ return 'Failed to load file content';
1973
+ }
1974
+ if (error.message.includes('EISDIR') || error.message.includes('illegal operation on a directory') || error.message.includes('is a directory')) {
1975
+ return 'Expected a file but received a folder';
1976
+ }
1977
+ return error.message;
1978
+ };
1950
1979
  const loadTabContentAsync = async (tabId, path, requestId, getLatestState) => {
1951
1980
  try {
1952
1981
  await loadFileContent(path);
@@ -1984,7 +2013,7 @@ const loadTabContentAsync = async (tabId, path, requestId, getLatestState) => {
1984
2013
  if (latestTab.loadingState !== 'loading') {
1985
2014
  return latestState;
1986
2015
  }
1987
- const errorMessage = error instanceof Error ? error.message : 'Failed to load file content';
2016
+ const errorMessage = getLoadFileErrorMessage(error);
1988
2017
  return updateTab(latestState, tabId, {
1989
2018
  errorMessage,
1990
2019
  loadingState: 'error'
@@ -2487,6 +2516,89 @@ const parseRawGroupId = rawGroupId => {
2487
2516
  return Number.isNaN(groupId) ? undefined : groupId;
2488
2517
  };
2489
2518
 
2519
+ const findTabByUri = (state, uri) => {
2520
+ const {
2521
+ layout
2522
+ } = state;
2523
+ const {
2524
+ groups
2525
+ } = layout;
2526
+ for (const group of groups) {
2527
+ const tab = group.tabs.find(t => t.uri === uri);
2528
+ if (tab) {
2529
+ return {
2530
+ groupId: group.id,
2531
+ tab
2532
+ };
2533
+ }
2534
+ }
2535
+ return undefined;
2536
+ };
2537
+
2538
+ const focusEditorGroup = (state, groupId) => {
2539
+ const {
2540
+ layout
2541
+ } = state;
2542
+ const {
2543
+ groups
2544
+ } = layout;
2545
+ const updatedGroups = groups.map(group => ({
2546
+ ...group,
2547
+ focused: group.id === groupId
2548
+ }));
2549
+ return {
2550
+ ...state,
2551
+ layout: {
2552
+ ...layout,
2553
+ activeGroupId: groupId,
2554
+ groups: updatedGroups
2555
+ }
2556
+ };
2557
+ };
2558
+
2559
+ const getActiveTabId = state => {
2560
+ const {
2561
+ layout
2562
+ } = state;
2563
+ const {
2564
+ activeGroupId,
2565
+ groups
2566
+ } = layout;
2567
+ const activeGroup = groups.find(g => g.id === activeGroupId);
2568
+ return activeGroup?.activeTabId;
2569
+ };
2570
+
2571
+ const getTabCount = state => {
2572
+ return state.layout.groups.reduce((sum, group) => sum + group.tabs.length, 0);
2573
+ };
2574
+
2575
+ const getCurrentState = state => {
2576
+ const {
2577
+ uid
2578
+ } = state;
2579
+ const stateFromStore = get(uid);
2580
+ if (!stateFromStore) {
2581
+ set(uid, state, state);
2582
+ return state;
2583
+ }
2584
+ const storedState = stateFromStore.newState;
2585
+ if (getTabCount(storedState) > getTabCount(state)) {
2586
+ return storedState;
2587
+ }
2588
+ set(uid, state, state);
2589
+ return state;
2590
+ };
2591
+
2592
+ const getEditorInputEditorType = editorInput => {
2593
+ switch (editorInput.type) {
2594
+ case 'diff-editor':
2595
+ case 'extension-detail-view':
2596
+ return 'custom';
2597
+ case 'editor':
2598
+ return 'text';
2599
+ }
2600
+ };
2601
+
2490
2602
  const getBasename$1 = uri => {
2491
2603
  const lastSlashIndex = uri.lastIndexOf('/');
2492
2604
  if (lastSlashIndex === -1) {
@@ -2521,6 +2633,32 @@ const getLabel = uri => {
2521
2633
  return getBasename$1(uri);
2522
2634
  };
2523
2635
 
2636
+ const getEditorInputTitle = editorInput => {
2637
+ switch (editorInput.type) {
2638
+ case 'diff-editor':
2639
+ {
2640
+ const leftTitle = getLabel(editorInput.uriLeft);
2641
+ const rightTitle = getLabel(editorInput.uriRight);
2642
+ return `${leftTitle} - ${rightTitle}`;
2643
+ }
2644
+ case 'editor':
2645
+ return getLabel(editorInput.uri);
2646
+ case 'extension-detail-view':
2647
+ return editorInput.extensionId;
2648
+ }
2649
+ };
2650
+
2651
+ const getEditorInputUri = editorInput => {
2652
+ switch (editorInput.type) {
2653
+ case 'diff-editor':
2654
+ return `diff://?left=${encodeURIComponent(editorInput.uriLeft)}&right=${encodeURIComponent(editorInput.uriRight)}`;
2655
+ case 'editor':
2656
+ return editorInput.uri;
2657
+ case 'extension-detail-view':
2658
+ return `extension-detail://${editorInput.extensionId}`;
2659
+ }
2660
+ };
2661
+
2524
2662
  const createEmptyGroup = (state, uri, requestId, preview = false, title = getLabel(uri), editorType = 'text', editorInput) => {
2525
2663
  const {
2526
2664
  layout
@@ -2679,94 +2817,85 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
2679
2817
  return newState;
2680
2818
  };
2681
2819
 
2682
- const findTabByUri = (state, uri) => {
2683
- const {
2684
- layout
2685
- } = state;
2686
- const {
2687
- groups
2688
- } = layout;
2689
- for (const group of groups) {
2690
- const tab = group.tabs.find(t => t.uri === uri);
2691
- if (tab) {
2692
- return {
2693
- groupId: group.id,
2694
- tab
2695
- };
2696
- }
2820
+ const getStateWithTab = (currentState, editorInput, existingTab, shouldRetryExistingTab, uri, preview, title, editorType) => {
2821
+ if (shouldRetryExistingTab && existingTab) {
2822
+ const focusedState = focusEditorGroup(currentState, existingTab.groupId);
2823
+ return {
2824
+ stateWithTab: updateTab(focusedState, existingTab.tab.id, {
2825
+ editorInput,
2826
+ errorMessage: '',
2827
+ loadingState: 'loading',
2828
+ title,
2829
+ uri
2830
+ }),
2831
+ tabId: existingTab.tab.id
2832
+ };
2697
2833
  }
2698
- return undefined;
2834
+ const stateWithTab = ensureActiveGroup(currentState, uri, preview, title, editorType, editorInput);
2835
+ return {
2836
+ stateWithTab,
2837
+ tabId: getActiveTabId(stateWithTab)
2838
+ };
2699
2839
  };
2700
2840
 
2701
- const focusEditorGroup = (state, groupId) => {
2841
+ const Directory = 3;
2842
+ const DirectoryExpanded = 4;
2843
+
2844
+ const isLocalEditorInput = editorInput => {
2845
+ if (editorInput.type !== 'editor') {
2846
+ return false;
2847
+ }
2848
+ return editorInput.uri.startsWith('file://') || !editorInput.uri.includes('://');
2849
+ };
2850
+
2851
+ const shouldCheckDirectoryEditorInput = editorInput => {
2852
+ if (!isLocalEditorInput(editorInput)) {
2853
+ return false;
2854
+ }
2855
+ const baseName = editorInput.uri.slice(editorInput.uri.lastIndexOf('/') + 1);
2856
+ return baseName.endsWith('/') || baseName !== '' && !baseName.includes('.');
2857
+ };
2858
+
2859
+ const isDirectoryEditorInput = async editorInput => {
2860
+ if (!shouldCheckDirectoryEditorInput(editorInput)) {
2861
+ return false;
2862
+ }
2863
+ try {
2864
+ const type = await invoke('FileSystem.stat', editorInput.uri);
2865
+ return type === Directory;
2866
+ } catch {
2867
+ return false;
2868
+ }
2869
+ };
2870
+
2871
+ const switchTab = (state, groupId, tabId) => {
2702
2872
  const {
2703
2873
  layout
2704
2874
  } = state;
2705
2875
  const {
2706
2876
  groups
2707
2877
  } = layout;
2708
- const updatedGroups = groups.map(group => ({
2709
- ...group,
2710
- focused: group.id === groupId
2711
- }));
2878
+ const updatedGroups = groups.map(group => {
2879
+ if (group.id === groupId) {
2880
+ const tabExists = group.tabs.some(tab => tab.id === tabId);
2881
+ if (tabExists) {
2882
+ return {
2883
+ ...group,
2884
+ activeTabId: tabId
2885
+ };
2886
+ }
2887
+ }
2888
+ return group;
2889
+ });
2712
2890
  return {
2713
2891
  ...state,
2714
2892
  layout: {
2715
2893
  ...layout,
2716
- activeGroupId: groupId,
2717
2894
  groups: updatedGroups
2718
2895
  }
2719
2896
  };
2720
2897
  };
2721
2898
 
2722
- const getActiveTabId = state => {
2723
- const {
2724
- layout
2725
- } = state;
2726
- const {
2727
- activeGroupId,
2728
- groups
2729
- } = layout;
2730
- const activeGroup = groups.find(g => g.id === activeGroupId);
2731
- return activeGroup?.activeTabId;
2732
- };
2733
-
2734
- const getEditorInputEditorType = editorInput => {
2735
- switch (editorInput.type) {
2736
- case 'diff-editor':
2737
- case 'extension-detail-view':
2738
- return 'custom';
2739
- case 'editor':
2740
- return 'text';
2741
- }
2742
- };
2743
-
2744
- const getEditorInputTitle = editorInput => {
2745
- switch (editorInput.type) {
2746
- case 'diff-editor':
2747
- {
2748
- const leftTitle = getLabel(editorInput.uriLeft);
2749
- const rightTitle = getLabel(editorInput.uriRight);
2750
- return `${leftTitle} - ${rightTitle}`;
2751
- }
2752
- case 'editor':
2753
- return getLabel(editorInput.uri);
2754
- case 'extension-detail-view':
2755
- return editorInput.extensionId;
2756
- }
2757
- };
2758
-
2759
- const getEditorInputUri = editorInput => {
2760
- switch (editorInput.type) {
2761
- case 'diff-editor':
2762
- return `diff://?left=${encodeURIComponent(editorInput.uriLeft)}&right=${encodeURIComponent(editorInput.uriRight)}`;
2763
- case 'editor':
2764
- return editorInput.uri;
2765
- case 'extension-detail-view':
2766
- return `extension-detail://${editorInput.extensionId}`;
2767
- }
2768
- };
2769
-
2770
2899
  const getIconsCached = (dirents, fileIconCache) => {
2771
2900
  return dirents.map(dirent => fileIconCache[dirent]);
2772
2901
  };
@@ -2801,9 +2930,6 @@ const getMissingIconRequestsForTabs = (tabs, fileIconCache) => {
2801
2930
  return iconRequests;
2802
2931
  };
2803
2932
 
2804
- const Directory = 3;
2805
- const DirectoryExpanded = 4;
2806
-
2807
2933
  const getSimpleIconRequestType = direntType => {
2808
2934
  if (direntType === Directory || direntType === DirectoryExpanded) {
2809
2935
  return 2;
@@ -2854,73 +2980,6 @@ const getFileIconsForTabs = async (tabs, fileIconCache) => {
2854
2980
  };
2855
2981
  };
2856
2982
 
2857
- const switchTab = (state, groupId, tabId) => {
2858
- const {
2859
- layout
2860
- } = state;
2861
- const {
2862
- groups
2863
- } = layout;
2864
- const updatedGroups = groups.map(group => {
2865
- if (group.id === groupId) {
2866
- const tabExists = group.tabs.some(tab => tab.id === tabId);
2867
- if (tabExists) {
2868
- return {
2869
- ...group,
2870
- activeTabId: tabId
2871
- };
2872
- }
2873
- }
2874
- return group;
2875
- });
2876
- return {
2877
- ...state,
2878
- layout: {
2879
- ...layout,
2880
- groups: updatedGroups
2881
- }
2882
- };
2883
- };
2884
-
2885
- const getTabCount = state => {
2886
- return state.layout.groups.reduce((sum, group) => sum + group.tabs.length, 0);
2887
- };
2888
- const getCurrentState = state => {
2889
- const {
2890
- uid
2891
- } = state;
2892
- const stateFromStore = get(uid);
2893
- if (!stateFromStore) {
2894
- set(uid, state, state);
2895
- return state;
2896
- }
2897
- const storedState = stateFromStore.newState;
2898
- if (getTabCount(storedState) > getTabCount(state)) {
2899
- return storedState;
2900
- }
2901
- set(uid, state, state);
2902
- return state;
2903
- };
2904
- const getStateWithTab = (currentState, editorInput, existingTab, shouldRetryExistingTab, uri, preview, title, editorType) => {
2905
- if (shouldRetryExistingTab && existingTab) {
2906
- const focusedState = focusEditorGroup(currentState, existingTab.groupId);
2907
- return {
2908
- stateWithTab: updateTab(focusedState, existingTab.tab.id, {
2909
- editorInput,
2910
- errorMessage: '',
2911
- loadingState: 'loading',
2912
- title,
2913
- uri
2914
- }),
2915
- tabId: existingTab.tab.id
2916
- };
2917
- }
2918
- const stateWithTab = ensureActiveGroup(currentState, uri, preview, title, editorType, editorInput);
2919
- return {
2920
- stateWithTab,
2921
- tabId: getActiveTabId(stateWithTab)
2922
- };
2923
- };
2924
2983
  const updateTabIcon = async (uid, state, readyState, tabId) => {
2925
2984
  const newTab = findTabById(readyState, tabId);
2926
2985
  if (!newTab || !newTab.tab.uri) {
@@ -2954,6 +3013,7 @@ const updateTabIcon = async (uid, state, readyState, tabId) => {
2954
3013
  return undefined;
2955
3014
  }
2956
3015
  };
3016
+
2957
3017
  const openInput = async (state, options) => {
2958
3018
  object(state);
2959
3019
  object(options);
@@ -2967,19 +3027,30 @@ const openInput = async (state, options) => {
2967
3027
  const uri = getEditorInputUri(editorInput);
2968
3028
  const title = getEditorInputTitle(editorInput);
2969
3029
  const editorType = getEditorInputEditorType(editorInput);
2970
- const existingTab = findTabByUri(state, uri);
3030
+ const currentState = getCurrentState(state);
3031
+ const existingTab = findTabByUri(currentState, uri);
2971
3032
  const shouldRetryExistingTab = !!existingTab && existingTab.tab.loadingState === 'error';
2972
3033
  if (existingTab && !shouldRetryExistingTab) {
2973
- const focusedState = focusEditorGroup(state, existingTab.groupId);
3034
+ const focusedState = focusEditorGroup(currentState, existingTab.groupId);
2974
3035
  return switchTab(focusedState, existingTab.groupId, existingTab.tab.id);
2975
3036
  }
2976
- const previousTabId = getActiveTabId(state);
2977
- const currentState = getCurrentState(state);
3037
+ const previousTabId = getActiveTabId(currentState);
2978
3038
  const {
2979
3039
  stateWithTab,
2980
3040
  tabId
2981
3041
  } = getStateWithTab(currentState, editorInput, existingTab, shouldRetryExistingTab, uri, preview, title, editorType);
2982
3042
  set(uid, state, stateWithTab);
3043
+ if (await isDirectoryEditorInput(editorInput)) {
3044
+ const {
3045
+ newState: latestState
3046
+ } = get(uid);
3047
+ const errorState = updateTab(latestState, tabId, {
3048
+ errorMessage: 'Expected a file but received a folder',
3049
+ loadingState: 'error'
3050
+ });
3051
+ set(uid, state, errorState);
3052
+ return errorState;
3053
+ }
2983
3054
  try {
2984
3055
  const viewletModuleId = await getViewletModuleIdForEditorInput(editorInput);
2985
3056
  const {
@@ -4183,6 +4254,7 @@ const Pin = 'Pin';
4183
4254
  const SplitAndMove = 'Split & Move';
4184
4255
  const MoveIntoNewWindow = 'Move into New Window';
4185
4256
  const CopyIntoNewWindow = 'Copy into New Window';
4257
+ const NewTextFile = 'New Text File';
4186
4258
  const NewWindow = 'New Window';
4187
4259
  const OpenFile = 'Open File';
4188
4260
  const SplitDown = 'Split Down';
@@ -4214,6 +4286,9 @@ const splitEditorGroup = () => {
4214
4286
  const newWindow$1 = () => {
4215
4287
  return i18nString(NewWindow);
4216
4288
  };
4289
+ const newTextFile = () => {
4290
+ return i18nString(NewTextFile);
4291
+ };
4217
4292
  const close = () => {
4218
4293
  return i18nString(Close);
4219
4294
  };
@@ -4300,6 +4375,11 @@ const getNewWindowMenuEntries = state => {
4300
4375
  const getMenuEntries$2 = (state, groupId) => {
4301
4376
  const groupArgs = getMenuEntryArgs(groupId);
4302
4377
  const entries = [{
4378
+ command: 'MainArea.newFile',
4379
+ flags: None,
4380
+ id: 'newTextFile',
4381
+ label: newTextFile()
4382
+ }, {
4303
4383
  args: [QuickPick, 'file'],
4304
4384
  command: 'Viewlet.openWidget',
4305
4385
  flags: None,
@@ -4552,30 +4632,40 @@ const getSashOffset = (layout, groupIndex, width) => {
4552
4632
  const escapeCssAttributeValue = value => {
4553
4633
  return value.replaceAll('\\', '\\\\').replaceAll('"', '\\"');
4554
4634
  };
4555
- const getSashCss = (layout, width = 0) => {
4556
- if (layout.groups.length <= 1) {
4557
- return [];
4558
- }
4559
- const rules = [];
4635
+ const toSashProperty = direction => {
4636
+ return direction === Horizontal ? 'left' : 'top';
4637
+ };
4638
+ const renderSashCss = ({
4639
+ property,
4640
+ sashId,
4641
+ value
4642
+ }) => {
4643
+ const escapedSashId = escapeCssAttributeValue(sashId);
4644
+ return `[data-sash-id="${escapedSashId}"] {
4645
+ ${property}: ${value};
4646
+ }`;
4647
+ };
4648
+ const getProtoSashCss = (layout, width) => {
4560
4649
  const segments = getGroupSegments(layout.groups, layout.direction);
4561
- const sashPositionProperty = layout.direction === Horizontal ? 'left' : 'top';
4650
+ const hasNestedSegments = segments.some(segment => segment.direction !== undefined);
4651
+ const rules = [];
4562
4652
  let segmentOffset = 0;
4563
4653
  for (let i = 1; i < segments.length; i++) {
4564
4654
  segmentOffset += getSegmentSize(segments[i - 1]);
4565
4655
  const beforeGroupId = segments[i - 1].groups.at(-1)?.id || 0;
4566
4656
  const afterGroupId = segments[i].groups[0].id;
4567
4657
  const sashId = create(beforeGroupId, afterGroupId);
4568
- const escapedSashId = escapeCssAttributeValue(sashId);
4569
- const sashOffset = segments.some(segment => segment.direction !== undefined) || layout.direction !== Horizontal || !width ? `${segmentOffset}%` : getSashOffset(layout, i, width);
4570
- rules.push(`[data-sashId="${escapedSashId}"] {
4571
- ${sashPositionProperty}: ${sashOffset};
4572
- }`);
4658
+ const value = hasNestedSegments || layout.direction !== Horizontal || !width ? `${segmentOffset}%` : getSashOffset(layout, i, width);
4659
+ rules.push({
4660
+ property: toSashProperty(layout.direction),
4661
+ sashId,
4662
+ value
4663
+ });
4573
4664
  }
4574
4665
  for (const segment of segments) {
4575
4666
  if (segment.direction === undefined || segment.groups.length <= 1) {
4576
4667
  continue;
4577
4668
  }
4578
- const nestedProperty = segment.direction === Horizontal ? 'left' : 'top';
4579
4669
  const segmentSize = getSegmentSize(segment);
4580
4670
  let nestedOffset = 0;
4581
4671
  for (let i = 1; i < segment.groups.length; i++) {
@@ -4583,20 +4673,35 @@ const getSashCss = (layout, width = 0) => {
4583
4673
  const beforeGroupId = segment.groups[i - 1].id;
4584
4674
  const afterGroupId = segment.groups[i].id;
4585
4675
  const sashId = create(beforeGroupId, afterGroupId);
4586
- const escapedSashId = escapeCssAttributeValue(sashId);
4587
- const relativeOffset = Number((nestedOffset / segmentSize * 100).toFixed(6));
4588
- rules.push(`[data-sashId="${escapedSashId}"] {
4589
- ${nestedProperty}: ${relativeOffset}%;
4590
- }`);
4676
+ const value = `${Number((nestedOffset / segmentSize * 100).toFixed(6))}%`;
4677
+ rules.push({
4678
+ property: toSashProperty(segment.direction),
4679
+ sashId,
4680
+ value
4681
+ });
4591
4682
  }
4592
4683
  }
4593
4684
  return rules;
4594
4685
  };
4686
+ const getSashCss = (layout, width = 0) => {
4687
+ if (layout.groups.length <= 1) {
4688
+ return [];
4689
+ }
4690
+ return getProtoSashCss(layout, width).map(renderSashCss);
4691
+ };
4595
4692
 
4596
4693
  const getCss = (layout, width = 0) => {
4597
4694
  const rules = [`.MainArea {
4598
4695
  }`, `.editor-groups-container {
4599
4696
  overflow: auto;
4697
+ }`, `.SashBorder {
4698
+ background: var(--SashBorder, gray);
4699
+ }`, `.SashBorderHorizontal {
4700
+ width: 100%;
4701
+ height: 1px;
4702
+ }`, `.SashBorderVertical {
4703
+ width: 1px;
4704
+ height: 100%;
4600
4705
  }`, `.EditorGroup {
4601
4706
  min-width: 250px;
4602
4707
  width: var(--EditorGroupWidth, auto);
@@ -5217,6 +5322,9 @@ const getSashClassName = direction => {
5217
5322
  return direction === Horizontal ? 'Sash SashVertical' : 'Sash SashHorizontal';
5218
5323
  };
5219
5324
 
5325
+ const getSashBorderClassName = direction => {
5326
+ return direction === 1 ? 'SashBorder SashBorderVertical' : 'SashBorder SashBorderHorizontal';
5327
+ };
5220
5328
  const renderSash = (direction, sashId) => {
5221
5329
  return [{
5222
5330
  childCount: 1,
@@ -5227,7 +5335,7 @@ const renderSash = (direction, sashId) => {
5227
5335
  type: Button$2
5228
5336
  }, {
5229
5337
  childCount: 0,
5230
- className: 'SashBorder',
5338
+ className: getSashBorderClassName(direction),
5231
5339
  type: Div
5232
5340
  }];
5233
5341
  };
@@ -5477,10 +5585,16 @@ const save = async state => {
5477
5585
  };
5478
5586
 
5479
5587
  const getFilteredGroups = groups => {
5480
- return groups.map(group => ({
5481
- ...group,
5482
- tabs: group.tabs.filter(tab => !tab.uri?.startsWith('untitled://')).map(normalizeTabEditorInput)
5483
- })).filter(group => group.tabs.length > 0);
5588
+ return groups.map(group => {
5589
+ const tabs = group.tabs.filter(tab => !tab.uri?.startsWith('untitled://')).map(normalizeTabEditorInput);
5590
+ const activeTabId = tabs.some(tab => tab.id === group.activeTabId) ? group.activeTabId : tabs[0]?.id;
5591
+ return {
5592
+ ...group,
5593
+ activeTabId,
5594
+ isEmpty: tabs.length === 0,
5595
+ tabs
5596
+ };
5597
+ });
5484
5598
  };
5485
5599
 
5486
5600
  const saveState = state => {
@@ -5640,6 +5754,26 @@ const splitUp = (state, groupId) => {
5640
5754
  };
5641
5755
 
5642
5756
  const commandMap = {
5757
+ 'Main.closeActiveEditor': wrapCommand(closeActiveEditor),
5758
+ 'Main.closeAll': wrapCommand(closeAll$1),
5759
+ 'Main.closeAllEditors': wrapCommand(closeAll$1),
5760
+ 'Main.closeFocusedTab': wrapCommand(closeFocusedTab),
5761
+ 'Main.closeOthers': wrapCommand(closeOtherTabs),
5762
+ 'Main.closeSaved': wrapCommand(closeSaved$1),
5763
+ 'Main.closeTabsByUris': wrapCommand(closeTabsByUris),
5764
+ 'Main.closeTabsRight': wrapCommand(closeTabsRight),
5765
+ 'Main.copyPath': wrapCommand(copyPath$1),
5766
+ 'Main.copyRelativePath': wrapCommand(copyRelativePath$1),
5767
+ 'Main.focusNext': wrapCommand(focusNextTab),
5768
+ 'Main.focusNextTab': wrapCommand(focusNextTab),
5769
+ 'Main.focusPrevious': wrapCommand(focusPreviousTab),
5770
+ 'Main.focusPreviousTab': wrapCommand(focusPreviousTab),
5771
+ 'Main.handleTabContextMenu': wrapCommand(handleTabContextMenu),
5772
+ 'Main.openInput': wrapCommand(openInput),
5773
+ 'Main.openUri': wrapCommand(openUri),
5774
+ 'Main.openUris': wrapCommand(openUris),
5775
+ 'Main.save': wrapCommand(save),
5776
+ 'Main.splitRight': wrapCommand(splitRight),
5643
5777
  'MainArea.closeActiveEditor': wrapCommand(closeActiveEditor),
5644
5778
  'MainArea.closeAll': wrapCommand(closeAll$1),
5645
5779
  'MainArea.closeAllEditors': wrapCommand(closeAll$1),
@@ -5647,6 +5781,7 @@ const commandMap = {
5647
5781
  'MainArea.closeFocusedTab': wrapCommand(closeFocusedTab),
5648
5782
  'MainArea.closeOthers': wrapCommand(closeOtherTabs),
5649
5783
  'MainArea.closeSaved': wrapCommand(closeSaved$1),
5784
+ 'MainArea.closeTabsByUris': wrapCommand(closeTabsByUris),
5650
5785
  'MainArea.closeTabsRight': wrapCommand(closeTabsRight),
5651
5786
  'MainArea.copyPath': wrapCommand(copyPath$1),
5652
5787
  'MainArea.copyRelativePath': wrapCommand(copyRelativePath$1),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.9.0",
3
+ "version": "9.11.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",