dockview-core 4.4.1 → 4.6.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.
Files changed (56) hide show
  1. package/dist/cjs/api/component.api.d.ts +2 -1
  2. package/dist/cjs/api/dockviewGroupPanelApi.d.ts +4 -0
  3. package/dist/cjs/api/dockviewGroupPanelApi.js +4 -3
  4. package/dist/cjs/api/dockviewPanelApi.js +1 -0
  5. package/dist/cjs/dockview/components/titlebar/tabs.d.ts +1 -1
  6. package/dist/cjs/dockview/components/titlebar/tabs.js +2 -2
  7. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +1 -1
  8. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +6 -3
  9. package/dist/cjs/dockview/components/titlebar/voidContainer.js +3 -0
  10. package/dist/cjs/dockview/dockviewComponent.d.ts +4 -1
  11. package/dist/cjs/dockview/dockviewComponent.js +91 -7
  12. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +3 -24
  13. package/dist/cjs/dockview/dockviewGroupPanelModel.js +3 -65
  14. package/dist/cjs/dockview/events.d.ts +28 -0
  15. package/dist/cjs/dockview/events.js +66 -0
  16. package/dist/cjs/dockview/options.d.ts +2 -1
  17. package/dist/dockview-core.amd.js +141 -49
  18. package/dist/dockview-core.amd.js.map +1 -1
  19. package/dist/dockview-core.amd.min.js +2 -2
  20. package/dist/dockview-core.amd.min.js.map +1 -1
  21. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  22. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  23. package/dist/dockview-core.amd.noStyle.js +140 -48
  24. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  25. package/dist/dockview-core.cjs.js +141 -49
  26. package/dist/dockview-core.cjs.js.map +1 -1
  27. package/dist/dockview-core.esm.js +142 -49
  28. package/dist/dockview-core.esm.js.map +1 -1
  29. package/dist/dockview-core.esm.min.js +2 -2
  30. package/dist/dockview-core.esm.min.js.map +1 -1
  31. package/dist/dockview-core.js +141 -49
  32. package/dist/dockview-core.js.map +1 -1
  33. package/dist/dockview-core.min.js +2 -2
  34. package/dist/dockview-core.min.js.map +1 -1
  35. package/dist/dockview-core.min.noStyle.js +2 -2
  36. package/dist/dockview-core.min.noStyle.js.map +1 -1
  37. package/dist/dockview-core.noStyle.js +140 -48
  38. package/dist/dockview-core.noStyle.js.map +1 -1
  39. package/dist/esm/api/component.api.d.ts +2 -1
  40. package/dist/esm/api/dockviewGroupPanelApi.d.ts +4 -0
  41. package/dist/esm/api/dockviewGroupPanelApi.js +4 -3
  42. package/dist/esm/api/dockviewPanelApi.js +1 -0
  43. package/dist/esm/dockview/components/titlebar/tabs.d.ts +1 -1
  44. package/dist/esm/dockview/components/titlebar/tabs.js +1 -1
  45. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +1 -1
  46. package/dist/esm/dockview/components/titlebar/tabsContainer.js +5 -2
  47. package/dist/esm/dockview/components/titlebar/voidContainer.js +3 -0
  48. package/dist/esm/dockview/dockviewComponent.d.ts +4 -1
  49. package/dist/esm/dockview/dockviewComponent.js +96 -10
  50. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +3 -24
  51. package/dist/esm/dockview/dockviewGroupPanelModel.js +1 -33
  52. package/dist/esm/dockview/events.d.ts +28 -0
  53. package/dist/esm/dockview/events.js +33 -0
  54. package/dist/esm/dockview/options.d.ts +2 -1
  55. package/dist/styles/dockview.css +5 -0
  56. package/package.json +4 -5
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 4.4.1
3
+ * @version 4.6.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -5053,6 +5053,40 @@
5053
5053
  }
5054
5054
  }
5055
5055
 
5056
+ class WillShowOverlayLocationEvent {
5057
+ get kind() {
5058
+ return this.options.kind;
5059
+ }
5060
+ get nativeEvent() {
5061
+ return this.event.nativeEvent;
5062
+ }
5063
+ get position() {
5064
+ return this.event.position;
5065
+ }
5066
+ get defaultPrevented() {
5067
+ return this.event.defaultPrevented;
5068
+ }
5069
+ get panel() {
5070
+ return this.options.panel;
5071
+ }
5072
+ get api() {
5073
+ return this.options.api;
5074
+ }
5075
+ get group() {
5076
+ return this.options.group;
5077
+ }
5078
+ preventDefault() {
5079
+ this.event.preventDefault();
5080
+ }
5081
+ getData() {
5082
+ return this.options.getData();
5083
+ }
5084
+ constructor(event, options) {
5085
+ this.event = event;
5086
+ this.options = options;
5087
+ }
5088
+ }
5089
+
5056
5090
  class GroupDragHandler extends DragHandler {
5057
5091
  constructor(element, accessor, group) {
5058
5092
  super(element);
@@ -5120,6 +5154,7 @@
5120
5154
  this._element = document.createElement('div');
5121
5155
  this._element.className = 'dv-void-container';
5122
5156
  this._element.draggable = !this.accessor.options.disableDnd;
5157
+ toggleClass(this._element, 'dv-draggable', !this.accessor.options.disableDnd);
5123
5158
  this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
5124
5159
  this.accessor.doSetGroupActive(this.group);
5125
5160
  }));
@@ -5144,6 +5179,7 @@
5144
5179
  }
5145
5180
  updateDragAndDropState() {
5146
5181
  this._element.draggable = !this.accessor.options.disableDnd;
5182
+ toggleClass(this._element, 'dv-draggable', !this.accessor.options.disableDnd);
5147
5183
  }
5148
5184
  }
5149
5185
 
@@ -5664,8 +5700,11 @@
5664
5700
  toggleClass(wrapper, 'dv-tab', true);
5665
5701
  toggleClass(wrapper, 'dv-active-tab', panelObject.api.isActive);
5666
5702
  toggleClass(wrapper, 'dv-inactive-tab', !panelObject.api.isActive);
5667
- wrapper.addEventListener('pointerdown', () => {
5703
+ wrapper.addEventListener('click', (event) => {
5668
5704
  this.accessor.popupService.close();
5705
+ if (event.defaultPrevented) {
5706
+ return;
5707
+ }
5669
5708
  tab.element.scrollIntoView();
5670
5709
  tab.panel.api.setActive();
5671
5710
  });
@@ -5782,39 +5821,6 @@
5782
5821
  this._kind = options.kind;
5783
5822
  }
5784
5823
  }
5785
- class WillShowOverlayLocationEvent {
5786
- get kind() {
5787
- return this.options.kind;
5788
- }
5789
- get nativeEvent() {
5790
- return this.event.nativeEvent;
5791
- }
5792
- get position() {
5793
- return this.event.position;
5794
- }
5795
- get defaultPrevented() {
5796
- return this.event.defaultPrevented;
5797
- }
5798
- get panel() {
5799
- return this.options.panel;
5800
- }
5801
- get api() {
5802
- return this.options.api;
5803
- }
5804
- get group() {
5805
- return this.options.group;
5806
- }
5807
- preventDefault() {
5808
- this.event.preventDefault();
5809
- }
5810
- getData() {
5811
- return this.options.getData();
5812
- }
5813
- constructor(event, options) {
5814
- this.event = event;
5815
- this.options = options;
5816
- }
5817
- }
5818
5824
  class DockviewGroupPanelModel extends CompositeDisposable {
5819
5825
  get element() {
5820
5826
  throw new Error('dockview: not supported');
@@ -6639,23 +6645,24 @@
6639
6645
  : window;
6640
6646
  }
6641
6647
  moveTo(options) {
6642
- var _a, _b, _c;
6648
+ var _a, _b, _c, _d;
6643
6649
  if (!this._group) {
6644
6650
  throw new Error(NOT_INITIALIZED_MESSAGE);
6645
6651
  }
6646
6652
  const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
6647
6653
  direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
6648
- skipSetActive: true,
6654
+ skipSetActive: (_c = options.skipSetActive) !== null && _c !== void 0 ? _c : false,
6649
6655
  });
6650
6656
  this.accessor.moveGroupOrPanel({
6651
6657
  from: { groupId: this._group.id },
6652
6658
  to: {
6653
6659
  group,
6654
6660
  position: options.group
6655
- ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center'
6661
+ ? (_d = options.position) !== null && _d !== void 0 ? _d : 'center'
6656
6662
  : 'center',
6657
6663
  index: options.index,
6658
6664
  },
6665
+ skipSetActive: options.skipSetActive,
6659
6666
  });
6660
6667
  }
6661
6668
  maximize() {
@@ -6887,6 +6894,7 @@
6887
6894
  : 'center',
6888
6895
  index: options.index,
6889
6896
  },
6897
+ skipSetActive: options.skipSetActive,
6890
6898
  });
6891
6899
  }
6892
6900
  setTitle(title) {
@@ -9479,6 +9487,7 @@
9479
9487
  group: destinationGroup,
9480
9488
  position: destinationTarget,
9481
9489
  },
9490
+ skipSetActive: options.skipSetActive,
9482
9491
  });
9483
9492
  return;
9484
9493
  }
@@ -9497,11 +9506,17 @@
9497
9506
  // remove the group and do not set a new group as active
9498
9507
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9499
9508
  }
9500
- this.movingLock(() => destinationGroup.model.openPanel(removedPanel, {
9501
- index: destinationIndex,
9502
- skipSetGroupActive: true,
9503
- }));
9504
- this.doSetGroupAndPanelActive(destinationGroup);
9509
+ this.movingLock(() => {
9510
+ var _a;
9511
+ return destinationGroup.model.openPanel(removedPanel, {
9512
+ index: destinationIndex,
9513
+ skipSetActive: (_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false,
9514
+ skipSetGroupActive: true,
9515
+ });
9516
+ });
9517
+ if (!options.skipSetActive) {
9518
+ this.doSetGroupAndPanelActive(destinationGroup);
9519
+ }
9505
9520
  this._onDidMovePanel.fire({
9506
9521
  panel: removedPanel,
9507
9522
  from: sourceGroup,
@@ -9604,6 +9619,7 @@
9604
9619
  const target = options.to.position;
9605
9620
  if (target === 'center') {
9606
9621
  const activePanel = from.activePanel;
9622
+ const targetActivePanel = to.activePanel;
9607
9623
  const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
9608
9624
  skipSetActive: true,
9609
9625
  })));
@@ -9613,12 +9629,23 @@
9613
9629
  this.movingLock(() => {
9614
9630
  for (const panel of panels) {
9615
9631
  to.model.openPanel(panel, {
9616
- skipSetActive: panel !== activePanel,
9632
+ skipSetActive: true, // Always skip setting panels active during move
9617
9633
  skipSetGroupActive: true,
9618
9634
  });
9619
9635
  }
9620
9636
  });
9621
- this.doSetGroupAndPanelActive(to);
9637
+ if (!options.skipSetActive) {
9638
+ // Make the moved panel (from the source group) active
9639
+ if (activePanel) {
9640
+ this.doSetGroupAndPanelActive(to);
9641
+ }
9642
+ }
9643
+ else if (targetActivePanel) {
9644
+ // Ensure the target group's original active panel remains active
9645
+ to.model.openPanel(targetActivePanel, {
9646
+ skipSetGroupActive: true
9647
+ });
9648
+ }
9622
9649
  }
9623
9650
  else {
9624
9651
  switch (from.api.location.type) {
@@ -9638,12 +9665,39 @@
9638
9665
  if (!selectedPopoutGroup) {
9639
9666
  throw new Error('failed to find popout group');
9640
9667
  }
9641
- selectedPopoutGroup.disposable.dispose();
9668
+ // Remove from popout groups list to prevent automatic restoration
9669
+ const index = this._popoutGroups.indexOf(selectedPopoutGroup);
9670
+ if (index >= 0) {
9671
+ this._popoutGroups.splice(index, 1);
9672
+ }
9673
+ // Clean up the reference group (ghost) if it exists and is hidden
9674
+ if (selectedPopoutGroup.referenceGroup) {
9675
+ const referenceGroup = this.getPanel(selectedPopoutGroup.referenceGroup);
9676
+ if (referenceGroup && !referenceGroup.api.isVisible) {
9677
+ this.doRemoveGroup(referenceGroup, { skipActive: true });
9678
+ }
9679
+ }
9680
+ // Manually dispose the window without triggering restoration
9681
+ selectedPopoutGroup.window.dispose();
9682
+ // Update group's location and containers for target
9683
+ if (to.api.location.type === 'grid') {
9684
+ from.model.renderContainer = this.overlayRenderContainer;
9685
+ from.model.dropTargetContainer = this.rootDropTargetContainer;
9686
+ from.model.location = { type: 'grid' };
9687
+ }
9688
+ else if (to.api.location.type === 'floating') {
9689
+ from.model.renderContainer = this.overlayRenderContainer;
9690
+ from.model.dropTargetContainer = this.rootDropTargetContainer;
9691
+ from.model.location = { type: 'floating' };
9692
+ }
9693
+ break;
9642
9694
  }
9643
9695
  }
9644
- if (from.api.location.type !== 'popout') {
9696
+ // For moves to grid locations
9697
+ if (to.api.location.type === 'grid') {
9645
9698
  const referenceLocation = getGridLocation(to.element);
9646
9699
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
9700
+ // Add to grid for all moves targeting grid location
9647
9701
  let size;
9648
9702
  switch (this.gridview.orientation) {
9649
9703
  case exports.Orientation.VERTICAL:
@@ -9661,10 +9715,49 @@
9661
9715
  }
9662
9716
  this.gridview.addView(from, size, dropLocation);
9663
9717
  }
9718
+ else if (to.api.location.type === 'floating') {
9719
+ // For moves to floating locations, add as floating group
9720
+ // Get the position/size from the target floating group
9721
+ const targetFloatingGroup = this._floatingGroups.find((x) => x.group === to);
9722
+ if (targetFloatingGroup) {
9723
+ const box = targetFloatingGroup.overlay.toJSON();
9724
+ // Calculate position based on available properties
9725
+ let left, top;
9726
+ if ('left' in box) {
9727
+ left = box.left + 50;
9728
+ }
9729
+ else if ('right' in box) {
9730
+ left = Math.max(0, box.right - box.width - 50);
9731
+ }
9732
+ else {
9733
+ left = 50; // Default fallback
9734
+ }
9735
+ if ('top' in box) {
9736
+ top = box.top + 50;
9737
+ }
9738
+ else if ('bottom' in box) {
9739
+ top = Math.max(0, box.bottom - box.height - 50);
9740
+ }
9741
+ else {
9742
+ top = 50; // Default fallback
9743
+ }
9744
+ this.addFloatingGroup(from, {
9745
+ height: box.height,
9746
+ width: box.width,
9747
+ position: {
9748
+ left,
9749
+ top,
9750
+ },
9751
+ });
9752
+ }
9753
+ }
9664
9754
  }
9665
9755
  from.panels.forEach((panel) => {
9666
9756
  this._onDidMovePanel.fire({ panel, from });
9667
9757
  });
9758
+ if (!options.skipSetActive) {
9759
+ this.doSetGroupAndPanelActive(from);
9760
+ }
9668
9761
  }
9669
9762
  doSetGroupActive(group) {
9670
9763
  super.doSetGroupActive(group);
@@ -10885,7 +10978,6 @@
10885
10978
  exports.SplitviewComponent = SplitviewComponent;
10886
10979
  exports.SplitviewPanel = SplitviewPanel;
10887
10980
  exports.Tab = Tab;
10888
- exports.WillShowOverlayLocationEvent = WillShowOverlayLocationEvent;
10889
10981
  exports.createDockview = createDockview;
10890
10982
  exports.createGridview = createGridview;
10891
10983
  exports.createPaneview = createPaneview;