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

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
  });
@@ -3841,6 +3841,7 @@ const MaskIconClose = 'MaskIcon MaskIconClose';
3841
3841
  const MaskIconExtensions = 'MaskIcon MaskIconExtensions';
3842
3842
  const MaskIconRecordKey = 'MaskIcon MaskIconRecordKey';
3843
3843
  const MaskIconSearch = 'MaskIcon MaskIconSearch';
3844
+ const MaskIconSettingsGear = 'MaskIcon MaskIconSettingsGear';
3844
3845
  const TextEditor = 'TextEditor';
3845
3846
  const TextEditorLoading = 'TextEditor TextEditor--loading';
3846
3847
  const EditorContentLoading = 'EditorContent EditorContent--loading';
@@ -4320,6 +4321,7 @@ const ExtensionDetailScheme = 'extension-detail://';
4320
4321
  const KeyBindingsUri = 'app://keybindings';
4321
4322
  const RunningExtensionsScheme = 'running-extensions://';
4322
4323
  const SearchEditorScheme = 'search-editor://';
4324
+ const SettingsScheme = 'settings://';
4323
4325
  const tabIconNode = {
4324
4326
  childCount: 1,
4325
4327
  className: TabIcon,
@@ -4351,6 +4353,9 @@ const renderTabIcon = tab => {
4351
4353
  if (tab.uri?.startsWith(SearchEditorScheme)) {
4352
4354
  return renderMaskIcon(MaskIconSearch);
4353
4355
  }
4356
+ if (tab.uri?.startsWith(SettingsScheme)) {
4357
+ return renderMaskIcon(MaskIconSettingsGear);
4358
+ }
4354
4359
  if (!tab.icon) {
4355
4360
  return [];
4356
4361
  }
@@ -4787,7 +4792,7 @@ const focusEditorGroup = (state, groupId) => {
4787
4792
  } = layout;
4788
4793
  const updatedGroups = groups.map(group => ({
4789
4794
  ...group,
4790
- focused: group.id === groupId
4795
+ isFocused: group.id === groupId
4791
4796
  }));
4792
4797
  return {
4793
4798
  ...state,
@@ -4981,6 +4986,9 @@ const getFileIcon = uri => {
4981
4986
  if (uri.startsWith('search-editor://')) {
4982
4987
  return `MaskIconSearch`;
4983
4988
  }
4989
+ if (uri.startsWith('settings://')) {
4990
+ return `MaskIconSettingsGear`;
4991
+ }
4984
4992
  return '';
4985
4993
  };
4986
4994
 
@@ -5109,9 +5117,9 @@ const createEmptyGroup$1 = (state, uri, requestId, preview = false, title = getL
5109
5117
  const newGroup = {
5110
5118
  activeTabId: newTab.id,
5111
5119
  direction,
5112
- focused: true,
5113
5120
  id: groupId,
5114
5121
  isEmpty: false,
5122
+ isFocused: true,
5115
5123
  size: 100,
5116
5124
  tabs: [newTab]
5117
5125
  };
@@ -5166,7 +5174,7 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
5166
5174
  type: 'editor',
5167
5175
  uri
5168
5176
  };
5169
- // Find the active group (by activeGroupId or focused flag)
5177
+ // Find the active group (by activeGroupId or isFocused flag)
5170
5178
  const {
5171
5179
  homeDirUri,
5172
5180
  layout
@@ -5175,7 +5183,7 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
5175
5183
  activeGroupId,
5176
5184
  groups
5177
5185
  } = layout;
5178
- const activeGroup = activeGroupId === -1 ? groups.find(group => group.focused) : groups.find(group => group.id === activeGroupId);
5186
+ const activeGroup = activeGroupId === -1 ? groups.find(group => group.isFocused) : groups.find(group => group.id === activeGroupId);
5179
5187
 
5180
5188
  // Generate a request ID for content loading
5181
5189
  const requestId = getNextRequestId();
@@ -5479,7 +5487,7 @@ const getActivePreviewEditorUid = state => {
5479
5487
  activeGroupId,
5480
5488
  groups
5481
5489
  } = layout;
5482
- const activeGroup = activeGroupId === -1 ? groups.find(group => group.focused) : groups.find(group => group.id === activeGroupId);
5490
+ const activeGroup = activeGroupId === -1 ? groups.find(group => group.isFocused) : groups.find(group => group.id === activeGroupId);
5483
5491
  const activeTab = activeGroup?.tabs.find(tab => tab.id === activeGroup.activeTabId);
5484
5492
  return activeTab?.isPreview ? activeTab.editorUid : -1;
5485
5493
  };
@@ -5712,12 +5720,12 @@ const focusGroup = (groups, groupId, activeTabId) => {
5712
5720
  return {
5713
5721
  ...group,
5714
5722
  activeTabId,
5715
- focused: true
5723
+ isFocused: true
5716
5724
  };
5717
5725
  }
5718
5726
  return {
5719
5727
  ...group,
5720
- focused: false
5728
+ isFocused: false
5721
5729
  };
5722
5730
  });
5723
5731
  };
@@ -5789,14 +5797,14 @@ const restoreIntoExistingGroup = (state, entry) => {
5789
5797
  return {
5790
5798
  ...currentGroup,
5791
5799
  activeTabId: restoredTab.id,
5792
- focused: true,
5793
5800
  isEmpty: false,
5801
+ isFocused: true,
5794
5802
  tabs
5795
5803
  };
5796
5804
  }
5797
5805
  return {
5798
5806
  ...currentGroup,
5799
- focused: false
5807
+ isFocused: false
5800
5808
  };
5801
5809
  });
5802
5810
  return {
@@ -5816,8 +5824,8 @@ const createRestoredGroup = entry => {
5816
5824
  return {
5817
5825
  ...entry.group,
5818
5826
  activeTabId: entry.tab.id,
5819
- focused: true,
5820
5827
  isEmpty: false,
5828
+ isFocused: true,
5821
5829
  tabs: [getRestoredTab(entry.tab)]
5822
5830
  };
5823
5831
  };
@@ -5843,7 +5851,7 @@ const restoreIntoRecreatedGroup = (state, entry) => {
5843
5851
  const groupIndex = clampIndex(entry.groupIndex, 0, groups.length);
5844
5852
  const unfocusedGroups = groups.map(group => ({
5845
5853
  ...group,
5846
- focused: false
5854
+ isFocused: false
5847
5855
  }));
5848
5856
  const insertedGroups = [...unfocusedGroups.slice(0, groupIndex), restoredGroup, ...unfocusedGroups.slice(groupIndex)];
5849
5857
  return {
@@ -5936,7 +5944,7 @@ const splitOnlyGroup = (state, groups, groupId, newGroupId, direction, splitLayo
5936
5944
  return {
5937
5945
  ...group,
5938
5946
  direction: splitLayoutDirection,
5939
- focused: false,
5947
+ isFocused: false,
5940
5948
  size: 50
5941
5949
  };
5942
5950
  }
@@ -5963,7 +5971,7 @@ const splitWithinMatchingNestedDirection = (state, groups, sourceGroup, groupId,
5963
5971
  if (group.id === groupId) {
5964
5972
  return {
5965
5973
  ...group,
5966
- focused: false,
5974
+ isFocused: false,
5967
5975
  size: Number((group.size / 2).toFixed(6))
5968
5976
  };
5969
5977
  }
@@ -5986,7 +5994,7 @@ const splitStandaloneSourceIntoNestedDirection = (state, groups, sourceGroup, gr
5986
5994
  const updatedSourceGroup = {
5987
5995
  ...sourceGroup,
5988
5996
  direction: splitLayoutDirection,
5989
- focused: false,
5997
+ isFocused: false,
5990
5998
  segmentId,
5991
5999
  size: halfSize
5992
6000
  };
@@ -6006,7 +6014,7 @@ const splitAtRootLevel = (state, groups, groupId, newGroupId, direction, baseNew
6006
6014
  return {
6007
6015
  ...group,
6008
6016
  direction: state.layout.direction,
6009
- focused: false,
6017
+ isFocused: false,
6010
6018
  size: 50
6011
6019
  };
6012
6020
  }
@@ -6040,9 +6048,9 @@ const splitEditorGroup = (state, groupId, direction) => {
6040
6048
  const baseNewGroup = {
6041
6049
  activeTabId: -1,
6042
6050
  direction: sourceGroup.direction,
6043
- focused: true,
6044
6051
  id: newGroupId,
6045
6052
  isEmpty: true,
6053
+ isFocused: true,
6046
6054
  size: sourceGroup.size / 2,
6047
6055
  tabs: []
6048
6056
  };
@@ -6564,9 +6572,9 @@ const splitDown = (state, groupId) => {
6564
6572
  const initialGroup = {
6565
6573
  activeTabId: -1,
6566
6574
  direction,
6567
- focused: true,
6568
6575
  id: initialGroupId,
6569
6576
  isEmpty: true,
6577
+ isFocused: true,
6570
6578
  size: 100,
6571
6579
  tabs: []
6572
6580
  };
@@ -6601,9 +6609,9 @@ const splitLeft = (state, groupId) => {
6601
6609
  const initialGroup = {
6602
6610
  activeTabId: -1,
6603
6611
  direction,
6604
- focused: true,
6605
6612
  id: initialGroupId,
6606
6613
  isEmpty: true,
6614
+ isFocused: true,
6607
6615
  size: 100,
6608
6616
  tabs: []
6609
6617
  };
@@ -6637,9 +6645,9 @@ const splitRight = (state, groupId) => {
6637
6645
  const initialGroup = {
6638
6646
  activeTabId: -1,
6639
6647
  direction,
6640
- focused: true,
6641
6648
  id: initialGroupId,
6642
6649
  isEmpty: true,
6650
+ isFocused: true,
6643
6651
  size: 100,
6644
6652
  tabs: []
6645
6653
  };
@@ -6671,9 +6679,9 @@ const splitUp = (state, groupId) => {
6671
6679
  const initialGroup = {
6672
6680
  activeTabId: -1,
6673
6681
  direction,
6674
- focused: true,
6675
6682
  id: initialGroupId,
6676
6683
  isEmpty: true,
6684
+ isFocused: true,
6677
6685
  size: 100,
6678
6686
  tabs: []
6679
6687
  };
@@ -6915,7 +6923,7 @@ const newFile = async state => {
6915
6923
  } = layout;
6916
6924
 
6917
6925
  // Find the active group
6918
- const activeGroup = activeGroupId === -1 ? groups.find(group => group.focused) : groups.find(group => group.id === activeGroupId);
6926
+ const activeGroup = activeGroupId === -1 ? groups.find(group => group.isFocused) : groups.find(group => group.id === activeGroupId);
6919
6927
 
6920
6928
  // Prepare initial state
6921
6929
  let newState = state;
@@ -7632,7 +7640,7 @@ const isValidTab = tab => {
7632
7640
  };
7633
7641
 
7634
7642
  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';
7643
+ 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
7644
  };
7637
7645
 
7638
7646
  const isValidMainAreaLayout = layout => {
@@ -7705,10 +7713,15 @@ const tryRestoreLayout = savedState => {
7705
7713
  direction: layoutDirection,
7706
7714
  groups: rawLayout.groups.map(group => {
7707
7715
  const groupDirection = normalizeGroupDirection(group, layoutDirection);
7716
+ const {
7717
+ focused: legacyIsFocused,
7718
+ ...groupWithoutLegacyFocus
7719
+ } = group ?? {};
7708
7720
  return {
7709
- ...group,
7721
+ ...groupWithoutLegacyFocus,
7710
7722
  activeTabId: group?.activeTabId === undefined ? -1 : group.activeTabId,
7711
7723
  direction: groupDirection,
7724
+ isFocused: typeof group?.isFocused === 'boolean' ? group.isFocused : legacyIsFocused,
7712
7725
  tabs: Array.isArray(group?.tabs) ? group.tabs.map(normalizeRestoredTab) : []
7713
7726
  };
7714
7727
  })
@@ -8885,9 +8898,9 @@ const createEmptyGroup = direction => {
8885
8898
  return {
8886
8899
  activeTabId: -1,
8887
8900
  direction,
8888
- focused: false,
8889
8901
  id: create$2(),
8890
8902
  isEmpty: true,
8903
+ isFocused: false,
8891
8904
  size: 100,
8892
8905
  tabs: []
8893
8906
  };
@@ -8897,7 +8910,7 @@ const getActiveGroupIndex = (groups, activeGroupId) => {
8897
8910
  if (activeIndex !== -1) {
8898
8911
  return activeIndex;
8899
8912
  }
8900
- const focusedIndex = groups.findIndex(group => group.focused);
8913
+ const focusedIndex = groups.findIndex(group => group.isFocused);
8901
8914
  if (focusedIndex !== -1) {
8902
8915
  return focusedIndex;
8903
8916
  }
@@ -8950,11 +8963,11 @@ const setEditorLayout = (state, direction, slots) => {
8950
8963
  const activeIndex = originalActiveIndex >= slots.length ? slots.length - 1 : getActiveGroupIndex(groups, activeGroupId);
8951
8964
  const nextGroups = groups.map((group, index) => {
8952
8965
  const slot = slots[index];
8953
- const focused = index === activeIndex;
8966
+ const isFocused = index === activeIndex;
8954
8967
  return {
8955
8968
  ...group,
8956
8969
  direction: slot.direction,
8957
- focused,
8970
+ isFocused,
8958
8971
  segmentId: slot.segmentId,
8959
8972
  size: slot.size
8960
8973
  };
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.3",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",