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
  */
@@ -4285,6 +4285,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4285
4285
  this._width = 0;
4286
4286
  this._height = 0;
4287
4287
  this._panels = [];
4288
+ this._panelDisposables = new Map();
4288
4289
  this._onMove = new Emitter();
4289
4290
  this.onMove = this._onMove.event;
4290
4291
  this._onDidDrop = new Emitter();
@@ -4299,6 +4300,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4299
4300
  this.onGroupDragStart = this._onGroupDragStart.event;
4300
4301
  this._onDidAddPanel = new Emitter();
4301
4302
  this.onDidAddPanel = this._onDidAddPanel.event;
4303
+ this._onDidPanelTitleChange = new Emitter();
4304
+ this.onDidPanelTitleChange = this._onDidPanelTitleChange.event;
4305
+ this._onDidPanelParametersChange = new Emitter();
4306
+ this.onDidPanelParametersChange = this._onDidPanelParametersChange.event;
4302
4307
  this._onDidRemovePanel = new Emitter();
4303
4308
  this.onDidRemovePanel = this._onDidRemovePanel.event;
4304
4309
  this._onDidActivePanelChange = new Emitter();
@@ -4587,6 +4592,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4587
4592
  if (this.mostRecentlyUsed.includes(panel)) {
4588
4593
  this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
4589
4594
  }
4595
+ const disposable = this._panelDisposables.get(panel.id);
4596
+ if (disposable) {
4597
+ disposable.dispose();
4598
+ this._panelDisposables.delete(panel.id);
4599
+ }
4590
4600
  this._onDidRemovePanel.fire({ panel });
4591
4601
  }
4592
4602
  doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
@@ -4604,6 +4614,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4604
4614
  }
4605
4615
  this.updateMru(panel);
4606
4616
  this.panels.splice(index, 0, panel);
4617
+ this._panelDisposables.set(panel.id, new CompositeDisposable(panel.api.onDidTitleChange((event) => this._onDidPanelTitleChange.fire(event)), panel.api.onDidParametersChange((event) => this._onDidPanelParametersChange.fire(event))));
4607
4618
  this._onDidAddPanel.fire({ panel });
4608
4619
  }
4609
4620
  doSetActivePanel(panel) {
@@ -5027,14 +5038,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5027
5038
  get height() {
5028
5039
  return this._height;
5029
5040
  }
5030
- constructor(id) {
5041
+ constructor(id, component) {
5031
5042
  super();
5032
5043
  this.id = id;
5044
+ this.component = component;
5033
5045
  this._isFocused = false;
5034
5046
  this._isActive = false;
5035
5047
  this._isVisible = true;
5036
5048
  this._width = 0;
5037
5049
  this._height = 0;
5050
+ this._parameters = {};
5038
5051
  this.panelUpdatesDisposable = new MutableDisposable();
5039
5052
  this._onDidDimensionChange = new Emitter();
5040
5053
  this.onDidDimensionsChange = this._onDidDimensionChange.event;
@@ -5052,8 +5065,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5052
5065
  this.onDidActiveChange = this._onDidActiveChange.event;
5053
5066
  this._onActiveChange = new Emitter();
5054
5067
  this.onActiveChange = this._onActiveChange.event;
5055
- this._onUpdateParameters = new Emitter();
5056
- this.onUpdateParameters = this._onUpdateParameters.event;
5068
+ this._onDidParametersChange = new Emitter();
5069
+ this.onDidParametersChange = this._onDidParametersChange.event;
5057
5070
  this.addDisposables(this.onDidFocusChange((event) => {
5058
5071
  this._isFocused = event.isFocused;
5059
5072
  }), this.onDidActiveChange((event) => {
@@ -5063,10 +5076,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5063
5076
  }), this.onDidDimensionsChange((event) => {
5064
5077
  this._width = event.width;
5065
5078
  this._height = event.height;
5066
- }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
5079
+ }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onWillFocus, this._onWillVisibilityChange, this._onDidParametersChange);
5080
+ }
5081
+ getParameters() {
5082
+ return this._parameters;
5067
5083
  }
5068
5084
  initialize(panel) {
5069
- this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
5085
+ this.panelUpdatesDisposable.value = this._onDidParametersChange.event((parameters) => {
5086
+ this._parameters = parameters;
5070
5087
  panel.update({
5071
5088
  params: parameters,
5072
5089
  });
@@ -5079,14 +5096,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5079
5096
  this._onActiveChange.fire();
5080
5097
  }
5081
5098
  updateParameters(parameters) {
5082
- this._onUpdateParameters.fire(parameters);
5099
+ this._onDidParametersChange.fire(parameters);
5083
5100
  }
5084
5101
  }
5085
5102
 
5086
5103
  class SplitviewPanelApiImpl extends PanelApiImpl {
5087
5104
  //
5088
- constructor(id) {
5089
- super(id);
5105
+ constructor(id, component) {
5106
+ super(id, component);
5090
5107
  this._onDidConstraintsChangeInternal = new Emitter();
5091
5108
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5092
5109
  //
@@ -5111,8 +5128,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5111
5128
  set pane(pane) {
5112
5129
  this._pane = pane;
5113
5130
  }
5114
- constructor(id) {
5115
- super(id);
5131
+ constructor(id, component) {
5132
+ super(id, component);
5116
5133
  this._onDidExpansionChange = new Emitter({
5117
5134
  replay: true,
5118
5135
  });
@@ -5271,7 +5288,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5271
5288
  this.header.style.display = value ? '' : 'none';
5272
5289
  }
5273
5290
  constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
5274
- super(id, component, new PaneviewPanelApiImpl(id));
5291
+ super(id, component, new PaneviewPanelApiImpl(id, component));
5275
5292
  this.headerComponent = headerComponent;
5276
5293
  this._onDidChangeExpansionState = new Emitter({ replay: true });
5277
5294
  this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
@@ -5502,8 +5519,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5502
5519
  }
5503
5520
 
5504
5521
  class GridviewPanelApiImpl extends PanelApiImpl {
5505
- constructor(id, panel) {
5506
- super(id);
5522
+ constructor(id, component, panel) {
5523
+ super(id, component);
5507
5524
  this._onDidConstraintsChangeInternal = new Emitter();
5508
5525
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5509
5526
  this._onDidConstraintsChange = new Emitter();
@@ -5574,7 +5591,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5574
5591
  return this.api.isActive;
5575
5592
  }
5576
5593
  constructor(id, component, options, api) {
5577
- super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id));
5594
+ super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id, component));
5578
5595
  this._evaluatedMinimumWidth = 0;
5579
5596
  this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
5580
5597
  this._evaluatedMinimumHeight = 0;
@@ -5682,7 +5699,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5682
5699
  return this._group.model.location;
5683
5700
  }
5684
5701
  constructor(id, accessor) {
5685
- super(id);
5702
+ super(id, '__dockviewgroup__');
5686
5703
  this.accessor = accessor;
5687
5704
  this._onDidLocationChange = new Emitter();
5688
5705
  this.onDidLocationChange = this._onDidLocationChange.event;
@@ -5856,8 +5873,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5856
5873
  get group() {
5857
5874
  return this._group;
5858
5875
  }
5859
- constructor(panel, group, accessor) {
5860
- super(panel.id);
5876
+ get tabComponent() {
5877
+ return this._tabComponent;
5878
+ }
5879
+ constructor(panel, group, accessor, component, tabComponent) {
5880
+ super(panel.id, component);
5861
5881
  this.panel = panel;
5862
5882
  this.accessor = accessor;
5863
5883
  this._onDidTitleChange = new Emitter();
@@ -5871,6 +5891,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5871
5891
  this._onDidLocationChange = new Emitter();
5872
5892
  this.onDidLocationChange = this._onDidLocationChange.event;
5873
5893
  this.groupEventsDisposable = new MutableDisposable();
5894
+ this._tabComponent = tabComponent;
5874
5895
  this.initialize(panel);
5875
5896
  this._group = group;
5876
5897
  this.setupGroupEventListeners();
@@ -5953,7 +5974,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5953
5974
  var _a;
5954
5975
  return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
5955
5976
  }
5956
- constructor(id, accessor, containerApi, group, view, options) {
5977
+ constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {
5957
5978
  super();
5958
5979
  this.id = id;
5959
5980
  this.accessor = accessor;
@@ -5961,7 +5982,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5961
5982
  this.view = view;
5962
5983
  this._renderer = options.renderer;
5963
5984
  this._group = group;
5964
- this.api = new DockviewPanelApiImpl(this, this._group, accessor);
5985
+ this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);
5965
5986
  this.addDisposables(this.api.onActiveChange(() => {
5966
5987
  accessor.setActivePanel(this);
5967
5988
  }), this.api.onDidSizeChange((event) => {
@@ -6256,7 +6277,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6256
6277
  ? (_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id
6257
6278
  : panelData.tabComponent;
6258
6279
  const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
6259
- const panel = new DockviewPanel(panelId, this.accessor, new DockviewApi(this.accessor), group, view, {
6280
+ const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {
6260
6281
  renderer: panelData.renderer,
6261
6282
  });
6262
6283
  panel.init({
@@ -8243,6 +8264,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8243
8264
  if (this._onDidActivePanelChange.value !== event.panel) {
8244
8265
  this._onDidActivePanelChange.fire(event.panel);
8245
8266
  }
8267
+ }), exports.DockviewEvent.any(view.model.onDidPanelTitleChange, view.model.onDidPanelParametersChange)(() => {
8268
+ this._bufferOnDidLayoutChange.fire();
8246
8269
  }));
8247
8270
  this._groups.set(view.id, { value: view, disposable });
8248
8271
  }
@@ -8255,7 +8278,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8255
8278
  const contentComponent = options.component;
8256
8279
  const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
8257
8280
  const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
8258
- const panel = new DockviewPanel(options.id, this, this._api, group, view, { renderer: options.renderer });
8281
+ const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, { renderer: options.renderer });
8259
8282
  panel.init({
8260
8283
  title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
8261
8284
  params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
@@ -9170,7 +9193,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9170
9193
  return this._snap;
9171
9194
  }
9172
9195
  constructor(id, componentName) {
9173
- super(id, componentName, new SplitviewPanelApiImpl(id));
9196
+ super(id, componentName, new SplitviewPanelApiImpl(id, componentName));
9174
9197
  this._evaluatedMinimumSize = 0;
9175
9198
  this._evaluatedMaximumSize = Number.POSITIVE_INFINITY;
9176
9199
  this._minimumSize = 0;