dockview-core 8.3.0 → 8.3.1

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 8.3.0
3
+ * @version 8.3.1
4
4
  * @link https://github.com/dockview/dockview
5
5
  * @license MIT
6
6
  */
@@ -4454,8 +4454,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4454
4454
  for (const el of elements) {
4455
4455
  let current = el;
4456
4456
  while (current) {
4457
+ var _target$isHitTestTran;
4457
4458
  const target = this._targetByElement.get(current);
4458
- if (target) return target;
4459
+ if (target && !((_target$isHitTestTran = target.isHitTestTransparent) === null || _target$isHitTestTran === void 0 ? void 0 : _target$isHitTestTran.call(target))) return target;
4459
4460
  current = current.parentElement;
4460
4461
  }
4461
4462
  }
@@ -4551,10 +4552,14 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4551
4552
  element: this.element,
4552
4553
  handleDragOver: (e) => this._onDragOver(e),
4553
4554
  handleDragLeave: () => this._onDragLeave(),
4554
- handleDrop: (e) => this._onDropEvent(e)
4555
+ handleDrop: (e) => this._onDropEvent(e),
4556
+ isHitTestTransparent: options.isHitTestTransparent
4555
4557
  };
4556
4558
  this.addDisposables(this._onDrop, this._onWillShowOverlay, PointerDragController.getInstance().registerTarget(handle));
4557
4559
  }
4560
+ clearOverlay() {
4561
+ this._clearOwnOverlay();
4562
+ }
4558
4563
  setTargetZones(zones) {
4559
4564
  this._acceptedTargetZonesSet = new Set(zones);
4560
4565
  }
@@ -5874,6 +5879,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
5874
5879
  if (this.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
5875
5880
  var _this$accessor$option;
5876
5881
  if (((_this$accessor$option = this.accessor.options.theme) === null || _this$accessor$option === void 0 ? void 0 : _this$accessor$option.tabAnimation) === "smooth") return false;
5882
+ if (data.tabGroupId && this.group.model.getTabGroupForPanel(this.panel.id)) return false;
5877
5883
  return true;
5878
5884
  }
5879
5885
  return this.group.model.canDisplayOverlay(event, position, "tab");
@@ -7321,7 +7327,23 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7321
7327
  }
7322
7328
  updateDirection() {
7323
7329
  const isVertical = this._ctx.getDirection() === "vertical";
7324
- for (const [, entry] of this._chipRenderers) entry.dropTarget.setTargetZones(isVertical ? ["top"] : ["left"]);
7330
+ for (const [, entry] of this._chipRenderers) {
7331
+ const zones = isVertical ? ["top"] : ["left"];
7332
+ entry.dropTarget.setTargetZones(zones);
7333
+ entry.pointerDropTarget.setTargetZones(zones);
7334
+ }
7335
+ }
7336
+ /**
7337
+ * Drop any overlay the chips are showing. A group move is committed by a
7338
+ * capturing listener on the tabs list that stops the event, so the chip
7339
+ * target under the cursor never sees the drop that would clear its own.
7340
+ */
7341
+ clearChipDropOverlays() {
7342
+ for (const [, entry] of this._chipRenderers) {
7343
+ var _entry$dropTarget, _entry$pointerDropTar;
7344
+ (_entry$dropTarget = entry.dropTarget) === null || _entry$dropTarget === void 0 || _entry$dropTarget.clearOverlay();
7345
+ (_entry$pointerDropTar = entry.pointerDropTarget) === null || _entry$pointerDropTar === void 0 || _entry$pointerDropTar.clearOverlay();
7346
+ }
7325
7347
  }
7326
7348
  snapshotChipWidths() {
7327
7349
  const widths = /* @__PURE__ */ new Map();
@@ -7570,9 +7592,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7570
7592
  };
7571
7593
  if (chip instanceof TabGroupChip) disposables.push(chip.onContextMenu(onContextMenu));
7572
7594
  else disposables.push(new LongPressDetector(chip.element, { onLongPress: onContextMenu }), addDisposableListener(chip.element, "contextmenu", onContextMenu));
7573
- const isVertical = this._ctx.getDirection() === "vertical";
7574
- const dropTarget = new Droptarget(chip.element, {
7575
- acceptedTargetZones: isVertical ? ["top"] : ["left"],
7595
+ const dropTargetOptions = {
7596
+ acceptedTargetZones: this._ctx.getDirection() === "vertical" ? ["top"] : ["left"],
7576
7597
  overlayModel: { activationSize: {
7577
7598
  value: 100,
7578
7599
  type: "percentage"
@@ -7583,15 +7604,18 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7583
7604
  const data = getPanelData();
7584
7605
  if (this._ctx.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
7585
7606
  var _this$_ctx$accessor$o3;
7586
- if (((_this$_ctx$accessor$o3 = this._ctx.accessor.options.theme) === null || _this$_ctx$accessor$o3 === void 0 ? void 0 : _this$_ctx$accessor$o3.tabAnimation) === "smooth") return false;
7607
+ if (((_this$_ctx$accessor$o3 = this._ctx.accessor.options.theme) === null || _this$_ctx$accessor$o3 === void 0 ? void 0 : _this$_ctx$accessor$o3.tabAnimation) === "smooth" && !data.tabGroupId) return false;
7587
7608
  return true;
7588
7609
  }
7589
7610
  return this._ctx.group.model.canDisplayOverlay(event, position, "tab");
7590
7611
  }
7591
- });
7592
- disposables.push(dropTarget, dropTarget.onDrop((event) => {
7612
+ };
7613
+ const dropTarget = html5Backend.createDropTarget(chip.element, dropTargetOptions);
7614
+ const pointerDropTarget = pointerBackend.createDropTarget(chip.element, dropTargetOptions);
7615
+ const onDrop = (event) => {
7593
7616
  this._callbacks.onChipDrop(tabGroup, event);
7594
- }));
7617
+ };
7618
+ disposables.push(dropTarget, dropTarget.onDrop(onDrop), pointerDropTarget, pointerDropTarget.onDrop(onDrop));
7595
7619
  const disposable = new CompositeDisposable(...disposables);
7596
7620
  this._chipRenderers.set(tabGroup.id, {
7597
7621
  chip,
@@ -7599,7 +7623,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7599
7623
  pointerDragSource: dragSources.pointerDragSource,
7600
7624
  dragSourcesDisposable: dragSources.disposable,
7601
7625
  disposable,
7602
- dropTarget
7626
+ dropTarget,
7627
+ pointerDropTarget
7603
7628
  });
7604
7629
  if (tabGroup.collapsed) this._skipNextCollapseAnimation = true;
7605
7630
  }
@@ -7844,7 +7869,14 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7844
7869
  * dragover bridge may have installed.
7845
7870
  */
7846
7871
  handlePointerDragEnd(e) {
7847
- if (e && this._animState && this._animState.sourceIndex !== -1 && !this._animState.sourceTabGroupId && this._animState.currentInsertionIndex !== null && this.isPointInsideTabsList(e.clientX, e.clientY)) this.commitPointerReorder(e.pointerEvent);
7872
+ if (e && this._animState && this._animState.sourceIndex !== -1 && this._animState.currentInsertionIndex !== null && this.isPointInsideTabsList(e.clientX, e.clientY)) {
7873
+ const sourceTabGroupId = this._animState.sourceTabGroupId;
7874
+ if (sourceTabGroupId) {
7875
+ const insertionIndex = this._animState.currentInsertionIndex;
7876
+ this._animState = null;
7877
+ this.commitGroupMove(sourceTabGroupId, insertionIndex);
7878
+ } else this.commitPointerReorder(e.pointerEvent);
7879
+ }
7848
7880
  this._pointerInsideTabsList = false;
7849
7881
  this.resetDragAnimation();
7850
7882
  }
@@ -8480,6 +8512,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8480
8512
  commitGroupMove(sourceTabGroupId, insertionIndex) {
8481
8513
  const data = getPanelData();
8482
8514
  this._tabGroupManager.disposeChipDrag(sourceTabGroupId);
8515
+ this._tabGroupManager.clearChipDropOverlays();
8483
8516
  if (this.group.model.getTabGroups().some((tg) => tg.id === sourceTabGroupId)) {
8484
8517
  var _this$accessor$option3;
8485
8518
  if (((_this$accessor$option3 = this.accessor.options.theme) === null || _this$accessor$option3 === void 0 ? void 0 : _this$accessor$option3.tabAnimation) === "smooth") {
@@ -8837,7 +8870,16 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8837
8870
  }
8838
8871
  });
8839
8872
  this._reorder = new TabReorderController(this);
8840
- this.addDisposables(this._onOverflowTabsChange, this._observerDisposable, this._pointerActivation, this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._reorder, PointerDragController.getInstance().onDragEnd((e) => {
8873
+ const tabsListPointerTarget = pointerBackend.createDropTarget(this._tabsList, {
8874
+ acceptedTargetZones: ["center"],
8875
+ canDisplayOverlay: () => false,
8876
+ isHitTestTransparent: () => {
8877
+ const data = getPanelData();
8878
+ if ((data === null || data === void 0 ? void 0 : data.viewId) !== this.accessor.id || data.groupId !== this.group.id) return true;
8879
+ return data.panelId === null && !data.tabGroupId;
8880
+ }
8881
+ });
8882
+ this.addDisposables(tabsListPointerTarget, this._onOverflowTabsChange, this._observerDisposable, this._pointerActivation, this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._reorder, PointerDragController.getInstance().onDragEnd((e) => {
8841
8883
  this._reorder.handlePointerDragEnd(e);
8842
8884
  }), PointerDragController.getInstance().onDragMove((e) => {
8843
8885
  this._reorder.handlePointerDragMove(e.clientX, e.clientY);
@@ -9313,6 +9355,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
9313
9355
  * (when the source tab is currently to the left of the target slot, its
9314
9356
  * removal shifts the insertion index down by one). Always clears
9315
9357
  * `targetTabGroupId` so the dropped tab lands outside the group.
9358
+ *
9359
+ * A chip dropped on a chip is a group move: the panel path would route it
9360
+ * through the cross-group machinery, which rebuilds the tab group under a
9361
+ * new id.
9316
9362
  */
9317
9363
  _handleChipDrop(tabGroup, event) {
9318
9364
  const firstPanelId = tabGroup.panelIds[0];
@@ -9320,6 +9366,14 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
9320
9366
  const insertionIndex = this._tabs.findIndex((x) => x.value.panel.id === firstPanelId);
9321
9367
  if (insertionIndex === -1) return;
9322
9368
  const data = getPanelData();
9369
+ if (data === null || data === void 0 ? void 0 : data.tabGroupId) {
9370
+ var _animState$currentIns2;
9371
+ const animState = this._animState;
9372
+ this._animState = null;
9373
+ this._pendingCollapse = false;
9374
+ this._commitGroupMove(data.tabGroupId, (_animState$currentIns2 = animState === null || animState === void 0 ? void 0 : animState.currentInsertionIndex) !== null && _animState$currentIns2 !== void 0 ? _animState$currentIns2 : insertionIndex);
9375
+ return;
9376
+ }
9323
9377
  const sourceIndex = (data === null || data === void 0 ? void 0 : data.groupId) === this.group.id && (data === null || data === void 0 ? void 0 : data.panelId) ? this._tabs.findIndex((x) => x.value.panel.id === data.panelId) : -1;
9324
9378
  const adjustedIndex = insertionIndex - (sourceIndex !== -1 && sourceIndex < insertionIndex ? 1 : 0);
9325
9379
  this._onDrop.fire({
@@ -16397,10 +16451,11 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16397
16451
  group = this.createGroup();
16398
16452
  this._onDidAddGroup.fire(group);
16399
16453
  this.movingLock(() => this.removePanel(item, {
16400
- removeEmptyGroup: true,
16454
+ removeEmptyGroup: false,
16401
16455
  skipDispose: true,
16402
16456
  skipSetActiveGroup: true
16403
16457
  }));
16458
+ this.removeGroupIfEmpty(sourceGroup);
16404
16459
  this.movingLock(() => group.model.openPanel(item, { skipSetGroupActive: true }));
16405
16460
  movedPanels = [{
16406
16461
  panel: item,
@@ -16471,6 +16526,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16471
16526
  });
16472
16527
  for (const { panel, from } of movedPanels) this.fireDidMovePanel(panel, from);
16473
16528
  }
16529
+ removeGroupIfEmpty(group) {
16530
+ if (group.model.size === 0) this.doRemoveGroup(group, { skipActive: true });
16531
+ }
16474
16532
  /**
16475
16533
  * Build an empty gridview configured to match the main grid's styling, for
16476
16534
  * hosting a nested layout inside a floating or popout window.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 8.3.0
3
+ * @version 8.3.1
4
4
  * @link https://github.com/dockview/dockview
5
5
  * @license MIT
6
6
  */
@@ -4449,8 +4449,9 @@ var PointerDragController = class PointerDragController extends CompositeDisposa
4449
4449
  for (const el of elements) {
4450
4450
  let current = el;
4451
4451
  while (current) {
4452
+ var _target$isHitTestTran;
4452
4453
  const target = this._targetByElement.get(current);
4453
- if (target) return target;
4454
+ if (target && !((_target$isHitTestTran = target.isHitTestTransparent) === null || _target$isHitTestTran === void 0 ? void 0 : _target$isHitTestTran.call(target))) return target;
4454
4455
  current = current.parentElement;
4455
4456
  }
4456
4457
  }
@@ -4546,10 +4547,14 @@ var PointerDropTarget = class extends CompositeDisposable {
4546
4547
  element: this.element,
4547
4548
  handleDragOver: (e) => this._onDragOver(e),
4548
4549
  handleDragLeave: () => this._onDragLeave(),
4549
- handleDrop: (e) => this._onDropEvent(e)
4550
+ handleDrop: (e) => this._onDropEvent(e),
4551
+ isHitTestTransparent: options.isHitTestTransparent
4550
4552
  };
4551
4553
  this.addDisposables(this._onDrop, this._onWillShowOverlay, PointerDragController.getInstance().registerTarget(handle));
4552
4554
  }
4555
+ clearOverlay() {
4556
+ this._clearOwnOverlay();
4557
+ }
4553
4558
  setTargetZones(zones) {
4554
4559
  this._acceptedTargetZonesSet = new Set(zones);
4555
4560
  }
@@ -5869,6 +5874,7 @@ var Tab = class extends CompositeDisposable {
5869
5874
  if (this.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
5870
5875
  var _this$accessor$option;
5871
5876
  if (((_this$accessor$option = this.accessor.options.theme) === null || _this$accessor$option === void 0 ? void 0 : _this$accessor$option.tabAnimation) === "smooth") return false;
5877
+ if (data.tabGroupId && this.group.model.getTabGroupForPanel(this.panel.id)) return false;
5872
5878
  return true;
5873
5879
  }
5874
5880
  return this.group.model.canDisplayOverlay(event, position, "tab");
@@ -7316,7 +7322,23 @@ var TabGroupManager = class {
7316
7322
  }
7317
7323
  updateDirection() {
7318
7324
  const isVertical = this._ctx.getDirection() === "vertical";
7319
- for (const [, entry] of this._chipRenderers) entry.dropTarget.setTargetZones(isVertical ? ["top"] : ["left"]);
7325
+ for (const [, entry] of this._chipRenderers) {
7326
+ const zones = isVertical ? ["top"] : ["left"];
7327
+ entry.dropTarget.setTargetZones(zones);
7328
+ entry.pointerDropTarget.setTargetZones(zones);
7329
+ }
7330
+ }
7331
+ /**
7332
+ * Drop any overlay the chips are showing. A group move is committed by a
7333
+ * capturing listener on the tabs list that stops the event, so the chip
7334
+ * target under the cursor never sees the drop that would clear its own.
7335
+ */
7336
+ clearChipDropOverlays() {
7337
+ for (const [, entry] of this._chipRenderers) {
7338
+ var _entry$dropTarget, _entry$pointerDropTar;
7339
+ (_entry$dropTarget = entry.dropTarget) === null || _entry$dropTarget === void 0 || _entry$dropTarget.clearOverlay();
7340
+ (_entry$pointerDropTar = entry.pointerDropTarget) === null || _entry$pointerDropTar === void 0 || _entry$pointerDropTar.clearOverlay();
7341
+ }
7320
7342
  }
7321
7343
  snapshotChipWidths() {
7322
7344
  const widths = /* @__PURE__ */ new Map();
@@ -7565,9 +7587,8 @@ var TabGroupManager = class {
7565
7587
  };
7566
7588
  if (chip instanceof TabGroupChip) disposables.push(chip.onContextMenu(onContextMenu));
7567
7589
  else disposables.push(new LongPressDetector(chip.element, { onLongPress: onContextMenu }), addDisposableListener(chip.element, "contextmenu", onContextMenu));
7568
- const isVertical = this._ctx.getDirection() === "vertical";
7569
- const dropTarget = new Droptarget(chip.element, {
7570
- acceptedTargetZones: isVertical ? ["top"] : ["left"],
7590
+ const dropTargetOptions = {
7591
+ acceptedTargetZones: this._ctx.getDirection() === "vertical" ? ["top"] : ["left"],
7571
7592
  overlayModel: { activationSize: {
7572
7593
  value: 100,
7573
7594
  type: "percentage"
@@ -7578,15 +7599,18 @@ var TabGroupManager = class {
7578
7599
  const data = getPanelData();
7579
7600
  if (this._ctx.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
7580
7601
  var _this$_ctx$accessor$o3;
7581
- if (((_this$_ctx$accessor$o3 = this._ctx.accessor.options.theme) === null || _this$_ctx$accessor$o3 === void 0 ? void 0 : _this$_ctx$accessor$o3.tabAnimation) === "smooth") return false;
7602
+ if (((_this$_ctx$accessor$o3 = this._ctx.accessor.options.theme) === null || _this$_ctx$accessor$o3 === void 0 ? void 0 : _this$_ctx$accessor$o3.tabAnimation) === "smooth" && !data.tabGroupId) return false;
7582
7603
  return true;
7583
7604
  }
7584
7605
  return this._ctx.group.model.canDisplayOverlay(event, position, "tab");
7585
7606
  }
7586
- });
7587
- disposables.push(dropTarget, dropTarget.onDrop((event) => {
7607
+ };
7608
+ const dropTarget = html5Backend.createDropTarget(chip.element, dropTargetOptions);
7609
+ const pointerDropTarget = pointerBackend.createDropTarget(chip.element, dropTargetOptions);
7610
+ const onDrop = (event) => {
7588
7611
  this._callbacks.onChipDrop(tabGroup, event);
7589
- }));
7612
+ };
7613
+ disposables.push(dropTarget, dropTarget.onDrop(onDrop), pointerDropTarget, pointerDropTarget.onDrop(onDrop));
7590
7614
  const disposable = new CompositeDisposable(...disposables);
7591
7615
  this._chipRenderers.set(tabGroup.id, {
7592
7616
  chip,
@@ -7594,7 +7618,8 @@ var TabGroupManager = class {
7594
7618
  pointerDragSource: dragSources.pointerDragSource,
7595
7619
  dragSourcesDisposable: dragSources.disposable,
7596
7620
  disposable,
7597
- dropTarget
7621
+ dropTarget,
7622
+ pointerDropTarget
7598
7623
  });
7599
7624
  if (tabGroup.collapsed) this._skipNextCollapseAnimation = true;
7600
7625
  }
@@ -7839,7 +7864,14 @@ var TabReorderController = class extends CompositeDisposable {
7839
7864
  * dragover bridge may have installed.
7840
7865
  */
7841
7866
  handlePointerDragEnd(e) {
7842
- if (e && this._animState && this._animState.sourceIndex !== -1 && !this._animState.sourceTabGroupId && this._animState.currentInsertionIndex !== null && this.isPointInsideTabsList(e.clientX, e.clientY)) this.commitPointerReorder(e.pointerEvent);
7867
+ if (e && this._animState && this._animState.sourceIndex !== -1 && this._animState.currentInsertionIndex !== null && this.isPointInsideTabsList(e.clientX, e.clientY)) {
7868
+ const sourceTabGroupId = this._animState.sourceTabGroupId;
7869
+ if (sourceTabGroupId) {
7870
+ const insertionIndex = this._animState.currentInsertionIndex;
7871
+ this._animState = null;
7872
+ this.commitGroupMove(sourceTabGroupId, insertionIndex);
7873
+ } else this.commitPointerReorder(e.pointerEvent);
7874
+ }
7843
7875
  this._pointerInsideTabsList = false;
7844
7876
  this.resetDragAnimation();
7845
7877
  }
@@ -8475,6 +8507,7 @@ var TabReorderController = class extends CompositeDisposable {
8475
8507
  commitGroupMove(sourceTabGroupId, insertionIndex) {
8476
8508
  const data = getPanelData();
8477
8509
  this._tabGroupManager.disposeChipDrag(sourceTabGroupId);
8510
+ this._tabGroupManager.clearChipDropOverlays();
8478
8511
  if (this.group.model.getTabGroups().some((tg) => tg.id === sourceTabGroupId)) {
8479
8512
  var _this$accessor$option3;
8480
8513
  if (((_this$accessor$option3 = this.accessor.options.theme) === null || _this$accessor$option3 === void 0 ? void 0 : _this$accessor$option3.tabAnimation) === "smooth") {
@@ -8832,7 +8865,16 @@ var Tabs = class extends CompositeDisposable {
8832
8865
  }
8833
8866
  });
8834
8867
  this._reorder = new TabReorderController(this);
8835
- this.addDisposables(this._onOverflowTabsChange, this._observerDisposable, this._pointerActivation, this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._reorder, PointerDragController.getInstance().onDragEnd((e) => {
8868
+ const tabsListPointerTarget = pointerBackend.createDropTarget(this._tabsList, {
8869
+ acceptedTargetZones: ["center"],
8870
+ canDisplayOverlay: () => false,
8871
+ isHitTestTransparent: () => {
8872
+ const data = getPanelData();
8873
+ if ((data === null || data === void 0 ? void 0 : data.viewId) !== this.accessor.id || data.groupId !== this.group.id) return true;
8874
+ return data.panelId === null && !data.tabGroupId;
8875
+ }
8876
+ });
8877
+ this.addDisposables(tabsListPointerTarget, this._onOverflowTabsChange, this._observerDisposable, this._pointerActivation, this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._reorder, PointerDragController.getInstance().onDragEnd((e) => {
8836
8878
  this._reorder.handlePointerDragEnd(e);
8837
8879
  }), PointerDragController.getInstance().onDragMove((e) => {
8838
8880
  this._reorder.handlePointerDragMove(e.clientX, e.clientY);
@@ -9308,6 +9350,10 @@ var Tabs = class extends CompositeDisposable {
9308
9350
  * (when the source tab is currently to the left of the target slot, its
9309
9351
  * removal shifts the insertion index down by one). Always clears
9310
9352
  * `targetTabGroupId` so the dropped tab lands outside the group.
9353
+ *
9354
+ * A chip dropped on a chip is a group move: the panel path would route it
9355
+ * through the cross-group machinery, which rebuilds the tab group under a
9356
+ * new id.
9311
9357
  */
9312
9358
  _handleChipDrop(tabGroup, event) {
9313
9359
  const firstPanelId = tabGroup.panelIds[0];
@@ -9315,6 +9361,14 @@ var Tabs = class extends CompositeDisposable {
9315
9361
  const insertionIndex = this._tabs.findIndex((x) => x.value.panel.id === firstPanelId);
9316
9362
  if (insertionIndex === -1) return;
9317
9363
  const data = getPanelData();
9364
+ if (data === null || data === void 0 ? void 0 : data.tabGroupId) {
9365
+ var _animState$currentIns2;
9366
+ const animState = this._animState;
9367
+ this._animState = null;
9368
+ this._pendingCollapse = false;
9369
+ this._commitGroupMove(data.tabGroupId, (_animState$currentIns2 = animState === null || animState === void 0 ? void 0 : animState.currentInsertionIndex) !== null && _animState$currentIns2 !== void 0 ? _animState$currentIns2 : insertionIndex);
9370
+ return;
9371
+ }
9318
9372
  const sourceIndex = (data === null || data === void 0 ? void 0 : data.groupId) === this.group.id && (data === null || data === void 0 ? void 0 : data.panelId) ? this._tabs.findIndex((x) => x.value.panel.id === data.panelId) : -1;
9319
9373
  const adjustedIndex = insertionIndex - (sourceIndex !== -1 && sourceIndex < insertionIndex ? 1 : 0);
9320
9374
  this._onDrop.fire({
@@ -16392,10 +16446,11 @@ var DockviewComponent = class extends BaseGrid {
16392
16446
  group = this.createGroup();
16393
16447
  this._onDidAddGroup.fire(group);
16394
16448
  this.movingLock(() => this.removePanel(item, {
16395
- removeEmptyGroup: true,
16449
+ removeEmptyGroup: false,
16396
16450
  skipDispose: true,
16397
16451
  skipSetActiveGroup: true
16398
16452
  }));
16453
+ this.removeGroupIfEmpty(sourceGroup);
16399
16454
  this.movingLock(() => group.model.openPanel(item, { skipSetGroupActive: true }));
16400
16455
  movedPanels = [{
16401
16456
  panel: item,
@@ -16466,6 +16521,9 @@ var DockviewComponent = class extends BaseGrid {
16466
16521
  });
16467
16522
  for (const { panel, from } of movedPanels) this.fireDidMovePanel(panel, from);
16468
16523
  }
16524
+ removeGroupIfEmpty(group) {
16525
+ if (group.model.size === 0) this.doRemoveGroup(group, { skipActive: true });
16526
+ }
16469
16527
  /**
16470
16528
  * Build an empty gridview configured to match the main grid's styling, for
16471
16529
  * hosting a nested layout inside a floating or popout window.