dockview 1.1.0 → 1.3.1

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.
Files changed (162) hide show
  1. package/dist/cjs/api/component.api.d.ts +17 -15
  2. package/dist/cjs/api/component.api.js +22 -22
  3. package/dist/cjs/api/component.api.js.map +1 -1
  4. package/dist/cjs/dnd/abstractDragHandler.d.ts +1 -1
  5. package/dist/cjs/dnd/abstractDragHandler.js +2 -3
  6. package/dist/cjs/dnd/abstractDragHandler.js.map +1 -1
  7. package/dist/cjs/dnd/droptarget.js +3 -3
  8. package/dist/cjs/dnd/droptarget.js.map +1 -1
  9. package/dist/cjs/dockview/components/tab/defaultTab.d.ts +1 -1
  10. package/dist/cjs/dockview/components/tab/defaultTab.js +1 -1
  11. package/dist/cjs/dockview/components/tab/defaultTab.js.map +1 -1
  12. package/dist/cjs/dockview/components/watermark/watermark.d.ts +3 -3
  13. package/dist/cjs/dockview/components/watermark/watermark.js +4 -4
  14. package/dist/cjs/dockview/components/watermark/watermark.js.map +1 -1
  15. package/dist/cjs/dockview/deserializer.js.map +1 -1
  16. package/dist/cjs/dockview/dockviewComponent.d.ts +8 -5
  17. package/dist/cjs/dockview/dockviewComponent.js +60 -41
  18. package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
  19. package/dist/cjs/dockview/dockviewGroupPanel.d.ts +1 -0
  20. package/dist/cjs/dockview/dockviewGroupPanel.js +8 -0
  21. package/dist/cjs/dockview/dockviewGroupPanel.js.map +1 -1
  22. package/dist/cjs/gridview/baseComponentGridview.d.ts +3 -20
  23. package/dist/cjs/gridview/baseComponentGridview.js +35 -43
  24. package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
  25. package/dist/cjs/gridview/basePanelView.js +2 -0
  26. package/dist/cjs/gridview/basePanelView.js.map +1 -1
  27. package/dist/cjs/gridview/branchNode.js +2 -2
  28. package/dist/cjs/gridview/branchNode.js.map +1 -1
  29. package/dist/cjs/gridview/gridview.js +3 -2
  30. package/dist/cjs/gridview/gridview.js.map +1 -1
  31. package/dist/cjs/gridview/gridviewComponent.d.ts +3 -9
  32. package/dist/cjs/gridview/gridviewComponent.js +30 -18
  33. package/dist/cjs/gridview/gridviewComponent.js.map +1 -1
  34. package/dist/cjs/gridview/leafNode.js +1 -1
  35. package/dist/cjs/gridview/leafNode.js.map +1 -1
  36. package/dist/cjs/groupview/groupPanel.d.ts +1 -0
  37. package/dist/cjs/groupview/groupview.d.ts +3 -2
  38. package/dist/cjs/groupview/groupview.js +15 -6
  39. package/dist/cjs/groupview/groupview.js.map +1 -1
  40. package/dist/cjs/groupview/panel/content.d.ts +1 -1
  41. package/dist/cjs/groupview/panel/content.js +1 -1
  42. package/dist/cjs/groupview/panel/content.js.map +1 -1
  43. package/dist/cjs/hostedContainer.js +2 -2
  44. package/dist/cjs/hostedContainer.js.map +1 -1
  45. package/dist/cjs/index.d.ts +2 -2
  46. package/dist/cjs/index.js +8 -4
  47. package/dist/cjs/index.js.map +1 -1
  48. package/dist/cjs/panel/types.d.ts +1 -0
  49. package/dist/cjs/paneview/defaultPaneviewHeader.d.ts +1 -1
  50. package/dist/cjs/paneview/defaultPaneviewHeader.js +1 -1
  51. package/dist/cjs/paneview/defaultPaneviewHeader.js.map +1 -1
  52. package/dist/cjs/paneview/draggablePaneviewPanel.js +1 -1
  53. package/dist/cjs/paneview/draggablePaneviewPanel.js.map +1 -1
  54. package/dist/cjs/paneview/paneview.d.ts +3 -1
  55. package/dist/cjs/paneview/paneview.js +12 -6
  56. package/dist/cjs/paneview/paneview.js.map +1 -1
  57. package/dist/cjs/paneview/paneviewComponent.d.ts +12 -5
  58. package/dist/cjs/paneview/paneviewComponent.js +68 -16
  59. package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
  60. package/dist/cjs/react/dockview/components.js +5 -1
  61. package/dist/cjs/react/dockview/components.js.map +1 -1
  62. package/dist/cjs/react/dockview/dockview.js +32 -10
  63. package/dist/cjs/react/dockview/dockview.js.map +1 -1
  64. package/dist/cjs/react/dockview/reactContentPart.d.ts +2 -2
  65. package/dist/cjs/react/dockview/reactContentPart.js +2 -13
  66. package/dist/cjs/react/dockview/reactContentPart.js.map +1 -1
  67. package/dist/cjs/react/dockview/reactHeaderPart.d.ts +2 -2
  68. package/dist/cjs/react/dockview/reactHeaderPart.js +2 -2
  69. package/dist/cjs/react/dockview/reactHeaderPart.js.map +1 -1
  70. package/dist/cjs/react/dockview/reactWatermarkPart.d.ts +2 -2
  71. package/dist/cjs/react/dockview/reactWatermarkPart.js +2 -2
  72. package/dist/cjs/react/dockview/reactWatermarkPart.js.map +1 -1
  73. package/dist/cjs/react/dockview/v2/reactContentRenderer.d.ts +2 -2
  74. package/dist/cjs/react/dockview/v2/reactContentRenderer.js +2 -2
  75. package/dist/cjs/react/dockview/v2/reactContentRenderer.js.map +1 -1
  76. package/dist/cjs/react/dockview/v2/webviewContentRenderer.d.ts +2 -2
  77. package/dist/cjs/react/dockview/v2/webviewContentRenderer.js +2 -2
  78. package/dist/cjs/react/dockview/v2/webviewContentRenderer.js.map +1 -1
  79. package/dist/cjs/react/gridview/gridview.js +9 -2
  80. package/dist/cjs/react/gridview/gridview.js.map +1 -1
  81. package/dist/cjs/react/gridview/view.d.ts +3 -2
  82. package/dist/cjs/react/gridview/view.js.map +1 -1
  83. package/dist/cjs/react/index.js +5 -1
  84. package/dist/cjs/react/index.js.map +1 -1
  85. package/dist/cjs/react/paneview/paneview.js +6 -2
  86. package/dist/cjs/react/paneview/paneview.js.map +1 -1
  87. package/dist/cjs/react/react.js +5 -1
  88. package/dist/cjs/react/react.js.map +1 -1
  89. package/dist/cjs/react/splitview/splitview.js +8 -2
  90. package/dist/cjs/react/splitview/splitview.js.map +1 -1
  91. package/dist/cjs/splitview/core/splitview.js +1 -1
  92. package/dist/cjs/splitview/core/splitview.js.map +1 -1
  93. package/dist/cjs/splitview/splitviewComponent.d.ts +5 -3
  94. package/dist/cjs/splitview/splitviewComponent.js +55 -16
  95. package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
  96. package/dist/dockview.amd.js +316 -312
  97. package/dist/dockview.amd.min.js +2 -2
  98. package/dist/dockview.amd.min.noStyle.js +2 -2
  99. package/dist/dockview.amd.noStyle.js +315 -311
  100. package/dist/dockview.cjs.js +316 -312
  101. package/dist/dockview.esm.js +316 -306
  102. package/dist/dockview.esm.min.js +2 -2
  103. package/dist/dockview.js +316 -312
  104. package/dist/dockview.min.js +2 -2
  105. package/dist/dockview.min.noStyle.js +2 -2
  106. package/dist/dockview.noStyle.js +315 -311
  107. package/dist/esm/api/component.api.d.ts +17 -15
  108. package/dist/esm/api/component.api.js +14 -14
  109. package/dist/esm/dnd/abstractDragHandler.d.ts +1 -1
  110. package/dist/esm/dnd/abstractDragHandler.js +2 -3
  111. package/dist/esm/dnd/droptarget.js +3 -3
  112. package/dist/esm/dockview/components/tab/defaultTab.d.ts +1 -1
  113. package/dist/esm/dockview/components/tab/defaultTab.js +1 -1
  114. package/dist/esm/dockview/components/watermark/watermark.d.ts +3 -3
  115. package/dist/esm/dockview/components/watermark/watermark.js +4 -4
  116. package/dist/esm/dockview/dockviewComponent.d.ts +8 -5
  117. package/dist/esm/dockview/dockviewComponent.js +34 -38
  118. package/dist/esm/dockview/dockviewGroupPanel.d.ts +1 -0
  119. package/dist/esm/dockview/dockviewGroupPanel.js +4 -0
  120. package/dist/esm/gridview/baseComponentGridview.d.ts +3 -20
  121. package/dist/esm/gridview/baseComponentGridview.js +13 -43
  122. package/dist/esm/gridview/basePanelView.js +2 -0
  123. package/dist/esm/gridview/branchNode.js +2 -2
  124. package/dist/esm/gridview/gridview.js +2 -1
  125. package/dist/esm/gridview/gridviewComponent.d.ts +3 -9
  126. package/dist/esm/gridview/gridviewComponent.js +9 -19
  127. package/dist/esm/groupview/groupPanel.d.ts +1 -0
  128. package/dist/esm/groupview/groupview.d.ts +3 -2
  129. package/dist/esm/groupview/groupview.js +8 -3
  130. package/dist/esm/groupview/panel/content.d.ts +1 -1
  131. package/dist/esm/groupview/panel/content.js +1 -1
  132. package/dist/esm/hostedContainer.js +2 -2
  133. package/dist/esm/index.d.ts +2 -2
  134. package/dist/esm/index.js +1 -2
  135. package/dist/esm/panel/types.d.ts +1 -0
  136. package/dist/esm/paneview/defaultPaneviewHeader.d.ts +1 -1
  137. package/dist/esm/paneview/defaultPaneviewHeader.js +1 -1
  138. package/dist/esm/paneview/draggablePaneviewPanel.js +1 -1
  139. package/dist/esm/paneview/paneview.d.ts +3 -1
  140. package/dist/esm/paneview/paneview.js +9 -5
  141. package/dist/esm/paneview/paneviewComponent.d.ts +12 -5
  142. package/dist/esm/paneview/paneviewComponent.js +34 -15
  143. package/dist/esm/react/dockview/dockview.js +27 -9
  144. package/dist/esm/react/dockview/reactContentPart.d.ts +2 -2
  145. package/dist/esm/react/dockview/reactContentPart.js +2 -13
  146. package/dist/esm/react/dockview/reactHeaderPart.d.ts +2 -2
  147. package/dist/esm/react/dockview/reactHeaderPart.js +2 -2
  148. package/dist/esm/react/dockview/reactWatermarkPart.d.ts +2 -2
  149. package/dist/esm/react/dockview/reactWatermarkPart.js +2 -2
  150. package/dist/esm/react/dockview/v2/reactContentRenderer.d.ts +2 -2
  151. package/dist/esm/react/dockview/v2/reactContentRenderer.js +2 -2
  152. package/dist/esm/react/dockview/v2/webviewContentRenderer.d.ts +2 -2
  153. package/dist/esm/react/dockview/v2/webviewContentRenderer.js +2 -2
  154. package/dist/esm/react/gridview/gridview.js +4 -1
  155. package/dist/esm/react/gridview/view.d.ts +3 -2
  156. package/dist/esm/react/paneview/paneview.js +1 -1
  157. package/dist/esm/react/splitview/splitview.js +3 -1
  158. package/dist/esm/splitview/core/splitview.js +1 -1
  159. package/dist/esm/splitview/splitviewComponent.d.ts +5 -3
  160. package/dist/esm/splitview/splitviewComponent.js +22 -15
  161. package/dist/styles/dockview.css +10 -10
  162. package/package.json +13 -13
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview
3
- * @version 1.1.0
3
+ * @version 1.3.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -31,6 +31,76 @@
31
31
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
32
32
  var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
33
33
 
34
+ class TransferObject {
35
+ constructor() {
36
+ //
37
+ }
38
+ }
39
+ class PanelTransfer extends TransferObject {
40
+ constructor(viewId, groupId, panelId) {
41
+ super();
42
+ this.viewId = viewId;
43
+ this.groupId = groupId;
44
+ this.panelId = panelId;
45
+ }
46
+ }
47
+ class PaneTransfer extends TransferObject {
48
+ constructor(viewId, paneId) {
49
+ super();
50
+ this.viewId = viewId;
51
+ this.paneId = paneId;
52
+ }
53
+ }
54
+ /**
55
+ * A singleton to store transfer data during drag & drop operations that are only valid within the application.
56
+ */
57
+ class LocalSelectionTransfer {
58
+ constructor() {
59
+ // protect against external instantiation
60
+ }
61
+ static getInstance() {
62
+ return LocalSelectionTransfer.INSTANCE;
63
+ }
64
+ hasData(proto) {
65
+ return proto && proto === this.proto;
66
+ }
67
+ clearData(proto) {
68
+ if (this.hasData(proto)) {
69
+ this.proto = undefined;
70
+ this.data = undefined;
71
+ }
72
+ }
73
+ getData(proto) {
74
+ if (this.hasData(proto)) {
75
+ return this.data;
76
+ }
77
+ return undefined;
78
+ }
79
+ setData(data, proto) {
80
+ if (proto) {
81
+ this.data = data;
82
+ this.proto = proto;
83
+ }
84
+ }
85
+ }
86
+ LocalSelectionTransfer.INSTANCE = new LocalSelectionTransfer();
87
+ function getPanelData() {
88
+ const panelTransfer = LocalSelectionTransfer.getInstance();
89
+ const isPanelEvent = panelTransfer.hasData(PanelTransfer.prototype);
90
+ if (!isPanelEvent) {
91
+ return undefined;
92
+ }
93
+ return panelTransfer.getData(PanelTransfer.prototype)[0];
94
+ }
95
+ function getPaneData() {
96
+ const paneTransfer = LocalSelectionTransfer.getInstance();
97
+ const isPanelEvent = paneTransfer.hasData(PaneTransfer.prototype);
98
+ if (!isPanelEvent) {
99
+ return undefined;
100
+ }
101
+ return paneTransfer.getData(PaneTransfer.prototype)[0];
102
+ }
103
+
34
104
  exports.Event = void 0;
35
105
  (function (Event) {
36
106
  Event.any = (...children) => {
@@ -120,116 +190,6 @@
120
190
  }
121
191
  }
122
192
 
123
- exports.Disposable = void 0;
124
- (function (Disposable) {
125
- Disposable.NONE = {
126
- dispose: () => {
127
- // noop
128
- },
129
- };
130
- })(exports.Disposable || (exports.Disposable = {}));
131
- class CompositeDisposable {
132
- constructor(...args) {
133
- this.disposables = args;
134
- }
135
- static from(...args) {
136
- return new CompositeDisposable(...args);
137
- }
138
- addDisposables(...args) {
139
- args.forEach((arg) => this.disposables.push(arg));
140
- }
141
- dispose() {
142
- this.disposables.forEach((arg) => arg.dispose());
143
- }
144
- }
145
- class MutableDisposable {
146
- constructor() {
147
- this._disposable = exports.Disposable.NONE;
148
- }
149
- set value(disposable) {
150
- if (this._disposable) {
151
- this._disposable.dispose();
152
- }
153
- this._disposable = disposable;
154
- }
155
- dispose() {
156
- if (this._disposable) {
157
- this._disposable.dispose();
158
- this._disposable = exports.Disposable.NONE;
159
- }
160
- }
161
- }
162
-
163
- class TransferObject {
164
- constructor() {
165
- //
166
- }
167
- }
168
- class PanelTransfer extends TransferObject {
169
- constructor(viewId, groupId, panelId) {
170
- super();
171
- this.viewId = viewId;
172
- this.groupId = groupId;
173
- this.panelId = panelId;
174
- }
175
- }
176
- class PaneTransfer extends TransferObject {
177
- constructor(viewId, paneId) {
178
- super();
179
- this.viewId = viewId;
180
- this.paneId = paneId;
181
- }
182
- }
183
- /**
184
- * A singleton to store transfer data during drag & drop operations that are only valid within the application.
185
- */
186
- class LocalSelectionTransfer {
187
- constructor() {
188
- // protect against external instantiation
189
- }
190
- static getInstance() {
191
- return LocalSelectionTransfer.INSTANCE;
192
- }
193
- hasData(proto) {
194
- return proto && proto === this.proto;
195
- }
196
- clearData(proto) {
197
- if (this.hasData(proto)) {
198
- this.proto = undefined;
199
- this.data = undefined;
200
- }
201
- }
202
- getData(proto) {
203
- if (this.hasData(proto)) {
204
- return this.data;
205
- }
206
- return undefined;
207
- }
208
- setData(data, proto) {
209
- if (proto) {
210
- this.data = data;
211
- this.proto = proto;
212
- }
213
- }
214
- }
215
- LocalSelectionTransfer.INSTANCE = new LocalSelectionTransfer();
216
- function getPanelData() {
217
- const panelTransfer = LocalSelectionTransfer.getInstance();
218
- const isPanelEvent = panelTransfer.hasData(PanelTransfer.prototype);
219
- if (!isPanelEvent) {
220
- return undefined;
221
- }
222
- return panelTransfer.getData(PanelTransfer.prototype)[0];
223
- }
224
- function getPaneData() {
225
- const paneTransfer = LocalSelectionTransfer.getInstance();
226
- const isPanelEvent = paneTransfer.hasData(PaneTransfer.prototype);
227
- if (!isPanelEvent) {
228
- return undefined;
229
- }
230
- return paneTransfer.getData(PaneTransfer.prototype)[0];
231
- }
232
-
233
193
  class SplitviewApi {
234
194
  constructor(component) {
235
195
  this.component = component;
@@ -252,6 +212,9 @@
252
212
  get orientation() {
253
213
  return this.component.orientation;
254
214
  }
215
+ get onDidLayoutFromJSON() {
216
+ return this.component.onDidLayoutFromJSON;
217
+ }
255
218
  get onDidLayoutChange() {
256
219
  return this.component.onDidLayoutChange;
257
220
  }
@@ -294,8 +257,8 @@
294
257
  movePanel(from, to) {
295
258
  this.component.movePanel(from, to);
296
259
  }
297
- fromJSON(data, deferComponentLayout) {
298
- this.component.fromJSON(data, deferComponentLayout);
260
+ fromJSON(data) {
261
+ this.component.fromJSON(data);
299
262
  }
300
263
  toJSON() {
301
264
  return this.component.toJSON();
@@ -320,6 +283,9 @@
320
283
  get onDidLayoutChange() {
321
284
  return this.component.onDidLayoutChange;
322
285
  }
286
+ get onDidLayoutFromJSON() {
287
+ return this.component.onDidLayoutFromJSON;
288
+ }
323
289
  get onDidAddView() {
324
290
  return this.component.onDidAddView;
325
291
  }
@@ -356,13 +322,13 @@
356
322
  this.component.layout(width, height);
357
323
  }
358
324
  addPanel(options) {
359
- return this.component.addPanel(options);
325
+ this.component.addPanel(options);
360
326
  }
361
327
  resizeToFit() {
362
328
  this.component.resizeToFit();
363
329
  }
364
- fromJSON(data, deferComponentLayout) {
365
- this.component.fromJSON(data, deferComponentLayout);
330
+ fromJSON(data) {
331
+ this.component.fromJSON(data);
366
332
  }
367
333
  toJSON() {
368
334
  return this.component.toJSON();
@@ -390,9 +356,6 @@
390
356
  get height() {
391
357
  return this.component.height;
392
358
  }
393
- get onGridEvent() {
394
- return this.component.onGridEvent;
395
- }
396
359
  get onDidLayoutChange() {
397
360
  return this.component.onDidLayoutChange;
398
361
  }
@@ -447,8 +410,8 @@
447
410
  setActive(panel) {
448
411
  this.component.setActive(panel);
449
412
  }
450
- fromJSON(data, deferComponentLayout) {
451
- return this.component.fromJSON(data, deferComponentLayout);
413
+ fromJSON(data) {
414
+ return this.component.fromJSON(data);
452
415
  }
453
416
  toJSON() {
454
417
  return this.component.toJSON();
@@ -482,9 +445,6 @@
482
445
  get totalPanels() {
483
446
  return this.component.totalPanels;
484
447
  }
485
- get onGridEvent() {
486
- return this.component.onGridEvent;
487
- }
488
448
  get onDidActiveGroupChange() {
489
449
  return this.component.onDidActiveGroupChange;
490
450
  }
@@ -503,7 +463,7 @@
503
463
  get onDidRemovePanel() {
504
464
  return this.component.onDidRemovePanel;
505
465
  }
506
- get onDidLayoutfromJSON() {
466
+ get onDidLayoutFromJSON() {
507
467
  return this.component.onDidLayoutfromJSON;
508
468
  }
509
469
  get onDidLayoutChange() {
@@ -568,6 +528,46 @@
568
528
  }
569
529
  }
570
530
 
531
+ var Disposable;
532
+ (function (Disposable) {
533
+ Disposable.NONE = {
534
+ dispose: () => {
535
+ // noop
536
+ },
537
+ };
538
+ })(Disposable || (Disposable = {}));
539
+ class CompositeDisposable {
540
+ constructor(...args) {
541
+ this.disposables = args;
542
+ }
543
+ static from(...args) {
544
+ return new CompositeDisposable(...args);
545
+ }
546
+ addDisposables(...args) {
547
+ args.forEach((arg) => this.disposables.push(arg));
548
+ }
549
+ dispose() {
550
+ this.disposables.forEach((arg) => arg.dispose());
551
+ }
552
+ }
553
+ class MutableDisposable {
554
+ constructor() {
555
+ this._disposable = Disposable.NONE;
556
+ }
557
+ set value(disposable) {
558
+ if (this._disposable) {
559
+ this._disposable.dispose();
560
+ }
561
+ this._disposable = disposable;
562
+ }
563
+ dispose() {
564
+ if (this._disposable) {
565
+ this._disposable.dispose();
566
+ this._disposable = Disposable.NONE;
567
+ }
568
+ }
569
+ }
570
+
571
571
  function watchElementResize(element, cb) {
572
572
  const observer = new ResizeObserver((entires) => {
573
573
  const firstEntry = entires[0];
@@ -1513,13 +1513,13 @@
1513
1513
  this._onDidSashEnd.dispose();
1514
1514
  this._onDidAddView.dispose();
1515
1515
  this._onDidRemoveView.dispose();
1516
- this.element.remove();
1517
1516
  for (let i = 0; i < this.element.children.length; i++) {
1518
1517
  if (this.element.children.item(i) === this.element) {
1519
1518
  this.element.removeChild(this.element);
1520
1519
  break;
1521
1520
  }
1522
1521
  }
1522
+ this.element.remove();
1523
1523
  }
1524
1524
  }
1525
1525
 
@@ -1542,7 +1542,7 @@
1542
1542
  });
1543
1543
  // if we've added views from the descriptor we need to
1544
1544
  // add the panes to our Pane array and setup animation
1545
- this.getPanes().forEach((pane, index) => {
1545
+ this.getPanes().forEach((pane) => {
1546
1546
  const disposable = new CompositeDisposable(pane.onDidChangeExpansionState(() => {
1547
1547
  this.setupAnimation();
1548
1548
  this._onDidChange.fire(undefined);
@@ -1610,17 +1610,20 @@
1610
1610
  getPanes() {
1611
1611
  return this.splitview.getViews();
1612
1612
  }
1613
- removePane(index) {
1613
+ removePane(index, options = { skipDispose: false }) {
1614
1614
  const paneItem = this.paneItems.splice(index, 1)[0];
1615
1615
  this.splitview.removeView(index);
1616
- paneItem.disposable.dispose();
1616
+ if (!options.skipDispose) {
1617
+ paneItem.disposable.dispose();
1618
+ paneItem.pane.dispose();
1619
+ }
1617
1620
  return paneItem;
1618
1621
  }
1619
1622
  moveView(from, to) {
1620
1623
  if (from === to) {
1621
1624
  return;
1622
1625
  }
1623
- const view = this.removePane(from);
1626
+ const view = this.removePane(from, { skipDispose: true });
1624
1627
  this.skipAnimation = true;
1625
1628
  try {
1626
1629
  this.addPane(view.pane, view.pane.size, to, false);
@@ -1648,15 +1651,16 @@
1648
1651
  }
1649
1652
  dispose() {
1650
1653
  super.dispose();
1651
- this.splitview.dispose();
1652
1654
  if (this.animationTimer) {
1653
1655
  clearTimeout(this.animationTimer);
1654
1656
  this.animationTimer = undefined;
1655
1657
  }
1656
1658
  this.paneItems.forEach((paneItem) => {
1657
1659
  paneItem.disposable.dispose();
1660
+ paneItem.pane.dispose();
1658
1661
  });
1659
1662
  this.paneItems = [];
1663
+ this.splitview.dispose();
1660
1664
  this.element.remove();
1661
1665
  }
1662
1666
  }
@@ -1720,7 +1724,7 @@
1720
1724
  this._onDrop = new Emitter();
1721
1725
  this.onDrop = this._onDrop.event;
1722
1726
  this.addDisposables(this._onDrop, new DragAndDropObserver(this.element, {
1723
- onDragEnter: (e) => undefined,
1727
+ onDragEnter: () => undefined,
1724
1728
  onDragOver: (e) => {
1725
1729
  if (isBooleanValue(this.options.canDisplayOverlay)) {
1726
1730
  if (!this.options.canDisplayOverlay) {
@@ -1761,10 +1765,10 @@
1761
1765
  this.toggleClasses(quadrant, isSmallX, isSmallY);
1762
1766
  this.setState(quadrant);
1763
1767
  },
1764
- onDragLeave: (e) => {
1768
+ onDragLeave: () => {
1765
1769
  this.removeDropTarget();
1766
1770
  },
1767
- onDragEnd: (e) => {
1771
+ onDragEnd: () => {
1768
1772
  this.removeDropTarget();
1769
1773
  },
1770
1774
  onDrop: (e) => {
@@ -1975,7 +1979,7 @@
1975
1979
  this.children = [];
1976
1980
  this._onDidChange = new Emitter();
1977
1981
  this.onDidChange = this._onDidChange.event;
1978
- this._childrenDisposable = exports.Disposable.NONE;
1982
+ this._childrenDisposable = Disposable.NONE;
1979
1983
  this._orthogonalSize = orthogonalSize;
1980
1984
  this._size = size;
1981
1985
  this.element = document.createElement('div');
@@ -2000,7 +2004,7 @@
2000
2004
  : true,
2001
2005
  };
2002
2006
  }),
2003
- size: this.orthogonalSize,
2007
+ size: this.size,
2004
2008
  };
2005
2009
  this.children = childDescriptors.map((c) => c.node);
2006
2010
  this.splitview = new Splitview(this.element, {
@@ -2161,7 +2165,7 @@
2161
2165
  }
2162
2166
  setupChildrenEvents() {
2163
2167
  this._childrenDisposable.dispose();
2164
- this._childrenDisposable = exports.Event.any(...this.children.map((c) => c.onDidChange))((e) => {
2168
+ this._childrenDisposable = exports.Event.any(...this.children.map((c) => c.onDidChange))(() => {
2165
2169
  /**
2166
2170
  * indicate a change has occured to allows any re-rendering but don't bubble
2167
2171
  * event because that was specific to this branch
@@ -2321,6 +2325,7 @@
2321
2325
  this.disposable.dispose();
2322
2326
  this._onDidChange.dispose();
2323
2327
  this.root.dispose();
2328
+ this.element.remove();
2324
2329
  }
2325
2330
  clear() {
2326
2331
  const orientation = this.root.orientation;
@@ -2523,7 +2528,7 @@
2523
2528
  const [parentIndex, ...__] = [...rest].reverse();
2524
2529
  const isSiblingVisible = parent.isChildVisible(0);
2525
2530
  parent.removeChild(0, sizing);
2526
- const sizes = grandParent.children.map((size, i) => grandParent.getChildSize(i));
2531
+ const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));
2527
2532
  grandParent.removeChild(parentIndex, sizing);
2528
2533
  if (sibling instanceof BranchNode) {
2529
2534
  sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
@@ -2622,7 +2627,7 @@
2622
2627
  }
2623
2628
  this.disposable.value = disposable;
2624
2629
  }
2625
- layout(width, height) {
2630
+ layout(_width, _height) {
2626
2631
  // noop
2627
2632
  }
2628
2633
  closePanel() {
@@ -2670,7 +2675,7 @@
2670
2675
  if (event.dataTransfer) {
2671
2676
  event.dataTransfer.effectAllowed = 'move';
2672
2677
  }
2673
- }), addDisposableListener(this.el, 'dragend', (ev) => {
2678
+ }), addDisposableListener(this.el, 'dragend', () => {
2674
2679
  for (const iframe of this.iframes) {
2675
2680
  iframe.style.pointerEvents = 'auto';
2676
2681
  }
@@ -3037,6 +3042,9 @@
3037
3042
  get maximumWidth() {
3038
3043
  return Number.MAX_SAFE_INTEGER;
3039
3044
  }
3045
+ get hasWatermark() {
3046
+ return !!(this.watermark && this.container.contains(this.watermark.element));
3047
+ }
3040
3048
  initialize() {
3041
3049
  var _a, _b;
3042
3050
  if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
@@ -3115,10 +3123,10 @@
3115
3123
  containsPanel(panel) {
3116
3124
  return this.panels.includes(panel);
3117
3125
  }
3118
- init(params) {
3126
+ init(_params) {
3119
3127
  //noop
3120
3128
  }
3121
- update(params) {
3129
+ update(_params) {
3122
3130
  //noop
3123
3131
  }
3124
3132
  focus() {
@@ -3341,29 +3349,18 @@
3341
3349
  }
3342
3350
  }
3343
3351
  dispose() {
3352
+ var _a;
3353
+ super.dispose();
3354
+ (_a = this.watermark) === null || _a === void 0 ? void 0 : _a.dispose();
3344
3355
  for (const panel of this.panels) {
3345
3356
  panel.dispose();
3346
3357
  }
3347
- super.dispose();
3348
3358
  this.dropTarget.dispose();
3349
3359
  this.tabsContainer.dispose();
3350
3360
  this.contentContainer.dispose();
3351
3361
  }
3352
3362
  }
3353
3363
 
3354
- exports.GroupChangeKind = void 0;
3355
- (function (GroupChangeKind) {
3356
- GroupChangeKind["ADD_PANEL"] = "ADD_PANEL";
3357
- GroupChangeKind["REMOVE_PANEL"] = "REMOVE_PANEL";
3358
- GroupChangeKind["PANEL_ACTIVE"] = "PANEL_ACTIVE";
3359
- //
3360
- GroupChangeKind["GROUP_ACTIVE"] = "GROUP_ACTIVE";
3361
- GroupChangeKind["ADD_GROUP"] = "ADD_GROUP";
3362
- GroupChangeKind["REMOVE_GROUP"] = "REMOVE_GROUP";
3363
- //
3364
- GroupChangeKind["LAYOUT_FROM_JSON"] = "LAYOUT_FROM_JSON";
3365
- GroupChangeKind["LAYOUT"] = "LAYOUT";
3366
- })(exports.GroupChangeKind || (exports.GroupChangeKind = {}));
3367
3364
  const nextLayoutId = sequentialNumberGenerator();
3368
3365
  function toTarget(direction) {
3369
3366
  switch (direction) {
@@ -3386,9 +3383,6 @@
3386
3383
  this._element = _element;
3387
3384
  this._id = nextLayoutId.next();
3388
3385
  this._groups = new Map();
3389
- //
3390
- this._onGridEvent = new Emitter();
3391
- this.onGridEvent = this._onGridEvent.event;
3392
3386
  this._onDidLayoutChange = new Emitter();
3393
3387
  this.onDidLayoutChange = this._onDidLayoutChange.event;
3394
3388
  this._onDidRemoveGroup = new Emitter();
@@ -3397,30 +3391,18 @@
3397
3391
  this.onDidAddGroup = this._onDidAddGroup.event;
3398
3392
  this._onDidActiveGroupChange = new Emitter();
3399
3393
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3394
+ this._bufferOnDidLayoutChange = new TickDelayedEvent();
3400
3395
  this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
3401
3396
  this.element.appendChild(this.gridview.element);
3402
3397
  this.layout(0, 0, true); // set some elements height/widths
3403
3398
  this.addDisposables(this.gridview.onDidChange(() => {
3404
- this._onGridEvent.fire({ kind: exports.GroupChangeKind.LAYOUT });
3399
+ this._onDidLayoutChange.fire();
3405
3400
  }));
3406
- this.addDisposables((() => {
3407
- const tickDelayedEvent = new TickDelayedEvent();
3408
- return new CompositeDisposable(this.onGridEvent((event) => {
3409
- if ([
3410
- exports.GroupChangeKind.ADD_GROUP,
3411
- exports.GroupChangeKind.REMOVE_GROUP,
3412
- exports.GroupChangeKind.ADD_PANEL,
3413
- exports.GroupChangeKind.REMOVE_PANEL,
3414
- exports.GroupChangeKind.GROUP_ACTIVE,
3415
- exports.GroupChangeKind.PANEL_ACTIVE,
3416
- exports.GroupChangeKind.LAYOUT,
3417
- ].includes(event.kind)) {
3418
- tickDelayedEvent.fire();
3419
- }
3420
- }), tickDelayedEvent.onEvent(() => {
3421
- this._onDidLayoutChange.fire();
3422
- }), tickDelayedEvent);
3423
- })());
3401
+ this.addDisposables(exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
3402
+ this._bufferOnDidLayoutChange.fire();
3403
+ }), this._bufferOnDidLayoutChange.onEvent(() => {
3404
+ this._onDidLayoutChange.fire();
3405
+ }), this._bufferOnDidLayoutChange);
3424
3406
  }
3425
3407
  get id() {
3426
3408
  return this._id;
@@ -3457,14 +3439,13 @@
3457
3439
  }
3458
3440
  setVisible(panel, visible) {
3459
3441
  this.gridview.setViewVisible(getGridLocation(panel.element), visible);
3460
- this._onGridEvent.fire({ kind: exports.GroupChangeKind.LAYOUT });
3442
+ this._onDidLayoutChange.fire();
3461
3443
  }
3462
3444
  isVisible(panel) {
3463
3445
  return this.gridview.isViewVisible(getGridLocation(panel.element));
3464
3446
  }
3465
3447
  doAddGroup(group, location = [0], size) {
3466
3448
  this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
3467
- this._onGridEvent.fire({ kind: exports.GroupChangeKind.ADD_GROUP });
3468
3449
  this._onDidAddGroup.fire(group);
3469
3450
  this.doSetGroupActive(group);
3470
3451
  }
@@ -3476,9 +3457,9 @@
3476
3457
  const view = this.gridview.remove(group, exports.Sizing.Distribute);
3477
3458
  if (item && !(options === null || options === void 0 ? void 0 : options.skipDispose)) {
3478
3459
  item.disposable.dispose();
3460
+ item.value.dispose();
3479
3461
  this._groups.delete(group.id);
3480
3462
  }
3481
- this._onGridEvent.fire({ kind: exports.GroupChangeKind.REMOVE_GROUP });
3482
3463
  this._onDidRemoveGroup.fire(group);
3483
3464
  if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
3484
3465
  const groups = Array.from(this._groups.values());
@@ -3507,9 +3488,6 @@
3507
3488
  }
3508
3489
  }
3509
3490
  this._activeGroup = group;
3510
- this._onGridEvent.fire({
3511
- kind: exports.GroupChangeKind.GROUP_ACTIVE,
3512
- });
3513
3491
  this._onDidActiveGroupChange.fire(group);
3514
3492
  }
3515
3493
  removeGroup(group) {
@@ -3566,11 +3544,13 @@
3566
3544
  }
3567
3545
  dispose() {
3568
3546
  super.dispose();
3569
- this._onGridEvent.dispose();
3570
3547
  this._onDidActiveGroupChange.dispose();
3571
3548
  this._onDidAddGroup.dispose();
3572
3549
  this._onDidRemoveGroup.dispose();
3573
3550
  this._onDidLayoutChange.dispose();
3551
+ for (const group of this.groups) {
3552
+ group.dispose();
3553
+ }
3574
3554
  this.gridview.dispose();
3575
3555
  }
3576
3556
  }
@@ -3748,6 +3728,10 @@
3748
3728
  this.update({ params: { title } });
3749
3729
  }));
3750
3730
  }
3731
+ get params() {
3732
+ var _a;
3733
+ return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
3734
+ }
3751
3735
  get title() {
3752
3736
  return this._title;
3753
3737
  }
@@ -3896,7 +3880,7 @@
3896
3880
  get id() {
3897
3881
  return 'watermark';
3898
3882
  }
3899
- update(event) {
3883
+ update(_event) {
3900
3884
  // noop
3901
3885
  }
3902
3886
  focus() {
@@ -3905,17 +3889,17 @@
3905
3889
  toJSON() {
3906
3890
  return {};
3907
3891
  }
3908
- layout(width, height) {
3892
+ layout(_width, _height) {
3909
3893
  // noop
3910
3894
  }
3911
3895
  init(params) {
3912
3896
  this.params = params;
3913
- this.addDisposables(this.params.containerApi.onDidLayoutChange((event) => {
3897
+ this.addDisposables(this.params.containerApi.onDidLayoutChange(() => {
3914
3898
  this.render();
3915
3899
  }));
3916
3900
  this.render();
3917
3901
  }
3918
- updateParentGroup(group, visible) {
3902
+ updateParentGroup(group, _visible) {
3919
3903
  this.group = group;
3920
3904
  this.render();
3921
3905
  }
@@ -4090,7 +4074,7 @@
4090
4074
  this._isGroupActive = group.isActive;
4091
4075
  this.render();
4092
4076
  }
4093
- layout(width, height) {
4077
+ layout(_width, _height) {
4094
4078
  // noop
4095
4079
  }
4096
4080
  render() {
@@ -4164,8 +4148,10 @@
4164
4148
  };
4165
4149
  }
4166
4150
  dispose() {
4151
+ var _a;
4167
4152
  super.dispose();
4168
4153
  this.api.dispose();
4154
+ (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
4169
4155
  }
4170
4156
  }
4171
4157
 
@@ -4424,7 +4410,9 @@
4424
4410
  this.onDidLayoutfromJSON = this._onDidLayoutfromJSON.event;
4425
4411
  this._onDidActivePanelChange = new Emitter();
4426
4412
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
4427
- this.addDisposables(this._onTabInteractionEvent, this._onTabContextMenu, this._onDidDrop);
4413
+ this.addDisposables(this._onTabInteractionEvent, this._onTabContextMenu, this._onDidDrop, exports.Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
4414
+ this._bufferOnDidLayoutChange.fire();
4415
+ }));
4428
4416
  this._options = options;
4429
4417
  if (!this.options.components) {
4430
4418
  this.options.components = {};
@@ -4558,11 +4546,12 @@
4558
4546
  };
4559
4547
  }
4560
4548
  fromJSON(data) {
4549
+ const groups = Array.from(this._groups.values()).map((_) => _.value);
4550
+ for (const group of groups) {
4551
+ // remove the group will automatically remove the panels
4552
+ this.removeGroup(group, true);
4553
+ }
4561
4554
  this.gridview.clear();
4562
- this.panels.forEach((panel) => {
4563
- panel.dispose();
4564
- });
4565
- this._groups.clear();
4566
4555
  if (!this.deserializer) {
4567
4556
  throw new Error('invalid deserializer');
4568
4557
  }
@@ -4586,7 +4575,6 @@
4586
4575
  }
4587
4576
  }
4588
4577
  this.gridview.layout(this.width, this.height);
4589
- this._onGridEvent.fire({ kind: exports.GroupChangeKind.LAYOUT_FROM_JSON });
4590
4578
  this._onDidLayoutfromJSON.fire();
4591
4579
  }
4592
4580
  closeAllGroups() {
@@ -4608,7 +4596,10 @@
4608
4596
  }
4609
4597
  addPanel(options) {
4610
4598
  var _a, _b;
4611
- const panel = this._addPanel(options);
4599
+ if (this.panels.find((_) => _.id === options.id)) {
4600
+ throw new Error(`panel with id ${options.id} already exists`);
4601
+ }
4602
+ const panel = this.createPanel(options);
4612
4603
  let referenceGroup;
4613
4604
  if ((_a = options.position) === null || _a === void 0 ? void 0 : _a.referencePanel) {
4614
4605
  const referencePanel = this.getGroupPanel(options.position.referencePanel);
@@ -4636,13 +4627,20 @@
4636
4627
  }
4637
4628
  return panel;
4638
4629
  }
4639
- removePanel(panel) {
4630
+ removePanel(panel, options = {
4631
+ removeEmptyGroup: true,
4632
+ skipDispose: false,
4633
+ }) {
4640
4634
  const group = panel.group;
4641
4635
  if (!group) {
4642
4636
  throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
4643
4637
  }
4644
4638
  group.model.removePanel(panel);
4645
- if (group.model.size === 0) {
4639
+ panel.dispose();
4640
+ const retainGroupForWatermark = this.size === 1;
4641
+ if (!retainGroupForWatermark &&
4642
+ group.model.size === 0 &&
4643
+ options.removeEmptyGroup) {
4646
4644
  this.removeGroup(group);
4647
4645
  }
4648
4646
  }
@@ -4674,16 +4672,15 @@
4674
4672
  this.doAddGroup(group);
4675
4673
  }
4676
4674
  }
4677
- removeGroup(group) {
4675
+ removeGroup(group, skipActive = false) {
4678
4676
  const panels = [...group.model.panels]; // reassign since group panels will mutate
4679
- panels.forEach((panel) => {
4680
- this.removePanel(panel);
4681
- });
4682
- if (this._groups.size === 1) {
4683
- this._activeGroup = group;
4684
- return;
4677
+ for (const panel of panels) {
4678
+ this.removePanel(panel, {
4679
+ removeEmptyGroup: false,
4680
+ skipDispose: false,
4681
+ });
4685
4682
  }
4686
- super.removeGroup(group);
4683
+ super.doRemoveGroup(group, { skipActive });
4687
4684
  }
4688
4685
  moveGroupOrPanel(referenceGroup, groupId, itemId, target, index) {
4689
4686
  var _a;
@@ -4738,15 +4735,11 @@
4738
4735
  }
4739
4736
  }
4740
4737
  doSetGroupActive(group, skipFocus) {
4741
- var _a, _b, _c;
4738
+ var _a, _b;
4742
4739
  const isGroupAlreadyFocused = this._activeGroup === group;
4743
4740
  super.doSetGroupActive(group, skipFocus);
4744
4741
  if (!isGroupAlreadyFocused && ((_a = this._activeGroup) === null || _a === void 0 ? void 0 : _a.model.activePanel)) {
4745
- this._onGridEvent.fire({
4746
- kind: exports.GroupChangeKind.PANEL_ACTIVE,
4747
- panel: (_b = this._activeGroup) === null || _b === void 0 ? void 0 : _b.model.activePanel,
4748
- });
4749
- this._onDidActivePanelChange.fire((_c = this._activeGroup) === null || _c === void 0 ? void 0 : _c.model.activePanel);
4742
+ this._onDidActivePanelChange.fire((_b = this._activeGroup) === null || _b === void 0 ? void 0 : _b.model.activePanel);
4750
4743
  }
4751
4744
  }
4752
4745
  createGroup(options) {
@@ -4768,6 +4761,7 @@
4768
4761
  }
4769
4762
  }
4770
4763
  const view = new GroupviewPanel(this, id, options);
4764
+ view.init({ params: {}, containerApi: null }); // required to initialized .part and allow for correct disposal of group
4771
4765
  if (!this._groups.has(view.id)) {
4772
4766
  const disposable = new CompositeDisposable(view.model.onMove((event) => {
4773
4767
  const { groupId, itemId, target, index } = event;
@@ -4777,28 +4771,16 @@
4777
4771
  }), view.model.onDidGroupChange((event) => {
4778
4772
  switch (event.kind) {
4779
4773
  case exports.GroupChangeKind2.ADD_PANEL:
4780
- this._onGridEvent.fire({
4781
- kind: exports.GroupChangeKind.ADD_PANEL,
4782
- panel: event.panel,
4783
- });
4784
4774
  if (event.panel) {
4785
4775
  this._onDidAddPanel.fire(event.panel);
4786
4776
  }
4787
4777
  break;
4788
4778
  case exports.GroupChangeKind2.REMOVE_PANEL:
4789
- this._onGridEvent.fire({
4790
- kind: exports.GroupChangeKind.REMOVE_PANEL,
4791
- panel: event.panel,
4792
- });
4793
4779
  if (event.panel) {
4794
4780
  this._onDidRemovePanel.fire(event.panel);
4795
4781
  }
4796
4782
  break;
4797
4783
  case exports.GroupChangeKind2.PANEL_ACTIVE:
4798
- this._onGridEvent.fire({
4799
- kind: exports.GroupChangeKind.PANEL_ACTIVE,
4800
- panel: event.panel,
4801
- });
4802
4784
  this._onDidActivePanelChange.fire(event.panel);
4803
4785
  break;
4804
4786
  }
@@ -4813,7 +4795,7 @@
4813
4795
  }
4814
4796
  return view;
4815
4797
  }
4816
- _addPanel(options) {
4798
+ createPanel(options) {
4817
4799
  const view = new DefaultGroupPanelView({
4818
4800
  content: this.createContentComponent(options.id, options.component),
4819
4801
  tab: this.createTabComponent(options.id, options.tabComponent),
@@ -4914,7 +4896,7 @@
4914
4896
  this.gridview.setViewVisible(getGridLocation(panel.element), visible);
4915
4897
  }
4916
4898
  setActive(panel) {
4917
- this._groups.forEach((value, key) => {
4899
+ this._groups.forEach((value, _key) => {
4918
4900
  value.value.setActive(panel === value.value);
4919
4901
  });
4920
4902
  }
@@ -4925,10 +4907,14 @@
4925
4907
  var _a;
4926
4908
  (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
4927
4909
  }
4928
- fromJSON(serializedGridview, deferComponentLayout) {
4910
+ fromJSON(serializedGridview) {
4929
4911
  const { grid, activePanel } = serializedGridview;
4912
+ const groups = Array.from(this._groups.values()); // reassign since group panels will mutate
4913
+ for (const group of groups) {
4914
+ group.disposable.dispose();
4915
+ this.doRemoveGroup(group.value, { skipActive: true });
4916
+ }
4930
4917
  this.gridview.clear();
4931
- this._groups.clear();
4932
4918
  const queue = [];
4933
4919
  this.gridview.deserialize(grid, {
4934
4920
  fromJSON: (node) => {
@@ -4955,21 +4941,13 @@
4955
4941
  },
4956
4942
  });
4957
4943
  this.layout(this.width, this.height, true);
4958
- if (deferComponentLayout) {
4959
- setTimeout(() => {
4960
- queue.forEach((f) => f());
4961
- }, 0);
4962
- }
4963
- else {
4964
- queue.forEach((f) => f());
4965
- }
4944
+ queue.forEach((f) => f());
4966
4945
  if (typeof activePanel === 'string') {
4967
4946
  const panel = this.getPanel(activePanel);
4968
4947
  if (panel) {
4969
4948
  this.doSetGroupActive(panel);
4970
4949
  }
4971
4950
  }
4972
- this._onGridEvent.fire({ kind: exports.GroupChangeKind.LAYOUT_FROM_JSON });
4973
4951
  this._onDidLayoutfromJSON.fire();
4974
4952
  }
4975
4953
  movePanel(panel, options) {
@@ -5026,7 +5004,6 @@
5026
5004
  });
5027
5005
  this.registerPanel(view);
5028
5006
  this.doAddGroup(view, relativeLocation, options.size);
5029
- return { api: view.api };
5030
5007
  }
5031
5008
  registerPanel(panel) {
5032
5009
  const disposable = new CompositeDisposable(panel.api.onDidFocusChange((event) => {
@@ -5077,11 +5054,6 @@
5077
5054
  }
5078
5055
  removeGroup(group) {
5079
5056
  super.removeGroup(group);
5080
- const panel = this._groups.get(group.id);
5081
- if (panel) {
5082
- panel.disposable.dispose();
5083
- this._groups.delete(group.id);
5084
- }
5085
5057
  }
5086
5058
  dispose() {
5087
5059
  super.dispose();
@@ -5098,6 +5070,8 @@
5098
5070
  this.element = element;
5099
5071
  this._disposable = new MutableDisposable();
5100
5072
  this.panels = new Map();
5073
+ this._onDidLayoutfromJSON = new Emitter();
5074
+ this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5101
5075
  this._onDidAddView = new Emitter();
5102
5076
  this.onDidAddView = this._onDidAddView.event;
5103
5077
  this._onDidRemoveView = new Emitter();
@@ -5112,7 +5086,7 @@
5112
5086
  options.frameworkComponents = {};
5113
5087
  }
5114
5088
  this.splitview = new Splitview(this.element, options);
5115
- this.addDisposables(this._disposable, this._onDidAddView, this._onDidRemoveView, this._onDidLayoutChange);
5089
+ this.addDisposables(this._disposable, this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
5116
5090
  }
5117
5091
  get options() {
5118
5092
  return this._options;
@@ -5188,7 +5162,11 @@
5188
5162
  }
5189
5163
  removePanel(panel, sizing) {
5190
5164
  const disposable = this.panels.get(panel.id);
5191
- disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
5165
+ if (!disposable) {
5166
+ throw new Error(`unknown splitview panel ${panel.id}`);
5167
+ }
5168
+ disposable.disposable.dispose();
5169
+ disposable.value.dispose();
5192
5170
  this.panels.delete(panel.id);
5193
5171
  const index = this.getPanels().findIndex((_) => _ === panel);
5194
5172
  this.splitview.removeView(index, sizing);
@@ -5247,7 +5225,7 @@
5247
5225
  }
5248
5226
  this.setActive(view, true);
5249
5227
  });
5250
- this.panels.set(view.id, disposable);
5228
+ this.panels.set(view.id, { disposable, value: view });
5251
5229
  }
5252
5230
  toJSON() {
5253
5231
  var _a;
@@ -5269,8 +5247,13 @@
5269
5247
  orientation: this.splitview.orientation,
5270
5248
  };
5271
5249
  }
5272
- fromJSON(serializedSplitview, deferComponentLayout = false) {
5250
+ fromJSON(serializedSplitview) {
5273
5251
  const { views, orientation, size, activeView } = serializedSplitview;
5252
+ for (const [_, value] of this.panels.entries()) {
5253
+ value.disposable.dispose();
5254
+ value.value.dispose();
5255
+ }
5256
+ this.panels.clear();
5274
5257
  this.splitview.dispose();
5275
5258
  const queue = [];
5276
5259
  this.splitview = new Splitview(this.element, {
@@ -5310,26 +5293,22 @@
5310
5293
  },
5311
5294
  });
5312
5295
  this.layout(this.width, this.height);
5313
- if (deferComponentLayout) {
5314
- setTimeout(() => {
5315
- queue.forEach((f) => f());
5316
- }, 0);
5317
- }
5318
- else {
5319
- queue.forEach((f) => f());
5320
- }
5296
+ queue.forEach((f) => f());
5321
5297
  if (typeof activeView === 'string') {
5322
5298
  const panel = this.getPanel(activeView);
5323
5299
  if (panel) {
5324
5300
  this.setActive(panel);
5325
5301
  }
5326
5302
  }
5303
+ this._onDidLayoutfromJSON.fire();
5327
5304
  }
5328
5305
  dispose() {
5329
- Array.from(this.panels.values()).forEach((value) => {
5330
- value.dispose();
5331
- });
5306
+ for (const [_, value] of this.panels.entries()) {
5307
+ value.disposable.dispose();
5308
+ value.value.dispose();
5309
+ }
5332
5310
  this.panels.clear();
5311
+ this.splitview.dispose();
5333
5312
  super.dispose();
5334
5313
  }
5335
5314
  }
@@ -5598,7 +5577,7 @@
5598
5577
  })(this.header);
5599
5578
  this.target = new Droptarget(this.element, {
5600
5579
  validOverlays: 'vertical',
5601
- canDisplayOverlay: (event) => {
5580
+ canDisplayOverlay: () => {
5602
5581
  const data = getPaneData();
5603
5582
  if (!data) {
5604
5583
  return true;
@@ -5669,7 +5648,7 @@
5669
5648
  this._expander.textContent = e.isExpanded ? '<' : '>';
5670
5649
  });
5671
5650
  }
5672
- update(params) {
5651
+ update(_params) {
5673
5652
  //
5674
5653
  }
5675
5654
  dispose() {
@@ -5695,6 +5674,9 @@
5695
5674
  super();
5696
5675
  this.element = element;
5697
5676
  this._disposable = new MutableDisposable();
5677
+ this._viewDisposables = new Map();
5678
+ this._onDidLayoutfromJSON = new Emitter();
5679
+ this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5698
5680
  this._onDidLayoutChange = new Emitter();
5699
5681
  this.onDidLayoutChange = this._onDidLayoutChange.event;
5700
5682
  this._onDidDrop = new Emitter();
@@ -5703,7 +5685,7 @@
5703
5685
  this.onDidAddView = this._onDidAddView.event;
5704
5686
  this._onDidRemoveView = new Emitter();
5705
5687
  this.onDidRemoveView = this._onDidRemoveView.event;
5706
- this.addDisposables(this._onDidLayoutChange, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
5688
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
5707
5689
  this._options = options;
5708
5690
  if (!options.components) {
5709
5691
  options.components = {};
@@ -5779,9 +5761,7 @@
5779
5761
  isExpanded: !!options.isExpanded,
5780
5762
  disableDnd: !!this.options.disableDnd,
5781
5763
  });
5782
- const disposable = new CompositeDisposable(view.onDidDrop((event) => {
5783
- this._onDidDrop.fire(event);
5784
- }));
5764
+ this.doAddPanel(view);
5785
5765
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
5786
5766
  const index = typeof options.index === 'number' ? options.index : undefined;
5787
5767
  view.init({
@@ -5794,7 +5774,7 @@
5794
5774
  });
5795
5775
  this.paneview.addPane(view, size, index);
5796
5776
  view.orientation = this.paneview.orientation;
5797
- return disposable;
5777
+ return view;
5798
5778
  }
5799
5779
  getPanels() {
5800
5780
  return this.paneview.getPanes();
@@ -5803,6 +5783,7 @@
5803
5783
  const views = this.getPanels();
5804
5784
  const index = views.findIndex((_) => _ === panel);
5805
5785
  this.paneview.removePane(index);
5786
+ this.doRemovePanel(panel);
5806
5787
  }
5807
5788
  movePanel(from, to) {
5808
5789
  this.paneview.moveView(from, to);
@@ -5849,9 +5830,13 @@
5849
5830
  size: this.paneview.size,
5850
5831
  };
5851
5832
  }
5852
- fromJSON(serializedPaneview, deferComponentLayout) {
5833
+ fromJSON(serializedPaneview) {
5853
5834
  const { views, size } = serializedPaneview;
5854
5835
  const queue = [];
5836
+ for (const [_, value] of this._viewDisposables.entries()) {
5837
+ value.dispose();
5838
+ }
5839
+ this._viewDisposables.clear();
5855
5840
  this.paneview.dispose();
5856
5841
  this.paneview = new Paneview(this.element, {
5857
5842
  orientation: exports.Orientation.VERTICAL,
@@ -5887,9 +5872,7 @@
5887
5872
  isExpanded: !!view.expanded,
5888
5873
  disableDnd: !!this.options.disableDnd,
5889
5874
  });
5890
- panel.onDidDrop((event) => {
5891
- this._onDidDrop.fire(event);
5892
- });
5875
+ this.doAddPanel(panel);
5893
5876
  queue.push(() => {
5894
5877
  panel.init({
5895
5878
  params: data.params || {},
@@ -5910,14 +5893,29 @@
5910
5893
  },
5911
5894
  });
5912
5895
  this.layout(this.width, this.height);
5913
- if (deferComponentLayout) {
5914
- setTimeout(() => {
5915
- queue.forEach((f) => f());
5916
- }, 0);
5896
+ queue.forEach((f) => f());
5897
+ this._onDidLayoutfromJSON.fire();
5898
+ }
5899
+ doAddPanel(panel) {
5900
+ const disposable = panel.onDidDrop((event) => {
5901
+ this._onDidDrop.fire(event);
5902
+ });
5903
+ this._viewDisposables.set(panel.id, disposable);
5904
+ }
5905
+ doRemovePanel(panel) {
5906
+ const disposable = this._viewDisposables.get(panel.id);
5907
+ if (disposable) {
5908
+ disposable.dispose();
5909
+ this._viewDisposables.delete(panel.id);
5917
5910
  }
5918
- else {
5919
- queue.forEach((f) => f());
5911
+ }
5912
+ dispose() {
5913
+ super.dispose();
5914
+ for (const [_, value] of this._viewDisposables.entries()) {
5915
+ value.dispose();
5920
5916
  }
5917
+ this._viewDisposables.clear();
5918
+ this.paneview.dispose();
5921
5919
  }
5922
5920
  }
5923
5921
 
@@ -6145,18 +6143,12 @@
6145
6143
  this.id = id;
6146
6144
  this.component = component;
6147
6145
  this.reactPortalStore = reactPortalStore;
6148
- // private hostedContainer: HostedContainer;
6149
6146
  this._onDidFocus = new Emitter();
6150
6147
  this.onDidFocus = this._onDidFocus.event;
6151
6148
  this._onDidBlur = new Emitter();
6152
6149
  this.onDidBlur = this._onDidBlur.event;
6153
6150
  this._element = document.createElement('div');
6154
6151
  this._element.className = 'dockview-react-part';
6155
- // this.hostedContainer = new HostedContainer({
6156
- // id,
6157
- // });
6158
- // this.hostedContainer.onDidFocus(() => this._onDidFocus.fire());
6159
- // this.hostedContainer.onDidBlur(() => this._onDidBlur.fire());
6160
6152
  this._actionsElement = document.createElement('div');
6161
6153
  this._actionsElement.className = 'dockview-react-part';
6162
6154
  }
@@ -6191,15 +6183,11 @@
6191
6183
  var _a;
6192
6184
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
6193
6185
  }
6194
- updateParentGroup(group, isPanelVisible) {
6186
+ updateParentGroup(group, _isPanelVisible) {
6195
6187
  this._group = group;
6196
6188
  }
6197
- layout(width, height) {
6189
+ layout(_width, _height) {
6198
6190
  // noop
6199
- // this.hostedContainer.layout(
6200
- // this.element
6201
- // // { width, height }
6202
- // );
6203
6191
  }
6204
6192
  close() {
6205
6193
  return Promise.resolve(true);
@@ -6209,7 +6197,6 @@
6209
6197
  this._onDidFocus.dispose();
6210
6198
  this._onDidBlur.dispose();
6211
6199
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
6212
- // this.hostedContainer?.dispose();
6213
6200
  (_b = this.actionsPart) === null || _b === void 0 ? void 0 : _b.dispose();
6214
6201
  }
6215
6202
  }
@@ -6244,10 +6231,10 @@
6244
6231
  id: this.id,
6245
6232
  };
6246
6233
  }
6247
- layout(width, height) {
6234
+ layout(_width, _height) {
6248
6235
  // noop - retrieval from api
6249
6236
  }
6250
- updateParentGroup(group, isPanelVisible) {
6237
+ updateParentGroup(_group, _isPanelVisible) {
6251
6238
  // noop - retrieval from api
6252
6239
  }
6253
6240
  dispose() {
@@ -6326,10 +6313,10 @@
6326
6313
  id: this.id,
6327
6314
  };
6328
6315
  }
6329
- layout(width, height) {
6316
+ layout(_width, _height) {
6330
6317
  // noop - retrieval from api
6331
6318
  }
6332
- updateParentGroup(group, isPanelVisible) {
6319
+ updateParentGroup(group, _isPanelVisible) {
6333
6320
  // noop - retrieval from api
6334
6321
  this._groupRef.value = group;
6335
6322
  }
@@ -6363,21 +6350,21 @@
6363
6350
  var _a;
6364
6351
  const factory = {
6365
6352
  content: {
6366
- createComponent: (id, componentId, component) => {
6353
+ createComponent: (_id, componentId, component) => {
6367
6354
  return new ReactPanelContentPart(componentId, component, {
6368
6355
  addPortal,
6369
6356
  });
6370
6357
  },
6371
6358
  },
6372
6359
  tab: {
6373
- createComponent: (id, componentId, component) => {
6360
+ createComponent: (_id, componentId, component) => {
6374
6361
  return new ReactPanelHeaderPart(componentId, component, {
6375
6362
  addPortal,
6376
6363
  });
6377
6364
  },
6378
6365
  },
6379
6366
  watermark: {
6380
- createComponent: (id, componentId, component) => {
6367
+ createComponent: (_id, componentId, component) => {
6381
6368
  return new ReactWatermarkPart(componentId, component, {
6382
6369
  addPortal,
6383
6370
  });
@@ -6396,11 +6383,6 @@
6396
6383
  ? { separatorBorder: 'transparent' }
6397
6384
  : undefined,
6398
6385
  });
6399
- const disposable = dockview.onDidDrop((event) => {
6400
- if (props.onDidDrop) {
6401
- props.onDidDrop(event);
6402
- }
6403
- });
6404
6386
  (_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
6405
6387
  dockview.deserializer = new ReactPanelDeserialzier(dockview);
6406
6388
  const { clientWidth, clientHeight } = domRef.current;
@@ -6410,10 +6392,25 @@
6410
6392
  }
6411
6393
  dockviewRef.current = dockview;
6412
6394
  return () => {
6413
- disposable.dispose();
6414
6395
  dockview.dispose();
6396
+ element.remove();
6415
6397
  };
6416
6398
  }, []);
6399
+ React__namespace.useEffect(() => {
6400
+ if (!dockviewRef.current) {
6401
+ return () => {
6402
+ // noop
6403
+ };
6404
+ }
6405
+ const disposable = dockviewRef.current.onDidDrop((event) => {
6406
+ if (props.onDidDrop) {
6407
+ props.onDidDrop(event);
6408
+ }
6409
+ });
6410
+ return () => {
6411
+ disposable.dispose();
6412
+ };
6413
+ }, [props.onDidDrop]);
6417
6414
  React__namespace.useEffect(() => {
6418
6415
  if (!dockviewRef.current) {
6419
6416
  return;
@@ -6422,6 +6419,14 @@
6422
6419
  frameworkComponents: props.components,
6423
6420
  });
6424
6421
  }, [props.components]);
6422
+ React__namespace.useEffect(() => {
6423
+ if (!dockviewRef.current) {
6424
+ return;
6425
+ }
6426
+ dockviewRef.current.updateOptions({
6427
+ watermarkFrameworkComponent: props.watermarkComponent,
6428
+ });
6429
+ }, [props.watermarkComponent]);
6425
6430
  React__namespace.useEffect(() => {
6426
6431
  if (!dockviewRef.current) {
6427
6432
  return;
@@ -6557,7 +6562,9 @@
6557
6562
  });
6558
6563
  },
6559
6564
  },
6560
- proportionalLayout: props.proportionalLayout,
6565
+ proportionalLayout: typeof props.proportionalLayout === 'boolean'
6566
+ ? props.proportionalLayout
6567
+ : true,
6561
6568
  styles: props.hideBorders
6562
6569
  ? { separatorBorder: 'transparent' }
6563
6570
  : undefined,
@@ -6625,7 +6632,9 @@
6625
6632
  var _a;
6626
6633
  const element = document.createElement('div');
6627
6634
  const gridview = new GridviewComponent(element, {
6628
- proportionalLayout: !!props.proportionalLayout,
6635
+ proportionalLayout: typeof props.proportionalLayout === 'boolean'
6636
+ ? props.proportionalLayout
6637
+ : true,
6629
6638
  orientation: props.orientation,
6630
6639
  frameworkComponents: props.components,
6631
6640
  frameworkComponentFactory: {
@@ -6648,6 +6657,7 @@
6648
6657
  gridviewRef.current = gridview;
6649
6658
  return () => {
6650
6659
  gridview.dispose();
6660
+ element.remove();
6651
6661
  };
6652
6662
  }, []);
6653
6663
  React__namespace.useEffect(() => {
@@ -6718,7 +6728,7 @@
6718
6728
  };
6719
6729
  }, [props.disableAutoResizing]);
6720
6730
  React__namespace.useEffect(() => {
6721
- const createComponent = (id, componentId, component) => new PanePanelSection(id, component, {
6731
+ const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
6722
6732
  addPortal,
6723
6733
  });
6724
6734
  const paneview = new PaneviewComponent(domRef.current, {
@@ -6784,13 +6794,11 @@
6784
6794
  PaneviewReact.displayName = 'PaneviewComponent';
6785
6795
 
6786
6796
  exports.BaseGrid = BaseGrid;
6787
- exports.CompositeDisposable = CompositeDisposable;
6788
6797
  exports.ContentContainer = ContentContainer;
6789
6798
  exports.DockviewApi = DockviewApi;
6790
6799
  exports.DockviewComponent = DockviewComponent;
6791
6800
  exports.DockviewComponents = DockviewComponents;
6792
6801
  exports.DockviewReact = DockviewReact;
6793
- exports.Emitter = Emitter;
6794
6802
  exports.Gridview = Gridview;
6795
6803
  exports.GridviewApi = GridviewApi;
6796
6804
  exports.GridviewComponent = GridviewComponent;
@@ -6798,7 +6806,6 @@
6798
6806
  exports.GridviewReact = GridviewReact;
6799
6807
  exports.Groupview = Groupview;
6800
6808
  exports.LocalSelectionTransfer = LocalSelectionTransfer;
6801
- exports.MutableDisposable = MutableDisposable;
6802
6809
  exports.PaneFramework = PaneFramework;
6803
6810
  exports.PaneTransfer = PaneTransfer;
6804
6811
  exports.PanelTransfer = PanelTransfer;
@@ -6817,9 +6824,6 @@
6817
6824
  exports.SplitviewPanel = SplitviewPanel;
6818
6825
  exports.SplitviewReact = SplitviewReact;
6819
6826
  exports.Tab = Tab$1;
6820
- exports.TickDelayedEvent = TickDelayedEvent;
6821
- exports.addDisposableListener = addDisposableListener;
6822
- exports.addDisposableWindowListener = addDisposableWindowListener;
6823
6827
  exports.getDirectionOrientation = getDirectionOrientation;
6824
6828
  exports.getGridLocation = getGridLocation;
6825
6829
  exports.getLocationOrientation = getLocationOrientation;