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
  */
@@ -4288,6 +4288,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
4288
4288
  this._width = 0;
4289
4289
  this._height = 0;
4290
4290
  this._panels = [];
4291
+ this._panelDisposables = new Map();
4291
4292
  this._onMove = new Emitter();
4292
4293
  this.onMove = this._onMove.event;
4293
4294
  this._onDidDrop = new Emitter();
@@ -4302,6 +4303,10 @@ class DockviewGroupPanelModel extends CompositeDisposable {
4302
4303
  this.onGroupDragStart = this._onGroupDragStart.event;
4303
4304
  this._onDidAddPanel = new Emitter();
4304
4305
  this.onDidAddPanel = this._onDidAddPanel.event;
4306
+ this._onDidPanelTitleChange = new Emitter();
4307
+ this.onDidPanelTitleChange = this._onDidPanelTitleChange.event;
4308
+ this._onDidPanelParametersChange = new Emitter();
4309
+ this.onDidPanelParametersChange = this._onDidPanelParametersChange.event;
4305
4310
  this._onDidRemovePanel = new Emitter();
4306
4311
  this.onDidRemovePanel = this._onDidRemovePanel.event;
4307
4312
  this._onDidActivePanelChange = new Emitter();
@@ -4590,6 +4595,11 @@ class DockviewGroupPanelModel extends CompositeDisposable {
4590
4595
  if (this.mostRecentlyUsed.includes(panel)) {
4591
4596
  this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
4592
4597
  }
4598
+ const disposable = this._panelDisposables.get(panel.id);
4599
+ if (disposable) {
4600
+ disposable.dispose();
4601
+ this._panelDisposables.delete(panel.id);
4602
+ }
4593
4603
  this._onDidRemovePanel.fire({ panel });
4594
4604
  }
4595
4605
  doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
@@ -4607,6 +4617,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
4607
4617
  }
4608
4618
  this.updateMru(panel);
4609
4619
  this.panels.splice(index, 0, panel);
4620
+ this._panelDisposables.set(panel.id, new CompositeDisposable(panel.api.onDidTitleChange((event) => this._onDidPanelTitleChange.fire(event)), panel.api.onDidParametersChange((event) => this._onDidPanelParametersChange.fire(event))));
4610
4621
  this._onDidAddPanel.fire({ panel });
4611
4622
  }
4612
4623
  doSetActivePanel(panel) {
@@ -5030,14 +5041,16 @@ class PanelApiImpl extends CompositeDisposable {
5030
5041
  get height() {
5031
5042
  return this._height;
5032
5043
  }
5033
- constructor(id) {
5044
+ constructor(id, component) {
5034
5045
  super();
5035
5046
  this.id = id;
5047
+ this.component = component;
5036
5048
  this._isFocused = false;
5037
5049
  this._isActive = false;
5038
5050
  this._isVisible = true;
5039
5051
  this._width = 0;
5040
5052
  this._height = 0;
5053
+ this._parameters = {};
5041
5054
  this.panelUpdatesDisposable = new MutableDisposable();
5042
5055
  this._onDidDimensionChange = new Emitter();
5043
5056
  this.onDidDimensionsChange = this._onDidDimensionChange.event;
@@ -5055,8 +5068,8 @@ class PanelApiImpl extends CompositeDisposable {
5055
5068
  this.onDidActiveChange = this._onDidActiveChange.event;
5056
5069
  this._onActiveChange = new Emitter();
5057
5070
  this.onActiveChange = this._onActiveChange.event;
5058
- this._onUpdateParameters = new Emitter();
5059
- this.onUpdateParameters = this._onUpdateParameters.event;
5071
+ this._onDidParametersChange = new Emitter();
5072
+ this.onDidParametersChange = this._onDidParametersChange.event;
5060
5073
  this.addDisposables(this.onDidFocusChange((event) => {
5061
5074
  this._isFocused = event.isFocused;
5062
5075
  }), this.onDidActiveChange((event) => {
@@ -5066,10 +5079,14 @@ class PanelApiImpl extends CompositeDisposable {
5066
5079
  }), this.onDidDimensionsChange((event) => {
5067
5080
  this._width = event.width;
5068
5081
  this._height = event.height;
5069
- }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
5082
+ }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onWillFocus, this._onWillVisibilityChange, this._onDidParametersChange);
5083
+ }
5084
+ getParameters() {
5085
+ return this._parameters;
5070
5086
  }
5071
5087
  initialize(panel) {
5072
- this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
5088
+ this.panelUpdatesDisposable.value = this._onDidParametersChange.event((parameters) => {
5089
+ this._parameters = parameters;
5073
5090
  panel.update({
5074
5091
  params: parameters,
5075
5092
  });
@@ -5082,14 +5099,14 @@ class PanelApiImpl extends CompositeDisposable {
5082
5099
  this._onActiveChange.fire();
5083
5100
  }
5084
5101
  updateParameters(parameters) {
5085
- this._onUpdateParameters.fire(parameters);
5102
+ this._onDidParametersChange.fire(parameters);
5086
5103
  }
5087
5104
  }
5088
5105
 
5089
5106
  class SplitviewPanelApiImpl extends PanelApiImpl {
5090
5107
  //
5091
- constructor(id) {
5092
- super(id);
5108
+ constructor(id, component) {
5109
+ super(id, component);
5093
5110
  this._onDidConstraintsChangeInternal = new Emitter();
5094
5111
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5095
5112
  //
@@ -5114,8 +5131,8 @@ class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
5114
5131
  set pane(pane) {
5115
5132
  this._pane = pane;
5116
5133
  }
5117
- constructor(id) {
5118
- super(id);
5134
+ constructor(id, component) {
5135
+ super(id, component);
5119
5136
  this._onDidExpansionChange = new Emitter({
5120
5137
  replay: true,
5121
5138
  });
@@ -5274,7 +5291,7 @@ class PaneviewPanel extends BasePanelView {
5274
5291
  this.header.style.display = value ? '' : 'none';
5275
5292
  }
5276
5293
  constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
5277
- super(id, component, new PaneviewPanelApiImpl(id));
5294
+ super(id, component, new PaneviewPanelApiImpl(id, component));
5278
5295
  this.headerComponent = headerComponent;
5279
5296
  this._onDidChangeExpansionState = new Emitter({ replay: true });
5280
5297
  this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
@@ -5505,8 +5522,8 @@ class DraggablePaneviewPanel extends PaneviewPanel {
5505
5522
  }
5506
5523
 
5507
5524
  class GridviewPanelApiImpl extends PanelApiImpl {
5508
- constructor(id, panel) {
5509
- super(id);
5525
+ constructor(id, component, panel) {
5526
+ super(id, component);
5510
5527
  this._onDidConstraintsChangeInternal = new Emitter();
5511
5528
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5512
5529
  this._onDidConstraintsChange = new Emitter();
@@ -5577,7 +5594,7 @@ class GridviewPanel extends BasePanelView {
5577
5594
  return this.api.isActive;
5578
5595
  }
5579
5596
  constructor(id, component, options, api) {
5580
- super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id));
5597
+ super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id, component));
5581
5598
  this._evaluatedMinimumWidth = 0;
5582
5599
  this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
5583
5600
  this._evaluatedMinimumHeight = 0;
@@ -5685,7 +5702,7 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
5685
5702
  return this._group.model.location;
5686
5703
  }
5687
5704
  constructor(id, accessor) {
5688
- super(id);
5705
+ super(id, '__dockviewgroup__');
5689
5706
  this.accessor = accessor;
5690
5707
  this._onDidLocationChange = new Emitter();
5691
5708
  this.onDidLocationChange = this._onDidLocationChange.event;
@@ -5859,8 +5876,11 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
5859
5876
  get group() {
5860
5877
  return this._group;
5861
5878
  }
5862
- constructor(panel, group, accessor) {
5863
- super(panel.id);
5879
+ get tabComponent() {
5880
+ return this._tabComponent;
5881
+ }
5882
+ constructor(panel, group, accessor, component, tabComponent) {
5883
+ super(panel.id, component);
5864
5884
  this.panel = panel;
5865
5885
  this.accessor = accessor;
5866
5886
  this._onDidTitleChange = new Emitter();
@@ -5874,6 +5894,7 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
5874
5894
  this._onDidLocationChange = new Emitter();
5875
5895
  this.onDidLocationChange = this._onDidLocationChange.event;
5876
5896
  this.groupEventsDisposable = new MutableDisposable();
5897
+ this._tabComponent = tabComponent;
5877
5898
  this.initialize(panel);
5878
5899
  this._group = group;
5879
5900
  this.setupGroupEventListeners();
@@ -5956,7 +5977,7 @@ class DockviewPanel extends CompositeDisposable {
5956
5977
  var _a;
5957
5978
  return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
5958
5979
  }
5959
- constructor(id, accessor, containerApi, group, view, options) {
5980
+ constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {
5960
5981
  super();
5961
5982
  this.id = id;
5962
5983
  this.accessor = accessor;
@@ -5964,7 +5985,7 @@ class DockviewPanel extends CompositeDisposable {
5964
5985
  this.view = view;
5965
5986
  this._renderer = options.renderer;
5966
5987
  this._group = group;
5967
- this.api = new DockviewPanelApiImpl(this, this._group, accessor);
5988
+ this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);
5968
5989
  this.addDisposables(this.api.onActiveChange(() => {
5969
5990
  accessor.setActivePanel(this);
5970
5991
  }), this.api.onDidSizeChange((event) => {
@@ -6259,7 +6280,7 @@ class DefaultDockviewDeserialzier {
6259
6280
  ? (_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id
6260
6281
  : panelData.tabComponent;
6261
6282
  const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
6262
- const panel = new DockviewPanel(panelId, this.accessor, new DockviewApi(this.accessor), group, view, {
6283
+ const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {
6263
6284
  renderer: panelData.renderer,
6264
6285
  });
6265
6286
  panel.init({
@@ -8246,6 +8267,8 @@ class DockviewComponent extends BaseGrid {
8246
8267
  if (this._onDidActivePanelChange.value !== event.panel) {
8247
8268
  this._onDidActivePanelChange.fire(event.panel);
8248
8269
  }
8270
+ }), exports.DockviewEvent.any(view.model.onDidPanelTitleChange, view.model.onDidPanelParametersChange)(() => {
8271
+ this._bufferOnDidLayoutChange.fire();
8249
8272
  }));
8250
8273
  this._groups.set(view.id, { value: view, disposable });
8251
8274
  }
@@ -8258,7 +8281,7 @@ class DockviewComponent extends BaseGrid {
8258
8281
  const contentComponent = options.component;
8259
8282
  const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
8260
8283
  const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
8261
- const panel = new DockviewPanel(options.id, this, this._api, group, view, { renderer: options.renderer });
8284
+ const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, { renderer: options.renderer });
8262
8285
  panel.init({
8263
8286
  title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
8264
8287
  params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
@@ -9173,7 +9196,7 @@ class SplitviewPanel extends BasePanelView {
9173
9196
  return this._snap;
9174
9197
  }
9175
9198
  constructor(id, componentName) {
9176
- super(id, componentName, new SplitviewPanelApiImpl(id));
9199
+ super(id, componentName, new SplitviewPanelApiImpl(id, componentName));
9177
9200
  this._evaluatedMinimumSize = 0;
9178
9201
  this._evaluatedMaximumSize = Number.POSITIVE_INFINITY;
9179
9202
  this._minimumSize = 0;