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
  */
@@ -4259,6 +4259,7 @@
4259
4259
  this._width = 0;
4260
4260
  this._height = 0;
4261
4261
  this._panels = [];
4262
+ this._panelDisposables = new Map();
4262
4263
  this._onMove = new Emitter();
4263
4264
  this.onMove = this._onMove.event;
4264
4265
  this._onDidDrop = new Emitter();
@@ -4273,6 +4274,10 @@
4273
4274
  this.onGroupDragStart = this._onGroupDragStart.event;
4274
4275
  this._onDidAddPanel = new Emitter();
4275
4276
  this.onDidAddPanel = this._onDidAddPanel.event;
4277
+ this._onDidPanelTitleChange = new Emitter();
4278
+ this.onDidPanelTitleChange = this._onDidPanelTitleChange.event;
4279
+ this._onDidPanelParametersChange = new Emitter();
4280
+ this.onDidPanelParametersChange = this._onDidPanelParametersChange.event;
4276
4281
  this._onDidRemovePanel = new Emitter();
4277
4282
  this.onDidRemovePanel = this._onDidRemovePanel.event;
4278
4283
  this._onDidActivePanelChange = new Emitter();
@@ -4561,6 +4566,11 @@
4561
4566
  if (this.mostRecentlyUsed.includes(panel)) {
4562
4567
  this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
4563
4568
  }
4569
+ const disposable = this._panelDisposables.get(panel.id);
4570
+ if (disposable) {
4571
+ disposable.dispose();
4572
+ this._panelDisposables.delete(panel.id);
4573
+ }
4564
4574
  this._onDidRemovePanel.fire({ panel });
4565
4575
  }
4566
4576
  doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
@@ -4578,6 +4588,7 @@
4578
4588
  }
4579
4589
  this.updateMru(panel);
4580
4590
  this.panels.splice(index, 0, panel);
4591
+ this._panelDisposables.set(panel.id, new CompositeDisposable(panel.api.onDidTitleChange((event) => this._onDidPanelTitleChange.fire(event)), panel.api.onDidParametersChange((event) => this._onDidPanelParametersChange.fire(event))));
4581
4592
  this._onDidAddPanel.fire({ panel });
4582
4593
  }
4583
4594
  doSetActivePanel(panel) {
@@ -5001,14 +5012,16 @@
5001
5012
  get height() {
5002
5013
  return this._height;
5003
5014
  }
5004
- constructor(id) {
5015
+ constructor(id, component) {
5005
5016
  super();
5006
5017
  this.id = id;
5018
+ this.component = component;
5007
5019
  this._isFocused = false;
5008
5020
  this._isActive = false;
5009
5021
  this._isVisible = true;
5010
5022
  this._width = 0;
5011
5023
  this._height = 0;
5024
+ this._parameters = {};
5012
5025
  this.panelUpdatesDisposable = new MutableDisposable();
5013
5026
  this._onDidDimensionChange = new Emitter();
5014
5027
  this.onDidDimensionsChange = this._onDidDimensionChange.event;
@@ -5026,8 +5039,8 @@
5026
5039
  this.onDidActiveChange = this._onDidActiveChange.event;
5027
5040
  this._onActiveChange = new Emitter();
5028
5041
  this.onActiveChange = this._onActiveChange.event;
5029
- this._onUpdateParameters = new Emitter();
5030
- this.onUpdateParameters = this._onUpdateParameters.event;
5042
+ this._onDidParametersChange = new Emitter();
5043
+ this.onDidParametersChange = this._onDidParametersChange.event;
5031
5044
  this.addDisposables(this.onDidFocusChange((event) => {
5032
5045
  this._isFocused = event.isFocused;
5033
5046
  }), this.onDidActiveChange((event) => {
@@ -5037,10 +5050,14 @@
5037
5050
  }), this.onDidDimensionsChange((event) => {
5038
5051
  this._width = event.width;
5039
5052
  this._height = event.height;
5040
- }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
5053
+ }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onWillFocus, this._onWillVisibilityChange, this._onDidParametersChange);
5054
+ }
5055
+ getParameters() {
5056
+ return this._parameters;
5041
5057
  }
5042
5058
  initialize(panel) {
5043
- this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
5059
+ this.panelUpdatesDisposable.value = this._onDidParametersChange.event((parameters) => {
5060
+ this._parameters = parameters;
5044
5061
  panel.update({
5045
5062
  params: parameters,
5046
5063
  });
@@ -5053,14 +5070,14 @@
5053
5070
  this._onActiveChange.fire();
5054
5071
  }
5055
5072
  updateParameters(parameters) {
5056
- this._onUpdateParameters.fire(parameters);
5073
+ this._onDidParametersChange.fire(parameters);
5057
5074
  }
5058
5075
  }
5059
5076
 
5060
5077
  class SplitviewPanelApiImpl extends PanelApiImpl {
5061
5078
  //
5062
- constructor(id) {
5063
- super(id);
5079
+ constructor(id, component) {
5080
+ super(id, component);
5064
5081
  this._onDidConstraintsChangeInternal = new Emitter();
5065
5082
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5066
5083
  //
@@ -5085,8 +5102,8 @@
5085
5102
  set pane(pane) {
5086
5103
  this._pane = pane;
5087
5104
  }
5088
- constructor(id) {
5089
- super(id);
5105
+ constructor(id, component) {
5106
+ super(id, component);
5090
5107
  this._onDidExpansionChange = new Emitter({
5091
5108
  replay: true,
5092
5109
  });
@@ -5245,7 +5262,7 @@
5245
5262
  this.header.style.display = value ? '' : 'none';
5246
5263
  }
5247
5264
  constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
5248
- super(id, component, new PaneviewPanelApiImpl(id));
5265
+ super(id, component, new PaneviewPanelApiImpl(id, component));
5249
5266
  this.headerComponent = headerComponent;
5250
5267
  this._onDidChangeExpansionState = new Emitter({ replay: true });
5251
5268
  this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
@@ -5476,8 +5493,8 @@
5476
5493
  }
5477
5494
 
5478
5495
  class GridviewPanelApiImpl extends PanelApiImpl {
5479
- constructor(id, panel) {
5480
- super(id);
5496
+ constructor(id, component, panel) {
5497
+ super(id, component);
5481
5498
  this._onDidConstraintsChangeInternal = new Emitter();
5482
5499
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5483
5500
  this._onDidConstraintsChange = new Emitter();
@@ -5548,7 +5565,7 @@
5548
5565
  return this.api.isActive;
5549
5566
  }
5550
5567
  constructor(id, component, options, api) {
5551
- super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id));
5568
+ super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id, component));
5552
5569
  this._evaluatedMinimumWidth = 0;
5553
5570
  this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
5554
5571
  this._evaluatedMinimumHeight = 0;
@@ -5656,7 +5673,7 @@
5656
5673
  return this._group.model.location;
5657
5674
  }
5658
5675
  constructor(id, accessor) {
5659
- super(id);
5676
+ super(id, '__dockviewgroup__');
5660
5677
  this.accessor = accessor;
5661
5678
  this._onDidLocationChange = new Emitter();
5662
5679
  this.onDidLocationChange = this._onDidLocationChange.event;
@@ -5830,8 +5847,11 @@
5830
5847
  get group() {
5831
5848
  return this._group;
5832
5849
  }
5833
- constructor(panel, group, accessor) {
5834
- super(panel.id);
5850
+ get tabComponent() {
5851
+ return this._tabComponent;
5852
+ }
5853
+ constructor(panel, group, accessor, component, tabComponent) {
5854
+ super(panel.id, component);
5835
5855
  this.panel = panel;
5836
5856
  this.accessor = accessor;
5837
5857
  this._onDidTitleChange = new Emitter();
@@ -5845,6 +5865,7 @@
5845
5865
  this._onDidLocationChange = new Emitter();
5846
5866
  this.onDidLocationChange = this._onDidLocationChange.event;
5847
5867
  this.groupEventsDisposable = new MutableDisposable();
5868
+ this._tabComponent = tabComponent;
5848
5869
  this.initialize(panel);
5849
5870
  this._group = group;
5850
5871
  this.setupGroupEventListeners();
@@ -5927,7 +5948,7 @@
5927
5948
  var _a;
5928
5949
  return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
5929
5950
  }
5930
- constructor(id, accessor, containerApi, group, view, options) {
5951
+ constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {
5931
5952
  super();
5932
5953
  this.id = id;
5933
5954
  this.accessor = accessor;
@@ -5935,7 +5956,7 @@
5935
5956
  this.view = view;
5936
5957
  this._renderer = options.renderer;
5937
5958
  this._group = group;
5938
- this.api = new DockviewPanelApiImpl(this, this._group, accessor);
5959
+ this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);
5939
5960
  this.addDisposables(this.api.onActiveChange(() => {
5940
5961
  accessor.setActivePanel(this);
5941
5962
  }), this.api.onDidSizeChange((event) => {
@@ -6230,7 +6251,7 @@
6230
6251
  ? (_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id
6231
6252
  : panelData.tabComponent;
6232
6253
  const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
6233
- const panel = new DockviewPanel(panelId, this.accessor, new DockviewApi(this.accessor), group, view, {
6254
+ const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {
6234
6255
  renderer: panelData.renderer,
6235
6256
  });
6236
6257
  panel.init({
@@ -8217,6 +8238,8 @@
8217
8238
  if (this._onDidActivePanelChange.value !== event.panel) {
8218
8239
  this._onDidActivePanelChange.fire(event.panel);
8219
8240
  }
8241
+ }), exports.DockviewEvent.any(view.model.onDidPanelTitleChange, view.model.onDidPanelParametersChange)(() => {
8242
+ this._bufferOnDidLayoutChange.fire();
8220
8243
  }));
8221
8244
  this._groups.set(view.id, { value: view, disposable });
8222
8245
  }
@@ -8229,7 +8252,7 @@
8229
8252
  const contentComponent = options.component;
8230
8253
  const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
8231
8254
  const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
8232
- const panel = new DockviewPanel(options.id, this, this._api, group, view, { renderer: options.renderer });
8255
+ const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, { renderer: options.renderer });
8233
8256
  panel.init({
8234
8257
  title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
8235
8258
  params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
@@ -9144,7 +9167,7 @@
9144
9167
  return this._snap;
9145
9168
  }
9146
9169
  constructor(id, componentName) {
9147
- super(id, componentName, new SplitviewPanelApiImpl(id));
9170
+ super(id, componentName, new SplitviewPanelApiImpl(id, componentName));
9148
9171
  this._evaluatedMinimumSize = 0;
9149
9172
  this._evaluatedMaximumSize = Number.POSITIVE_INFINITY;
9150
9173
  this._minimumSize = 0;