@lvce-editor/main-area-worker 9.71.2 → 9.72.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.
@@ -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);
@@ -8497,11 +8507,15 @@ const moveIntoNewWindow = async state => {
8497
8507
  return state;
8498
8508
  }
8499
8509
  const tab = group.tabs.find(tab => tab.id === activeTabId);
8500
- if (!tab?.uri) {
8510
+ if (!tab || tab.terminal) {
8501
8511
  return state;
8502
8512
  }
8503
- await invoke$3('ElectronWindow.openNewWithUri', tab.uri);
8504
- return closeTabAndSave(state, group.id, activeTabId);
8513
+ const editorInput = tab.editorInput ?? normalizeTabEditorInput(tab).editorInput;
8514
+ if (!editorInput) {
8515
+ return state;
8516
+ }
8517
+ await invoke$3('ElectronWindow.openNewWithEditorInput', editorInput, tab.editorUid, tab.isDirty);
8518
+ return closeTabWithViewlet(state, group.id, activeTabId);
8505
8519
  };
8506
8520
 
8507
8521
  const newWindow = async state => {
@@ -8827,6 +8841,9 @@ const renderEventListeners = () => {
8827
8841
  }, {
8828
8842
  name: HandleFocus,
8829
8843
  params: ['handleClick', 'event.target.dataset.groupId']
8844
+ }, {
8845
+ name: HandleGroupMouseDown,
8846
+ params: ['handleGroupMouseDown', 'event.currentTarget.dataset.groupId']
8830
8847
  }, {
8831
8848
  name: HandleClickClose,
8832
8849
  params: ['handleClickCloseTab', 'event.currentTarget.dataset.groupIndex', 'event.currentTarget.dataset.index'],
@@ -9488,7 +9505,7 @@ const commandMap = {
9488
9505
  'MainArea.getComponentState': getComponentState,
9489
9506
  'MainArea.getMenuEntries': wrapGetter(getMenuEntries),
9490
9507
  'MainArea.getMenuIds': getMenuIds,
9491
- 'MainArea.handleClick': wrapSerialCommand(handleClick),
9508
+ 'MainArea.handleClick': wrapSerialAsyncCommand(handleClickWithContext),
9492
9509
  'MainArea.handleClickAction': wrapSerialCommand(handleClickAction),
9493
9510
  'MainArea.handleClickCloseTab': wrapSerialCommand(handleClickCloseTab),
9494
9511
  'MainArea.handleClickTab': wrapSerialCommand(handleClickTab),
@@ -9500,6 +9517,7 @@ const commandMap = {
9500
9517
  'MainArea.handleDragOver': wrapSerialCommand(handleDragOver),
9501
9518
  'MainArea.handleDragStart': wrapSerialCommand(handleDragStart),
9502
9519
  'MainArea.handleDrop': wrapSerialAsyncCommand(handleDrop),
9520
+ 'MainArea.handleGroupMouseDown': wrapSerialAsyncCommand(handleGroupMouseDown),
9503
9521
  'MainArea.handleHeaderDoubleClick': wrapSerialCommand(handleHeaderDoubleClick),
9504
9522
  'MainArea.handleIconThemeChange': wrapSerialCommand(handleIconThemeChange),
9505
9523
  '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.2",
3
+ "version": "9.72.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",