dockview 1.5.2 → 1.6.0

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 (220) hide show
  1. package/dist/cjs/api/component.api.d.ts +3 -2
  2. package/dist/cjs/api/component.api.js +9 -2
  3. package/dist/cjs/api/component.api.js.map +1 -1
  4. package/dist/cjs/api/{groupPanelApi.d.ts → dockviewPanelApi.d.ts} +2 -2
  5. package/dist/cjs/api/{groupPanelApi.js → dockviewPanelApi.js} +4 -6
  6. package/dist/cjs/api/dockviewPanelApi.js.map +1 -0
  7. package/dist/cjs/api/gridviewPanelApi.d.ts +4 -3
  8. package/dist/cjs/api/gridviewPanelApi.js +4 -4
  9. package/dist/cjs/api/gridviewPanelApi.js.map +1 -1
  10. package/dist/cjs/api/panelApi.d.ts +7 -0
  11. package/dist/cjs/api/panelApi.js +17 -1
  12. package/dist/cjs/api/panelApi.js.map +1 -1
  13. package/dist/cjs/array.d.ts +1 -1
  14. package/dist/cjs/dnd/abstractDragHandler.d.ts +2 -2
  15. package/dist/cjs/dnd/abstractDragHandler.js +3 -3
  16. package/dist/cjs/dnd/abstractDragHandler.js.map +1 -1
  17. package/dist/cjs/dnd/dataTransfer.d.ts +2 -2
  18. package/dist/cjs/dnd/dataTransfer.js.map +1 -1
  19. package/dist/cjs/dnd/dnd.d.ts +1 -1
  20. package/dist/cjs/dnd/dnd.js +7 -12
  21. package/dist/cjs/dnd/dnd.js.map +1 -1
  22. package/dist/cjs/dnd/droptarget.d.ts +20 -15
  23. package/dist/cjs/dnd/droptarget.js +152 -74
  24. package/dist/cjs/dnd/droptarget.js.map +1 -1
  25. package/dist/cjs/dnd/ghost.d.ts +1 -0
  26. package/dist/cjs/dnd/ghost.js +15 -0
  27. package/dist/cjs/dnd/ghost.js.map +1 -0
  28. package/dist/cjs/dnd/groupDragHandler.d.ts +11 -0
  29. package/dist/cjs/dnd/groupDragHandler.js +62 -0
  30. package/dist/cjs/dnd/groupDragHandler.js.map +1 -0
  31. package/dist/cjs/dockview/defaultGroupPanelView.d.ts +1 -1
  32. package/dist/cjs/dockview/deserializer.d.ts +2 -1
  33. package/dist/cjs/dockview/dockviewComponent.d.ts +15 -7
  34. package/dist/cjs/dockview/dockviewComponent.js +215 -34
  35. package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
  36. package/dist/{esm/dockview/dockviewGroupPanel.d.ts → cjs/dockview/dockviewPanel.d.ts} +16 -5
  37. package/dist/cjs/dockview/{dockviewGroupPanel.js → dockviewPanel.js} +25 -21
  38. package/dist/cjs/dockview/dockviewPanel.js.map +1 -0
  39. package/dist/cjs/dockview/options.d.ts +32 -10
  40. package/dist/cjs/dockview/options.js +29 -0
  41. package/dist/cjs/dockview/options.js.map +1 -1
  42. package/dist/cjs/dockview/validation.d.ts +2 -0
  43. package/dist/cjs/dockview/validation.js +135 -0
  44. package/dist/cjs/dockview/validation.js.map +1 -0
  45. package/dist/cjs/gridview/baseComponentGridview.d.ts +1 -1
  46. package/dist/cjs/gridview/baseComponentGridview.js +5 -6
  47. package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
  48. package/dist/cjs/gridview/basePanelView.d.ts +2 -2
  49. package/dist/cjs/gridview/gridview.d.ts +9 -3
  50. package/dist/cjs/gridview/gridview.js +38 -7
  51. package/dist/cjs/gridview/gridview.js.map +1 -1
  52. package/dist/cjs/gridview/gridviewComponent.d.ts +2 -2
  53. package/dist/cjs/gridview/gridviewComponent.js +2 -3
  54. package/dist/cjs/gridview/gridviewComponent.js.map +1 -1
  55. package/dist/cjs/gridview/gridviewPanel.d.ts +3 -3
  56. package/dist/cjs/gridview/gridviewPanel.js +1 -2
  57. package/dist/cjs/gridview/gridviewPanel.js.map +1 -1
  58. package/dist/cjs/gridview/types.d.ts +1 -1
  59. package/dist/cjs/groupview/dnd.d.ts +2 -1
  60. package/dist/cjs/groupview/dnd.js +1 -0
  61. package/dist/cjs/groupview/dnd.js.map +1 -1
  62. package/dist/cjs/groupview/groupview.d.ts +6 -6
  63. package/dist/cjs/groupview/groupview.js +43 -25
  64. package/dist/cjs/groupview/groupview.js.map +1 -1
  65. package/dist/cjs/groupview/groupviewPanel.d.ts +3 -3
  66. package/dist/cjs/groupview/panel/content.d.ts +1 -1
  67. package/dist/cjs/groupview/tab.d.ts +2 -12
  68. package/dist/cjs/groupview/tab.js +13 -9
  69. package/dist/cjs/groupview/tab.js.map +1 -1
  70. package/dist/cjs/groupview/titlebar/tabsContainer.d.ts +5 -8
  71. package/dist/cjs/groupview/titlebar/tabsContainer.js +23 -30
  72. package/dist/cjs/groupview/titlebar/tabsContainer.js.map +1 -1
  73. package/dist/cjs/groupview/titlebar/voidContainer.d.ts +15 -0
  74. package/dist/cjs/groupview/titlebar/voidContainer.js +74 -0
  75. package/dist/cjs/groupview/titlebar/voidContainer.js.map +1 -0
  76. package/dist/cjs/groupview/types.d.ts +18 -2
  77. package/dist/cjs/index.d.ts +3 -3
  78. package/dist/cjs/index.js +4 -3
  79. package/dist/cjs/index.js.map +1 -1
  80. package/dist/cjs/paneview/draggablePaneviewPanel.js +6 -5
  81. package/dist/cjs/paneview/draggablePaneviewPanel.js.map +1 -1
  82. package/dist/cjs/paneview/paneviewComponent.js +2 -2
  83. package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
  84. package/dist/cjs/paneview/paneviewPanel.js +1 -0
  85. package/dist/cjs/paneview/paneviewPanel.js.map +1 -1
  86. package/dist/cjs/react/deserializer.d.ts +2 -1
  87. package/dist/cjs/react/deserializer.js +2 -2
  88. package/dist/cjs/react/deserializer.js.map +1 -1
  89. package/dist/cjs/react/dockview/defaultTab.d.ts +1 -1
  90. package/dist/cjs/react/dockview/dockview.d.ts +5 -4
  91. package/dist/cjs/react/dockview/dockview.js +1 -0
  92. package/dist/cjs/react/dockview/dockview.js.map +1 -1
  93. package/dist/cjs/react/dockview/groupControlsRenderer.d.ts +1 -1
  94. package/dist/cjs/react/gridview/view.js +2 -1
  95. package/dist/cjs/react/gridview/view.js.map +1 -1
  96. package/dist/cjs/react/react.d.ts +1 -1
  97. package/dist/cjs/splitview/core/splitview.d.ts +4 -4
  98. package/dist/cjs/splitview/splitviewComponent.d.ts +1 -1
  99. package/dist/cjs/splitview/splitviewComponent.js +2 -2
  100. package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
  101. package/dist/cjs/splitview/splitviewPanel.js +1 -0
  102. package/dist/cjs/splitview/splitviewPanel.js.map +1 -1
  103. package/dist/cjs/types.d.ts +2 -1
  104. package/dist/cjs/types.js +5 -0
  105. package/dist/cjs/types.js.map +1 -1
  106. package/dist/dockview.amd.js +1411 -987
  107. package/dist/dockview.amd.min.js +2 -2
  108. package/dist/dockview.amd.min.noStyle.js +2 -2
  109. package/dist/dockview.amd.noStyle.js +1410 -986
  110. package/dist/dockview.cjs.js +1394 -970
  111. package/dist/dockview.esm.js +1385 -964
  112. package/dist/dockview.esm.min.js +2 -2
  113. package/dist/dockview.js +1411 -987
  114. package/dist/dockview.min.js +2 -2
  115. package/dist/dockview.min.noStyle.js +2 -2
  116. package/dist/dockview.noStyle.js +1410 -986
  117. package/dist/esm/actionbar/actionsContainer.js +3 -3
  118. package/dist/esm/api/component.api.d.ts +3 -2
  119. package/dist/esm/api/component.api.js +16 -13
  120. package/dist/esm/api/{groupPanelApi.d.ts → dockviewPanelApi.d.ts} +2 -2
  121. package/dist/esm/api/{groupPanelApi.js → dockviewPanelApi.js} +16 -18
  122. package/dist/esm/api/gridviewPanelApi.d.ts +4 -3
  123. package/dist/esm/api/gridviewPanelApi.js +4 -4
  124. package/dist/esm/api/panelApi.d.ts +7 -0
  125. package/dist/esm/api/panelApi.js +33 -17
  126. package/dist/esm/api/paneviewPanelApi.js +3 -3
  127. package/dist/esm/array.d.ts +1 -1
  128. package/dist/esm/dnd/abstractDragHandler.d.ts +2 -2
  129. package/dist/esm/dnd/abstractDragHandler.js +3 -3
  130. package/dist/esm/dnd/dataTransfer.d.ts +2 -2
  131. package/dist/esm/dnd/dnd.d.ts +1 -1
  132. package/dist/esm/dnd/dnd.js +7 -12
  133. package/dist/esm/dnd/droptarget.d.ts +20 -15
  134. package/dist/esm/dnd/droptarget.js +149 -67
  135. package/dist/esm/dnd/ghost.d.ts +1 -0
  136. package/dist/esm/dnd/ghost.js +10 -0
  137. package/dist/esm/dnd/groupDragHandler.d.ts +11 -0
  138. package/dist/esm/dnd/groupDragHandler.js +38 -0
  139. package/dist/esm/dockview/components/tab/defaultTab.js +6 -6
  140. package/dist/esm/dockview/components/watermark/watermark.js +3 -3
  141. package/dist/esm/dockview/defaultGroupPanelView.d.ts +1 -1
  142. package/dist/esm/dockview/defaultGroupPanelView.js +5 -5
  143. package/dist/esm/dockview/deserializer.d.ts +2 -1
  144. package/dist/esm/dockview/dockviewComponent.d.ts +15 -7
  145. package/dist/esm/dockview/dockviewComponent.js +229 -65
  146. package/dist/{cjs/dockview/dockviewGroupPanel.d.ts → esm/dockview/dockviewPanel.d.ts} +16 -5
  147. package/dist/esm/dockview/{dockviewGroupPanel.js → dockviewPanel.js} +19 -15
  148. package/dist/esm/dockview/options.d.ts +32 -10
  149. package/dist/esm/dockview/options.js +24 -1
  150. package/dist/esm/dockview/validation.d.ts +2 -0
  151. package/dist/esm/dockview/validation.js +86 -0
  152. package/dist/esm/gridview/baseComponentGridview.d.ts +1 -1
  153. package/dist/esm/gridview/baseComponentGridview.js +31 -32
  154. package/dist/esm/gridview/basePanelView.d.ts +2 -2
  155. package/dist/esm/gridview/basePanelView.js +13 -13
  156. package/dist/esm/gridview/branchNode.js +47 -47
  157. package/dist/esm/gridview/gridview.d.ts +9 -3
  158. package/dist/esm/gridview/gridview.js +41 -15
  159. package/dist/esm/gridview/gridviewComponent.d.ts +2 -2
  160. package/dist/esm/gridview/gridviewComponent.js +17 -18
  161. package/dist/esm/gridview/gridviewPanel.d.ts +3 -3
  162. package/dist/esm/gridview/gridviewPanel.js +45 -45
  163. package/dist/esm/gridview/leafNode.js +23 -23
  164. package/dist/esm/gridview/types.d.ts +1 -1
  165. package/dist/esm/groupview/dnd.d.ts +2 -1
  166. package/dist/esm/groupview/dnd.js +1 -0
  167. package/dist/esm/groupview/groupview.d.ts +6 -6
  168. package/dist/esm/groupview/groupview.js +90 -72
  169. package/dist/esm/groupview/groupviewPanel.d.ts +3 -3
  170. package/dist/esm/groupview/groupviewPanel.js +4 -4
  171. package/dist/esm/groupview/panel/content.d.ts +1 -1
  172. package/dist/esm/groupview/panel/content.js +3 -3
  173. package/dist/esm/groupview/tab.d.ts +2 -12
  174. package/dist/esm/groupview/tab.js +15 -11
  175. package/dist/esm/groupview/titlebar/tabsContainer.d.ts +5 -8
  176. package/dist/esm/groupview/titlebar/tabsContainer.js +54 -61
  177. package/dist/esm/groupview/titlebar/voidContainer.d.ts +15 -0
  178. package/dist/esm/groupview/titlebar/voidContainer.js +47 -0
  179. package/dist/esm/groupview/types.d.ts +18 -2
  180. package/dist/esm/hostedContainer.js +3 -3
  181. package/dist/esm/index.d.ts +3 -3
  182. package/dist/esm/index.js +2 -2
  183. package/dist/esm/lifecycle.js +3 -3
  184. package/dist/esm/paneview/defaultPaneviewHeader.js +3 -3
  185. package/dist/esm/paneview/draggablePaneviewPanel.js +7 -6
  186. package/dist/esm/paneview/paneview.js +21 -21
  187. package/dist/esm/paneview/paneviewComponent.js +30 -30
  188. package/dist/esm/paneview/paneviewPanel.js +45 -44
  189. package/dist/esm/react/deserializer.d.ts +2 -1
  190. package/dist/esm/react/deserializer.js +2 -2
  191. package/dist/esm/react/dockview/defaultTab.d.ts +1 -1
  192. package/dist/esm/react/dockview/dockview.d.ts +5 -4
  193. package/dist/esm/react/dockview/dockview.js +1 -0
  194. package/dist/esm/react/dockview/groupControlsRenderer.d.ts +1 -1
  195. package/dist/esm/react/dockview/groupControlsRenderer.js +8 -8
  196. package/dist/esm/react/dockview/reactContentPart.js +3 -3
  197. package/dist/esm/react/dockview/reactHeaderPart.js +3 -3
  198. package/dist/esm/react/dockview/reactWatermarkPart.js +3 -3
  199. package/dist/esm/react/dockview/v2/reactContentRenderer.js +9 -9
  200. package/dist/esm/react/dockview/v2/webviewContentRenderer.js +3 -3
  201. package/dist/esm/react/gridview/view.js +2 -1
  202. package/dist/esm/react/paneview/view.js +3 -3
  203. package/dist/esm/react/react.d.ts +1 -1
  204. package/dist/esm/splitview/core/splitview.d.ts +4 -4
  205. package/dist/esm/splitview/core/splitview.js +59 -59
  206. package/dist/esm/splitview/core/viewItem.js +15 -15
  207. package/dist/esm/splitview/splitviewComponent.d.ts +1 -1
  208. package/dist/esm/splitview/splitviewComponent.js +23 -23
  209. package/dist/esm/splitview/splitviewPanel.js +31 -30
  210. package/dist/esm/types.d.ts +2 -1
  211. package/dist/esm/types.js +3 -1
  212. package/dist/styles/dockview.css +23 -26
  213. package/package.json +12 -16
  214. package/dist/cjs/api/groupPanelApi.js.map +0 -1
  215. package/dist/cjs/dockview/dockviewGroupPanel.js.map +0 -1
  216. package/dist/cjs/groupview/groupPanel.d.ts +0 -32
  217. package/dist/cjs/groupview/groupPanel.js +0 -3
  218. package/dist/cjs/groupview/groupPanel.js.map +0 -1
  219. package/dist/esm/groupview/groupPanel.d.ts +0 -32
  220. package/dist/esm/groupview/groupPanel.js +0 -1
@@ -1,13 +1,12 @@
1
1
  /**
2
2
  * dockview
3
- * @version 1.5.2
3
+ * @version 1.6.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
7
7
  define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) { 'use strict';
8
8
 
9
- function _interopNamespace(e) {
10
- if (e && e.__esModule) return e;
9
+ function _interopNamespaceDefault(e) {
11
10
  var n = Object.create(null);
12
11
  if (e) {
13
12
  Object.keys(e).forEach(function (k) {
@@ -20,12 +19,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
20
19
  }
21
20
  });
22
21
  }
23
- n["default"] = e;
22
+ n.default = e;
24
23
  return Object.freeze(n);
25
24
  }
26
25
 
27
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
- var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
26
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
27
+ var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
29
28
 
30
29
  class TransferObject {
31
30
  constructor() {
@@ -195,12 +194,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
195
194
  };
196
195
  })(Disposable || (Disposable = {}));
197
196
  class CompositeDisposable {
198
- constructor(...args) {
199
- this.disposables = args;
200
- }
201
197
  static from(...args) {
202
198
  return new CompositeDisposable(...args);
203
199
  }
200
+ constructor(...args) {
201
+ this.disposables = args;
202
+ }
204
203
  addDisposables(...args) {
205
204
  args.forEach((arg) => this.disposables.push(arg));
206
205
  }
@@ -418,21 +417,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
418
417
  }
419
418
 
420
419
  class ViewItem {
421
- constructor(container, view, size, disposable) {
422
- this.container = container;
423
- this.view = view;
424
- this.disposable = disposable;
425
- this._cachedVisibleSize = undefined;
426
- if (typeof size === 'number') {
427
- this._size = size;
428
- this._cachedVisibleSize = undefined;
429
- container.classList.add('visible');
430
- }
431
- else {
432
- this._size = 0;
433
- this._cachedVisibleSize = size.cachedVisibleSize;
434
- }
435
- }
436
420
  set size(size) {
437
421
  this._size = size;
438
422
  }
@@ -485,6 +469,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
485
469
  set enabled(enabled) {
486
470
  this.container.style.pointerEvents = enabled ? '' : 'none';
487
471
  }
472
+ constructor(container, view, size, disposable) {
473
+ this.container = container;
474
+ this.view = view;
475
+ this.disposable = disposable;
476
+ this._cachedVisibleSize = undefined;
477
+ if (typeof size === 'number') {
478
+ this._size = size;
479
+ this._cachedVisibleSize = undefined;
480
+ container.classList.add('visible');
481
+ }
482
+ else {
483
+ this._size = 0;
484
+ this._cachedVisibleSize = size.cachedVisibleSize;
485
+ }
486
+ }
488
487
  // layout(offset: number, layoutContext: TLayoutContext | undefined): void {
489
488
  // this.layoutContainer(offset);
490
489
  // this.view.layout(this.size, offset, layoutContext);
@@ -531,6 +530,65 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
531
530
  Sizing.Invisible = Invisible;
532
531
  })(exports.Sizing || (exports.Sizing = {}));
533
532
  class Splitview {
533
+ get size() {
534
+ return this._size;
535
+ }
536
+ set size(value) {
537
+ this._size = value;
538
+ }
539
+ get orthogonalSize() {
540
+ return this._orthogonalSize;
541
+ }
542
+ set orthogonalSize(value) {
543
+ this._orthogonalSize = value;
544
+ }
545
+ get length() {
546
+ return this.views.length;
547
+ }
548
+ get proportions() {
549
+ return this._proportions ? [...this._proportions] : undefined;
550
+ }
551
+ get orientation() {
552
+ return this._orientation;
553
+ }
554
+ set orientation(value) {
555
+ this._orientation = value;
556
+ const tmp = this.size;
557
+ this.size = this.orthogonalSize;
558
+ this.orthogonalSize = tmp;
559
+ removeClasses(this.element, 'horizontal', 'vertical');
560
+ this.element.classList.add(this.orientation == exports.Orientation.HORIZONTAL
561
+ ? 'horizontal'
562
+ : 'vertical');
563
+ }
564
+ get minimumSize() {
565
+ return this.views.reduce((r, item) => r + item.minimumSize, 0);
566
+ }
567
+ get maximumSize() {
568
+ return this.length === 0
569
+ ? Number.POSITIVE_INFINITY
570
+ : this.views.reduce((r, item) => r + item.maximumSize, 0);
571
+ }
572
+ get startSnappingEnabled() {
573
+ return this._startSnappingEnabled;
574
+ }
575
+ set startSnappingEnabled(startSnappingEnabled) {
576
+ if (this._startSnappingEnabled === startSnappingEnabled) {
577
+ return;
578
+ }
579
+ this._startSnappingEnabled = startSnappingEnabled;
580
+ this.updateSashEnablement();
581
+ }
582
+ get endSnappingEnabled() {
583
+ return this._endSnappingEnabled;
584
+ }
585
+ set endSnappingEnabled(endSnappingEnabled) {
586
+ if (this._endSnappingEnabled === endSnappingEnabled) {
587
+ return;
588
+ }
589
+ this._endSnappingEnabled = endSnappingEnabled;
590
+ this.updateSashEnablement();
591
+ }
534
592
  constructor(container, options) {
535
593
  this.container = container;
536
594
  this.views = [];
@@ -660,65 +718,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
660
718
  this.saveProportions();
661
719
  }
662
720
  }
663
- get size() {
664
- return this._size;
665
- }
666
- set size(value) {
667
- this._size = value;
668
- }
669
- get orthogonalSize() {
670
- return this._orthogonalSize;
671
- }
672
- set orthogonalSize(value) {
673
- this._orthogonalSize = value;
674
- }
675
- get length() {
676
- return this.views.length;
677
- }
678
- get proportions() {
679
- return this._proportions ? [...this._proportions] : undefined;
680
- }
681
- get orientation() {
682
- return this._orientation;
683
- }
684
- set orientation(value) {
685
- this._orientation = value;
686
- const tmp = this.size;
687
- this.size = this.orthogonalSize;
688
- this.orthogonalSize = tmp;
689
- removeClasses(this.element, 'horizontal', 'vertical');
690
- this.element.classList.add(this.orientation == exports.Orientation.HORIZONTAL
691
- ? 'horizontal'
692
- : 'vertical');
693
- }
694
- get minimumSize() {
695
- return this.views.reduce((r, item) => r + item.minimumSize, 0);
696
- }
697
- get maximumSize() {
698
- return this.length === 0
699
- ? Number.POSITIVE_INFINITY
700
- : this.views.reduce((r, item) => r + item.maximumSize, 0);
701
- }
702
- get startSnappingEnabled() {
703
- return this._startSnappingEnabled;
704
- }
705
- set startSnappingEnabled(startSnappingEnabled) {
706
- if (this._startSnappingEnabled === startSnappingEnabled) {
707
- return;
708
- }
709
- this._startSnappingEnabled = startSnappingEnabled;
710
- this.updateSashEnablement();
711
- }
712
- get endSnappingEnabled() {
713
- return this._endSnappingEnabled;
714
- }
715
- set endSnappingEnabled(endSnappingEnabled) {
716
- if (this._endSnappingEnabled === endSnappingEnabled) {
717
- return;
718
- }
719
- this._endSnappingEnabled = endSnappingEnabled;
720
- this.updateSashEnablement();
721
- }
722
721
  style(styles) {
723
722
  if ((styles === null || styles === void 0 ? void 0 : styles.separatorBorder) === 'transparent') {
724
723
  removeClasses(this.element, 'separator-border');
@@ -1182,6 +1181,27 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1182
1181
  }
1183
1182
 
1184
1183
  class Paneview extends CompositeDisposable {
1184
+ get onDidAddView() {
1185
+ return this.splitview.onDidAddView;
1186
+ }
1187
+ get onDidRemoveView() {
1188
+ return this.splitview.onDidRemoveView;
1189
+ }
1190
+ get minimumSize() {
1191
+ return this.splitview.minimumSize;
1192
+ }
1193
+ get maximumSize() {
1194
+ return this.splitview.maximumSize;
1195
+ }
1196
+ get orientation() {
1197
+ return this.splitview.orientation;
1198
+ }
1199
+ get size() {
1200
+ return this.splitview.size;
1201
+ }
1202
+ get orthogonalSize() {
1203
+ return this.splitview.orthogonalSize;
1204
+ }
1185
1205
  constructor(container, options) {
1186
1206
  var _a;
1187
1207
  super();
@@ -1224,27 +1244,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1224
1244
  this._onDidChange.fire();
1225
1245
  }));
1226
1246
  }
1227
- get onDidAddView() {
1228
- return this.splitview.onDidAddView;
1229
- }
1230
- get onDidRemoveView() {
1231
- return this.splitview.onDidRemoveView;
1232
- }
1233
- get minimumSize() {
1234
- return this.splitview.minimumSize;
1235
- }
1236
- get maximumSize() {
1237
- return this.splitview.maximumSize;
1238
- }
1239
- get orientation() {
1240
- return this.splitview.orientation;
1241
- }
1242
- get size() {
1243
- return this.splitview.size;
1244
- }
1245
- get orthogonalSize() {
1246
- return this.splitview.orthogonalSize;
1247
- }
1248
1247
  addPane(pane, size, index = this.splitview.length, skipLayout = false) {
1249
1248
  const disposable = pane.onDidChangeExpansionState(() => {
1250
1249
  this.setupAnimation();
@@ -1323,243 +1322,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1323
1322
  }
1324
1323
  }
1325
1324
 
1326
- class DragAndDropObserver extends CompositeDisposable {
1327
- constructor(element, callbacks) {
1328
- super();
1329
- this.element = element;
1330
- this.callbacks = callbacks;
1331
- // A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE
1332
- // calls see https://github.com/microsoft/vscode/issues/14470
1333
- // when the element has child elements where the events are fired
1334
- // repeadedly.
1335
- this.counter = 0;
1336
- this.registerListeners();
1325
+ /*---------------------------------------------------------------------------------------------
1326
+ * Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:
1327
+ * https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
1328
+ *--------------------------------------------------------------------------------------------*/
1329
+ class LeafNode {
1330
+ get minimumWidth() {
1331
+ return this.view.minimumWidth;
1337
1332
  }
1338
- registerListeners() {
1339
- this.addDisposables(addDisposableListener(this.element, 'dragenter', (e) => {
1340
- this.counter++;
1341
- this.callbacks.onDragEnter(e);
1342
- }));
1343
- this.addDisposables(addDisposableListener(this.element, 'dragover', (e) => {
1344
- e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)
1345
- if (this.callbacks.onDragOver) {
1346
- this.callbacks.onDragOver(e);
1347
- }
1348
- }));
1349
- this.addDisposables(addDisposableListener(this.element, 'dragleave', (e) => {
1350
- this.counter--;
1351
- if (this.counter === 0) {
1352
- this.callbacks.onDragLeave(e);
1353
- }
1354
- }));
1355
- this.addDisposables(addDisposableListener(this.element, 'dragend', (e) => {
1356
- this.counter = 0;
1357
- this.callbacks.onDragEnd(e);
1358
- }));
1359
- this.addDisposables(addDisposableListener(this.element, 'drop', (e) => {
1360
- this.counter = 0;
1361
- this.callbacks.onDrop(e);
1362
- }));
1363
- }
1364
- }
1365
-
1366
- exports.Position = void 0;
1367
- (function (Position) {
1368
- Position["Top"] = "Top";
1369
- Position["Left"] = "Left";
1370
- Position["Bottom"] = "Bottom";
1371
- Position["Right"] = "Right";
1372
- Position["Center"] = "Center";
1373
- })(exports.Position || (exports.Position = {}));
1374
- function isBooleanValue(canDisplayOverlay) {
1375
- return typeof canDisplayOverlay === 'boolean';
1376
- }
1377
- class Droptarget extends CompositeDisposable {
1378
- constructor(element, options) {
1379
- super();
1380
- this.element = element;
1381
- this.options = options;
1382
- this._onDrop = new Emitter();
1383
- this.onDrop = this._onDrop.event;
1384
- this.addDisposables(this._onDrop, new DragAndDropObserver(this.element, {
1385
- onDragEnter: () => undefined,
1386
- onDragOver: (e) => {
1387
- const width = this.element.clientWidth;
1388
- const height = this.element.clientHeight;
1389
- if (width === 0 || height === 0) {
1390
- return; // avoid div!0
1391
- }
1392
- const x = e.offsetX;
1393
- const y = e.offsetY;
1394
- const xp = (100 * x) / width;
1395
- const yp = (100 * y) / height;
1396
- const quadrant = this.calculateQuadrant(this.options.validOverlays, xp, yp);
1397
- if (isBooleanValue(this.options.canDisplayOverlay)) {
1398
- if (!this.options.canDisplayOverlay) {
1399
- return;
1400
- }
1401
- }
1402
- else if (!this.options.canDisplayOverlay(e, quadrant)) {
1403
- return;
1404
- }
1405
- if (!this.target) {
1406
- this.target = document.createElement('div');
1407
- this.target.className = 'drop-target-dropzone';
1408
- this.overlay = document.createElement('div');
1409
- this.overlay.className = 'drop-target-selection';
1410
- this._state = exports.Position.Center;
1411
- this.target.appendChild(this.overlay);
1412
- this.element.classList.add('drop-target');
1413
- this.element.append(this.target);
1414
- }
1415
- if (this.options.validOverlays === 'none') {
1416
- return;
1417
- }
1418
- if (!this.target || !this.overlay) {
1419
- return;
1420
- }
1421
- const isSmallX = width < 100;
1422
- const isSmallY = height < 100;
1423
- this.toggleClasses(quadrant, isSmallX, isSmallY);
1424
- this.setState(quadrant);
1425
- },
1426
- onDragLeave: () => {
1427
- this.removeDropTarget();
1428
- },
1429
- onDragEnd: () => {
1430
- this.removeDropTarget();
1431
- },
1432
- onDrop: (e) => {
1433
- e.preventDefault();
1434
- e.stopPropagation();
1435
- const state = this._state;
1436
- this.removeDropTarget();
1437
- if (state) {
1438
- this._onDrop.fire({ position: state, nativeEvent: e });
1439
- }
1440
- },
1441
- }));
1442
- }
1443
- get state() {
1444
- return this._state;
1445
- }
1446
- set validOverlays(value) {
1447
- this.options.validOverlays = value;
1448
- }
1449
- set canDisplayOverlay(value) {
1450
- this.options.canDisplayOverlay = value;
1451
- }
1452
- dispose() {
1453
- this.removeDropTarget();
1454
- }
1455
- toggleClasses(quadrant, isSmallX, isSmallY) {
1456
- if (!this.overlay) {
1457
- return;
1458
- }
1459
- const isLeft = quadrant === 'left';
1460
- const isRight = quadrant === 'right';
1461
- const isTop = quadrant === 'top';
1462
- const isBottom = quadrant === 'bottom';
1463
- toggleClass(this.overlay, 'right', !isSmallX && isRight);
1464
- toggleClass(this.overlay, 'left', !isSmallX && isLeft);
1465
- toggleClass(this.overlay, 'top', !isSmallY && isTop);
1466
- toggleClass(this.overlay, 'bottom', !isSmallY && isBottom);
1467
- toggleClass(this.overlay, 'small-right', isSmallX && isRight);
1468
- toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
1469
- toggleClass(this.overlay, 'small-top', isSmallY && isTop);
1470
- toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
1471
- }
1472
- setState(quadrant) {
1473
- switch (quadrant) {
1474
- case 'top':
1475
- this._state = exports.Position.Top;
1476
- break;
1477
- case 'left':
1478
- this._state = exports.Position.Left;
1479
- break;
1480
- case 'bottom':
1481
- this._state = exports.Position.Bottom;
1482
- break;
1483
- case 'right':
1484
- this._state = exports.Position.Right;
1485
- break;
1486
- default:
1487
- this._state = exports.Position.Center;
1488
- break;
1489
- }
1490
- }
1491
- calculateQuadrant(overlayType, xp, yp) {
1492
- switch (overlayType) {
1493
- case 'all':
1494
- if (xp < 20) {
1495
- return 'left';
1496
- }
1497
- if (xp > 80) {
1498
- return 'right';
1499
- }
1500
- if (yp < 20) {
1501
- return 'top';
1502
- }
1503
- if (yp > 80) {
1504
- return 'bottom';
1505
- }
1506
- break;
1507
- case 'vertical':
1508
- if (yp < 50) {
1509
- return 'top';
1510
- }
1511
- return 'bottom';
1512
- case 'horizontal':
1513
- if (xp < 50) {
1514
- return 'left';
1515
- }
1516
- return 'right';
1517
- }
1518
- return null;
1519
- }
1520
- removeDropTarget() {
1521
- if (this.target) {
1522
- this._state = undefined;
1523
- this.element.removeChild(this.target);
1524
- this.target = undefined;
1525
- this.element.classList.remove('drop-target');
1526
- }
1527
- }
1528
- }
1529
-
1530
- /*---------------------------------------------------------------------------------------------
1531
- * Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:
1532
- * https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
1533
- *--------------------------------------------------------------------------------------------*/
1534
- class LeafNode {
1535
- constructor(view, orientation, orthogonalSize, size = 0) {
1536
- this.view = view;
1537
- this.orientation = orientation;
1538
- this._onDidChange = new Emitter();
1539
- this.onDidChange = this._onDidChange.event;
1540
- this._orthogonalSize = orthogonalSize;
1541
- this._size = size;
1542
- this._disposable = this.view.onDidChange((event) => {
1543
- if (event) {
1544
- this._onDidChange.fire({
1545
- size: this.orientation === exports.Orientation.VERTICAL
1546
- ? event.width
1547
- : event.height,
1548
- orthogonalSize: this.orientation === exports.Orientation.VERTICAL
1549
- ? event.height
1550
- : event.width,
1551
- });
1552
- }
1553
- else {
1554
- this._onDidChange.fire({});
1555
- }
1556
- });
1557
- }
1558
- get minimumWidth() {
1559
- return this.view.minimumWidth;
1560
- }
1561
- get maximumWidth() {
1562
- return this.view.maximumWidth;
1333
+ get maximumWidth() {
1334
+ return this.view.maximumWidth;
1563
1335
  }
1564
1336
  get minimumHeight() {
1565
1337
  return this.view.minimumHeight;
@@ -1612,6 +1384,29 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1612
1384
  ? this.size
1613
1385
  : this.orthogonalSize;
1614
1386
  }
1387
+ constructor(view, orientation, orthogonalSize, size = 0) {
1388
+ this.view = view;
1389
+ this.orientation = orientation;
1390
+ this._onDidChange = new Emitter();
1391
+ this.onDidChange = this._onDidChange.event;
1392
+ this._orthogonalSize = orthogonalSize;
1393
+ this._size = size;
1394
+ this._disposable = this.view.onDidChange((event) => {
1395
+ if (event) {
1396
+ this._onDidChange.fire({
1397
+ size: this.orientation === exports.Orientation.VERTICAL
1398
+ ? event.width
1399
+ : event.height,
1400
+ orthogonalSize: this.orientation === exports.Orientation.VERTICAL
1401
+ ? event.height
1402
+ : event.width,
1403
+ });
1404
+ }
1405
+ else {
1406
+ this._onDidChange.fire({});
1407
+ }
1408
+ });
1409
+ }
1615
1410
  setVisible(visible) {
1616
1411
  if (this.view.setVisible) {
1617
1412
  this.view.setVisible(visible);
@@ -1634,53 +1429,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1634
1429
  * https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
1635
1430
  *--------------------------------------------------------------------------------------------*/
1636
1431
  class BranchNode extends CompositeDisposable {
1637
- constructor(orientation, proportionalLayout, styles, size, orthogonalSize, childDescriptors) {
1638
- super();
1639
- this.orientation = orientation;
1640
- this.proportionalLayout = proportionalLayout;
1641
- this.styles = styles;
1642
- this.children = [];
1643
- this._onDidChange = new Emitter();
1644
- this.onDidChange = this._onDidChange.event;
1645
- this._childrenDisposable = Disposable.NONE;
1646
- this._orthogonalSize = orthogonalSize;
1647
- this._size = size;
1648
- this.element = document.createElement('div');
1649
- this.element.className = 'branch-node';
1650
- if (!childDescriptors) {
1651
- this.splitview = new Splitview(this.element, {
1652
- orientation: this.orientation,
1653
- proportionalLayout,
1654
- styles,
1655
- });
1656
- this.splitview.layout(this.size, this.orthogonalSize);
1657
- }
1658
- else {
1659
- const descriptor = {
1660
- views: childDescriptors.map((childDescriptor) => {
1661
- return {
1662
- view: childDescriptor.node,
1663
- size: childDescriptor.node.size,
1664
- visible: childDescriptor.node instanceof LeafNode &&
1665
- childDescriptor.visible !== undefined
1666
- ? childDescriptor.visible
1667
- : true,
1668
- };
1669
- }),
1670
- size: this.size,
1671
- };
1672
- this.children = childDescriptors.map((c) => c.node);
1673
- this.splitview = new Splitview(this.element, {
1674
- orientation: this.orientation,
1675
- descriptor,
1676
- proportionalLayout,
1677
- });
1678
- }
1679
- this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {
1680
- this._onDidChange.fire({});
1681
- }));
1682
- this.setupChildrenEvents();
1683
- }
1684
1432
  get width() {
1685
1433
  return this.orientation === exports.Orientation.HORIZONTAL
1686
1434
  ? this.size
@@ -1746,6 +1494,53 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1746
1494
  }
1747
1495
  return exports.LayoutPriority.Normal;
1748
1496
  }
1497
+ constructor(orientation, proportionalLayout, styles, size, orthogonalSize, childDescriptors) {
1498
+ super();
1499
+ this.orientation = orientation;
1500
+ this.proportionalLayout = proportionalLayout;
1501
+ this.styles = styles;
1502
+ this.children = [];
1503
+ this._onDidChange = new Emitter();
1504
+ this.onDidChange = this._onDidChange.event;
1505
+ this._childrenDisposable = Disposable.NONE;
1506
+ this._orthogonalSize = orthogonalSize;
1507
+ this._size = size;
1508
+ this.element = document.createElement('div');
1509
+ this.element.className = 'branch-node';
1510
+ if (!childDescriptors) {
1511
+ this.splitview = new Splitview(this.element, {
1512
+ orientation: this.orientation,
1513
+ proportionalLayout,
1514
+ styles,
1515
+ });
1516
+ this.splitview.layout(this.size, this.orthogonalSize);
1517
+ }
1518
+ else {
1519
+ const descriptor = {
1520
+ views: childDescriptors.map((childDescriptor) => {
1521
+ return {
1522
+ view: childDescriptor.node,
1523
+ size: childDescriptor.node.size,
1524
+ visible: childDescriptor.node instanceof LeafNode &&
1525
+ childDescriptor.visible !== undefined
1526
+ ? childDescriptor.visible
1527
+ : true,
1528
+ };
1529
+ }),
1530
+ size: this.size,
1531
+ };
1532
+ this.children = childDescriptors.map((c) => c.node);
1533
+ this.splitview = new Splitview(this.element, {
1534
+ orientation: this.orientation,
1535
+ descriptor,
1536
+ proportionalLayout,
1537
+ });
1538
+ }
1539
+ this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {
1540
+ this._onDidChange.fire({});
1541
+ }));
1542
+ this.setupChildrenEvents();
1543
+ }
1749
1544
  setVisible(visible) {
1750
1545
  for (const child of this.children) {
1751
1546
  child.setVisible(visible);
@@ -1917,20 +1712,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1917
1712
  if (orientation === directionOrientation) {
1918
1713
  const [rest, _index] = tail(location);
1919
1714
  let index = _index;
1920
- if (direction === exports.Position.Right || direction === exports.Position.Bottom) {
1715
+ if (direction === 'right' || direction === 'bottom') {
1921
1716
  index += 1;
1922
1717
  }
1923
1718
  return [...rest, index];
1924
1719
  }
1925
1720
  else {
1926
- const index = direction === exports.Position.Right || direction === exports.Position.Bottom
1927
- ? 1
1928
- : 0;
1721
+ const index = direction === 'right' || direction === 'bottom' ? 1 : 0;
1929
1722
  return [...location, index];
1930
1723
  }
1931
1724
  }
1932
1725
  function getDirectionOrientation(direction) {
1933
- return direction === exports.Position.Top || direction === exports.Position.Bottom
1726
+ return direction === 'top' || direction === 'bottom'
1934
1727
  ? exports.Orientation.VERTICAL
1935
1728
  : exports.Orientation.HORIZONTAL;
1936
1729
  }
@@ -1965,15 +1758,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1965
1758
  };
1966
1759
  };
1967
1760
  class Gridview {
1968
- constructor(proportionalLayout, styles, orientation) {
1969
- this.proportionalLayout = proportionalLayout;
1970
- this.styles = styles;
1971
- this.disposable = new MutableDisposable();
1972
- this._onDidChange = new Emitter();
1973
- this.onDidChange = this._onDidChange.event;
1974
- this.element = document.createElement('div');
1975
- this.element.className = 'grid-view';
1976
- this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
1761
+ get length() {
1762
+ return this._root ? this._root.children.length : 0;
1977
1763
  }
1978
1764
  serialize() {
1979
1765
  const root = serializeBranchNode(this.getView(), this.orientation);
@@ -2047,6 +1833,32 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2047
1833
  this._onDidChange.fire(e);
2048
1834
  });
2049
1835
  }
1836
+ /**
1837
+ * If the root is orientated as a VERTICAL node then nest the existing root within a new HORIZIONTAL root node
1838
+ * If the root is orientated as a HORIZONTAL node then nest the existing root within a new VERITCAL root node
1839
+ */
1840
+ insertOrthogonalSplitviewAtRoot() {
1841
+ if (!this._root) {
1842
+ return;
1843
+ }
1844
+ const oldRoot = this.root;
1845
+ oldRoot.element.remove();
1846
+ this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size);
1847
+ if (oldRoot.children.length === 1) {
1848
+ // can remove one level of redundant branching if there is only a single child
1849
+ const childReference = oldRoot.children[0];
1850
+ oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
1851
+ oldRoot.dispose();
1852
+ this._root.addChild(childReference, exports.Sizing.Distribute, 0);
1853
+ }
1854
+ else {
1855
+ this._root.addChild(oldRoot, exports.Sizing.Distribute, 0);
1856
+ }
1857
+ this.element.appendChild(this._root.element);
1858
+ this.disposable.value = this._root.onDidChange((e) => {
1859
+ this._onDidChange.fire(e);
1860
+ });
1861
+ }
2050
1862
  next(location) {
2051
1863
  return this.progmaticSelect(location);
2052
1864
  }
@@ -2105,6 +1917,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2105
1917
  get maximumHeight() {
2106
1918
  return this.root.maximumHeight;
2107
1919
  }
1920
+ constructor(proportionalLayout, styles, orientation) {
1921
+ this.proportionalLayout = proportionalLayout;
1922
+ this.styles = styles;
1923
+ this.disposable = new MutableDisposable();
1924
+ this._onDidChange = new Emitter();
1925
+ this.onDidChange = this._onDidChange.event;
1926
+ this.element = document.createElement('div');
1927
+ this.element.className = 'grid-view';
1928
+ this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
1929
+ }
2108
1930
  isViewVisible(location) {
2109
1931
  const [rest, index] = tail(location);
2110
1932
  const [, parent] = this.getNode(rest);
@@ -2236,9 +2058,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2236
2058
  }
2237
2059
 
2238
2060
  class SplitviewApi {
2239
- constructor(component) {
2240
- this.component = component;
2241
- }
2242
2061
  get minimumSize() {
2243
2062
  return this.component.minimumSize;
2244
2063
  }
@@ -2272,6 +2091,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2272
2091
  get onDidRemoveView() {
2273
2092
  return this.component.onDidRemoveView;
2274
2093
  }
2094
+ constructor(component) {
2095
+ this.component = component;
2096
+ }
2275
2097
  updateOptions(options) {
2276
2098
  this.component.updateOptions(options);
2277
2099
  }
@@ -2304,9 +2126,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2304
2126
  }
2305
2127
  }
2306
2128
  class PaneviewApi {
2307
- constructor(component) {
2308
- this.component = component;
2309
- }
2310
2129
  get minimumSize() {
2311
2130
  return this.component.minimumSize;
2312
2131
  }
@@ -2345,6 +2164,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2345
2164
  };
2346
2165
  return emitter.event;
2347
2166
  }
2167
+ constructor(component) {
2168
+ this.component = component;
2169
+ }
2348
2170
  removePanel(panel) {
2349
2171
  this.component.removePanel(panel);
2350
2172
  }
@@ -2374,9 +2196,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2374
2196
  }
2375
2197
  }
2376
2198
  class GridviewApi {
2377
- constructor(component) {
2378
- this.component = component;
2379
- }
2380
2199
  get minimumHeight() {
2381
2200
  return this.component.minimumHeight;
2382
2201
  }
@@ -2419,6 +2238,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2419
2238
  set orientation(value) {
2420
2239
  this.component.updateOptions({ orientation: value });
2421
2240
  }
2241
+ constructor(component) {
2242
+ this.component = component;
2243
+ }
2422
2244
  focus() {
2423
2245
  this.component.focus();
2424
2246
  }
@@ -2448,8 +2270,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2448
2270
  }
2449
2271
  }
2450
2272
  class DockviewApi {
2451
- constructor(component) {
2452
- this.component = component;
2273
+ get id() {
2274
+ return this.component.id;
2453
2275
  }
2454
2276
  get width() {
2455
2277
  return this.component.width;
@@ -2514,6 +2336,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2514
2336
  get activeGroup() {
2515
2337
  return this.component.activeGroup;
2516
2338
  }
2339
+ constructor(component) {
2340
+ this.component = component;
2341
+ }
2517
2342
  getTabHeight() {
2518
2343
  return this.component.tabHeight;
2519
2344
  }
@@ -2532,8 +2357,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2532
2357
  addPanel(options) {
2533
2358
  return this.component.addPanel(options);
2534
2359
  }
2535
- addEmptyGroup(options) {
2536
- this.component.addEmptyGroup(options);
2360
+ addGroup(options) {
2361
+ return this.component.addGroup(options);
2537
2362
  }
2538
2363
  moveToNext(options) {
2539
2364
  this.component.moveToNext(options);
@@ -2561,7 +2386,293 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2561
2386
  }
2562
2387
  }
2563
2388
 
2389
+ class DragAndDropObserver extends CompositeDisposable {
2390
+ constructor(element, callbacks) {
2391
+ super();
2392
+ this.element = element;
2393
+ this.callbacks = callbacks;
2394
+ this.target = null;
2395
+ this.registerListeners();
2396
+ }
2397
+ registerListeners() {
2398
+ this.addDisposables(addDisposableListener(this.element, 'dragenter', (e) => {
2399
+ this.target = e.target;
2400
+ this.callbacks.onDragEnter(e);
2401
+ }, true));
2402
+ this.addDisposables(addDisposableListener(this.element, 'dragover', (e) => {
2403
+ e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)
2404
+ if (this.callbacks.onDragOver) {
2405
+ this.callbacks.onDragOver(e);
2406
+ }
2407
+ }, true));
2408
+ this.addDisposables(addDisposableListener(this.element, 'dragleave', (e) => {
2409
+ if (this.target === e.target) {
2410
+ this.target = null;
2411
+ this.callbacks.onDragLeave(e);
2412
+ }
2413
+ }));
2414
+ this.addDisposables(addDisposableListener(this.element, 'dragend', (e) => {
2415
+ this.target = null;
2416
+ this.callbacks.onDragEnd(e);
2417
+ }));
2418
+ this.addDisposables(addDisposableListener(this.element, 'drop', (e) => {
2419
+ this.callbacks.onDrop(e);
2420
+ }));
2421
+ }
2422
+ }
2423
+
2424
+ function isBooleanValue(value) {
2425
+ return typeof value === 'boolean';
2426
+ }
2427
+
2428
+ function numberOrFallback(maybeNumber, fallback) {
2429
+ return typeof maybeNumber === 'number' ? maybeNumber : fallback;
2430
+ }
2431
+ function directionToPosition(direction) {
2432
+ switch (direction) {
2433
+ case 'above':
2434
+ return 'top';
2435
+ case 'below':
2436
+ return 'bottom';
2437
+ case 'left':
2438
+ return 'left';
2439
+ case 'right':
2440
+ return 'right';
2441
+ case 'within':
2442
+ return 'center';
2443
+ default:
2444
+ throw new Error(`invalid direction '${direction}'`);
2445
+ }
2446
+ }
2447
+ function positionToDirection(position) {
2448
+ switch (position) {
2449
+ case 'top':
2450
+ return 'above';
2451
+ case 'bottom':
2452
+ return 'below';
2453
+ case 'left':
2454
+ return 'left';
2455
+ case 'right':
2456
+ return 'right';
2457
+ case 'center':
2458
+ return 'within';
2459
+ default:
2460
+ throw new Error(`invalid position '${position}'`);
2461
+ }
2462
+ }
2463
+ class Droptarget extends CompositeDisposable {
2464
+ get state() {
2465
+ return this._state;
2466
+ }
2467
+ constructor(element, options) {
2468
+ super();
2469
+ this.element = element;
2470
+ this.options = options;
2471
+ this._onDrop = new Emitter();
2472
+ this.onDrop = this._onDrop.event;
2473
+ // use a set to take advantage of #<set>.has
2474
+ const acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
2475
+ this.addDisposables(this._onDrop, new DragAndDropObserver(this.element, {
2476
+ onDragEnter: () => undefined,
2477
+ onDragOver: (e) => {
2478
+ const width = this.element.clientWidth;
2479
+ const height = this.element.clientHeight;
2480
+ if (width === 0 || height === 0) {
2481
+ return; // avoid div!0
2482
+ }
2483
+ const rect = e.currentTarget.getBoundingClientRect();
2484
+ const x = e.clientX - rect.left;
2485
+ const y = e.clientY - rect.top;
2486
+ const quadrant = this.calculateQuadrant(acceptedTargetZonesSet, x, y, width, height);
2487
+ if (quadrant === null) {
2488
+ // no drop target should be displayed
2489
+ this.removeDropTarget();
2490
+ return;
2491
+ }
2492
+ if (isBooleanValue(this.options.canDisplayOverlay)) {
2493
+ if (!this.options.canDisplayOverlay) {
2494
+ return;
2495
+ }
2496
+ }
2497
+ else if (!this.options.canDisplayOverlay(e, quadrant)) {
2498
+ return;
2499
+ }
2500
+ if (!this.target) {
2501
+ this.target = document.createElement('div');
2502
+ this.target.className = 'drop-target-dropzone';
2503
+ this.overlay = document.createElement('div');
2504
+ this.overlay.className = 'drop-target-selection';
2505
+ this._state = 'center';
2506
+ this.target.appendChild(this.overlay);
2507
+ this.element.classList.add('drop-target');
2508
+ this.element.append(this.target);
2509
+ }
2510
+ if (this.options.acceptedTargetZones.length === 0) {
2511
+ return;
2512
+ }
2513
+ if (!this.target || !this.overlay) {
2514
+ return;
2515
+ }
2516
+ this.toggleClasses(quadrant, width, height);
2517
+ this.setState(quadrant);
2518
+ },
2519
+ onDragLeave: () => {
2520
+ this.removeDropTarget();
2521
+ },
2522
+ onDragEnd: () => {
2523
+ this.removeDropTarget();
2524
+ },
2525
+ onDrop: (e) => {
2526
+ e.preventDefault();
2527
+ e.stopPropagation();
2528
+ const state = this._state;
2529
+ this.removeDropTarget();
2530
+ if (state) {
2531
+ this._onDrop.fire({ position: state, nativeEvent: e });
2532
+ }
2533
+ },
2534
+ }));
2535
+ }
2536
+ dispose() {
2537
+ this.removeDropTarget();
2538
+ }
2539
+ toggleClasses(quadrant, width, height) {
2540
+ var _a, _b, _c, _d;
2541
+ if (!this.overlay) {
2542
+ return;
2543
+ }
2544
+ const isSmallX = width < 100;
2545
+ const isSmallY = height < 100;
2546
+ const isLeft = quadrant === 'left';
2547
+ const isRight = quadrant === 'right';
2548
+ const isTop = quadrant === 'top';
2549
+ const isBottom = quadrant === 'bottom';
2550
+ const rightClass = !isSmallX && isRight;
2551
+ const leftClass = !isSmallX && isLeft;
2552
+ const topClass = !isSmallY && isTop;
2553
+ const bottomClass = !isSmallY && isBottom;
2554
+ let size = 0.5;
2555
+ if (((_b = (_a = this.options.overlayModel) === null || _a === void 0 ? void 0 : _a.size) === null || _b === void 0 ? void 0 : _b.type) === 'percentage') {
2556
+ size = clamp(this.options.overlayModel.size.value, 0, 100) / 100;
2557
+ }
2558
+ if (((_d = (_c = this.options.overlayModel) === null || _c === void 0 ? void 0 : _c.size) === null || _d === void 0 ? void 0 : _d.type) === 'pixels') {
2559
+ if (rightClass || leftClass) {
2560
+ size =
2561
+ clamp(0, this.options.overlayModel.size.value, width) /
2562
+ width;
2563
+ }
2564
+ if (topClass || bottomClass) {
2565
+ size =
2566
+ clamp(0, this.options.overlayModel.size.value, height) /
2567
+ height;
2568
+ }
2569
+ }
2570
+ const translate = (1 - size) / 2;
2571
+ const scale = size;
2572
+ let transform;
2573
+ if (rightClass) {
2574
+ transform = `translateX(${100 * translate}%) scaleX(${scale})`;
2575
+ }
2576
+ else if (leftClass) {
2577
+ transform = `translateX(-${100 * translate}%) scaleX(${scale})`;
2578
+ }
2579
+ else if (topClass) {
2580
+ transform = `translateY(-${100 * translate}%) scaleY(${scale})`;
2581
+ }
2582
+ else if (bottomClass) {
2583
+ transform = `translateY(${100 * translate}%) scaleY(${scale})`;
2584
+ }
2585
+ else {
2586
+ transform = '';
2587
+ }
2588
+ this.overlay.style.transform = transform;
2589
+ toggleClass(this.overlay, 'small-right', isSmallX && isRight);
2590
+ toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
2591
+ toggleClass(this.overlay, 'small-top', isSmallY && isTop);
2592
+ toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
2593
+ }
2594
+ setState(quadrant) {
2595
+ switch (quadrant) {
2596
+ case 'top':
2597
+ this._state = 'top';
2598
+ break;
2599
+ case 'left':
2600
+ this._state = 'left';
2601
+ break;
2602
+ case 'bottom':
2603
+ this._state = 'bottom';
2604
+ break;
2605
+ case 'right':
2606
+ this._state = 'right';
2607
+ break;
2608
+ case 'center':
2609
+ this._state = 'center';
2610
+ break;
2611
+ }
2612
+ }
2613
+ calculateQuadrant(overlayType, x, y, width, height) {
2614
+ var _a, _b, _c, _d, _e, _f;
2615
+ const isPercentage = ((_a = this.options.overlayModel) === null || _a === void 0 ? void 0 : _a.activationSize) === undefined ||
2616
+ ((_c = (_b = this.options.overlayModel) === null || _b === void 0 ? void 0 : _b.activationSize) === null || _c === void 0 ? void 0 : _c.type) === 'percentage';
2617
+ const value = numberOrFallback((_f = (_e = (_d = this.options) === null || _d === void 0 ? void 0 : _d.overlayModel) === null || _e === void 0 ? void 0 : _e.activationSize) === null || _f === void 0 ? void 0 : _f.value, 20);
2618
+ if (isPercentage) {
2619
+ return calculateQuadrantAsPercentage(overlayType, x, y, width, height, value);
2620
+ }
2621
+ return calculateQuadrantAsPixels(overlayType, x, y, width, height, value);
2622
+ }
2623
+ removeDropTarget() {
2624
+ if (this.target) {
2625
+ this._state = undefined;
2626
+ this.element.removeChild(this.target);
2627
+ this.target = undefined;
2628
+ this.overlay = undefined;
2629
+ this.element.classList.remove('drop-target');
2630
+ }
2631
+ }
2632
+ }
2633
+ function calculateQuadrantAsPercentage(overlayType, x, y, width, height, threshold) {
2634
+ const xp = (100 * x) / width;
2635
+ const yp = (100 * y) / height;
2636
+ if (overlayType.has('left') && xp < threshold) {
2637
+ return 'left';
2638
+ }
2639
+ if (overlayType.has('right') && xp > 100 - threshold) {
2640
+ return 'right';
2641
+ }
2642
+ if (overlayType.has('top') && yp < threshold) {
2643
+ return 'top';
2644
+ }
2645
+ if (overlayType.has('bottom') && yp > 100 - threshold) {
2646
+ return 'bottom';
2647
+ }
2648
+ if (!overlayType.has('center')) {
2649
+ return null;
2650
+ }
2651
+ return 'center';
2652
+ }
2653
+ function calculateQuadrantAsPixels(overlayType, x, y, width, height, threshold) {
2654
+ if (overlayType.has('left') && x < threshold) {
2655
+ return 'left';
2656
+ }
2657
+ if (overlayType.has('right') && x > width - threshold) {
2658
+ return 'right';
2659
+ }
2660
+ if (overlayType.has('top') && y < threshold) {
2661
+ return 'top';
2662
+ }
2663
+ if (overlayType.has('bottom') && y > height - threshold) {
2664
+ return 'bottom';
2665
+ }
2666
+ if (!overlayType.has('center')) {
2667
+ return null;
2668
+ }
2669
+ return 'center';
2670
+ }
2671
+
2564
2672
  class ContentContainer extends CompositeDisposable {
2673
+ get element() {
2674
+ return this._element;
2675
+ }
2565
2676
  constructor() {
2566
2677
  super();
2567
2678
  this.disposable = new MutableDisposable();
@@ -2579,9 +2690,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2579
2690
  // 3) register dragEnd events
2580
2691
  // 4) register mouseMove events (if no buttons are present we take this as a dragEnd event)
2581
2692
  }
2582
- get element() {
2583
- return this._element;
2584
- }
2585
2693
  show() {
2586
2694
  this.element.style.display = '';
2587
2695
  }
@@ -2637,6 +2745,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2637
2745
  DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
2638
2746
  DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
2639
2747
  DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
2748
+ DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
2640
2749
  })(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
2641
2750
 
2642
2751
  class DragHandler extends CompositeDisposable {
@@ -2658,9 +2767,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2658
2767
  for (const iframe of this.iframes) {
2659
2768
  iframe.style.pointerEvents = 'none';
2660
2769
  }
2661
- this.el.classList.add('dragged');
2662
- setTimeout(() => this.el.classList.remove('dragged'), 0);
2663
- this.disposable.value = this.getData();
2770
+ this.el.classList.add('dv-dragged');
2771
+ setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
2772
+ this.disposable.value = this.getData(event.dataTransfer);
2664
2773
  if (event.dataTransfer) {
2665
2774
  event.dataTransfer.effectAllowed = 'move';
2666
2775
  }
@@ -2674,11 +2783,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2674
2783
  }
2675
2784
  }
2676
2785
 
2677
- exports.MouseEventKind = void 0;
2678
- (function (MouseEventKind) {
2679
- MouseEventKind["CLICK"] = "CLICK";
2680
- })(exports.MouseEventKind || (exports.MouseEventKind = {}));
2681
2786
  class Tab extends CompositeDisposable {
2787
+ get element() {
2788
+ return this._element;
2789
+ }
2682
2790
  constructor(panelId, accessor, group) {
2683
2791
  super();
2684
2792
  this.panelId = panelId;
@@ -2722,25 +2830,30 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2722
2830
  * on the tabs-container. I cannot use event.preventDefault() since I need the on DragStart event to occur
2723
2831
  */
2724
2832
  event.stopPropagation();
2725
- this._onChanged.fire({ kind: exports.MouseEventKind.CLICK, event });
2833
+ this._onChanged.fire(event);
2726
2834
  }));
2727
2835
  this.droptarget = new Droptarget(this._element, {
2728
- validOverlays: 'none',
2729
- canDisplayOverlay: (event) => {
2836
+ acceptedTargetZones: ['center'],
2837
+ canDisplayOverlay: (event, position) => {
2838
+ if (this.group.locked) {
2839
+ return false;
2840
+ }
2730
2841
  const data = getPanelData();
2731
2842
  if (data && this.accessor.id === data.viewId) {
2843
+ if (data.panelId === null &&
2844
+ data.groupId === this.group.id) {
2845
+ // don't allow group move to drop on self
2846
+ return false;
2847
+ }
2732
2848
  return this.panelId !== data.panelId;
2733
2849
  }
2734
- return this.group.model.canDisplayOverlay(event, exports.DockviewDropTargets.Tab);
2850
+ return this.group.model.canDisplayOverlay(event, position, exports.DockviewDropTargets.Tab);
2735
2851
  },
2736
2852
  });
2737
2853
  this.addDisposables(this.droptarget.onDrop((event) => {
2738
2854
  this._onDropped.fire(event);
2739
2855
  }));
2740
2856
  }
2741
- get element() {
2742
- return this._element;
2743
- }
2744
2857
  setActive(isActive) {
2745
2858
  toggleClass(this.element, 'active-tab', isActive);
2746
2859
  toggleClass(this.element, 'inactive-tab', !isActive);
@@ -2758,56 +2871,94 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2758
2871
  }
2759
2872
  }
2760
2873
 
2761
- class TabsContainer extends CompositeDisposable {
2762
- constructor(accessor, group, options) {
2874
+ function addGhostImage(dataTransfer, ghostElement) {
2875
+ // class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
2876
+ addClasses(ghostElement, 'dv-dragged');
2877
+ document.body.appendChild(ghostElement);
2878
+ dataTransfer.setDragImage(ghostElement, 0, 0);
2879
+ setTimeout(() => {
2880
+ ghostElement.remove();
2881
+ }, 0);
2882
+ }
2883
+
2884
+ class GroupDragHandler extends DragHandler {
2885
+ constructor(element, accessorId, group) {
2886
+ super(element);
2887
+ this.accessorId = accessorId;
2888
+ this.group = group;
2889
+ this.panelTransfer = LocalSelectionTransfer.getInstance();
2890
+ }
2891
+ getData(dataTransfer) {
2892
+ this.panelTransfer.setData([new PanelTransfer(this.accessorId, this.group.id, null)], PanelTransfer.prototype);
2893
+ const style = window.getComputedStyle(this.el);
2894
+ const bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
2895
+ const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
2896
+ if (dataTransfer) {
2897
+ const ghostElement = document.createElement('div');
2898
+ ghostElement.style.backgroundColor = bgColor;
2899
+ ghostElement.style.color = color;
2900
+ ghostElement.style.padding = '2px 8px';
2901
+ ghostElement.style.height = '24px';
2902
+ ghostElement.style.fontSize = '11px';
2903
+ ghostElement.style.lineHeight = '20px';
2904
+ ghostElement.style.borderRadius = '12px';
2905
+ ghostElement.style.position = 'absolute';
2906
+ ghostElement.textContent = `Multiple Panels (${this.group.size})`;
2907
+ addGhostImage(dataTransfer, ghostElement);
2908
+ }
2909
+ return {
2910
+ dispose: () => {
2911
+ this.panelTransfer.clearData(PanelTransfer.prototype);
2912
+ },
2913
+ };
2914
+ }
2915
+ dispose() {
2916
+ //
2917
+ }
2918
+ }
2919
+
2920
+ class VoidContainer extends CompositeDisposable {
2921
+ get element() {
2922
+ return this._element;
2923
+ }
2924
+ constructor(accessor, group) {
2763
2925
  super();
2764
2926
  this.accessor = accessor;
2765
2927
  this.group = group;
2766
- this.tabs = [];
2767
- this.selectedIndex = -1;
2768
- this._hidden = false;
2769
2928
  this._onDrop = new Emitter();
2770
2929
  this.onDrop = this._onDrop.event;
2771
- this.addDisposables(this._onDrop);
2772
2930
  this._element = document.createElement('div');
2773
- this._element.className = 'tabs-and-actions-container';
2774
- this.height = options.tabHeight;
2775
- this.actionContainer = document.createElement('div');
2776
- this.actionContainer.className = 'action-container';
2777
- this.tabContainer = document.createElement('div');
2778
- this.tabContainer.className = 'tabs-container';
2779
- this.voidContainer = document.createElement('div');
2780
- this.voidContainer.className = 'void-container';
2781
- this._element.appendChild(this.tabContainer);
2782
- this._element.appendChild(this.voidContainer);
2783
- this._element.appendChild(this.actionContainer);
2784
- this.voidDropTarget = new Droptarget(this.voidContainer, {
2785
- validOverlays: 'none',
2786
- canDisplayOverlay: (event) => {
2931
+ this._element.className = 'void-container';
2932
+ this._element.tabIndex = 0;
2933
+ this._element.draggable = true;
2934
+ this.addDisposables(this._onDrop, addDisposableListener(this._element, 'click', () => {
2935
+ this.accessor.doSetGroupActive(this.group);
2936
+ }));
2937
+ const handler = new GroupDragHandler(this._element, accessor.id, group);
2938
+ this.voidDropTarget = new Droptarget(this._element, {
2939
+ acceptedTargetZones: ['center'],
2940
+ canDisplayOverlay: (event, position) => {
2787
2941
  var _a;
2788
2942
  const data = getPanelData();
2789
2943
  if (data && this.accessor.id === data.viewId) {
2944
+ if (data.panelId === null &&
2945
+ data.groupId === this.group.id) {
2946
+ // don't allow group move to drop on self
2947
+ return false;
2948
+ }
2790
2949
  // don't show the overlay if the tab being dragged is the last panel of this group
2791
- return ((_a = last(this.tabs)) === null || _a === void 0 ? void 0 : _a.value.panelId) !== data.panelId;
2950
+ return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
2792
2951
  }
2793
- return group.model.canDisplayOverlay(event, exports.DockviewDropTargets.Panel);
2952
+ return group.model.canDisplayOverlay(event, position, exports.DockviewDropTargets.Panel);
2794
2953
  },
2795
2954
  });
2796
- this.addDisposables(this.voidDropTarget.onDrop((event) => {
2797
- this._onDrop.fire({
2798
- event: event.nativeEvent,
2799
- index: this.tabs.length,
2800
- });
2801
- }), this.voidDropTarget, addDisposableListener(this.tabContainer, 'mousedown', (event) => {
2802
- if (event.defaultPrevented) {
2803
- return;
2804
- }
2805
- const isLeftClick = event.button === 0;
2806
- if (isLeftClick) {
2807
- this.accessor.doSetGroupActive(this.group);
2808
- }
2809
- }));
2955
+ this.addDisposables(handler, this.voidDropTarget.onDrop((event) => {
2956
+ this._onDrop.fire(event);
2957
+ }), this.voidDropTarget);
2810
2958
  }
2959
+ }
2960
+
2961
+ class TabsContainer extends CompositeDisposable {
2811
2962
  get panels() {
2812
2963
  return this.tabs.map((_) => _.value.panelId);
2813
2964
  }
@@ -2868,6 +3019,52 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2868
3019
  indexOf(id) {
2869
3020
  return this.tabs.findIndex((tab) => tab.value.panelId === id);
2870
3021
  }
3022
+ constructor(accessor, group) {
3023
+ super();
3024
+ this.accessor = accessor;
3025
+ this.group = group;
3026
+ this.tabs = [];
3027
+ this.selectedIndex = -1;
3028
+ this._hidden = false;
3029
+ this._onDrop = new Emitter();
3030
+ this.onDrop = this._onDrop.event;
3031
+ this.addDisposables(this._onDrop);
3032
+ this._element = document.createElement('div');
3033
+ this._element.className = 'tabs-and-actions-container';
3034
+ this.height = accessor.options.tabHeight;
3035
+ toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
3036
+ this.addDisposables(this.accessor.onDidAddPanel((e) => {
3037
+ if (e.api.group === this.group) {
3038
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
3039
+ }
3040
+ }), this.accessor.onDidRemovePanel((e) => {
3041
+ if (e.api.group === this.group) {
3042
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
3043
+ }
3044
+ }));
3045
+ this.actionContainer = document.createElement('div');
3046
+ this.actionContainer.className = 'action-container';
3047
+ this.tabContainer = document.createElement('div');
3048
+ this.tabContainer.className = 'tabs-container';
3049
+ this.voidContainer = new VoidContainer(this.accessor, this.group);
3050
+ this._element.appendChild(this.tabContainer);
3051
+ this._element.appendChild(this.voidContainer.element);
3052
+ this._element.appendChild(this.actionContainer);
3053
+ this.addDisposables(this.voidContainer, this.voidContainer.onDrop((event) => {
3054
+ this._onDrop.fire({
3055
+ event: event.nativeEvent,
3056
+ index: this.tabs.length,
3057
+ });
3058
+ }), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
3059
+ if (event.defaultPrevented) {
3060
+ return;
3061
+ }
3062
+ const isLeftClick = event.button === 0;
3063
+ if (isLeftClick) {
3064
+ this.accessor.doSetGroupActive(this.group);
3065
+ }
3066
+ }));
3067
+ }
2871
3068
  setActive(_isGroupActive) {
2872
3069
  // noop
2873
3070
  }
@@ -2912,15 +3109,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2912
3109
  var _a;
2913
3110
  const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
2914
3111
  this.group.model.isContentFocused;
2915
- const isLeftClick = event.event.button === 0;
2916
- if (!isLeftClick || event.event.defaultPrevented) {
3112
+ const isLeftClick = event.button === 0;
3113
+ if (!isLeftClick || event.defaultPrevented) {
2917
3114
  return;
2918
3115
  }
2919
- if (event.kind === exports.MouseEventKind.CLICK) {
2920
- this.group.model.openPanel(panel, {
2921
- skipFocus: alreadyFocused,
2922
- });
2923
- }
3116
+ this.group.model.openPanel(panel, {
3117
+ skipFocus: alreadyFocused,
3118
+ });
2924
3119
  }), tabToAdd.onDrop((event) => {
2925
3120
  this._onDrop.fire({
2926
3121
  event: event.nativeEvent,
@@ -2943,63 +3138,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2943
3138
  }
2944
3139
 
2945
3140
  class Groupview extends CompositeDisposable {
2946
- constructor(container, accessor, id, options, parent) {
2947
- super();
2948
- this.container = container;
2949
- this.accessor = accessor;
2950
- this.id = id;
2951
- this.options = options;
2952
- this.parent = parent;
2953
- this._isGroupActive = false;
2954
- this._locked = false;
2955
- this.mostRecentlyUsed = [];
2956
- this._onDidChange = new Emitter();
2957
- this.onDidChange = this._onDidChange.event;
2958
- this._width = 0;
2959
- this._height = 0;
2960
- this._panels = [];
2961
- this._onMove = new Emitter();
2962
- this.onMove = this._onMove.event;
2963
- this._onDidDrop = new Emitter();
2964
- this.onDidDrop = this._onDidDrop.event;
2965
- this._onDidAddPanel = new Emitter();
2966
- this.onDidAddPanel = this._onDidAddPanel.event;
2967
- this._onDidRemovePanel = new Emitter();
2968
- this.onDidRemovePanel = this._onDidRemovePanel.event;
2969
- this._onDidActivePanelChange = new Emitter();
2970
- this.onDidActivePanelChange = this._onDidActivePanelChange.event;
2971
- this.container.classList.add('groupview');
2972
- this.tabsContainer = new TabsContainer(this.accessor, this.parent, {
2973
- tabHeight: options.tabHeight,
2974
- });
2975
- this.contentContainer = new ContentContainer();
2976
- this.dropTarget = new Droptarget(this.contentContainer.element, {
2977
- validOverlays: 'all',
2978
- canDisplayOverlay: (event, quadrant) => {
2979
- if (this.locked && !quadrant) {
2980
- return false;
2981
- }
2982
- const data = getPanelData();
2983
- if (data && data.viewId === this.accessor.id) {
2984
- const groupHasOnePanelAndIsActiveDragElement = this._panels.length === 1 && data.groupId === this.id;
2985
- return !groupHasOnePanelAndIsActiveDragElement;
2986
- }
2987
- return this.canDisplayOverlay(event, exports.DockviewDropTargets.Panel);
2988
- },
2989
- });
2990
- container.append(this.tabsContainer.element, this.contentContainer.element);
2991
- this.header.hidden = !!options.hideHeader;
2992
- this.locked = !!options.locked;
2993
- this.addDisposables(this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this.tabsContainer.onDrop((event) => {
2994
- this.handleDropEvent(event.event, exports.Position.Center, event.index);
2995
- }), this.contentContainer.onDidFocus(() => {
2996
- this.accessor.doSetGroupActive(this.parent, true);
2997
- }), this.contentContainer.onDidBlur(() => {
2998
- // noop
2999
- }), this.dropTarget.onDrop((event) => {
3000
- this.handleDropEvent(event.nativeEvent, event.position);
3001
- }));
3002
- }
3003
3141
  get element() {
3004
3142
  throw new Error('not supported');
3005
3143
  }
@@ -3011,6 +3149,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3011
3149
  }
3012
3150
  set locked(value) {
3013
3151
  this._locked = value;
3152
+ toggleClass(this.container, 'locked-groupview', value);
3014
3153
  }
3015
3154
  get isActive() {
3016
3155
  return this._isGroupActive;
@@ -3048,6 +3187,71 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3048
3187
  }
3049
3188
  return isAncestor(document.activeElement, this.contentContainer.element);
3050
3189
  }
3190
+ constructor(container, accessor, id, options, groupPanel) {
3191
+ super();
3192
+ this.container = container;
3193
+ this.accessor = accessor;
3194
+ this.id = id;
3195
+ this.options = options;
3196
+ this.groupPanel = groupPanel;
3197
+ this._isGroupActive = false;
3198
+ this._locked = false;
3199
+ this.mostRecentlyUsed = [];
3200
+ this._onDidChange = new Emitter();
3201
+ this.onDidChange = this._onDidChange.event;
3202
+ this._width = 0;
3203
+ this._height = 0;
3204
+ this._panels = [];
3205
+ this._onMove = new Emitter();
3206
+ this.onMove = this._onMove.event;
3207
+ this._onDidDrop = new Emitter();
3208
+ this.onDidDrop = this._onDidDrop.event;
3209
+ this._onDidAddPanel = new Emitter();
3210
+ this.onDidAddPanel = this._onDidAddPanel.event;
3211
+ this._onDidRemovePanel = new Emitter();
3212
+ this.onDidRemovePanel = this._onDidRemovePanel.event;
3213
+ this._onDidActivePanelChange = new Emitter();
3214
+ this.onDidActivePanelChange = this._onDidActivePanelChange.event;
3215
+ this.container.classList.add('groupview');
3216
+ this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
3217
+ this.contentContainer = new ContentContainer();
3218
+ this.dropTarget = new Droptarget(this.contentContainer.element, {
3219
+ acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
3220
+ canDisplayOverlay: (event, position) => {
3221
+ if (this.locked && position === 'center') {
3222
+ return false;
3223
+ }
3224
+ const data = getPanelData();
3225
+ if (data && data.viewId === this.accessor.id) {
3226
+ if (data.groupId === this.id) {
3227
+ if (position === 'center') {
3228
+ // don't allow to drop on self for center position
3229
+ return false;
3230
+ }
3231
+ if (data.panelId === null) {
3232
+ // don't allow group move to drop anywhere on self
3233
+ return false;
3234
+ }
3235
+ }
3236
+ const groupHasOnePanelAndIsActiveDragElement = this._panels.length === 1 && data.groupId === this.id;
3237
+ return !groupHasOnePanelAndIsActiveDragElement;
3238
+ }
3239
+ return this.canDisplayOverlay(event, position, exports.DockviewDropTargets.Panel);
3240
+ },
3241
+ });
3242
+ container.append(this.tabsContainer.element, this.contentContainer.element);
3243
+ this.header.hidden = !!options.hideHeader;
3244
+ this.locked = !!options.locked;
3245
+ this.addDisposables(this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this.tabsContainer.onDrop((event) => {
3246
+ this.handleDropEvent(event.event, 'center', event.index);
3247
+ }), this.contentContainer.onDidFocus(() => {
3248
+ this.accessor.doSetGroupActive(this.groupPanel, true);
3249
+ }), this.contentContainer.onDidBlur(() => {
3250
+ // noop
3251
+ }), this.dropTarget.onDrop((event) => {
3252
+ this.handleDropEvent(event.nativeEvent, event.position);
3253
+ }));
3254
+ }
3051
3255
  initialize() {
3052
3256
  var _a, _b;
3053
3257
  if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
@@ -3063,11 +3267,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3063
3267
  this.setActive(this.isActive, true, true);
3064
3268
  this.updateContainer();
3065
3269
  if (this.accessor.options.createGroupControlElement) {
3066
- this._control = this.accessor.options.createGroupControlElement(this.parent);
3270
+ this._control = this.accessor.options.createGroupControlElement(this.groupPanel);
3067
3271
  this.addDisposables(this._control);
3068
3272
  this._control.init({
3069
3273
  containerApi: new DockviewApi(this.accessor),
3070
- api: this.parent.api,
3274
+ api: this.groupPanel.api,
3071
3275
  });
3072
3276
  this.tabsContainer.setActionElement(this._control.element);
3073
3277
  }
@@ -3154,10 +3358,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3154
3358
  const skipSetPanelActive = !!options.skipSetPanelActive;
3155
3359
  const skipSetGroupActive = !!options.skipSetGroupActive;
3156
3360
  // ensure the group is updated before we fire any events
3157
- panel.updateParentGroup(this.parent, true);
3361
+ panel.updateParentGroup(this.groupPanel, true);
3158
3362
  if (this._activePanel === panel) {
3159
3363
  if (!skipSetGroupActive) {
3160
- this.accessor.doSetGroupActive(this.parent);
3364
+ this.accessor.doSetGroupActive(this.groupPanel);
3161
3365
  }
3162
3366
  return;
3163
3367
  }
@@ -3166,7 +3370,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3166
3370
  this.doSetActivePanel(panel);
3167
3371
  }
3168
3372
  if (!skipSetGroupActive) {
3169
- this.accessor.doSetGroupActive(this.parent, !!options.skipFocus);
3373
+ this.accessor.doSetGroupActive(this.groupPanel, !!options.skipFocus);
3170
3374
  }
3171
3375
  this.updateContainer();
3172
3376
  }
@@ -3189,7 +3393,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3189
3393
  }
3190
3394
  }
3191
3395
  else {
3192
- this.accessor.removeGroup(this.parent);
3396
+ this.accessor.removeGroup(this.groupPanel);
3193
3397
  }
3194
3398
  }
3195
3399
  closePanel(panel) {
@@ -3294,7 +3498,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3294
3498
  }
3295
3499
  updateContainer() {
3296
3500
  toggleClass(this.container, 'empty', this.isEmpty);
3297
- this.panels.forEach((panel) => panel.updateParentGroup(this.parent, this.isActive));
3501
+ this.panels.forEach((panel) => panel.updateParentGroup(this.groupPanel, this.isActive));
3298
3502
  if (this.isEmpty && !this.watermark) {
3299
3503
  const watermark = this.accessor.createWatermarkComponent();
3300
3504
  watermark.init({
@@ -3306,29 +3510,28 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3306
3510
  this.watermark = watermark;
3307
3511
  addDisposableListener(this.watermark.element, 'click', () => {
3308
3512
  if (!this.isActive) {
3309
- this.accessor.doSetGroupActive(this.parent);
3513
+ this.accessor.doSetGroupActive(this.groupPanel);
3310
3514
  }
3311
3515
  });
3312
- this.contentContainer.hide();
3313
3516
  this.tabsContainer.hide();
3314
- this.container.appendChild(this.watermark.element);
3315
- this.watermark.updateParentGroup(this.parent, true);
3517
+ this.contentContainer.element.appendChild(this.watermark.element);
3518
+ this.watermark.updateParentGroup(this.groupPanel, true);
3316
3519
  }
3317
3520
  if (!this.isEmpty && this.watermark) {
3318
3521
  this.watermark.element.remove();
3319
3522
  this.watermark.dispose();
3320
3523
  this.watermark = undefined;
3321
- this.contentContainer.show();
3322
3524
  this.tabsContainer.show();
3323
3525
  }
3324
3526
  }
3325
- canDisplayOverlay(event, target) {
3527
+ canDisplayOverlay(event, position, target) {
3326
3528
  // custom overlay handler
3327
3529
  if (this.accessor.options.showDndOverlay) {
3328
3530
  return this.accessor.options.showDndOverlay({
3329
3531
  nativeEvent: event,
3330
3532
  target,
3331
3533
  group: this.accessor.getPanel(this.id),
3534
+ position,
3332
3535
  getData: getPanelData,
3333
3536
  });
3334
3537
  }
@@ -3336,7 +3539,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3336
3539
  }
3337
3540
  handleDropEvent(event, position, index) {
3338
3541
  const data = getPanelData();
3339
- if (data) {
3542
+ if (data && data.viewId === this.accessor.id) {
3543
+ if (data.panelId === null) {
3544
+ // this is a group move dnd event
3545
+ const { groupId } = data;
3546
+ this._onMove.fire({
3547
+ target: position,
3548
+ groupId: groupId,
3549
+ index,
3550
+ });
3551
+ return;
3552
+ }
3340
3553
  const fromSameGroup = this.tabsContainer.indexOf(data.panelId) !== -1;
3341
3554
  if (fromSameGroup && this.tabsContainer.size === 1) {
3342
3555
  return;
@@ -3382,45 +3595,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3382
3595
  function toTarget(direction) {
3383
3596
  switch (direction) {
3384
3597
  case 'left':
3385
- return exports.Position.Left;
3598
+ return 'left';
3386
3599
  case 'right':
3387
- return exports.Position.Right;
3600
+ return 'right';
3388
3601
  case 'above':
3389
- return exports.Position.Top;
3602
+ return 'top';
3390
3603
  case 'below':
3391
- return exports.Position.Bottom;
3604
+ return 'bottom';
3392
3605
  case 'within':
3393
3606
  default:
3394
- return exports.Position.Center;
3607
+ return 'center';
3395
3608
  }
3396
3609
  }
3397
3610
  class BaseGrid extends CompositeDisposable {
3398
- constructor(_element, options) {
3399
- super();
3400
- this._element = _element;
3401
- this._id = nextLayoutId$1.next();
3402
- this._groups = new Map();
3403
- this._onDidLayoutChange = new Emitter();
3404
- this.onDidLayoutChange = this._onDidLayoutChange.event;
3405
- this._onDidRemoveGroup = new Emitter();
3406
- this.onDidRemoveGroup = this._onDidRemoveGroup.event;
3407
- this._onDidAddGroup = new Emitter();
3408
- this.onDidAddGroup = this._onDidAddGroup.event;
3409
- this._onDidActiveGroupChange = new Emitter();
3410
- this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3411
- this._bufferOnDidLayoutChange = new TickDelayedEvent();
3412
- this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
3413
- this.element.appendChild(this.gridview.element);
3414
- this.layout(0, 0, true); // set some elements height/widths
3415
- this.addDisposables(this.gridview.onDidChange(() => {
3416
- this._bufferOnDidLayoutChange.fire();
3417
- }));
3418
- this.addDisposables(exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
3419
- this._bufferOnDidLayoutChange.fire();
3420
- }), this._bufferOnDidLayoutChange.onEvent(() => {
3421
- this._onDidLayoutChange.fire();
3422
- }), this._bufferOnDidLayoutChange);
3423
- }
3424
3611
  get id() {
3425
3612
  return this._id;
3426
3613
  }
@@ -3454,6 +3641,32 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3454
3641
  get activeGroup() {
3455
3642
  return this._activeGroup;
3456
3643
  }
3644
+ constructor(_element, options) {
3645
+ super();
3646
+ this._element = _element;
3647
+ this._id = nextLayoutId$1.next();
3648
+ this._groups = new Map();
3649
+ this._onDidLayoutChange = new Emitter();
3650
+ this.onDidLayoutChange = this._onDidLayoutChange.event;
3651
+ this._onDidRemoveGroup = new Emitter();
3652
+ this.onDidRemoveGroup = this._onDidRemoveGroup.event;
3653
+ this._onDidAddGroup = new Emitter();
3654
+ this.onDidAddGroup = this._onDidAddGroup.event;
3655
+ this._onDidActiveGroupChange = new Emitter();
3656
+ this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3657
+ this._bufferOnDidLayoutChange = new TickDelayedEvent();
3658
+ this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
3659
+ this.element.appendChild(this.gridview.element);
3660
+ this.layout(0, 0, true); // set some elements height/widths
3661
+ this.addDisposables(this.gridview.onDidChange(() => {
3662
+ this._bufferOnDidLayoutChange.fire();
3663
+ }));
3664
+ this.addDisposables(exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
3665
+ this._bufferOnDidLayoutChange.fire();
3666
+ }), this._bufferOnDidLayoutChange.onEvent(() => {
3667
+ this._onDidLayoutChange.fire();
3668
+ }), this._bufferOnDidLayoutChange);
3669
+ }
3457
3670
  setVisible(panel, visible) {
3458
3671
  this.gridview.setViewVisible(getGridLocation(panel.element), visible);
3459
3672
  this._onDidLayoutChange.fire();
@@ -3562,10 +3775,51 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3562
3775
  }
3563
3776
  }
3564
3777
 
3778
+ function isPanelOptionsWithPanel(data) {
3779
+ if (data.referencePanel) {
3780
+ return true;
3781
+ }
3782
+ return false;
3783
+ }
3784
+ function isPanelOptionsWithGroup(data) {
3785
+ if (data.referenceGroup) {
3786
+ return true;
3787
+ }
3788
+ return false;
3789
+ }
3790
+ function isGroupOptionsWithPanel(data) {
3791
+ if (data.referencePanel) {
3792
+ return true;
3793
+ }
3794
+ return false;
3795
+ }
3796
+ function isGroupOptionsWithGroup(data) {
3797
+ if (data.referenceGroup) {
3798
+ return true;
3799
+ }
3800
+ return false;
3801
+ }
3802
+
3565
3803
  /**
3566
3804
  * A core api implementation that should be used across all panel-like objects
3567
3805
  */
3568
3806
  class PanelApiImpl extends CompositeDisposable {
3807
+ //
3808
+ get isFocused() {
3809
+ return this._isFocused;
3810
+ }
3811
+ get isActive() {
3812
+ return this._isActive;
3813
+ }
3814
+ get isVisible() {
3815
+ return this._isVisible;
3816
+ }
3817
+ get width() {
3818
+ return this._width;
3819
+ }
3820
+ get height() {
3821
+ return this._height;
3822
+ }
3569
3823
  constructor(id) {
3570
3824
  super();
3571
3825
  this.id = id;
@@ -3574,6 +3828,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3574
3828
  this._isVisible = true;
3575
3829
  this._width = 0;
3576
3830
  this._height = 0;
3831
+ this.panelUpdatesDisposable = new MutableDisposable();
3577
3832
  this._onDidDimensionChange = new Emitter({
3578
3833
  replay: true,
3579
3834
  });
@@ -3602,32 +3857,28 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3602
3857
  //
3603
3858
  this._onActiveChange = new Emitter();
3604
3859
  this.onActiveChange = this._onActiveChange.event;
3605
- this.addDisposables(this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this.onDidFocusChange((event) => {
3860
+ //
3861
+ this._onUpdateParameters = new Emitter();
3862
+ this.onUpdateParameters = this._onUpdateParameters.event;
3863
+ this.addDisposables(this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this._onUpdateParameters, this.onDidFocusChange((event) => {
3606
3864
  this._isFocused = event.isFocused;
3607
3865
  }), this.onDidActiveChange((event) => {
3608
3866
  this._isActive = event.isActive;
3609
3867
  }), this.onDidVisibilityChange((event) => {
3610
3868
  this._isVisible = event.isVisible;
3611
- }), this.onDidDimensionsChange((event) => {
3612
- this._width = event.width;
3613
- this._height = event.height;
3614
- }));
3615
- }
3616
- //
3617
- get isFocused() {
3618
- return this._isFocused;
3619
- }
3620
- get isActive() {
3621
- return this._isActive;
3622
- }
3623
- get isVisible() {
3624
- return this._isVisible;
3625
- }
3626
- get width() {
3627
- return this._width;
3869
+ }), this.onDidDimensionsChange((event) => {
3870
+ this._width = event.width;
3871
+ this._height = event.height;
3872
+ }));
3628
3873
  }
3629
- get height() {
3630
- return this._height;
3874
+ initialize(panel) {
3875
+ this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
3876
+ panel.update({
3877
+ params: {
3878
+ params: parameters,
3879
+ },
3880
+ });
3881
+ });
3631
3882
  }
3632
3883
  setVisible(isVisible) {
3633
3884
  this._onVisibilityChange.fire({ isVisible });
@@ -3635,26 +3886,29 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3635
3886
  setActive() {
3636
3887
  this._onActiveChange.fire();
3637
3888
  }
3889
+ updateParameters(parameters) {
3890
+ this._onUpdateParameters.fire(parameters);
3891
+ }
3638
3892
  dispose() {
3639
3893
  super.dispose();
3640
3894
  }
3641
3895
  }
3642
3896
 
3643
3897
  class GridviewPanelApiImpl extends PanelApiImpl {
3644
- //
3645
- constructor(id) {
3898
+ constructor(id, panel) {
3646
3899
  super(id);
3647
3900
  this._onDidConstraintsChangeInternal = new Emitter();
3648
3901
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
3649
- //
3650
3902
  this._onDidConstraintsChange = new Emitter({
3651
3903
  replay: true,
3652
3904
  });
3653
3905
  this.onDidConstraintsChange = this._onDidConstraintsChange.event;
3654
- //
3655
3906
  this._onDidSizeChange = new Emitter();
3656
3907
  this.onDidSizeChange = this._onDidSizeChange.event;
3657
3908
  this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
3909
+ if (panel) {
3910
+ this.initialize(panel);
3911
+ }
3658
3912
  }
3659
3913
  setConstraints(value) {
3660
3914
  this._onDidConstraintsChangeInternal.fire(value);
@@ -3665,19 +3919,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3665
3919
  }
3666
3920
 
3667
3921
  class DockviewPanelApiImpl extends GridviewPanelApiImpl {
3668
- constructor(panel, group) {
3669
- super(panel.id);
3670
- this.panel = panel;
3671
- this._onDidTitleChange = new Emitter();
3672
- this.onDidTitleChange = this._onDidTitleChange.event;
3673
- this._onDidActiveGroupChange = new Emitter();
3674
- this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3675
- this._onDidGroupChange = new Emitter();
3676
- this.onDidGroupChange = this._onDidGroupChange.event;
3677
- this.disposable = new MutableDisposable();
3678
- this._group = group;
3679
- this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
3680
- }
3681
3922
  get title() {
3682
3923
  return this.panel.title;
3683
3924
  }
@@ -3701,30 +3942,29 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3701
3942
  get group() {
3702
3943
  return this._group;
3703
3944
  }
3945
+ constructor(panel, group) {
3946
+ super(panel.id);
3947
+ this.panel = panel;
3948
+ this._onDidTitleChange = new Emitter();
3949
+ this.onDidTitleChange = this._onDidTitleChange.event;
3950
+ this._onDidActiveGroupChange = new Emitter();
3951
+ this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3952
+ this._onDidGroupChange = new Emitter();
3953
+ this.onDidGroupChange = this._onDidGroupChange.event;
3954
+ this.disposable = new MutableDisposable();
3955
+ this.initialize(panel);
3956
+ this._group = group;
3957
+ this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
3958
+ }
3704
3959
  setTitle(title) {
3705
- this._onDidTitleChange.fire({ title });
3960
+ this.panel.update({ params: { title } });
3706
3961
  }
3707
3962
  close() {
3708
- if (!this.group) {
3709
- throw new Error(`panel ${this.id} has no group`);
3710
- }
3711
- return this.group.model.closePanel(this.panel);
3963
+ this.group.model.closePanel(this.panel);
3712
3964
  }
3713
3965
  }
3714
3966
 
3715
- class DockviewGroupPanel extends CompositeDisposable {
3716
- constructor(id, accessor, containerApi, group) {
3717
- super();
3718
- this.id = id;
3719
- this.containerApi = containerApi;
3720
- this.mutableDisposable = new MutableDisposable();
3721
- this._title = '';
3722
- this._group = group;
3723
- this.api = new DockviewPanelApiImpl(this, this._group);
3724
- this.addDisposables(this.api.onActiveChange(() => {
3725
- accessor.setActivePanel(this);
3726
- }));
3727
- }
3967
+ class DockviewPanel extends CompositeDisposable {
3728
3968
  get params() {
3729
3969
  return this._params;
3730
3970
  }
@@ -3737,6 +3977,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3737
3977
  get view() {
3738
3978
  return this._view;
3739
3979
  }
3980
+ constructor(id, accessor, containerApi, group) {
3981
+ super();
3982
+ this.id = id;
3983
+ this.containerApi = containerApi;
3984
+ this.mutableDisposable = new MutableDisposable();
3985
+ this._title = '';
3986
+ this._group = group;
3987
+ this.api = new DockviewPanelApiImpl(this, this._group);
3988
+ this.addDisposables(this.api.onActiveChange(() => {
3989
+ accessor.setActivePanel(this);
3990
+ }), this.api.onDidSizeChange((event) => {
3991
+ // forward the resize event to the group since if you want to resize a panel
3992
+ // you are actually just resizing the panels parent which is the group
3993
+ this.group.api.setSize(event);
3994
+ }));
3995
+ }
3740
3996
  init(params) {
3741
3997
  var _a;
3742
3998
  this._params = params.params;
@@ -3819,6 +4075,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3819
4075
  }
3820
4076
 
3821
4077
  class ActionContainer {
4078
+ get element() {
4079
+ return this._element;
4080
+ }
3822
4081
  constructor() {
3823
4082
  this._element = document.createElement('div');
3824
4083
  this._element.className = 'actions-bar';
@@ -3826,9 +4085,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3826
4085
  this._list.className = 'actions-container';
3827
4086
  this._element.appendChild(this._list);
3828
4087
  }
3829
- get element() {
3830
- return this._element;
3831
- }
3832
4088
  add(element) {
3833
4089
  const listItem = document.createElement('li');
3834
4090
  listItem.className = 'action-item';
@@ -3869,6 +4125,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3869
4125
  });
3870
4126
 
3871
4127
  class Watermark extends CompositeDisposable {
4128
+ get id() {
4129
+ return 'watermark';
4130
+ }
3872
4131
  constructor() {
3873
4132
  super();
3874
4133
  this._element = document.createElement('div');
@@ -3896,9 +4155,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3896
4155
  }
3897
4156
  }));
3898
4157
  }
3899
- get id() {
3900
- return 'watermark';
3901
- }
3902
4158
  update(_event) {
3903
4159
  // noop
3904
4160
  }
@@ -3961,6 +4217,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3961
4217
 
3962
4218
  const DEFAULT_TAB_IDENTIFIER = '__default__tab__';
3963
4219
  class DefaultTab extends CompositeDisposable {
4220
+ get element() {
4221
+ return this._element;
4222
+ }
4223
+ get id() {
4224
+ return DEFAULT_TAB_IDENTIFIER;
4225
+ }
3964
4226
  constructor() {
3965
4227
  super();
3966
4228
  this._isPanelVisible = false;
@@ -3993,12 +4255,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3993
4255
  }));
3994
4256
  this.render();
3995
4257
  }
3996
- get element() {
3997
- return this._element;
3998
- }
3999
- get id() {
4000
- return DEFAULT_TAB_IDENTIFIER;
4001
- }
4002
4258
  update(event) {
4003
4259
  this.params = Object.assign(Object.assign({}, this.params), event.params);
4004
4260
  this.render();
@@ -4037,6 +4293,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4037
4293
  }
4038
4294
 
4039
4295
  class BasePanelView extends CompositeDisposable {
4296
+ get element() {
4297
+ return this._element;
4298
+ }
4299
+ get width() {
4300
+ return this._width;
4301
+ }
4302
+ get height() {
4303
+ return this._height;
4304
+ }
4305
+ get params() {
4306
+ var _a;
4307
+ return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
4308
+ }
4040
4309
  constructor(id, component, api) {
4041
4310
  super();
4042
4311
  this.id = id;
@@ -4057,19 +4326,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4057
4326
  this.api._onDidChangeFocus.fire({ isFocused: false });
4058
4327
  }));
4059
4328
  }
4060
- get element() {
4061
- return this._element;
4062
- }
4063
- get width() {
4064
- return this._width;
4065
- }
4066
- get height() {
4067
- return this._height;
4068
- }
4069
- get params() {
4070
- var _a;
4071
- return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
4072
- }
4073
4329
  focus() {
4074
4330
  this.api._onFocusEvent.fire();
4075
4331
  }
@@ -4110,50 +4366,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4110
4366
  }
4111
4367
 
4112
4368
  class GridviewPanel extends BasePanelView {
4113
- constructor(id, component, api = new GridviewPanelApiImpl(id)) {
4114
- super(id, component, api);
4115
- this._evaluatedMinimumWidth = 0;
4116
- this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
4117
- this._evaluatedMinimumHeight = 0;
4118
- this._evaluatedMaximumHeight = Number.MAX_SAFE_INTEGER;
4119
- this._minimumWidth = 0;
4120
- this._minimumHeight = 0;
4121
- this._maximumWidth = Number.MAX_SAFE_INTEGER;
4122
- this._maximumHeight = Number.MAX_SAFE_INTEGER;
4123
- this._snap = false;
4124
- this._onDidChange = new Emitter();
4125
- this.onDidChange = this._onDidChange.event;
4126
- this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
4127
- const { isVisible } = event;
4128
- const { accessor } = this._params;
4129
- accessor.setVisible(this, isVisible);
4130
- }), this.api.onActiveChange(() => {
4131
- const { accessor } = this._params;
4132
- accessor.setActive(this);
4133
- }), this.api.onDidConstraintsChangeInternal((event) => {
4134
- if (typeof event.minimumWidth === 'number' ||
4135
- typeof event.minimumWidth === 'function') {
4136
- this._minimumWidth = event.minimumWidth;
4137
- }
4138
- if (typeof event.minimumHeight === 'number' ||
4139
- typeof event.minimumHeight === 'function') {
4140
- this._minimumHeight = event.minimumHeight;
4141
- }
4142
- if (typeof event.maximumWidth === 'number' ||
4143
- typeof event.maximumWidth === 'function') {
4144
- this._maximumWidth = event.maximumWidth;
4145
- }
4146
- if (typeof event.maximumHeight === 'number' ||
4147
- typeof event.maximumHeight === 'function') {
4148
- this._maximumHeight = event.maximumHeight;
4149
- }
4150
- }), this.api.onDidSizeChange((event) => {
4151
- this._onDidChange.fire({
4152
- height: event.height,
4153
- width: event.width,
4154
- });
4155
- }));
4156
- }
4157
4369
  get priority() {
4158
4370
  return this._priority;
4159
4371
  }
@@ -4203,6 +4415,51 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4203
4415
  get isActive() {
4204
4416
  return this.api.isActive;
4205
4417
  }
4418
+ constructor(id, component, api) {
4419
+ super(id, component, api);
4420
+ this._evaluatedMinimumWidth = 0;
4421
+ this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
4422
+ this._evaluatedMinimumHeight = 0;
4423
+ this._evaluatedMaximumHeight = Number.MAX_SAFE_INTEGER;
4424
+ this._minimumWidth = 0;
4425
+ this._minimumHeight = 0;
4426
+ this._maximumWidth = Number.MAX_SAFE_INTEGER;
4427
+ this._maximumHeight = Number.MAX_SAFE_INTEGER;
4428
+ this._snap = false;
4429
+ this._onDidChange = new Emitter();
4430
+ this.onDidChange = this._onDidChange.event;
4431
+ this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
4432
+ this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
4433
+ const { isVisible } = event;
4434
+ const { accessor } = this._params;
4435
+ accessor.setVisible(this, isVisible);
4436
+ }), this.api.onActiveChange(() => {
4437
+ const { accessor } = this._params;
4438
+ accessor.setActive(this);
4439
+ }), this.api.onDidConstraintsChangeInternal((event) => {
4440
+ if (typeof event.minimumWidth === 'number' ||
4441
+ typeof event.minimumWidth === 'function') {
4442
+ this._minimumWidth = event.minimumWidth;
4443
+ }
4444
+ if (typeof event.minimumHeight === 'number' ||
4445
+ typeof event.minimumHeight === 'function') {
4446
+ this._minimumHeight = event.minimumHeight;
4447
+ }
4448
+ if (typeof event.maximumWidth === 'number' ||
4449
+ typeof event.maximumWidth === 'function') {
4450
+ this._maximumWidth = event.maximumWidth;
4451
+ }
4452
+ if (typeof event.maximumHeight === 'number' ||
4453
+ typeof event.maximumHeight === 'function') {
4454
+ this._maximumHeight = event.maximumHeight;
4455
+ }
4456
+ }), this.api.onDidSizeChange((event) => {
4457
+ this._onDidChange.fire({
4458
+ height: event.height,
4459
+ width: event.width,
4460
+ });
4461
+ }));
4462
+ }
4206
4463
  setVisible(isVisible) {
4207
4464
  this.api._onDidVisibilityChange.fire({ isVisible });
4208
4465
  }
@@ -4248,10 +4505,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4248
4505
  class GroupviewApi extends GridviewPanelApiImpl {
4249
4506
  }
4250
4507
  class GroupPanel extends GridviewPanel {
4251
- constructor(accessor, id, options) {
4252
- super(id, 'groupview_default', new GroupviewApi(id));
4253
- this._model = new Groupview(this.element, accessor, id, options, this);
4254
- }
4255
4508
  get panels() {
4256
4509
  return this._model.panels;
4257
4510
  }
@@ -4285,6 +4538,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4285
4538
  get header() {
4286
4539
  return this._model.header;
4287
4540
  }
4541
+ constructor(accessor, id, options) {
4542
+ super(id, 'groupview_default', new GroupviewApi(id));
4543
+ this._model = new Groupview(this.element, accessor, id, options, this);
4544
+ }
4288
4545
  initialize() {
4289
4546
  this._model.initialize();
4290
4547
  }
@@ -4305,17 +4562,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4305
4562
  }
4306
4563
 
4307
4564
  class DefaultGroupPanelView {
4308
- constructor(renderers) {
4309
- var _a;
4310
- this._content = renderers.content;
4311
- this._tab = (_a = renderers.tab) !== null && _a !== void 0 ? _a : new DefaultTab();
4312
- }
4313
4565
  get content() {
4314
4566
  return this._content;
4315
4567
  }
4316
4568
  get tab() {
4317
4569
  return this._tab;
4318
4570
  }
4571
+ constructor(renderers) {
4572
+ var _a;
4573
+ this._content = renderers.content;
4574
+ this._tab = (_a = renderers.tab) !== null && _a !== void 0 ? _a : new DefaultTab();
4575
+ }
4319
4576
  init(params) {
4320
4577
  this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
4321
4578
  this.tab.init(params);
@@ -4337,25 +4594,60 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4337
4594
  if (tab && Object.keys(tab).length === 0) {
4338
4595
  tab = undefined;
4339
4596
  }
4340
- return {
4341
- content: this.content.toJSON(),
4342
- tab,
4343
- };
4597
+ return {
4598
+ content: this.content.toJSON(),
4599
+ tab,
4600
+ };
4601
+ }
4602
+ dispose() {
4603
+ this.content.dispose();
4604
+ this.tab.dispose();
4605
+ }
4606
+ }
4607
+
4608
+ class DockviewComponent extends BaseGrid {
4609
+ get orientation() {
4610
+ return this.gridview.orientation;
4611
+ }
4612
+ get totalPanels() {
4613
+ return this.panels.length;
4614
+ }
4615
+ get panels() {
4616
+ return this.groups.flatMap((group) => group.panels);
4617
+ }
4618
+ get deserializer() {
4619
+ return this._deserializer;
4620
+ }
4621
+ set deserializer(value) {
4622
+ this._deserializer = value;
4623
+ }
4624
+ get options() {
4625
+ return this._options;
4626
+ }
4627
+ get activePanel() {
4628
+ const activeGroup = this.activeGroup;
4629
+ if (!activeGroup) {
4630
+ return undefined;
4631
+ }
4632
+ return activeGroup.activePanel;
4344
4633
  }
4345
- dispose() {
4346
- this.content.dispose();
4347
- this.tab.dispose();
4634
+ set tabHeight(height) {
4635
+ this.options.tabHeight = height;
4636
+ this._groups.forEach((value) => {
4637
+ value.value.model.header.height = height;
4638
+ });
4639
+ }
4640
+ get tabHeight() {
4641
+ return this.options.tabHeight;
4348
4642
  }
4349
- }
4350
-
4351
- const nextGroupId = sequentialNumberGenerator();
4352
- class DockviewComponent extends BaseGrid {
4353
4643
  constructor(element, options) {
4354
4644
  super(element, {
4355
4645
  proportionalLayout: true,
4356
4646
  orientation: options.orientation || exports.Orientation.HORIZONTAL,
4357
4647
  styles: options.styles,
4358
4648
  });
4649
+ this.nextGroupId = sequentialNumberGenerator();
4650
+ this.watermark = null;
4359
4651
  this._onDidDrop = new Emitter();
4360
4652
  this.onDidDrop = this._onDidDrop.event;
4361
4653
  this._onDidRemovePanel = new Emitter();
@@ -4366,7 +4658,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4366
4658
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
4367
4659
  this._onDidActivePanelChange = new Emitter();
4368
4660
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
4369
- this.addDisposables(this._onDidDrop, exports.Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
4661
+ this.element.classList.add('dv-dockview');
4662
+ this.addDisposables(this._onDidDrop, exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
4663
+ this.updateWatermark();
4664
+ }), exports.Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
4370
4665
  this._bufferOnDidLayoutChange.fire();
4371
4666
  }));
4372
4667
  this._options = options;
@@ -4386,38 +4681,72 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4386
4681
  !this.options.watermarkFrameworkComponent) {
4387
4682
  this.options.watermarkComponent = Watermark;
4388
4683
  }
4684
+ const dropTarget = new Droptarget(this.element, {
4685
+ canDisplayOverlay: (event, position) => {
4686
+ const data = getPanelData();
4687
+ if (data) {
4688
+ if (data.viewId !== this.id) {
4689
+ return false;
4690
+ }
4691
+ return true;
4692
+ }
4693
+ if (this.options.showDndOverlay) {
4694
+ return this.options.showDndOverlay({
4695
+ nativeEvent: event,
4696
+ position: position,
4697
+ target: exports.DockviewDropTargets.Edge,
4698
+ getData: getPanelData,
4699
+ });
4700
+ }
4701
+ return false;
4702
+ },
4703
+ acceptedTargetZones: ['top', 'bottom', 'left', 'right'],
4704
+ overlayModel: {
4705
+ activationSize: { type: 'pixels', value: 10 },
4706
+ size: { type: 'pixels', value: 20 },
4707
+ },
4708
+ });
4709
+ this.addDisposables(dropTarget, dropTarget.onDrop((event) => {
4710
+ const data = getPanelData();
4711
+ if (data) {
4712
+ this.moveGroupOrPanel(this.orthogonalize(event.position), data.groupId, data.panelId || undefined, 'center');
4713
+ }
4714
+ else {
4715
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
4716
+ }
4717
+ }));
4389
4718
  this._api = new DockviewApi(this);
4719
+ this.updateWatermark();
4390
4720
  }
4391
- get totalPanels() {
4392
- return this.panels.length;
4393
- }
4394
- get panels() {
4395
- return this.groups.flatMap((group) => group.panels);
4396
- }
4397
- get deserializer() {
4398
- return this._deserializer;
4399
- }
4400
- set deserializer(value) {
4401
- this._deserializer = value;
4402
- }
4403
- get options() {
4404
- return this._options;
4405
- }
4406
- get activePanel() {
4407
- const activeGroup = this.activeGroup;
4408
- if (!activeGroup) {
4409
- return undefined;
4721
+ orthogonalize(position) {
4722
+ switch (position) {
4723
+ case 'top':
4724
+ case 'bottom':
4725
+ if (this.gridview.orientation === exports.Orientation.HORIZONTAL) {
4726
+ // we need to add to a vertical splitview but the current root is a horizontal splitview.
4727
+ // insert a vertical splitview at the root level and add the existing view as a child
4728
+ this.gridview.insertOrthogonalSplitviewAtRoot();
4729
+ }
4730
+ break;
4731
+ case 'left':
4732
+ case 'right':
4733
+ if (this.gridview.orientation === exports.Orientation.VERTICAL) {
4734
+ // we need to add to a horizontal splitview but the current root is a vertical splitview.
4735
+ // insert a horiziontal splitview at the root level and add the existing view as a child
4736
+ this.gridview.insertOrthogonalSplitviewAtRoot();
4737
+ }
4738
+ break;
4739
+ }
4740
+ switch (position) {
4741
+ case 'top':
4742
+ case 'left':
4743
+ return this.createGroupAtLocation([0]); // insert into first position
4744
+ case 'bottom':
4745
+ case 'right':
4746
+ return this.createGroupAtLocation([this.gridview.length]); // insert into last position
4747
+ default:
4748
+ throw new Error(`unsupported position ${position}`);
4410
4749
  }
4411
- return activeGroup.activePanel;
4412
- }
4413
- set tabHeight(height) {
4414
- this.options.tabHeight = height;
4415
- this._groups.forEach((value) => {
4416
- value.value.model.header.height = height;
4417
- });
4418
- }
4419
- get tabHeight() {
4420
- return this.options.tabHeight;
4421
4750
  }
4422
4751
  updateOptions(options) {
4423
4752
  const hasOrientationChanged = typeof options.orientation === 'string' &&
@@ -4467,8 +4796,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4467
4796
  options.group = this.activeGroup;
4468
4797
  }
4469
4798
  if (options.includePanel && options.group) {
4470
- if (options.group.activePanel !==
4471
- options.group.panels[0]) {
4799
+ if (options.group.activePanel !== options.group.panels[0]) {
4472
4800
  options.group.model.moveToPrevious({ suppressRoll: true });
4473
4801
  return;
4474
4802
  }
@@ -4501,14 +4829,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4501
4829
  fromJSON(data) {
4502
4830
  this.clear();
4503
4831
  if (!this.deserializer) {
4504
- throw new Error('invalid deserializer');
4832
+ throw new Error('no deserializer provided');
4505
4833
  }
4506
4834
  const { grid, panels, options, activeGroup } = data;
4507
4835
  if (typeof (options === null || options === void 0 ? void 0 : options.tabHeight) === 'number') {
4508
4836
  this.tabHeight = options.tabHeight;
4509
4837
  }
4510
- if (!this.deserializer) {
4511
- throw new Error('no deserializer provided');
4838
+ if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
4839
+ throw new Error('root must be of type branch');
4512
4840
  }
4513
4841
  this.gridview.deserialize(grid, {
4514
4842
  fromJSON: (node) => {
@@ -4521,19 +4849,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4521
4849
  this._onDidAddGroup.fire(group);
4522
4850
  for (const child of views) {
4523
4851
  const panel = this.deserializer.fromJSON(panels[child], group);
4524
- const isActive = typeof activeView === 'string' && activeView === panel.id;
4852
+ const isActive = typeof activeView === 'string' &&
4853
+ activeView === panel.id;
4525
4854
  group.model.openPanel(panel, {
4526
4855
  skipSetPanelActive: !isActive,
4527
- skipSetGroupActive: true
4856
+ skipSetGroupActive: true,
4528
4857
  });
4529
4858
  }
4530
4859
  if (!group.activePanel && group.panels.length > 0) {
4531
4860
  group.model.openPanel(group.panels[group.panels.length - 1], {
4532
- skipSetGroupActive: true
4861
+ skipSetGroupActive: true,
4533
4862
  });
4534
4863
  }
4535
4864
  return group;
4536
- }
4865
+ },
4537
4866
  });
4538
4867
  if (typeof activeGroup === 'string') {
4539
4868
  const panel = this.getPanel(activeGroup);
@@ -4572,12 +4901,31 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4572
4901
  throw new Error(`panel with id ${options.id} already exists`);
4573
4902
  }
4574
4903
  let referenceGroup;
4575
- if ((_a = options.position) === null || _a === void 0 ? void 0 : _a.referencePanel) {
4576
- const referencePanel = this.getGroupPanel(options.position.referencePanel);
4577
- if (!referencePanel) {
4578
- throw new Error(`referencePanel ${options.position.referencePanel} does not exist`);
4904
+ if (options.position) {
4905
+ if (isPanelOptionsWithPanel(options.position)) {
4906
+ const referencePanel = typeof options.position.referencePanel === 'string'
4907
+ ? this.getGroupPanel(options.position.referencePanel)
4908
+ : options.position.referencePanel;
4909
+ if (!referencePanel) {
4910
+ throw new Error(`referencePanel ${options.position.referencePanel} does not exist`);
4911
+ }
4912
+ referenceGroup = this.findGroup(referencePanel);
4913
+ }
4914
+ else if (isPanelOptionsWithGroup(options.position)) {
4915
+ referenceGroup =
4916
+ typeof options.position.referenceGroup === 'string'
4917
+ ? (_a = this._groups.get(options.position.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
4918
+ : options.position.referenceGroup;
4919
+ if (!referenceGroup) {
4920
+ throw new Error(`referencePanel ${options.position.referenceGroup} does not exist`);
4921
+ }
4922
+ }
4923
+ else {
4924
+ const group = this.orthogonalize(directionToPosition(options.position.direction));
4925
+ const panel = this.createPanel(options, group);
4926
+ group.model.openPanel(panel);
4927
+ return panel;
4579
4928
  }
4580
- referenceGroup = this.findGroup(referencePanel);
4581
4929
  }
4582
4930
  else {
4583
4931
  referenceGroup = this.activeGroup;
@@ -4585,7 +4933,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4585
4933
  let panel;
4586
4934
  if (referenceGroup) {
4587
4935
  const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
4588
- if (target === exports.Position.Center) {
4936
+ if (target === 'center') {
4589
4937
  panel = this.createPanel(options, referenceGroup);
4590
4938
  referenceGroup.model.openPanel(panel);
4591
4939
  }
@@ -4614,10 +4962,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4614
4962
  }
4615
4963
  group.model.removePanel(panel);
4616
4964
  panel.dispose();
4617
- const retainGroupForWatermark = this.size === 1;
4618
- if (!retainGroupForWatermark &&
4619
- group.size === 0 &&
4620
- options.removeEmptyGroup) {
4965
+ if (group.size === 0 && options.removeEmptyGroup) {
4621
4966
  this.removeGroup(group);
4622
4967
  }
4623
4968
  }
@@ -4629,24 +4974,67 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4629
4974
  ? { 'watermark-name': this.options.watermarkFrameworkComponent }
4630
4975
  : {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
4631
4976
  }
4632
- addEmptyGroup(options) {
4977
+ updateWatermark() {
4978
+ if (this.groups.length === 0) {
4979
+ if (!this.watermark) {
4980
+ this.watermark = this.createWatermarkComponent();
4981
+ this.watermark.init({
4982
+ containerApi: new DockviewApi(this),
4983
+ params: {},
4984
+ title: '',
4985
+ api: null,
4986
+ });
4987
+ const watermarkContainer = document.createElement('div');
4988
+ watermarkContainer.className = 'dv-watermark-container';
4989
+ watermarkContainer.appendChild(this.watermark.element);
4990
+ this.element.appendChild(watermarkContainer);
4991
+ }
4992
+ }
4993
+ else if (this.watermark) {
4994
+ this.watermark.element.parentElement.remove();
4995
+ this.watermark.dispose();
4996
+ this.watermark = null;
4997
+ }
4998
+ }
4999
+ addGroup(options) {
5000
+ var _a;
4633
5001
  const group = this.createGroup();
4634
5002
  if (options) {
4635
- const referencePanel = this.panels.find((panel) => panel.id === options.referencePanel);
4636
- if (!referencePanel) {
4637
- throw new Error(`reference panel ${options.referencePanel} does not exist`);
5003
+ let referenceGroup;
5004
+ if (isGroupOptionsWithPanel(options)) {
5005
+ const referencePanel = typeof options.referencePanel === 'string'
5006
+ ? this.panels.find((panel) => panel.id === options.referencePanel)
5007
+ : options.referencePanel;
5008
+ if (!referencePanel) {
5009
+ throw new Error(`reference panel ${options.referencePanel} does not exist`);
5010
+ }
5011
+ referenceGroup = this.findGroup(referencePanel);
5012
+ if (!referenceGroup) {
5013
+ throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
5014
+ }
4638
5015
  }
4639
- const referenceGroup = this.findGroup(referencePanel);
4640
- if (!referenceGroup) {
4641
- throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
5016
+ else if (isGroupOptionsWithGroup(options)) {
5017
+ referenceGroup =
5018
+ typeof options.referenceGroup === 'string'
5019
+ ? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
5020
+ : options.referenceGroup;
5021
+ if (!referenceGroup) {
5022
+ throw new Error(`reference group ${options.referenceGroup} does not exist`);
5023
+ }
5024
+ }
5025
+ else {
5026
+ const group = this.orthogonalize(directionToPosition(options.direction));
5027
+ return group;
4642
5028
  }
4643
5029
  const target = toTarget(options.direction || 'within');
4644
5030
  const location = getGridLocation(referenceGroup.element);
4645
5031
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
4646
5032
  this.doAddGroup(group, relativeLocation);
5033
+ return group;
4647
5034
  }
4648
5035
  else {
4649
5036
  this.doAddGroup(group);
5037
+ return group;
4650
5038
  }
4651
5039
  }
4652
5040
  removeGroup(group, skipActive = false) {
@@ -4664,7 +5052,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4664
5052
  const sourceGroup = groupId
4665
5053
  ? (_a = this._groups.get(groupId)) === null || _a === void 0 ? void 0 : _a.value
4666
5054
  : undefined;
4667
- if (!target || target === exports.Position.Center) {
5055
+ if (itemId === undefined) {
5056
+ if (sourceGroup) {
5057
+ this.moveGroup(sourceGroup, referenceGroup, target);
5058
+ }
5059
+ return;
5060
+ }
5061
+ if (!target || target === 'center') {
4668
5062
  const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(itemId)) ||
4669
5063
  this.panels.find((panel) => panel.id === itemId);
4670
5064
  if (!groupItem) {
@@ -4712,6 +5106,28 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4712
5106
  }
4713
5107
  }
4714
5108
  }
5109
+ moveGroup(sourceGroup, referenceGroup, target) {
5110
+ if (sourceGroup) {
5111
+ if (!target || target === 'center') {
5112
+ const activePanel = sourceGroup.activePanel;
5113
+ const panels = [...sourceGroup.panels].map((p) => sourceGroup.model.removePanel(p.id));
5114
+ if ((sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.size) === 0) {
5115
+ this.doRemoveGroup(sourceGroup);
5116
+ }
5117
+ for (const panel of panels) {
5118
+ referenceGroup.model.openPanel(panel, {
5119
+ skipSetPanelActive: panel !== activePanel,
5120
+ });
5121
+ }
5122
+ }
5123
+ else {
5124
+ this.gridview.removeView(getGridLocation(sourceGroup.element));
5125
+ const referenceLocation = getGridLocation(referenceGroup.element);
5126
+ const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
5127
+ this.gridview.addView(sourceGroup, exports.Sizing.Distribute, dropLocation);
5128
+ }
5129
+ }
5130
+ }
4715
5131
  doSetGroupActive(group, skipFocus) {
4716
5132
  var _a, _b;
4717
5133
  const isGroupAlreadyFocused = this._activeGroup === group;
@@ -4733,9 +5149,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4733
5149
  id = undefined;
4734
5150
  }
4735
5151
  if (!id) {
4736
- id = nextGroupId.next();
5152
+ id = this.nextGroupId.next();
4737
5153
  while (this._groups.has(id)) {
4738
- id = nextGroupId.next();
5154
+ id = this.nextGroupId.next();
4739
5155
  }
4740
5156
  }
4741
5157
  const view = new GroupPanel(this, id, options);
@@ -4768,7 +5184,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4768
5184
  content: this.createContentComponent(options.id, options.component),
4769
5185
  tab: this.createTabComponent(options.id, options.tabComponent || this.options.defaultTabComponent),
4770
5186
  });
4771
- const panel = new DockviewGroupPanel(options.id, this, this._api, group);
5187
+ const panel = new DockviewPanel(options.id, this, this._api, group);
4772
5188
  panel.init({
4773
5189
  view,
4774
5190
  title: options.title || options.id,
@@ -4803,6 +5219,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4803
5219
  }
4804
5220
 
4805
5221
  class GridviewComponent extends BaseGrid {
5222
+ get orientation() {
5223
+ return this.gridview.orientation;
5224
+ }
5225
+ set orientation(value) {
5226
+ this.gridview.orientation = value;
5227
+ }
5228
+ get options() {
5229
+ return this._options;
5230
+ }
5231
+ get deserializer() {
5232
+ return this._deserializer;
5233
+ }
5234
+ set deserializer(value) {
5235
+ this._deserializer = value;
5236
+ }
4806
5237
  constructor(element, options) {
4807
5238
  super(element, {
4808
5239
  proportionalLayout: options.proportionalLayout,
@@ -4819,21 +5250,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4819
5250
  this.options.frameworkComponents = {};
4820
5251
  }
4821
5252
  }
4822
- get orientation() {
4823
- return this.gridview.orientation;
4824
- }
4825
- set orientation(value) {
4826
- this.gridview.orientation = value;
4827
- }
4828
- get options() {
4829
- return this._options;
4830
- }
4831
- get deserializer() {
4832
- return this._deserializer;
4833
- }
4834
- set deserializer(value) {
4835
- this._deserializer = value;
4836
- }
4837
5253
  updateOptions(options) {
4838
5254
  const hasOrientationChanged = typeof options.orientation === 'string' &&
4839
5255
  this.gridview.orientation !== options.orientation;
@@ -4931,7 +5347,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4931
5347
  throw new Error(`reference group ${options.reference} does not exist`);
4932
5348
  }
4933
5349
  const target = toTarget(options.direction);
4934
- if (target === exports.Position.Center) {
5350
+ if (target === 'center') {
4935
5351
  throw new Error(`${target} not supported as an option`);
4936
5352
  }
4937
5353
  else {
@@ -4949,7 +5365,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4949
5365
  throw new Error(`reference group ${options.position.referencePanel} does not exist`);
4950
5366
  }
4951
5367
  const target = toTarget(options.position.direction);
4952
- if (target === exports.Position.Center) {
5368
+ if (target === 'center') {
4953
5369
  throw new Error(`${target} not supported as an option`);
4954
5370
  }
4955
5371
  else {
@@ -5038,29 +5454,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5038
5454
  * A high-level implementation of splitview that works using 'panels'
5039
5455
  */
5040
5456
  class SplitviewComponent extends CompositeDisposable {
5041
- constructor(element, options) {
5042
- super();
5043
- this.element = element;
5044
- this._disposable = new MutableDisposable();
5045
- this._panels = new Map();
5046
- this._onDidLayoutfromJSON = new Emitter();
5047
- this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5048
- this._onDidAddView = new Emitter();
5049
- this.onDidAddView = this._onDidAddView.event;
5050
- this._onDidRemoveView = new Emitter();
5051
- this.onDidRemoveView = this._onDidRemoveView.event;
5052
- this._onDidLayoutChange = new Emitter();
5053
- this.onDidLayoutChange = this._onDidLayoutChange.event;
5054
- this._options = options;
5055
- if (!options.components) {
5056
- options.components = {};
5057
- }
5058
- if (!options.frameworkComponents) {
5059
- options.frameworkComponents = {};
5060
- }
5061
- this.splitview = new Splitview(this.element, options);
5062
- this.addDisposables(this._disposable, this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
5063
- }
5064
5457
  get panels() {
5065
5458
  return this.splitview.getViews();
5066
5459
  }
@@ -5098,6 +5491,29 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5098
5491
  ? this.splitview.size
5099
5492
  : this.splitview.orthogonalSize;
5100
5493
  }
5494
+ constructor(element, options) {
5495
+ super();
5496
+ this.element = element;
5497
+ this._disposable = new MutableDisposable();
5498
+ this._panels = new Map();
5499
+ this._onDidLayoutfromJSON = new Emitter();
5500
+ this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5501
+ this._onDidAddView = new Emitter();
5502
+ this.onDidAddView = this._onDidAddView.event;
5503
+ this._onDidRemoveView = new Emitter();
5504
+ this.onDidRemoveView = this._onDidRemoveView.event;
5505
+ this._onDidLayoutChange = new Emitter();
5506
+ this.onDidLayoutChange = this._onDidLayoutChange.event;
5507
+ this._options = options;
5508
+ if (!options.components) {
5509
+ options.components = {};
5510
+ }
5511
+ if (!options.frameworkComponents) {
5512
+ options.frameworkComponents = {};
5513
+ }
5514
+ this.splitview = new Splitview(this.element, options);
5515
+ this.addDisposables(this._disposable, this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
5516
+ }
5101
5517
  updateOptions(options) {
5102
5518
  const hasOrientationChanged = typeof options.orientation === 'string' &&
5103
5519
  this.options.orientation !== options.orientation;
@@ -5299,38 +5715,85 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5299
5715
  setConstraints(value) {
5300
5716
  this._onDidConstraintsChangeInternal.fire(value);
5301
5717
  }
5302
- setSize(event) {
5303
- this._onDidSizeChange.fire(event);
5718
+ setSize(event) {
5719
+ this._onDidSizeChange.fire(event);
5720
+ }
5721
+ }
5722
+
5723
+ class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
5724
+ set pane(pane) {
5725
+ this._pane = pane;
5726
+ }
5727
+ constructor(id) {
5728
+ super(id);
5729
+ this._onDidExpansionChange = new Emitter({
5730
+ replay: true,
5731
+ });
5732
+ this.onDidExpansionChange = this._onDidExpansionChange.event;
5733
+ this._onMouseEnter = new Emitter({});
5734
+ this.onMouseEnter = this._onMouseEnter.event;
5735
+ this._onMouseLeave = new Emitter({});
5736
+ this.onMouseLeave = this._onMouseLeave.event;
5737
+ this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
5738
+ }
5739
+ setExpanded(isExpanded) {
5740
+ var _a;
5741
+ (_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
5742
+ }
5743
+ get isExpanded() {
5744
+ var _a;
5745
+ return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
5746
+ }
5747
+ }
5748
+
5749
+ class PaneviewPanel extends BasePanelView {
5750
+ set orientation(value) {
5751
+ this._orientation = value;
5752
+ }
5753
+ get orientation() {
5754
+ return this._orientation;
5755
+ }
5756
+ get minimumSize() {
5757
+ const headerSize = this.headerSize;
5758
+ const expanded = this.isExpanded();
5759
+ const minimumBodySize = expanded ? this._minimumBodySize : 0;
5760
+ return headerSize + minimumBodySize;
5761
+ }
5762
+ get maximumSize() {
5763
+ const headerSize = this.headerSize;
5764
+ const expanded = this.isExpanded();
5765
+ const maximumBodySize = expanded ? this._maximumBodySize : 0;
5766
+ return headerSize + maximumBodySize;
5767
+ }
5768
+ get size() {
5769
+ return this._size;
5770
+ }
5771
+ get orthogonalSize() {
5772
+ return this._orthogonalSize;
5773
+ }
5774
+ set orthogonalSize(size) {
5775
+ this._orthogonalSize = size;
5776
+ }
5777
+ get minimumBodySize() {
5778
+ return this._minimumBodySize;
5779
+ }
5780
+ set minimumBodySize(value) {
5781
+ this._minimumBodySize = typeof value === 'number' ? value : 0;
5304
5782
  }
5305
- }
5306
-
5307
- class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
5308
- constructor(id) {
5309
- super(id);
5310
- this._onDidExpansionChange = new Emitter({
5311
- replay: true,
5312
- });
5313
- this.onDidExpansionChange = this._onDidExpansionChange.event;
5314
- this._onMouseEnter = new Emitter({});
5315
- this.onMouseEnter = this._onMouseEnter.event;
5316
- this._onMouseLeave = new Emitter({});
5317
- this.onMouseLeave = this._onMouseLeave.event;
5318
- this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
5783
+ get maximumBodySize() {
5784
+ return this._maximumBodySize;
5319
5785
  }
5320
- set pane(pane) {
5321
- this._pane = pane;
5786
+ set maximumBodySize(value) {
5787
+ this._maximumBodySize =
5788
+ typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
5322
5789
  }
5323
- setExpanded(isExpanded) {
5324
- var _a;
5325
- (_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
5790
+ get headerVisible() {
5791
+ return this._headerVisible;
5326
5792
  }
5327
- get isExpanded() {
5328
- var _a;
5329
- return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
5793
+ set headerVisible(value) {
5794
+ this._headerVisible = value;
5795
+ this.header.style.display = value ? '' : 'none';
5330
5796
  }
5331
- }
5332
-
5333
- class PaneviewPanel extends BasePanelView {
5334
5797
  constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
5335
5798
  super(id, component, new PaneviewPanelApiImpl(id));
5336
5799
  this.headerComponent = headerComponent;
@@ -5346,6 +5809,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5346
5809
  this._isExpanded = false;
5347
5810
  this.expandedSize = 0;
5348
5811
  this.api.pane = this; // TODO cannot use 'this' before 'super'
5812
+ this.api.initialize(this);
5349
5813
  this._isExpanded = isExpanded;
5350
5814
  this._headerVisible = isHeaderVisible;
5351
5815
  this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
@@ -5375,53 +5839,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5375
5839
  }));
5376
5840
  this.renderOnce();
5377
5841
  }
5378
- set orientation(value) {
5379
- this._orientation = value;
5380
- }
5381
- get orientation() {
5382
- return this._orientation;
5383
- }
5384
- get minimumSize() {
5385
- const headerSize = this.headerSize;
5386
- const expanded = this.isExpanded();
5387
- const minimumBodySize = expanded ? this._minimumBodySize : 0;
5388
- return headerSize + minimumBodySize;
5389
- }
5390
- get maximumSize() {
5391
- const headerSize = this.headerSize;
5392
- const expanded = this.isExpanded();
5393
- const maximumBodySize = expanded ? this._maximumBodySize : 0;
5394
- return headerSize + maximumBodySize;
5395
- }
5396
- get size() {
5397
- return this._size;
5398
- }
5399
- get orthogonalSize() {
5400
- return this._orthogonalSize;
5401
- }
5402
- set orthogonalSize(size) {
5403
- this._orthogonalSize = size;
5404
- }
5405
- get minimumBodySize() {
5406
- return this._minimumBodySize;
5407
- }
5408
- set minimumBodySize(value) {
5409
- this._minimumBodySize = typeof value === 'number' ? value : 0;
5410
- }
5411
- get maximumBodySize() {
5412
- return this._maximumBodySize;
5413
- }
5414
- set maximumBodySize(value) {
5415
- this._maximumBodySize =
5416
- typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
5417
- }
5418
- get headerVisible() {
5419
- return this._headerVisible;
5420
- }
5421
- set headerVisible(value) {
5422
- this._headerVisible = value;
5423
- this.header.style.display = value ? '' : 'none';
5424
- }
5425
5842
  setVisible(isVisible) {
5426
5843
  this.api._onDidVisibilityChange.fire({ isVisible });
5427
5844
  }
@@ -5545,7 +5962,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5545
5962
  }
5546
5963
  })(this.header);
5547
5964
  this.target = new Droptarget(this.element, {
5548
- validOverlays: 'vertical',
5965
+ acceptedTargetZones: ['top', 'bottom'],
5966
+ overlayModel: {
5967
+ activationSize: { type: 'percentage', value: 50 },
5968
+ },
5549
5969
  canDisplayOverlay: (event) => {
5550
5970
  const data = getPaneData();
5551
5971
  if (data) {
@@ -5588,12 +6008,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5588
6008
  const allPanels = containerApi.panels;
5589
6009
  const fromIndex = allPanels.indexOf(existingPanel);
5590
6010
  let toIndex = containerApi.panels.indexOf(this);
5591
- if (event.position === exports.Position.Left ||
5592
- event.position === exports.Position.Top) {
6011
+ if (event.position === 'left' || event.position === 'top') {
5593
6012
  toIndex = Math.max(0, toIndex - 1);
5594
6013
  }
5595
- if (event.position === exports.Position.Right ||
5596
- event.position === exports.Position.Bottom) {
6014
+ if (event.position === 'right' || event.position === 'bottom') {
5597
6015
  if (fromIndex > toIndex) {
5598
6016
  toIndex++;
5599
6017
  }
@@ -5604,6 +6022,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5604
6022
  }
5605
6023
 
5606
6024
  class DefaultHeader extends CompositeDisposable {
6025
+ get element() {
6026
+ return this._element;
6027
+ }
5607
6028
  constructor() {
5608
6029
  super();
5609
6030
  this._expandedIcon = createExpandMoreButton();
@@ -5622,9 +6043,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5622
6043
  (_a = this.apiRef.api) === null || _a === void 0 ? void 0 : _a.setExpanded(!this.apiRef.api.isExpanded);
5623
6044
  }));
5624
6045
  }
5625
- get element() {
5626
- return this._element;
5627
- }
5628
6046
  init(params) {
5629
6047
  this.apiRef.api = params.api;
5630
6048
  this._content.textContent = params.title;
@@ -5677,36 +6095,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5677
6095
  }
5678
6096
  }
5679
6097
  class PaneviewComponent extends CompositeDisposable {
5680
- constructor(element, options) {
5681
- super();
5682
- this.element = element;
5683
- this._id = nextLayoutId.next();
5684
- this._disposable = new MutableDisposable();
5685
- this._viewDisposables = new Map();
5686
- this._onDidLayoutfromJSON = new Emitter();
5687
- this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5688
- this._onDidLayoutChange = new Emitter();
5689
- this.onDidLayoutChange = this._onDidLayoutChange.event;
5690
- this._onDidDrop = new Emitter();
5691
- this.onDidDrop = this._onDidDrop.event;
5692
- this._onDidAddView = new Emitter();
5693
- this.onDidAddView = this._onDidAddView.event;
5694
- this._onDidRemoveView = new Emitter();
5695
- this.onDidRemoveView = this._onDidRemoveView.event;
5696
- this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
5697
- this._options = options;
5698
- if (!options.components) {
5699
- options.components = {};
5700
- }
5701
- if (!options.frameworkComponents) {
5702
- options.frameworkComponents = {};
5703
- }
5704
- this.paneview = new Paneview(this.element, {
5705
- // only allow paneview in the vertical orientation for now
5706
- orientation: exports.Orientation.VERTICAL,
5707
- });
5708
- this.addDisposables(this._disposable);
5709
- }
5710
6098
  get id() {
5711
6099
  return this._id;
5712
6100
  }
@@ -5741,6 +6129,36 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5741
6129
  get options() {
5742
6130
  return this._options;
5743
6131
  }
6132
+ constructor(element, options) {
6133
+ super();
6134
+ this.element = element;
6135
+ this._id = nextLayoutId.next();
6136
+ this._disposable = new MutableDisposable();
6137
+ this._viewDisposables = new Map();
6138
+ this._onDidLayoutfromJSON = new Emitter();
6139
+ this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
6140
+ this._onDidLayoutChange = new Emitter();
6141
+ this.onDidLayoutChange = this._onDidLayoutChange.event;
6142
+ this._onDidDrop = new Emitter();
6143
+ this.onDidDrop = this._onDidDrop.event;
6144
+ this._onDidAddView = new Emitter();
6145
+ this.onDidAddView = this._onDidAddView.event;
6146
+ this._onDidRemoveView = new Emitter();
6147
+ this.onDidRemoveView = this._onDidRemoveView.event;
6148
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
6149
+ this._options = options;
6150
+ if (!options.components) {
6151
+ options.components = {};
6152
+ }
6153
+ if (!options.frameworkComponents) {
6154
+ options.frameworkComponents = {};
6155
+ }
6156
+ this.paneview = new Paneview(this.element, {
6157
+ // only allow paneview in the vertical orientation for now
6158
+ orientation: exports.Orientation.VERTICAL,
6159
+ });
6160
+ this.addDisposables(this._disposable);
6161
+ }
5744
6162
  focus() {
5745
6163
  //
5746
6164
  }
@@ -5926,36 +6344,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5926
6344
  }
5927
6345
 
5928
6346
  class SplitviewPanel extends BasePanelView {
5929
- constructor(id, componentName) {
5930
- super(id, componentName, new SplitviewPanelApiImpl(id));
5931
- this._evaluatedMinimumSize = 0;
5932
- this._evaluatedMaximumSize = Number.POSITIVE_INFINITY;
5933
- this._minimumSize = 0;
5934
- this._maximumSize = Number.POSITIVE_INFINITY;
5935
- this._snap = false;
5936
- this._onDidChange = new Emitter();
5937
- this.onDidChange = this._onDidChange.event;
5938
- this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
5939
- const { isVisible } = event;
5940
- const { accessor } = this._params;
5941
- accessor.setVisible(this, isVisible);
5942
- }), this.api.onActiveChange(() => {
5943
- const { accessor } = this._params;
5944
- accessor.setActive(this);
5945
- }), this.api.onDidConstraintsChangeInternal((event) => {
5946
- if (typeof event.minimumSize === 'number' ||
5947
- typeof event.minimumSize === 'function') {
5948
- this._minimumSize = event.minimumSize;
5949
- }
5950
- if (typeof event.maximumSize === 'number' ||
5951
- typeof event.maximumSize === 'function') {
5952
- this._maximumSize = event.maximumSize;
5953
- }
5954
- this.updateConstraints();
5955
- }), this.api.onDidSizeChange((event) => {
5956
- this._onDidChange.fire({ size: event.size });
5957
- }));
5958
- }
5959
6347
  get priority() {
5960
6348
  return this._priority;
5961
6349
  }
@@ -5988,6 +6376,37 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5988
6376
  get snap() {
5989
6377
  return this._snap;
5990
6378
  }
6379
+ constructor(id, componentName) {
6380
+ super(id, componentName, new SplitviewPanelApiImpl(id));
6381
+ this._evaluatedMinimumSize = 0;
6382
+ this._evaluatedMaximumSize = Number.POSITIVE_INFINITY;
6383
+ this._minimumSize = 0;
6384
+ this._maximumSize = Number.POSITIVE_INFINITY;
6385
+ this._snap = false;
6386
+ this._onDidChange = new Emitter();
6387
+ this.onDidChange = this._onDidChange.event;
6388
+ this.api.initialize(this);
6389
+ this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
6390
+ const { isVisible } = event;
6391
+ const { accessor } = this._params;
6392
+ accessor.setVisible(this, isVisible);
6393
+ }), this.api.onActiveChange(() => {
6394
+ const { accessor } = this._params;
6395
+ accessor.setActive(this);
6396
+ }), this.api.onDidConstraintsChangeInternal((event) => {
6397
+ if (typeof event.minimumSize === 'number' ||
6398
+ typeof event.minimumSize === 'function') {
6399
+ this._minimumSize = event.minimumSize;
6400
+ }
6401
+ if (typeof event.maximumSize === 'number' ||
6402
+ typeof event.maximumSize === 'function') {
6403
+ this._maximumSize = event.maximumSize;
6404
+ }
6405
+ this.updateConstraints();
6406
+ }), this.api.onDidSizeChange((event) => {
6407
+ this._onDidChange.fire({ size: event.size });
6408
+ }));
6409
+ }
5991
6410
  setVisible(isVisible) {
5992
6411
  this.api._onDidVisibilityChange.fire({ isVisible });
5993
6412
  }
@@ -6153,6 +6572,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6153
6572
  }
6154
6573
 
6155
6574
  class ReactPanelContentPart {
6575
+ get element() {
6576
+ return this._element;
6577
+ }
6156
6578
  constructor(id, component, reactPortalStore) {
6157
6579
  this.id = id;
6158
6580
  this.component = component;
@@ -6164,9 +6586,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6164
6586
  this._element = document.createElement('div');
6165
6587
  this._element.className = 'dockview-react-part';
6166
6588
  }
6167
- get element() {
6168
- return this._element;
6169
- }
6170
6589
  focus() {
6171
6590
  // TODO
6172
6591
  }
@@ -6201,6 +6620,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6201
6620
  }
6202
6621
 
6203
6622
  class ReactPanelHeaderPart {
6623
+ get element() {
6624
+ return this._element;
6625
+ }
6204
6626
  constructor(id, component, reactPortalStore) {
6205
6627
  this.id = id;
6206
6628
  this.component = component;
@@ -6208,9 +6630,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6208
6630
  this._element = document.createElement('div');
6209
6631
  this._element.className = 'dockview-react-part';
6210
6632
  }
6211
- get element() {
6212
- return this._element;
6213
- }
6214
6633
  focus() {
6215
6634
  //noop
6216
6635
  }
@@ -6269,7 +6688,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6269
6688
  content: createComponent(viewData.content.id, viewData.content.id, this.layout.options.components, this.layout.options.frameworkComponents, (_d = this.layout.options.frameworkComponentFactory) === null || _d === void 0 ? void 0 : _d.content),
6270
6689
  tab,
6271
6690
  });
6272
- const panel = new DockviewGroupPanel(panelId, this.layout, new DockviewApi(this.layout), group);
6691
+ const panel = new DockviewPanel(panelId, this.layout, new DockviewApi(this.layout), group);
6273
6692
  panel.init({
6274
6693
  view,
6275
6694
  title,
@@ -6280,6 +6699,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6280
6699
  }
6281
6700
 
6282
6701
  class ReactWatermarkPart {
6702
+ get element() {
6703
+ return this._element;
6704
+ }
6283
6705
  constructor(id, component, reactPortalStore) {
6284
6706
  this.id = id;
6285
6707
  this.component = component;
@@ -6290,9 +6712,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6290
6712
  this._element = document.createElement('div');
6291
6713
  this._element.className = 'dockview-react-part';
6292
6714
  }
6293
- get element() {
6294
- return this._element;
6295
- }
6296
6715
  init(parameters) {
6297
6716
  this.parameters = parameters;
6298
6717
  this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
@@ -6335,14 +6754,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6335
6754
  }
6336
6755
 
6337
6756
  class ReactGroupControlsRendererPart {
6338
- constructor(component, reactPortalStore, _group) {
6339
- this.component = component;
6340
- this.reactPortalStore = reactPortalStore;
6341
- this._group = _group;
6342
- this.mutableDisposable = new MutableDisposable();
6343
- this._element = document.createElement('div');
6344
- this._element.className = 'dockview-react-part';
6345
- }
6346
6757
  get element() {
6347
6758
  return this._element;
6348
6759
  }
@@ -6352,6 +6763,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6352
6763
  get group() {
6353
6764
  return this._group;
6354
6765
  }
6766
+ constructor(component, reactPortalStore, _group) {
6767
+ this.component = component;
6768
+ this.reactPortalStore = reactPortalStore;
6769
+ this._group = _group;
6770
+ this.mutableDisposable = new MutableDisposable();
6771
+ this._element = document.createElement('div');
6772
+ this._element.className = 'dockview-react-part';
6773
+ }
6355
6774
  focus() {
6356
6775
  // TODO
6357
6776
  }
@@ -6466,6 +6885,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6466
6885
  : undefined,
6467
6886
  showDndOverlay: props.showDndOverlay,
6468
6887
  createGroupControlElement: createGroupControlElement(props.groupControlComponent, { addPortal }),
6888
+ singleTabMode: props.singleTabMode,
6469
6889
  });
6470
6890
  (_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
6471
6891
  dockview.deserializer = new ReactPanelDeserialzier(dockview);
@@ -6678,7 +7098,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6678
7098
 
6679
7099
  class ReactGridPanelView extends GridviewPanel {
6680
7100
  constructor(id, component, reactComponent, reactPortalStore) {
6681
- super(id, component);
7101
+ super(id, component, new GridviewPanelApiImpl(id));
6682
7102
  this.reactComponent = reactComponent;
6683
7103
  this.reactPortalStore = reactPortalStore;
6684
7104
  }
@@ -6757,6 +7177,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6757
7177
  GridviewReact.displayName = 'GridviewComponent';
6758
7178
 
6759
7179
  class PanePanelSection {
7180
+ get element() {
7181
+ return this._element;
7182
+ }
6760
7183
  constructor(id, component, reactPortalStore) {
6761
7184
  this.id = id;
6762
7185
  this.component = component;
@@ -6765,9 +7188,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6765
7188
  this._element.style.height = '100%';
6766
7189
  this._element.style.width = '100%';
6767
7190
  }
6768
- get element() {
6769
- return this._element;
6770
- }
6771
7191
  init(parameters) {
6772
7192
  this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
6773
7193
  params: parameters.params,
@@ -6915,6 +7335,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6915
7335
  exports.SplitviewPanel = SplitviewPanel;
6916
7336
  exports.SplitviewReact = SplitviewReact;
6917
7337
  exports.Tab = Tab;
7338
+ exports.directionToPosition = directionToPosition;
6918
7339
  exports.getDirectionOrientation = getDirectionOrientation;
6919
7340
  exports.getGridLocation = getGridLocation;
6920
7341
  exports.getLocationOrientation = getLocationOrientation;
@@ -6923,11 +7344,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6923
7344
  exports.getRelativeLocation = getRelativeLocation;
6924
7345
  exports.indexInParent = indexInParent;
6925
7346
  exports.isGridBranchNode = isGridBranchNode;
7347
+ exports.isGroupOptionsWithGroup = isGroupOptionsWithGroup;
7348
+ exports.isGroupOptionsWithPanel = isGroupOptionsWithPanel;
7349
+ exports.isPanelOptionsWithGroup = isPanelOptionsWithGroup;
7350
+ exports.isPanelOptionsWithPanel = isPanelOptionsWithPanel;
6926
7351
  exports.isReactElement = isReactElement;
6927
7352
  exports.orthogonal = orthogonal;
7353
+ exports.positionToDirection = positionToDirection;
6928
7354
  exports.toTarget = toTarget;
6929
7355
  exports.usePortalsLifecycle = usePortalsLifecycle;
6930
7356
 
6931
- Object.defineProperty(exports, '__esModule', { value: true });
6932
-
6933
7357
  }));