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
  */
@@ -1478,6 +1478,9 @@ class Paneview extends CompositeDisposable {
1478
1478
  this._onDidChange.fire();
1479
1479
  }));
1480
1480
  }
1481
+ setViewVisible(index, visible) {
1482
+ this.splitview.setViewVisible(index, visible);
1483
+ }
1481
1484
  addPane(pane, size, index = this.splitview.length, skipLayout = false) {
1482
1485
  const disposable = pane.onDidChangeExpansionState(() => {
1483
1486
  this.setupAnimation();
@@ -2982,19 +2985,27 @@ class DockviewApi {
2982
2985
  return this.component.onWillDrop;
2983
2986
  }
2984
2987
  /**
2988
+ * Invoked before an overlay is shown indicating a drop target.
2985
2989
  *
2990
+ * Calling `event.preventDefault()` will prevent the overlay being shown and prevent
2991
+ * the any subsequent drop event.
2986
2992
  */
2987
2993
  get onWillShowOverlay() {
2988
2994
  return this.component.onWillShowOverlay;
2989
2995
  }
2990
2996
  /**
2991
- * Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality.
2997
+ * Invoked before a group is dragged.
2998
+ *
2999
+ * Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting.
3000
+ *
2992
3001
  */
2993
3002
  get onWillDragGroup() {
2994
3003
  return this.component.onWillDragGroup;
2995
3004
  }
2996
3005
  /**
2997
- * Invoked before a panel is dragged. Exposed for custom Drag'n'Drop functionality.
3006
+ * Invoked before a panel is dragged.
3007
+ *
3008
+ * Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting.
2998
3009
  */
2999
3010
  get onWillDragPanel() {
3000
3011
  return this.component.onWillDragPanel;
@@ -3538,7 +3549,7 @@ class ContentContainer extends CompositeDisposable {
3538
3549
  data.groupId === this.group.id;
3539
3550
  return !groupHasOnePanelAndIsActiveDragElement;
3540
3551
  }
3541
- return this.group.canDisplayOverlay(event, position, 'panel');
3552
+ return this.group.canDisplayOverlay(event, position, 'content');
3542
3553
  },
3543
3554
  });
3544
3555
  this.addDisposables(this.dropTarget);
@@ -3861,7 +3872,7 @@ class VoidContainer extends CompositeDisposable {
3861
3872
  // don't show the overlay if the tab being dragged is the last panel of this group
3862
3873
  return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
3863
3874
  }
3864
- return group.model.canDisplayOverlay(event, position, 'panel');
3875
+ return group.model.canDisplayOverlay(event, position, 'header_space');
3865
3876
  },
3866
3877
  });
3867
3878
  this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
@@ -4990,9 +5001,6 @@ class PanelApiImpl extends CompositeDisposable {
4990
5001
  get isVisible() {
4991
5002
  return this._isVisible;
4992
5003
  }
4993
- get isHidden() {
4994
- return this._isHidden;
4995
- }
4996
5004
  get width() {
4997
5005
  return this._width;
4998
5006
  }
@@ -5005,7 +5013,6 @@ class PanelApiImpl extends CompositeDisposable {
5005
5013
  this._isFocused = false;
5006
5014
  this._isActive = false;
5007
5015
  this._isVisible = true;
5008
- this._isHidden = false;
5009
5016
  this._width = 0;
5010
5017
  this._height = 0;
5011
5018
  this.panelUpdatesDisposable = new MutableDisposable();
@@ -5019,8 +5026,8 @@ class PanelApiImpl extends CompositeDisposable {
5019
5026
  //
5020
5027
  this._onDidVisibilityChange = new Emitter();
5021
5028
  this.onDidVisibilityChange = this._onDidVisibilityChange.event;
5022
- this._onDidHiddenChange = new Emitter();
5023
- this.onDidHiddenChange = this._onDidHiddenChange.event;
5029
+ this._onWillVisibilityChange = new Emitter();
5030
+ this.onWillVisibilityChange = this._onWillVisibilityChange.event;
5024
5031
  this._onDidActiveChange = new Emitter();
5025
5032
  this.onDidActiveChange = this._onDidActiveChange.event;
5026
5033
  this._onActiveChange = new Emitter();
@@ -5033,12 +5040,10 @@ class PanelApiImpl extends CompositeDisposable {
5033
5040
  this._isActive = event.isActive;
5034
5041
  }), this.onDidVisibilityChange((event) => {
5035
5042
  this._isVisible = event.isVisible;
5036
- }), this.onDidHiddenChange((event) => {
5037
- this._isHidden = event.isHidden;
5038
5043
  }), this.onDidDimensionsChange((event) => {
5039
5044
  this._width = event.width;
5040
5045
  this._height = event.height;
5041
- }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onDidHiddenChange, this._onUpdateParameters);
5046
+ }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
5042
5047
  }
5043
5048
  initialize(panel) {
5044
5049
  this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
@@ -5047,8 +5052,8 @@ class PanelApiImpl extends CompositeDisposable {
5047
5052
  });
5048
5053
  });
5049
5054
  }
5050
- setHidden(isHidden) {
5051
- this._onDidHiddenChange.fire({ isHidden });
5055
+ setVisible(isVisible) {
5056
+ this._onWillVisibilityChange.fire({ isVisible });
5052
5057
  }
5053
5058
  setActive() {
5054
5059
  this._onActiveChange.fire();
@@ -5266,7 +5271,11 @@ class PaneviewPanel extends BasePanelView {
5266
5271
  this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
5267
5272
  this._orientation = orientation;
5268
5273
  this.element.classList.add('pane');
5269
- this.addDisposables(this.api.onDidSizeChange((event) => {
5274
+ this.addDisposables(this.api.onWillVisibilityChange((event) => {
5275
+ const { isVisible } = event;
5276
+ const { accessor } = this._params;
5277
+ accessor.setVisible(this, isVisible);
5278
+ }), this.api.onDidSizeChange((event) => {
5270
5279
  this._onDidChange.fire({ size: event.size });
5271
5280
  }), addDisposableListener(this.element, 'mouseenter', (ev) => {
5272
5281
  this.api._onMouseEnter.fire(ev);
@@ -5570,10 +5579,10 @@ class GridviewPanel extends BasePanelView {
5570
5579
  this._maximumHeight = options.maximumHeight;
5571
5580
  }
5572
5581
  this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
5573
- this.addDisposables(this.api.onDidHiddenChange((event) => {
5574
- const { isHidden } = event;
5582
+ this.addDisposables(this.api.onWillVisibilityChange((event) => {
5583
+ const { isVisible } = event;
5575
5584
  const { accessor } = this._params;
5576
- accessor.setVisible(this, !isHidden);
5585
+ accessor.setVisible(this, isVisible);
5577
5586
  }), this.api.onActiveChange(() => {
5578
5587
  const { accessor } = this._params;
5579
5588
  accessor.doSetGroupActive(this);
@@ -5814,32 +5823,11 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
5814
5823
  return this.panel.renderer;
5815
5824
  }
5816
5825
  set group(value) {
5817
- const isOldGroupActive = this.isGroupActive;
5826
+ const oldGroup = this._group;
5818
5827
  if (this._group !== value) {
5819
5828
  this._group = value;
5820
5829
  this._onDidGroupChange.fire({});
5821
- let _trackGroupActive = isOldGroupActive; // prevent duplicate events with same state
5822
- this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidLocationChange((event) => {
5823
- if (this.group !== this.panel.group) {
5824
- return;
5825
- }
5826
- this._onDidLocationChange.fire(event);
5827
- }), this.group.api.onDidActiveChange(() => {
5828
- if (this.group !== this.panel.group) {
5829
- return;
5830
- }
5831
- if (_trackGroupActive !== this.isGroupActive) {
5832
- _trackGroupActive = this.isGroupActive;
5833
- this._onDidActiveGroupChange.fire({
5834
- isActive: this.isGroupActive,
5835
- });
5836
- }
5837
- }));
5838
- // if (this.isGroupActive !== isOldGroupActive) {
5839
- // this._onDidActiveGroupChange.fire({
5840
- // isActive: this.isGroupActive,
5841
- // });
5842
- // }
5830
+ this.setupGroupEventListeners(oldGroup);
5843
5831
  this._onDidLocationChange.fire({
5844
5832
  location: this.group.api.location,
5845
5833
  });
@@ -5865,6 +5853,7 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
5865
5853
  this.groupEventsDisposable = new MutableDisposable();
5866
5854
  this.initialize(panel);
5867
5855
  this._group = group;
5856
+ this.setupGroupEventListeners();
5868
5857
  this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange);
5869
5858
  }
5870
5859
  getWindow() {
@@ -5899,6 +5888,35 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
5899
5888
  exitMaximized() {
5900
5889
  this.group.api.exitMaximized();
5901
5890
  }
5891
+ setupGroupEventListeners(previousGroup) {
5892
+ var _a;
5893
+ let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
5894
+ this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
5895
+ if (!event.isVisible && this.isVisible) {
5896
+ this._onDidVisibilityChange.fire(event);
5897
+ }
5898
+ else if (event.isVisible &&
5899
+ !this.isVisible &&
5900
+ this.group.model.isPanelActive(this.panel)) {
5901
+ this._onDidVisibilityChange.fire(event);
5902
+ }
5903
+ }), this.group.api.onDidLocationChange((event) => {
5904
+ if (this.group !== this.panel.group) {
5905
+ return;
5906
+ }
5907
+ this._onDidLocationChange.fire(event);
5908
+ }), this.group.api.onDidActiveChange(() => {
5909
+ if (this.group !== this.panel.group) {
5910
+ return;
5911
+ }
5912
+ if (_trackGroupActive !== this.isGroupActive) {
5913
+ _trackGroupActive = this.isGroupActive;
5914
+ this._onDidActiveGroupChange.fire({
5915
+ isActive: this.isGroupActive,
5916
+ });
5917
+ }
5918
+ }));
5919
+ }
5902
5920
  }
5903
5921
 
5904
5922
  class DockviewPanel extends CompositeDisposable {
@@ -7079,7 +7097,15 @@ class DockviewComponent extends BaseGrid {
7079
7097
  acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
7080
7098
  overlayModel: (_b = this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
7081
7099
  });
7082
- this.addDisposables(this._rootDropTarget.onDrop((event) => {
7100
+ this.addDisposables(this._rootDropTarget, this._rootDropTarget.onWillShowOverlay((event) => {
7101
+ if (this.gridview.length > 0 && event.position === 'center') {
7102
+ // option only available when no panels in primary grid
7103
+ return;
7104
+ }
7105
+ this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
7106
+ kind: 'edge',
7107
+ }));
7108
+ }), this._rootDropTarget.onDrop((event) => {
7083
7109
  var _a;
7084
7110
  const willDropEvent = new DockviewWillDropEvent({
7085
7111
  nativeEvent: event.nativeEvent,
@@ -7088,7 +7114,7 @@ class DockviewComponent extends BaseGrid {
7088
7114
  api: this._api,
7089
7115
  group: undefined,
7090
7116
  getData: getPanelData,
7091
- kind: 'content',
7117
+ kind: 'edge',
7092
7118
  });
7093
7119
  this._onWillDrop.fire(willDropEvent);
7094
7120
  if (willDropEvent.defaultPrevented) {
@@ -7144,7 +7170,7 @@ class DockviewComponent extends BaseGrid {
7144
7170
  const box = getBox();
7145
7171
  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;
7146
7172
  if (itemToPopout.api.location.type === 'grid') {
7147
- itemToPopout.api.setHidden(true);
7173
+ itemToPopout.api.setVisible(false);
7148
7174
  }
7149
7175
  const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id
7150
7176
  theme !== null && theme !== void 0 ? theme : '', {
@@ -7195,7 +7221,7 @@ class DockviewComponent extends BaseGrid {
7195
7221
  }));
7196
7222
  switch (referenceLocation) {
7197
7223
  case 'grid':
7198
- referenceGroup.api.setHidden(true);
7224
+ referenceGroup.api.setVisible(false);
7199
7225
  break;
7200
7226
  case 'floating':
7201
7227
  case 'popout':
@@ -7249,8 +7275,8 @@ class DockviewComponent extends BaseGrid {
7249
7275
  from: group,
7250
7276
  to: referenceGroup,
7251
7277
  }));
7252
- if (referenceGroup.api.isHidden) {
7253
- referenceGroup.api.setHidden(false);
7278
+ if (!referenceGroup.api.isVisible) {
7279
+ referenceGroup.api.setVisible(true);
7254
7280
  }
7255
7281
  if (this.getPanel(group.id)) {
7256
7282
  this.doRemoveGroup(group, {
@@ -7823,7 +7849,7 @@ class DockviewComponent extends BaseGrid {
7823
7849
  }
7824
7850
  updateWatermark() {
7825
7851
  var _a, _b;
7826
- if (this.groups.filter((x) => x.api.location.type === 'grid' && !x.api.isHidden).length === 0) {
7852
+ if (this.groups.filter((x) => x.api.location.type === 'grid' && x.api.isVisible).length === 0) {
7827
7853
  if (!this.watermark) {
7828
7854
  this.watermark = this.createWatermarkComponent();
7829
7855
  this.watermark.init({
@@ -8606,19 +8632,19 @@ class SplitviewComponent extends Resizable {
8606
8632
  const index = this.panels.indexOf(panel);
8607
8633
  this.splitview.setViewVisible(index, visible);
8608
8634
  }
8609
- setActive(view, skipFocus) {
8610
- this._activePanel = view;
8635
+ setActive(panel, skipFocus) {
8636
+ this._activePanel = panel;
8611
8637
  this.panels
8612
- .filter((v) => v !== view)
8638
+ .filter((v) => v !== panel)
8613
8639
  .forEach((v) => {
8614
8640
  v.api._onDidActiveChange.fire({ isActive: false });
8615
8641
  if (!skipFocus) {
8616
8642
  v.focus();
8617
8643
  }
8618
8644
  });
8619
- view.api._onDidActiveChange.fire({ isActive: true });
8645
+ panel.api._onDidActiveChange.fire({ isActive: true });
8620
8646
  if (!skipFocus) {
8621
- view.focus();
8647
+ panel.focus();
8622
8648
  }
8623
8649
  }
8624
8650
  removePanel(panel, sizing) {
@@ -8917,6 +8943,10 @@ class PaneviewComponent extends Resizable {
8917
8943
  });
8918
8944
  this.addDisposables(this._disposable);
8919
8945
  }
8946
+ setVisible(panel, visible) {
8947
+ const index = this.panels.indexOf(panel);
8948
+ this.paneview.setViewVisible(index, visible);
8949
+ }
8920
8950
  focus() {
8921
8951
  //noop
8922
8952
  }
@@ -8963,6 +8993,7 @@ class PaneviewComponent extends Resizable {
8963
8993
  isExpanded: options.isExpanded,
8964
8994
  title: options.title,
8965
8995
  containerApi: new PaneviewApi(this),
8996
+ accessor: this,
8966
8997
  });
8967
8998
  this.paneview.addPane(view, size, index);
8968
8999
  view.orientation = this.paneview.orientation;
@@ -9062,6 +9093,7 @@ class PaneviewComponent extends Resizable {
9062
9093
  title: data.title,
9063
9094
  isExpanded: !!view.expanded,
9064
9095
  containerApi: new PaneviewApi(this),
9096
+ accessor: this,
9065
9097
  });
9066
9098
  panel.orientation = this.paneview.orientation;
9067
9099
  });
@@ -9150,10 +9182,10 @@ class SplitviewPanel extends BasePanelView {
9150
9182
  this._onDidChange = new Emitter();
9151
9183
  this.onDidChange = this._onDidChange.event;
9152
9184
  this.api.initialize(this);
9153
- this.addDisposables(this._onDidChange, this.api.onDidHiddenChange((event) => {
9154
- const { isHidden } = event;
9185
+ this.addDisposables(this._onDidChange, this.api.onWillVisibilityChange((event) => {
9186
+ const { isVisible } = event;
9155
9187
  const { accessor } = this._params;
9156
- accessor.setVisible(this, !isHidden);
9188
+ accessor.setVisible(this, isVisible);
9157
9189
  }), this.api.onActiveChange(() => {
9158
9190
  const { accessor } = this._params;
9159
9191
  accessor.setActive(this);