dockview-core 1.10.0 → 1.10.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.
Files changed (69) hide show
  1. package/dist/cjs/api/component.api.d.ts +10 -2
  2. package/dist/cjs/api/component.api.js +10 -2
  3. package/dist/cjs/api/dockviewPanelApi.d.ts +1 -0
  4. package/dist/cjs/api/dockviewPanelApi.js +33 -24
  5. package/dist/cjs/api/panelApi.d.ts +4 -13
  6. package/dist/cjs/api/panelApi.js +5 -15
  7. package/dist/cjs/dockview/components/panel/content.js +1 -1
  8. package/dist/cjs/dockview/components/titlebar/voidContainer.js +1 -1
  9. package/dist/cjs/dockview/dockviewComponent.js +15 -7
  10. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +3 -4
  11. package/dist/cjs/dockview/options.d.ts +3 -3
  12. package/dist/cjs/dockview/types.d.ts +0 -1
  13. package/dist/cjs/gridview/gridviewPanel.js +3 -3
  14. package/dist/cjs/lifecycle.d.ts +1 -1
  15. package/dist/cjs/paneview/paneview.d.ts +1 -0
  16. package/dist/cjs/paneview/paneview.js +3 -0
  17. package/dist/cjs/paneview/paneviewComponent.d.ts +2 -0
  18. package/dist/cjs/paneview/paneviewComponent.js +6 -0
  19. package/dist/cjs/paneview/paneviewPanel.d.ts +2 -0
  20. package/dist/cjs/paneview/paneviewPanel.js +5 -1
  21. package/dist/cjs/splitview/splitviewComponent.d.ts +1 -1
  22. package/dist/cjs/splitview/splitviewComponent.js +5 -5
  23. package/dist/cjs/splitview/splitviewPanel.js +3 -3
  24. package/dist/dockview-core.amd.js +90 -58
  25. package/dist/dockview-core.amd.js.map +1 -1
  26. package/dist/dockview-core.amd.min.js +2 -2
  27. package/dist/dockview-core.amd.min.js.map +1 -1
  28. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  29. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  30. package/dist/dockview-core.amd.noStyle.js +90 -58
  31. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  32. package/dist/dockview-core.cjs.js +90 -58
  33. package/dist/dockview-core.cjs.js.map +1 -1
  34. package/dist/dockview-core.esm.js +90 -58
  35. package/dist/dockview-core.esm.js.map +1 -1
  36. package/dist/dockview-core.esm.min.js +2 -2
  37. package/dist/dockview-core.esm.min.js.map +1 -1
  38. package/dist/dockview-core.js +90 -58
  39. package/dist/dockview-core.js.map +1 -1
  40. package/dist/dockview-core.min.js +2 -2
  41. package/dist/dockview-core.min.js.map +1 -1
  42. package/dist/dockview-core.min.noStyle.js +2 -2
  43. package/dist/dockview-core.min.noStyle.js.map +1 -1
  44. package/dist/dockview-core.noStyle.js +90 -58
  45. package/dist/dockview-core.noStyle.js.map +1 -1
  46. package/dist/esm/api/component.api.d.ts +10 -2
  47. package/dist/esm/api/component.api.js +10 -2
  48. package/dist/esm/api/dockviewPanelApi.d.ts +1 -0
  49. package/dist/esm/api/dockviewPanelApi.js +32 -23
  50. package/dist/esm/api/panelApi.d.ts +4 -13
  51. package/dist/esm/api/panelApi.js +5 -11
  52. package/dist/esm/dockview/components/panel/content.js +1 -1
  53. package/dist/esm/dockview/components/titlebar/voidContainer.js +1 -1
  54. package/dist/esm/dockview/dockviewComponent.js +16 -8
  55. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +3 -4
  56. package/dist/esm/dockview/options.d.ts +3 -3
  57. package/dist/esm/dockview/types.d.ts +0 -1
  58. package/dist/esm/gridview/gridviewPanel.js +3 -3
  59. package/dist/esm/lifecycle.d.ts +1 -1
  60. package/dist/esm/paneview/paneview.d.ts +1 -0
  61. package/dist/esm/paneview/paneview.js +3 -0
  62. package/dist/esm/paneview/paneviewComponent.d.ts +2 -0
  63. package/dist/esm/paneview/paneviewComponent.js +6 -0
  64. package/dist/esm/paneview/paneviewPanel.d.ts +2 -0
  65. package/dist/esm/paneview/paneviewPanel.js +5 -1
  66. package/dist/esm/splitview/splitviewComponent.d.ts +1 -1
  67. package/dist/esm/splitview/splitviewComponent.js +5 -5
  68. package/dist/esm/splitview/splitviewPanel.js +3 -3
  69. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 1.10.0
3
+ * @version 1.10.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -1476,6 +1476,9 @@ class Paneview extends CompositeDisposable {
1476
1476
  this._onDidChange.fire();
1477
1477
  }));
1478
1478
  }
1479
+ setViewVisible(index, visible) {
1480
+ this.splitview.setViewVisible(index, visible);
1481
+ }
1479
1482
  addPane(pane, size, index = this.splitview.length, skipLayout = false) {
1480
1483
  const disposable = pane.onDidChangeExpansionState(() => {
1481
1484
  this.setupAnimation();
@@ -2980,19 +2983,27 @@ class DockviewApi {
2980
2983
  return this.component.onWillDrop;
2981
2984
  }
2982
2985
  /**
2986
+ * Invoked before an overlay is shown indicating a drop target.
2983
2987
  *
2988
+ * Calling `event.preventDefault()` will prevent the overlay being shown and prevent
2989
+ * the any subsequent drop event.
2984
2990
  */
2985
2991
  get onWillShowOverlay() {
2986
2992
  return this.component.onWillShowOverlay;
2987
2993
  }
2988
2994
  /**
2989
- * Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality.
2995
+ * Invoked before a group is dragged.
2996
+ *
2997
+ * Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting.
2998
+ *
2990
2999
  */
2991
3000
  get onWillDragGroup() {
2992
3001
  return this.component.onWillDragGroup;
2993
3002
  }
2994
3003
  /**
2995
- * Invoked before a panel is dragged. Exposed for custom Drag'n'Drop functionality.
3004
+ * Invoked before a panel is dragged.
3005
+ *
3006
+ * Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting.
2996
3007
  */
2997
3008
  get onWillDragPanel() {
2998
3009
  return this.component.onWillDragPanel;
@@ -3536,7 +3547,7 @@ class ContentContainer extends CompositeDisposable {
3536
3547
  data.groupId === this.group.id;
3537
3548
  return !groupHasOnePanelAndIsActiveDragElement;
3538
3549
  }
3539
- return this.group.canDisplayOverlay(event, position, 'panel');
3550
+ return this.group.canDisplayOverlay(event, position, 'content');
3540
3551
  },
3541
3552
  });
3542
3553
  this.addDisposables(this.dropTarget);
@@ -3859,7 +3870,7 @@ class VoidContainer extends CompositeDisposable {
3859
3870
  // don't show the overlay if the tab being dragged is the last panel of this group
3860
3871
  return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
3861
3872
  }
3862
- return group.model.canDisplayOverlay(event, position, 'panel');
3873
+ return group.model.canDisplayOverlay(event, position, 'header_space');
3863
3874
  },
3864
3875
  });
3865
3876
  this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
@@ -4988,9 +4999,6 @@ class PanelApiImpl extends CompositeDisposable {
4988
4999
  get isVisible() {
4989
5000
  return this._isVisible;
4990
5001
  }
4991
- get isHidden() {
4992
- return this._isHidden;
4993
- }
4994
5002
  get width() {
4995
5003
  return this._width;
4996
5004
  }
@@ -5003,7 +5011,6 @@ class PanelApiImpl extends CompositeDisposable {
5003
5011
  this._isFocused = false;
5004
5012
  this._isActive = false;
5005
5013
  this._isVisible = true;
5006
- this._isHidden = false;
5007
5014
  this._width = 0;
5008
5015
  this._height = 0;
5009
5016
  this.panelUpdatesDisposable = new MutableDisposable();
@@ -5017,8 +5024,8 @@ class PanelApiImpl extends CompositeDisposable {
5017
5024
  //
5018
5025
  this._onDidVisibilityChange = new Emitter();
5019
5026
  this.onDidVisibilityChange = this._onDidVisibilityChange.event;
5020
- this._onDidHiddenChange = new Emitter();
5021
- this.onDidHiddenChange = this._onDidHiddenChange.event;
5027
+ this._onWillVisibilityChange = new Emitter();
5028
+ this.onWillVisibilityChange = this._onWillVisibilityChange.event;
5022
5029
  this._onDidActiveChange = new Emitter();
5023
5030
  this.onDidActiveChange = this._onDidActiveChange.event;
5024
5031
  this._onActiveChange = new Emitter();
@@ -5031,12 +5038,10 @@ class PanelApiImpl extends CompositeDisposable {
5031
5038
  this._isActive = event.isActive;
5032
5039
  }), this.onDidVisibilityChange((event) => {
5033
5040
  this._isVisible = event.isVisible;
5034
- }), this.onDidHiddenChange((event) => {
5035
- this._isHidden = event.isHidden;
5036
5041
  }), this.onDidDimensionsChange((event) => {
5037
5042
  this._width = event.width;
5038
5043
  this._height = event.height;
5039
- }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onDidHiddenChange, this._onUpdateParameters);
5044
+ }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
5040
5045
  }
5041
5046
  initialize(panel) {
5042
5047
  this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
@@ -5045,8 +5050,8 @@ class PanelApiImpl extends CompositeDisposable {
5045
5050
  });
5046
5051
  });
5047
5052
  }
5048
- setHidden(isHidden) {
5049
- this._onDidHiddenChange.fire({ isHidden });
5053
+ setVisible(isVisible) {
5054
+ this._onWillVisibilityChange.fire({ isVisible });
5050
5055
  }
5051
5056
  setActive() {
5052
5057
  this._onActiveChange.fire();
@@ -5264,7 +5269,11 @@ class PaneviewPanel extends BasePanelView {
5264
5269
  this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
5265
5270
  this._orientation = orientation;
5266
5271
  this.element.classList.add('pane');
5267
- this.addDisposables(this.api.onDidSizeChange((event) => {
5272
+ this.addDisposables(this.api.onWillVisibilityChange((event) => {
5273
+ const { isVisible } = event;
5274
+ const { accessor } = this._params;
5275
+ accessor.setVisible(this, isVisible);
5276
+ }), this.api.onDidSizeChange((event) => {
5268
5277
  this._onDidChange.fire({ size: event.size });
5269
5278
  }), addDisposableListener(this.element, 'mouseenter', (ev) => {
5270
5279
  this.api._onMouseEnter.fire(ev);
@@ -5568,10 +5577,10 @@ class GridviewPanel extends BasePanelView {
5568
5577
  this._maximumHeight = options.maximumHeight;
5569
5578
  }
5570
5579
  this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
5571
- this.addDisposables(this.api.onDidHiddenChange((event) => {
5572
- const { isHidden } = event;
5580
+ this.addDisposables(this.api.onWillVisibilityChange((event) => {
5581
+ const { isVisible } = event;
5573
5582
  const { accessor } = this._params;
5574
- accessor.setVisible(this, !isHidden);
5583
+ accessor.setVisible(this, isVisible);
5575
5584
  }), this.api.onActiveChange(() => {
5576
5585
  const { accessor } = this._params;
5577
5586
  accessor.doSetGroupActive(this);
@@ -5812,32 +5821,11 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
5812
5821
  return this.panel.renderer;
5813
5822
  }
5814
5823
  set group(value) {
5815
- const isOldGroupActive = this.isGroupActive;
5824
+ const oldGroup = this._group;
5816
5825
  if (this._group !== value) {
5817
5826
  this._group = value;
5818
5827
  this._onDidGroupChange.fire({});
5819
- let _trackGroupActive = isOldGroupActive; // prevent duplicate events with same state
5820
- this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidLocationChange((event) => {
5821
- if (this.group !== this.panel.group) {
5822
- return;
5823
- }
5824
- this._onDidLocationChange.fire(event);
5825
- }), this.group.api.onDidActiveChange(() => {
5826
- if (this.group !== this.panel.group) {
5827
- return;
5828
- }
5829
- if (_trackGroupActive !== this.isGroupActive) {
5830
- _trackGroupActive = this.isGroupActive;
5831
- this._onDidActiveGroupChange.fire({
5832
- isActive: this.isGroupActive,
5833
- });
5834
- }
5835
- }));
5836
- // if (this.isGroupActive !== isOldGroupActive) {
5837
- // this._onDidActiveGroupChange.fire({
5838
- // isActive: this.isGroupActive,
5839
- // });
5840
- // }
5828
+ this.setupGroupEventListeners(oldGroup);
5841
5829
  this._onDidLocationChange.fire({
5842
5830
  location: this.group.api.location,
5843
5831
  });
@@ -5863,6 +5851,7 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
5863
5851
  this.groupEventsDisposable = new MutableDisposable();
5864
5852
  this.initialize(panel);
5865
5853
  this._group = group;
5854
+ this.setupGroupEventListeners();
5866
5855
  this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange);
5867
5856
  }
5868
5857
  getWindow() {
@@ -5897,6 +5886,35 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
5897
5886
  exitMaximized() {
5898
5887
  this.group.api.exitMaximized();
5899
5888
  }
5889
+ setupGroupEventListeners(previousGroup) {
5890
+ var _a;
5891
+ let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
5892
+ this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
5893
+ if (!event.isVisible && this.isVisible) {
5894
+ this._onDidVisibilityChange.fire(event);
5895
+ }
5896
+ else if (event.isVisible &&
5897
+ !this.isVisible &&
5898
+ this.group.model.isPanelActive(this.panel)) {
5899
+ this._onDidVisibilityChange.fire(event);
5900
+ }
5901
+ }), this.group.api.onDidLocationChange((event) => {
5902
+ if (this.group !== this.panel.group) {
5903
+ return;
5904
+ }
5905
+ this._onDidLocationChange.fire(event);
5906
+ }), this.group.api.onDidActiveChange(() => {
5907
+ if (this.group !== this.panel.group) {
5908
+ return;
5909
+ }
5910
+ if (_trackGroupActive !== this.isGroupActive) {
5911
+ _trackGroupActive = this.isGroupActive;
5912
+ this._onDidActiveGroupChange.fire({
5913
+ isActive: this.isGroupActive,
5914
+ });
5915
+ }
5916
+ }));
5917
+ }
5900
5918
  }
5901
5919
 
5902
5920
  class DockviewPanel extends CompositeDisposable {
@@ -7077,7 +7095,15 @@ class DockviewComponent extends BaseGrid {
7077
7095
  acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
7078
7096
  overlayModel: (_b = this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
7079
7097
  });
7080
- this.addDisposables(this._rootDropTarget.onDrop((event) => {
7098
+ this.addDisposables(this._rootDropTarget, this._rootDropTarget.onWillShowOverlay((event) => {
7099
+ if (this.gridview.length > 0 && event.position === 'center') {
7100
+ // option only available when no panels in primary grid
7101
+ return;
7102
+ }
7103
+ this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
7104
+ kind: 'edge',
7105
+ }));
7106
+ }), this._rootDropTarget.onDrop((event) => {
7081
7107
  var _a;
7082
7108
  const willDropEvent = new DockviewWillDropEvent({
7083
7109
  nativeEvent: event.nativeEvent,
@@ -7086,7 +7112,7 @@ class DockviewComponent extends BaseGrid {
7086
7112
  api: this._api,
7087
7113
  group: undefined,
7088
7114
  getData: getPanelData,
7089
- kind: 'content',
7115
+ kind: 'edge',
7090
7116
  });
7091
7117
  this._onWillDrop.fire(willDropEvent);
7092
7118
  if (willDropEvent.defaultPrevented) {
@@ -7142,7 +7168,7 @@ class DockviewComponent extends BaseGrid {
7142
7168
  const box = getBox();
7143
7169
  const groupId = (_b = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this.getNextGroupId(); //item.id;
7144
7170
  if (itemToPopout.api.location.type === 'grid') {
7145
- itemToPopout.api.setHidden(true);
7171
+ itemToPopout.api.setVisible(false);
7146
7172
  }
7147
7173
  const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id
7148
7174
  theme !== null && theme !== void 0 ? theme : '', {
@@ -7193,7 +7219,7 @@ class DockviewComponent extends BaseGrid {
7193
7219
  }));
7194
7220
  switch (referenceLocation) {
7195
7221
  case 'grid':
7196
- referenceGroup.api.setHidden(true);
7222
+ referenceGroup.api.setVisible(false);
7197
7223
  break;
7198
7224
  case 'floating':
7199
7225
  case 'popout':
@@ -7247,8 +7273,8 @@ class DockviewComponent extends BaseGrid {
7247
7273
  from: group,
7248
7274
  to: referenceGroup,
7249
7275
  }));
7250
- if (referenceGroup.api.isHidden) {
7251
- referenceGroup.api.setHidden(false);
7276
+ if (!referenceGroup.api.isVisible) {
7277
+ referenceGroup.api.setVisible(true);
7252
7278
  }
7253
7279
  if (this.getPanel(group.id)) {
7254
7280
  this.doRemoveGroup(group, {
@@ -7821,7 +7847,7 @@ class DockviewComponent extends BaseGrid {
7821
7847
  }
7822
7848
  updateWatermark() {
7823
7849
  var _a, _b;
7824
- if (this.groups.filter((x) => x.api.location.type === 'grid' && !x.api.isHidden).length === 0) {
7850
+ if (this.groups.filter((x) => x.api.location.type === 'grid' && x.api.isVisible).length === 0) {
7825
7851
  if (!this.watermark) {
7826
7852
  this.watermark = this.createWatermarkComponent();
7827
7853
  this.watermark.init({
@@ -8604,19 +8630,19 @@ class SplitviewComponent extends Resizable {
8604
8630
  const index = this.panels.indexOf(panel);
8605
8631
  this.splitview.setViewVisible(index, visible);
8606
8632
  }
8607
- setActive(view, skipFocus) {
8608
- this._activePanel = view;
8633
+ setActive(panel, skipFocus) {
8634
+ this._activePanel = panel;
8609
8635
  this.panels
8610
- .filter((v) => v !== view)
8636
+ .filter((v) => v !== panel)
8611
8637
  .forEach((v) => {
8612
8638
  v.api._onDidActiveChange.fire({ isActive: false });
8613
8639
  if (!skipFocus) {
8614
8640
  v.focus();
8615
8641
  }
8616
8642
  });
8617
- view.api._onDidActiveChange.fire({ isActive: true });
8643
+ panel.api._onDidActiveChange.fire({ isActive: true });
8618
8644
  if (!skipFocus) {
8619
- view.focus();
8645
+ panel.focus();
8620
8646
  }
8621
8647
  }
8622
8648
  removePanel(panel, sizing) {
@@ -8915,6 +8941,10 @@ class PaneviewComponent extends Resizable {
8915
8941
  });
8916
8942
  this.addDisposables(this._disposable);
8917
8943
  }
8944
+ setVisible(panel, visible) {
8945
+ const index = this.panels.indexOf(panel);
8946
+ this.paneview.setViewVisible(index, visible);
8947
+ }
8918
8948
  focus() {
8919
8949
  //noop
8920
8950
  }
@@ -8961,6 +8991,7 @@ class PaneviewComponent extends Resizable {
8961
8991
  isExpanded: options.isExpanded,
8962
8992
  title: options.title,
8963
8993
  containerApi: new PaneviewApi(this),
8994
+ accessor: this,
8964
8995
  });
8965
8996
  this.paneview.addPane(view, size, index);
8966
8997
  view.orientation = this.paneview.orientation;
@@ -9060,6 +9091,7 @@ class PaneviewComponent extends Resizable {
9060
9091
  title: data.title,
9061
9092
  isExpanded: !!view.expanded,
9062
9093
  containerApi: new PaneviewApi(this),
9094
+ accessor: this,
9063
9095
  });
9064
9096
  panel.orientation = this.paneview.orientation;
9065
9097
  });
@@ -9148,10 +9180,10 @@ class SplitviewPanel extends BasePanelView {
9148
9180
  this._onDidChange = new Emitter();
9149
9181
  this.onDidChange = this._onDidChange.event;
9150
9182
  this.api.initialize(this);
9151
- this.addDisposables(this._onDidChange, this.api.onDidHiddenChange((event) => {
9152
- const { isHidden } = event;
9183
+ this.addDisposables(this._onDidChange, this.api.onWillVisibilityChange((event) => {
9184
+ const { isVisible } = event;
9153
9185
  const { accessor } = this._params;
9154
- accessor.setVisible(this, !isHidden);
9186
+ accessor.setVisible(this, isVisible);
9155
9187
  }), this.api.onActiveChange(() => {
9156
9188
  const { accessor } = this._params;
9157
9189
  accessor.setActive(this);