@lvce-editor/main-area-worker 9.67.1 → 9.67.2

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.
@@ -1822,7 +1822,7 @@ const getActiveTab = state => {
1822
1822
  const {
1823
1823
  groups
1824
1824
  } = layout;
1825
- const activeGroup = groups.find(group => group.focused);
1825
+ const activeGroup = groups.find(group => group.isFocused);
1826
1826
  if (!activeGroup || !activeGroup.activeTabId) {
1827
1827
  return undefined;
1828
1828
  }
@@ -2353,7 +2353,7 @@ const closeTabAndSave = async (state, groupId, tabId) => {
2353
2353
  };
2354
2354
 
2355
2355
  const isFocused$1 = group => {
2356
- return group.focused;
2356
+ return group.isFocused;
2357
2357
  };
2358
2358
  const getFocusedGroup = state => {
2359
2359
  const {
@@ -2452,7 +2452,7 @@ const closeEditorGroup$1 = (state, groupId) => {
2452
2452
  };
2453
2453
 
2454
2454
  const isFocused = group => {
2455
- return group.focused;
2455
+ return group.isFocused;
2456
2456
  };
2457
2457
  const closeFocusedTab = async state => {
2458
2458
  const {
@@ -3076,7 +3076,7 @@ const getUpdatedGroups = (groups, groupIndex, needsLoading, tabId) => {
3076
3076
  if (index !== groupIndex) {
3077
3077
  return {
3078
3078
  ...group,
3079
- focused: false
3079
+ isFocused: false
3080
3080
  };
3081
3081
  }
3082
3082
  const tabs = needsLoading ? group.tabs.map(tab => {
@@ -3092,7 +3092,7 @@ const getUpdatedGroups = (groups, groupIndex, needsLoading, tabId) => {
3092
3092
  return {
3093
3093
  ...group,
3094
3094
  activeTabId: tabId,
3095
- focused: true,
3095
+ isFocused: true,
3096
3096
  tabs
3097
3097
  };
3098
3098
  });
@@ -4787,7 +4787,7 @@ const focusEditorGroup = (state, groupId) => {
4787
4787
  } = layout;
4788
4788
  const updatedGroups = groups.map(group => ({
4789
4789
  ...group,
4790
- focused: group.id === groupId
4790
+ isFocused: group.id === groupId
4791
4791
  }));
4792
4792
  return {
4793
4793
  ...state,
@@ -5109,9 +5109,9 @@ const createEmptyGroup$1 = (state, uri, requestId, preview = false, title = getL
5109
5109
  const newGroup = {
5110
5110
  activeTabId: newTab.id,
5111
5111
  direction,
5112
- focused: true,
5113
5112
  id: groupId,
5114
5113
  isEmpty: false,
5114
+ isFocused: true,
5115
5115
  size: 100,
5116
5116
  tabs: [newTab]
5117
5117
  };
@@ -5166,7 +5166,7 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
5166
5166
  type: 'editor',
5167
5167
  uri
5168
5168
  };
5169
- // Find the active group (by activeGroupId or focused flag)
5169
+ // Find the active group (by activeGroupId or isFocused flag)
5170
5170
  const {
5171
5171
  homeDirUri,
5172
5172
  layout
@@ -5175,7 +5175,7 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
5175
5175
  activeGroupId,
5176
5176
  groups
5177
5177
  } = layout;
5178
- const activeGroup = activeGroupId === -1 ? groups.find(group => group.focused) : groups.find(group => group.id === activeGroupId);
5178
+ const activeGroup = activeGroupId === -1 ? groups.find(group => group.isFocused) : groups.find(group => group.id === activeGroupId);
5179
5179
 
5180
5180
  // Generate a request ID for content loading
5181
5181
  const requestId = getNextRequestId();
@@ -5479,7 +5479,7 @@ const getActivePreviewEditorUid = state => {
5479
5479
  activeGroupId,
5480
5480
  groups
5481
5481
  } = layout;
5482
- const activeGroup = activeGroupId === -1 ? groups.find(group => group.focused) : groups.find(group => group.id === activeGroupId);
5482
+ const activeGroup = activeGroupId === -1 ? groups.find(group => group.isFocused) : groups.find(group => group.id === activeGroupId);
5483
5483
  const activeTab = activeGroup?.tabs.find(tab => tab.id === activeGroup.activeTabId);
5484
5484
  return activeTab?.isPreview ? activeTab.editorUid : -1;
5485
5485
  };
@@ -5712,12 +5712,12 @@ const focusGroup = (groups, groupId, activeTabId) => {
5712
5712
  return {
5713
5713
  ...group,
5714
5714
  activeTabId,
5715
- focused: true
5715
+ isFocused: true
5716
5716
  };
5717
5717
  }
5718
5718
  return {
5719
5719
  ...group,
5720
- focused: false
5720
+ isFocused: false
5721
5721
  };
5722
5722
  });
5723
5723
  };
@@ -5789,14 +5789,14 @@ const restoreIntoExistingGroup = (state, entry) => {
5789
5789
  return {
5790
5790
  ...currentGroup,
5791
5791
  activeTabId: restoredTab.id,
5792
- focused: true,
5793
5792
  isEmpty: false,
5793
+ isFocused: true,
5794
5794
  tabs
5795
5795
  };
5796
5796
  }
5797
5797
  return {
5798
5798
  ...currentGroup,
5799
- focused: false
5799
+ isFocused: false
5800
5800
  };
5801
5801
  });
5802
5802
  return {
@@ -5816,8 +5816,8 @@ const createRestoredGroup = entry => {
5816
5816
  return {
5817
5817
  ...entry.group,
5818
5818
  activeTabId: entry.tab.id,
5819
- focused: true,
5820
5819
  isEmpty: false,
5820
+ isFocused: true,
5821
5821
  tabs: [getRestoredTab(entry.tab)]
5822
5822
  };
5823
5823
  };
@@ -5843,7 +5843,7 @@ const restoreIntoRecreatedGroup = (state, entry) => {
5843
5843
  const groupIndex = clampIndex(entry.groupIndex, 0, groups.length);
5844
5844
  const unfocusedGroups = groups.map(group => ({
5845
5845
  ...group,
5846
- focused: false
5846
+ isFocused: false
5847
5847
  }));
5848
5848
  const insertedGroups = [...unfocusedGroups.slice(0, groupIndex), restoredGroup, ...unfocusedGroups.slice(groupIndex)];
5849
5849
  return {
@@ -5936,7 +5936,7 @@ const splitOnlyGroup = (state, groups, groupId, newGroupId, direction, splitLayo
5936
5936
  return {
5937
5937
  ...group,
5938
5938
  direction: splitLayoutDirection,
5939
- focused: false,
5939
+ isFocused: false,
5940
5940
  size: 50
5941
5941
  };
5942
5942
  }
@@ -5963,7 +5963,7 @@ const splitWithinMatchingNestedDirection = (state, groups, sourceGroup, groupId,
5963
5963
  if (group.id === groupId) {
5964
5964
  return {
5965
5965
  ...group,
5966
- focused: false,
5966
+ isFocused: false,
5967
5967
  size: Number((group.size / 2).toFixed(6))
5968
5968
  };
5969
5969
  }
@@ -5986,7 +5986,7 @@ const splitStandaloneSourceIntoNestedDirection = (state, groups, sourceGroup, gr
5986
5986
  const updatedSourceGroup = {
5987
5987
  ...sourceGroup,
5988
5988
  direction: splitLayoutDirection,
5989
- focused: false,
5989
+ isFocused: false,
5990
5990
  segmentId,
5991
5991
  size: halfSize
5992
5992
  };
@@ -6006,7 +6006,7 @@ const splitAtRootLevel = (state, groups, groupId, newGroupId, direction, baseNew
6006
6006
  return {
6007
6007
  ...group,
6008
6008
  direction: state.layout.direction,
6009
- focused: false,
6009
+ isFocused: false,
6010
6010
  size: 50
6011
6011
  };
6012
6012
  }
@@ -6040,9 +6040,9 @@ const splitEditorGroup = (state, groupId, direction) => {
6040
6040
  const baseNewGroup = {
6041
6041
  activeTabId: -1,
6042
6042
  direction: sourceGroup.direction,
6043
- focused: true,
6044
6043
  id: newGroupId,
6045
6044
  isEmpty: true,
6045
+ isFocused: true,
6046
6046
  size: sourceGroup.size / 2,
6047
6047
  tabs: []
6048
6048
  };
@@ -6564,9 +6564,9 @@ const splitDown = (state, groupId) => {
6564
6564
  const initialGroup = {
6565
6565
  activeTabId: -1,
6566
6566
  direction,
6567
- focused: true,
6568
6567
  id: initialGroupId,
6569
6568
  isEmpty: true,
6569
+ isFocused: true,
6570
6570
  size: 100,
6571
6571
  tabs: []
6572
6572
  };
@@ -6601,9 +6601,9 @@ const splitLeft = (state, groupId) => {
6601
6601
  const initialGroup = {
6602
6602
  activeTabId: -1,
6603
6603
  direction,
6604
- focused: true,
6605
6604
  id: initialGroupId,
6606
6605
  isEmpty: true,
6606
+ isFocused: true,
6607
6607
  size: 100,
6608
6608
  tabs: []
6609
6609
  };
@@ -6637,9 +6637,9 @@ const splitRight = (state, groupId) => {
6637
6637
  const initialGroup = {
6638
6638
  activeTabId: -1,
6639
6639
  direction,
6640
- focused: true,
6641
6640
  id: initialGroupId,
6642
6641
  isEmpty: true,
6642
+ isFocused: true,
6643
6643
  size: 100,
6644
6644
  tabs: []
6645
6645
  };
@@ -6671,9 +6671,9 @@ const splitUp = (state, groupId) => {
6671
6671
  const initialGroup = {
6672
6672
  activeTabId: -1,
6673
6673
  direction,
6674
- focused: true,
6675
6674
  id: initialGroupId,
6676
6675
  isEmpty: true,
6676
+ isFocused: true,
6677
6677
  size: 100,
6678
6678
  tabs: []
6679
6679
  };
@@ -6915,7 +6915,7 @@ const newFile = async state => {
6915
6915
  } = layout;
6916
6916
 
6917
6917
  // Find the active group
6918
- const activeGroup = activeGroupId === -1 ? groups.find(group => group.focused) : groups.find(group => group.id === activeGroupId);
6918
+ const activeGroup = activeGroupId === -1 ? groups.find(group => group.isFocused) : groups.find(group => group.id === activeGroupId);
6919
6919
 
6920
6920
  // Prepare initial state
6921
6921
  let newState = state;
@@ -7632,7 +7632,7 @@ const isValidTab = tab => {
7632
7632
  };
7633
7633
 
7634
7634
  const isValidEditorGroup = group => {
7635
- return group && typeof group.id === 'number' && Array.isArray(group.tabs) && group.tabs.every(isValidTab) && typeof group.activeTabId === 'number' && isLayoutDirection(group.direction) && typeof group.focused === 'boolean' && (group.segmentId === undefined || typeof group.segmentId === 'number') && typeof group.size === 'number' && group.size > 0 && typeof group.isEmpty === 'boolean';
7635
+ return group && typeof group.id === 'number' && Array.isArray(group.tabs) && group.tabs.every(isValidTab) && typeof group.activeTabId === 'number' && isLayoutDirection(group.direction) && typeof group.isFocused === 'boolean' && (group.segmentId === undefined || typeof group.segmentId === 'number') && typeof group.size === 'number' && group.size > 0 && typeof group.isEmpty === 'boolean';
7636
7636
  };
7637
7637
 
7638
7638
  const isValidMainAreaLayout = layout => {
@@ -7705,10 +7705,15 @@ const tryRestoreLayout = savedState => {
7705
7705
  direction: layoutDirection,
7706
7706
  groups: rawLayout.groups.map(group => {
7707
7707
  const groupDirection = normalizeGroupDirection(group, layoutDirection);
7708
+ const {
7709
+ focused: legacyIsFocused,
7710
+ ...groupWithoutLegacyFocus
7711
+ } = group ?? {};
7708
7712
  return {
7709
- ...group,
7713
+ ...groupWithoutLegacyFocus,
7710
7714
  activeTabId: group?.activeTabId === undefined ? -1 : group.activeTabId,
7711
7715
  direction: groupDirection,
7716
+ isFocused: typeof group?.isFocused === 'boolean' ? group.isFocused : legacyIsFocused,
7712
7717
  tabs: Array.isArray(group?.tabs) ? group.tabs.map(normalizeRestoredTab) : []
7713
7718
  };
7714
7719
  })
@@ -8885,9 +8890,9 @@ const createEmptyGroup = direction => {
8885
8890
  return {
8886
8891
  activeTabId: -1,
8887
8892
  direction,
8888
- focused: false,
8889
8893
  id: create$2(),
8890
8894
  isEmpty: true,
8895
+ isFocused: false,
8891
8896
  size: 100,
8892
8897
  tabs: []
8893
8898
  };
@@ -8897,7 +8902,7 @@ const getActiveGroupIndex = (groups, activeGroupId) => {
8897
8902
  if (activeIndex !== -1) {
8898
8903
  return activeIndex;
8899
8904
  }
8900
- const focusedIndex = groups.findIndex(group => group.focused);
8905
+ const focusedIndex = groups.findIndex(group => group.isFocused);
8901
8906
  if (focusedIndex !== -1) {
8902
8907
  return focusedIndex;
8903
8908
  }
@@ -8950,11 +8955,11 @@ const setEditorLayout = (state, direction, slots) => {
8950
8955
  const activeIndex = originalActiveIndex >= slots.length ? slots.length - 1 : getActiveGroupIndex(groups, activeGroupId);
8951
8956
  const nextGroups = groups.map((group, index) => {
8952
8957
  const slot = slots[index];
8953
- const focused = index === activeIndex;
8958
+ const isFocused = index === activeIndex;
8954
8959
  return {
8955
8960
  ...group,
8956
8961
  direction: slot.direction,
8957
- focused,
8962
+ isFocused,
8958
8963
  segmentId: slot.segmentId,
8959
8964
  size: slot.size
8960
8965
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.67.1",
3
+ "version": "9.67.2",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",