dockview 1.10.1 → 1.10.2

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
3
- * @version 1.10.1
3
+ * @version 1.10.2
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -4266,6 +4266,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
4266
4266
  this._width = 0;
4267
4267
  this._height = 0;
4268
4268
  this._panels = [];
4269
+ this._panelDisposables = new Map();
4269
4270
  this._onMove = new Emitter();
4270
4271
  this.onMove = this._onMove.event;
4271
4272
  this._onDidDrop = new Emitter();
@@ -4280,6 +4281,10 @@ class DockviewGroupPanelModel extends CompositeDisposable {
4280
4281
  this.onGroupDragStart = this._onGroupDragStart.event;
4281
4282
  this._onDidAddPanel = new Emitter();
4282
4283
  this.onDidAddPanel = this._onDidAddPanel.event;
4284
+ this._onDidPanelTitleChange = new Emitter();
4285
+ this.onDidPanelTitleChange = this._onDidPanelTitleChange.event;
4286
+ this._onDidPanelParametersChange = new Emitter();
4287
+ this.onDidPanelParametersChange = this._onDidPanelParametersChange.event;
4283
4288
  this._onDidRemovePanel = new Emitter();
4284
4289
  this.onDidRemovePanel = this._onDidRemovePanel.event;
4285
4290
  this._onDidActivePanelChange = new Emitter();
@@ -4568,6 +4573,11 @@ class DockviewGroupPanelModel extends CompositeDisposable {
4568
4573
  if (this.mostRecentlyUsed.includes(panel)) {
4569
4574
  this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
4570
4575
  }
4576
+ const disposable = this._panelDisposables.get(panel.id);
4577
+ if (disposable) {
4578
+ disposable.dispose();
4579
+ this._panelDisposables.delete(panel.id);
4580
+ }
4571
4581
  this._onDidRemovePanel.fire({ panel });
4572
4582
  }
4573
4583
  doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
@@ -4585,6 +4595,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
4585
4595
  }
4586
4596
  this.updateMru(panel);
4587
4597
  this.panels.splice(index, 0, panel);
4598
+ this._panelDisposables.set(panel.id, new CompositeDisposable(panel.api.onDidTitleChange((event) => this._onDidPanelTitleChange.fire(event)), panel.api.onDidParametersChange((event) => this._onDidPanelParametersChange.fire(event))));
4588
4599
  this._onDidAddPanel.fire({ panel });
4589
4600
  }
4590
4601
  doSetActivePanel(panel) {
@@ -5008,14 +5019,16 @@ class PanelApiImpl extends CompositeDisposable {
5008
5019
  get height() {
5009
5020
  return this._height;
5010
5021
  }
5011
- constructor(id) {
5022
+ constructor(id, component) {
5012
5023
  super();
5013
5024
  this.id = id;
5025
+ this.component = component;
5014
5026
  this._isFocused = false;
5015
5027
  this._isActive = false;
5016
5028
  this._isVisible = true;
5017
5029
  this._width = 0;
5018
5030
  this._height = 0;
5031
+ this._parameters = {};
5019
5032
  this.panelUpdatesDisposable = new MutableDisposable();
5020
5033
  this._onDidDimensionChange = new Emitter();
5021
5034
  this.onDidDimensionsChange = this._onDidDimensionChange.event;
@@ -5033,8 +5046,8 @@ class PanelApiImpl extends CompositeDisposable {
5033
5046
  this.onDidActiveChange = this._onDidActiveChange.event;
5034
5047
  this._onActiveChange = new Emitter();
5035
5048
  this.onActiveChange = this._onActiveChange.event;
5036
- this._onUpdateParameters = new Emitter();
5037
- this.onUpdateParameters = this._onUpdateParameters.event;
5049
+ this._onDidParametersChange = new Emitter();
5050
+ this.onDidParametersChange = this._onDidParametersChange.event;
5038
5051
  this.addDisposables(this.onDidFocusChange((event) => {
5039
5052
  this._isFocused = event.isFocused;
5040
5053
  }), this.onDidActiveChange((event) => {
@@ -5044,10 +5057,14 @@ class PanelApiImpl extends CompositeDisposable {
5044
5057
  }), this.onDidDimensionsChange((event) => {
5045
5058
  this._width = event.width;
5046
5059
  this._height = event.height;
5047
- }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
5060
+ }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onWillFocus, this._onWillVisibilityChange, this._onDidParametersChange);
5061
+ }
5062
+ getParameters() {
5063
+ return this._parameters;
5048
5064
  }
5049
5065
  initialize(panel) {
5050
- this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
5066
+ this.panelUpdatesDisposable.value = this._onDidParametersChange.event((parameters) => {
5067
+ this._parameters = parameters;
5051
5068
  panel.update({
5052
5069
  params: parameters,
5053
5070
  });
@@ -5060,14 +5077,14 @@ class PanelApiImpl extends CompositeDisposable {
5060
5077
  this._onActiveChange.fire();
5061
5078
  }
5062
5079
  updateParameters(parameters) {
5063
- this._onUpdateParameters.fire(parameters);
5080
+ this._onDidParametersChange.fire(parameters);
5064
5081
  }
5065
5082
  }
5066
5083
 
5067
5084
  class SplitviewPanelApiImpl extends PanelApiImpl {
5068
5085
  //
5069
- constructor(id) {
5070
- super(id);
5086
+ constructor(id, component) {
5087
+ super(id, component);
5071
5088
  this._onDidConstraintsChangeInternal = new Emitter();
5072
5089
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5073
5090
  //
@@ -5092,8 +5109,8 @@ class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
5092
5109
  set pane(pane) {
5093
5110
  this._pane = pane;
5094
5111
  }
5095
- constructor(id) {
5096
- super(id);
5112
+ constructor(id, component) {
5113
+ super(id, component);
5097
5114
  this._onDidExpansionChange = new Emitter({
5098
5115
  replay: true,
5099
5116
  });
@@ -5252,7 +5269,7 @@ class PaneviewPanel extends BasePanelView {
5252
5269
  this.header.style.display = value ? '' : 'none';
5253
5270
  }
5254
5271
  constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
5255
- super(id, component, new PaneviewPanelApiImpl(id));
5272
+ super(id, component, new PaneviewPanelApiImpl(id, component));
5256
5273
  this.headerComponent = headerComponent;
5257
5274
  this._onDidChangeExpansionState = new Emitter({ replay: true });
5258
5275
  this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
@@ -5483,8 +5500,8 @@ class DraggablePaneviewPanel extends PaneviewPanel {
5483
5500
  }
5484
5501
 
5485
5502
  class GridviewPanelApiImpl extends PanelApiImpl {
5486
- constructor(id, panel) {
5487
- super(id);
5503
+ constructor(id, component, panel) {
5504
+ super(id, component);
5488
5505
  this._onDidConstraintsChangeInternal = new Emitter();
5489
5506
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5490
5507
  this._onDidConstraintsChange = new Emitter();
@@ -5555,7 +5572,7 @@ class GridviewPanel extends BasePanelView {
5555
5572
  return this.api.isActive;
5556
5573
  }
5557
5574
  constructor(id, component, options, api) {
5558
- super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id));
5575
+ super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id, component));
5559
5576
  this._evaluatedMinimumWidth = 0;
5560
5577
  this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
5561
5578
  this._evaluatedMinimumHeight = 0;
@@ -5663,7 +5680,7 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
5663
5680
  return this._group.model.location;
5664
5681
  }
5665
5682
  constructor(id, accessor) {
5666
- super(id);
5683
+ super(id, '__dockviewgroup__');
5667
5684
  this.accessor = accessor;
5668
5685
  this._onDidLocationChange = new Emitter();
5669
5686
  this.onDidLocationChange = this._onDidLocationChange.event;
@@ -5837,8 +5854,11 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
5837
5854
  get group() {
5838
5855
  return this._group;
5839
5856
  }
5840
- constructor(panel, group, accessor) {
5841
- super(panel.id);
5857
+ get tabComponent() {
5858
+ return this._tabComponent;
5859
+ }
5860
+ constructor(panel, group, accessor, component, tabComponent) {
5861
+ super(panel.id, component);
5842
5862
  this.panel = panel;
5843
5863
  this.accessor = accessor;
5844
5864
  this._onDidTitleChange = new Emitter();
@@ -5852,6 +5872,7 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
5852
5872
  this._onDidLocationChange = new Emitter();
5853
5873
  this.onDidLocationChange = this._onDidLocationChange.event;
5854
5874
  this.groupEventsDisposable = new MutableDisposable();
5875
+ this._tabComponent = tabComponent;
5855
5876
  this.initialize(panel);
5856
5877
  this._group = group;
5857
5878
  this.setupGroupEventListeners();
@@ -5934,7 +5955,7 @@ class DockviewPanel extends CompositeDisposable {
5934
5955
  var _a;
5935
5956
  return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
5936
5957
  }
5937
- constructor(id, accessor, containerApi, group, view, options) {
5958
+ constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {
5938
5959
  super();
5939
5960
  this.id = id;
5940
5961
  this.accessor = accessor;
@@ -5942,7 +5963,7 @@ class DockviewPanel extends CompositeDisposable {
5942
5963
  this.view = view;
5943
5964
  this._renderer = options.renderer;
5944
5965
  this._group = group;
5945
- this.api = new DockviewPanelApiImpl(this, this._group, accessor);
5966
+ this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);
5946
5967
  this.addDisposables(this.api.onActiveChange(() => {
5947
5968
  accessor.setActivePanel(this);
5948
5969
  }), this.api.onDidSizeChange((event) => {
@@ -6237,7 +6258,7 @@ class DefaultDockviewDeserialzier {
6237
6258
  ? (_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id
6238
6259
  : panelData.tabComponent;
6239
6260
  const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
6240
- const panel = new DockviewPanel(panelId, this.accessor, new DockviewApi(this.accessor), group, view, {
6261
+ const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {
6241
6262
  renderer: panelData.renderer,
6242
6263
  });
6243
6264
  panel.init({
@@ -8224,6 +8245,8 @@ class DockviewComponent extends BaseGrid {
8224
8245
  if (this._onDidActivePanelChange.value !== event.panel) {
8225
8246
  this._onDidActivePanelChange.fire(event.panel);
8226
8247
  }
8248
+ }), Event.any(view.model.onDidPanelTitleChange, view.model.onDidPanelParametersChange)(() => {
8249
+ this._bufferOnDidLayoutChange.fire();
8227
8250
  }));
8228
8251
  this._groups.set(view.id, { value: view, disposable });
8229
8252
  }
@@ -8236,7 +8259,7 @@ class DockviewComponent extends BaseGrid {
8236
8259
  const contentComponent = options.component;
8237
8260
  const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
8238
8261
  const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
8239
- const panel = new DockviewPanel(options.id, this, this._api, group, view, { renderer: options.renderer });
8262
+ const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, { renderer: options.renderer });
8240
8263
  panel.init({
8241
8264
  title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
8242
8265
  params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
@@ -9151,7 +9174,7 @@ class SplitviewPanel extends BasePanelView {
9151
9174
  return this._snap;
9152
9175
  }
9153
9176
  constructor(id, componentName) {
9154
- super(id, componentName, new SplitviewPanelApiImpl(id));
9177
+ super(id, componentName, new SplitviewPanelApiImpl(id, componentName));
9155
9178
  this._evaluatedMinimumSize = 0;
9156
9179
  this._evaluatedMaximumSize = Number.POSITIVE_INFINITY;
9157
9180
  this._minimumSize = 0;