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