@lvce-editor/main-area-worker 9.71.1 → 9.71.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.
@@ -3992,6 +3992,7 @@ const HandleTabsWheel = 30;
3992
3992
  const HandleTabDragOver = 31;
3993
3993
  const HandleTabsDragOver = 32;
3994
3994
  const HandleFocus = 33;
3995
+ const HandleGroupMouseDown = 34;
3995
3996
 
3996
3997
  const dragOverlayVirtualDom = {
3997
3998
  childCount: 0,
@@ -4668,6 +4669,7 @@ const renderEditorGroup = (group, groupIndex, splitButtonEnabled = false, closeB
4668
4669
  childCount: 2,
4669
4670
  className: mergeClassNames(EditorGroup, getEditorGroupClassName(group.id)),
4670
4671
  'data-groupId': String(group.id),
4672
+ onMouseDown: HandleGroupMouseDown,
4671
4673
  type: Div
4672
4674
  }, ...renderEditorGroupHeader(group, groupIndex, splitButtonEnabled, tabDropIndicator), editorContainerNode, ...renderEditor(activeTab)];
4673
4675
  };
@@ -4905,14 +4907,22 @@ const parseRawGroupId = rawGroupId => {
4905
4907
  return Number.isNaN(groupId) ? undefined : groupId;
4906
4908
  };
4907
4909
 
4908
- const handleClick = async (state, name) => {
4910
+ const handleClick = (state, name) => {
4909
4911
  const groupId = parseRawGroupId(name);
4910
4912
  if (groupId === undefined) {
4911
4913
  return state;
4912
4914
  }
4913
4915
  const hasGroup = state.layout.groups.some(group => group.id === groupId);
4916
+ // Empty-group focus must publish a fresh layout even when this group is already active.
4914
4917
  return hasGroup ? focusEditorGroup(state, groupId) : state;
4915
4918
  };
4919
+ const handleGroupMouseDown = async (context, name) => {
4920
+ const groupId = parseRawGroupId(name);
4921
+ await context.updateState(state => state.layout.activeGroupId === groupId ? state : handleClick(state, name));
4922
+ };
4923
+ const handleClickWithContext = async (context, name) => {
4924
+ await context.updateState(state => handleClick(state, name));
4925
+ };
4916
4926
 
4917
4927
  const getActiveGroup = (groups, activeGroupId) => {
4918
4928
  return groups.find(g => g.id === activeGroupId);
@@ -6908,7 +6918,7 @@ const moveTabToGroup = (state, sourceGroupId, targetGroupId, tabId, targetIndex)
6908
6918
  }
6909
6919
  return group;
6910
6920
  });
6911
- return {
6921
+ const nextState = {
6912
6922
  ...state,
6913
6923
  layout: {
6914
6924
  ...layout,
@@ -6916,6 +6926,11 @@ const moveTabToGroup = (state, sourceGroupId, targetGroupId, tabId, targetIndex)
6916
6926
  groups: updatedGroups
6917
6927
  }
6918
6928
  };
6929
+ const updatedSourceGroup = updatedGroups.find(group => group.id === sourceGroupId);
6930
+ if (updatedSourceGroup?.tabs.length === 0) {
6931
+ return closeEditorGroup$1(nextState, sourceGroupId);
6932
+ }
6933
+ return nextState;
6919
6934
  };
6920
6935
 
6921
6936
  const getOpenTabCount = state => {
@@ -8822,6 +8837,9 @@ const renderEventListeners = () => {
8822
8837
  }, {
8823
8838
  name: HandleFocus,
8824
8839
  params: ['handleClick', 'event.target.dataset.groupId']
8840
+ }, {
8841
+ name: HandleGroupMouseDown,
8842
+ params: ['handleGroupMouseDown', 'event.currentTarget.dataset.groupId']
8825
8843
  }, {
8826
8844
  name: HandleClickClose,
8827
8845
  params: ['handleClickCloseTab', 'event.currentTarget.dataset.groupIndex', 'event.currentTarget.dataset.index'],
@@ -9483,7 +9501,7 @@ const commandMap = {
9483
9501
  'MainArea.getComponentState': getComponentState,
9484
9502
  'MainArea.getMenuEntries': wrapGetter(getMenuEntries),
9485
9503
  'MainArea.getMenuIds': getMenuIds,
9486
- 'MainArea.handleClick': wrapSerialCommand(handleClick),
9504
+ 'MainArea.handleClick': wrapSerialAsyncCommand(handleClickWithContext),
9487
9505
  'MainArea.handleClickAction': wrapSerialCommand(handleClickAction),
9488
9506
  'MainArea.handleClickCloseTab': wrapSerialCommand(handleClickCloseTab),
9489
9507
  'MainArea.handleClickTab': wrapSerialCommand(handleClickTab),
@@ -9495,6 +9513,7 @@ const commandMap = {
9495
9513
  'MainArea.handleDragOver': wrapSerialCommand(handleDragOver),
9496
9514
  'MainArea.handleDragStart': wrapSerialCommand(handleDragStart),
9497
9515
  'MainArea.handleDrop': wrapSerialAsyncCommand(handleDrop),
9516
+ 'MainArea.handleGroupMouseDown': wrapSerialAsyncCommand(handleGroupMouseDown),
9498
9517
  'MainArea.handleHeaderDoubleClick': wrapSerialCommand(handleHeaderDoubleClick),
9499
9518
  'MainArea.handleIconThemeChange': wrapSerialCommand(handleIconThemeChange),
9500
9519
  'MainArea.handleMessagePort': handleDirectMessagePort,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.71.1",
3
+ "version": "9.71.3",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",