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
  */
@@ -4255,6 +4255,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4255
4255
  this._width = 0;
4256
4256
  this._height = 0;
4257
4257
  this._panels = [];
4258
+ this._panelDisposables = new Map();
4258
4259
  this._onMove = new Emitter();
4259
4260
  this.onMove = this._onMove.event;
4260
4261
  this._onDidDrop = new Emitter();
@@ -4269,6 +4270,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4269
4270
  this.onGroupDragStart = this._onGroupDragStart.event;
4270
4271
  this._onDidAddPanel = new Emitter();
4271
4272
  this.onDidAddPanel = this._onDidAddPanel.event;
4273
+ this._onDidPanelTitleChange = new Emitter();
4274
+ this.onDidPanelTitleChange = this._onDidPanelTitleChange.event;
4275
+ this._onDidPanelParametersChange = new Emitter();
4276
+ this.onDidPanelParametersChange = this._onDidPanelParametersChange.event;
4272
4277
  this._onDidRemovePanel = new Emitter();
4273
4278
  this.onDidRemovePanel = this._onDidRemovePanel.event;
4274
4279
  this._onDidActivePanelChange = new Emitter();
@@ -4557,6 +4562,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4557
4562
  if (this.mostRecentlyUsed.includes(panel)) {
4558
4563
  this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
4559
4564
  }
4565
+ const disposable = this._panelDisposables.get(panel.id);
4566
+ if (disposable) {
4567
+ disposable.dispose();
4568
+ this._panelDisposables.delete(panel.id);
4569
+ }
4560
4570
  this._onDidRemovePanel.fire({ panel });
4561
4571
  }
4562
4572
  doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
@@ -4574,6 +4584,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4574
4584
  }
4575
4585
  this.updateMru(panel);
4576
4586
  this.panels.splice(index, 0, panel);
4587
+ this._panelDisposables.set(panel.id, new CompositeDisposable(panel.api.onDidTitleChange((event) => this._onDidPanelTitleChange.fire(event)), panel.api.onDidParametersChange((event) => this._onDidPanelParametersChange.fire(event))));
4577
4588
  this._onDidAddPanel.fire({ panel });
4578
4589
  }
4579
4590
  doSetActivePanel(panel) {
@@ -4997,14 +5008,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4997
5008
  get height() {
4998
5009
  return this._height;
4999
5010
  }
5000
- constructor(id) {
5011
+ constructor(id, component) {
5001
5012
  super();
5002
5013
  this.id = id;
5014
+ this.component = component;
5003
5015
  this._isFocused = false;
5004
5016
  this._isActive = false;
5005
5017
  this._isVisible = true;
5006
5018
  this._width = 0;
5007
5019
  this._height = 0;
5020
+ this._parameters = {};
5008
5021
  this.panelUpdatesDisposable = new MutableDisposable();
5009
5022
  this._onDidDimensionChange = new Emitter();
5010
5023
  this.onDidDimensionsChange = this._onDidDimensionChange.event;
@@ -5022,8 +5035,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5022
5035
  this.onDidActiveChange = this._onDidActiveChange.event;
5023
5036
  this._onActiveChange = new Emitter();
5024
5037
  this.onActiveChange = this._onActiveChange.event;
5025
- this._onUpdateParameters = new Emitter();
5026
- this.onUpdateParameters = this._onUpdateParameters.event;
5038
+ this._onDidParametersChange = new Emitter();
5039
+ this.onDidParametersChange = this._onDidParametersChange.event;
5027
5040
  this.addDisposables(this.onDidFocusChange((event) => {
5028
5041
  this._isFocused = event.isFocused;
5029
5042
  }), this.onDidActiveChange((event) => {
@@ -5033,10 +5046,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5033
5046
  }), this.onDidDimensionsChange((event) => {
5034
5047
  this._width = event.width;
5035
5048
  this._height = event.height;
5036
- }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
5049
+ }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onWillFocus, this._onWillVisibilityChange, this._onDidParametersChange);
5050
+ }
5051
+ getParameters() {
5052
+ return this._parameters;
5037
5053
  }
5038
5054
  initialize(panel) {
5039
- this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
5055
+ this.panelUpdatesDisposable.value = this._onDidParametersChange.event((parameters) => {
5056
+ this._parameters = parameters;
5040
5057
  panel.update({
5041
5058
  params: parameters,
5042
5059
  });
@@ -5049,14 +5066,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5049
5066
  this._onActiveChange.fire();
5050
5067
  }
5051
5068
  updateParameters(parameters) {
5052
- this._onUpdateParameters.fire(parameters);
5069
+ this._onDidParametersChange.fire(parameters);
5053
5070
  }
5054
5071
  }
5055
5072
 
5056
5073
  class SplitviewPanelApiImpl extends PanelApiImpl {
5057
5074
  //
5058
- constructor(id) {
5059
- super(id);
5075
+ constructor(id, component) {
5076
+ super(id, component);
5060
5077
  this._onDidConstraintsChangeInternal = new Emitter();
5061
5078
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5062
5079
  //
@@ -5081,8 +5098,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5081
5098
  set pane(pane) {
5082
5099
  this._pane = pane;
5083
5100
  }
5084
- constructor(id) {
5085
- super(id);
5101
+ constructor(id, component) {
5102
+ super(id, component);
5086
5103
  this._onDidExpansionChange = new Emitter({
5087
5104
  replay: true,
5088
5105
  });
@@ -5241,7 +5258,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5241
5258
  this.header.style.display = value ? '' : 'none';
5242
5259
  }
5243
5260
  constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
5244
- super(id, component, new PaneviewPanelApiImpl(id));
5261
+ super(id, component, new PaneviewPanelApiImpl(id, component));
5245
5262
  this.headerComponent = headerComponent;
5246
5263
  this._onDidChangeExpansionState = new Emitter({ replay: true });
5247
5264
  this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
@@ -5472,8 +5489,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5472
5489
  }
5473
5490
 
5474
5491
  class GridviewPanelApiImpl extends PanelApiImpl {
5475
- constructor(id, panel) {
5476
- super(id);
5492
+ constructor(id, component, panel) {
5493
+ super(id, component);
5477
5494
  this._onDidConstraintsChangeInternal = new Emitter();
5478
5495
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5479
5496
  this._onDidConstraintsChange = new Emitter();
@@ -5544,7 +5561,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5544
5561
  return this.api.isActive;
5545
5562
  }
5546
5563
  constructor(id, component, options, api) {
5547
- super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id));
5564
+ super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id, component));
5548
5565
  this._evaluatedMinimumWidth = 0;
5549
5566
  this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
5550
5567
  this._evaluatedMinimumHeight = 0;
@@ -5652,7 +5669,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5652
5669
  return this._group.model.location;
5653
5670
  }
5654
5671
  constructor(id, accessor) {
5655
- super(id);
5672
+ super(id, '__dockviewgroup__');
5656
5673
  this.accessor = accessor;
5657
5674
  this._onDidLocationChange = new Emitter();
5658
5675
  this.onDidLocationChange = this._onDidLocationChange.event;
@@ -5826,8 +5843,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5826
5843
  get group() {
5827
5844
  return this._group;
5828
5845
  }
5829
- constructor(panel, group, accessor) {
5830
- super(panel.id);
5846
+ get tabComponent() {
5847
+ return this._tabComponent;
5848
+ }
5849
+ constructor(panel, group, accessor, component, tabComponent) {
5850
+ super(panel.id, component);
5831
5851
  this.panel = panel;
5832
5852
  this.accessor = accessor;
5833
5853
  this._onDidTitleChange = new Emitter();
@@ -5841,6 +5861,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5841
5861
  this._onDidLocationChange = new Emitter();
5842
5862
  this.onDidLocationChange = this._onDidLocationChange.event;
5843
5863
  this.groupEventsDisposable = new MutableDisposable();
5864
+ this._tabComponent = tabComponent;
5844
5865
  this.initialize(panel);
5845
5866
  this._group = group;
5846
5867
  this.setupGroupEventListeners();
@@ -5923,7 +5944,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5923
5944
  var _a;
5924
5945
  return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
5925
5946
  }
5926
- constructor(id, accessor, containerApi, group, view, options) {
5947
+ constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {
5927
5948
  super();
5928
5949
  this.id = id;
5929
5950
  this.accessor = accessor;
@@ -5931,7 +5952,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5931
5952
  this.view = view;
5932
5953
  this._renderer = options.renderer;
5933
5954
  this._group = group;
5934
- this.api = new DockviewPanelApiImpl(this, this._group, accessor);
5955
+ this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);
5935
5956
  this.addDisposables(this.api.onActiveChange(() => {
5936
5957
  accessor.setActivePanel(this);
5937
5958
  }), this.api.onDidSizeChange((event) => {
@@ -6226,7 +6247,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6226
6247
  ? (_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id
6227
6248
  : panelData.tabComponent;
6228
6249
  const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
6229
- const panel = new DockviewPanel(panelId, this.accessor, new DockviewApi(this.accessor), group, view, {
6250
+ const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {
6230
6251
  renderer: panelData.renderer,
6231
6252
  });
6232
6253
  panel.init({
@@ -8213,6 +8234,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8213
8234
  if (this._onDidActivePanelChange.value !== event.panel) {
8214
8235
  this._onDidActivePanelChange.fire(event.panel);
8215
8236
  }
8237
+ }), exports.DockviewEvent.any(view.model.onDidPanelTitleChange, view.model.onDidPanelParametersChange)(() => {
8238
+ this._bufferOnDidLayoutChange.fire();
8216
8239
  }));
8217
8240
  this._groups.set(view.id, { value: view, disposable });
8218
8241
  }
@@ -8225,7 +8248,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8225
8248
  const contentComponent = options.component;
8226
8249
  const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
8227
8250
  const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
8228
- const panel = new DockviewPanel(options.id, this, this._api, group, view, { renderer: options.renderer });
8251
+ const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, { renderer: options.renderer });
8229
8252
  panel.init({
8230
8253
  title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
8231
8254
  params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
@@ -9140,7 +9163,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9140
9163
  return this._snap;
9141
9164
  }
9142
9165
  constructor(id, componentName) {
9143
- super(id, componentName, new SplitviewPanelApiImpl(id));
9166
+ super(id, componentName, new SplitviewPanelApiImpl(id, componentName));
9144
9167
  this._evaluatedMinimumSize = 0;
9145
9168
  this._evaluatedMaximumSize = Number.POSITIVE_INFINITY;
9146
9169
  this._minimumSize = 0;