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,6 +1,6 @@
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
  */
@@ -10,8 +10,7 @@
10
10
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.dockview = {}, global.React, global.ReactDOM));
11
11
  })(this, (function (exports, React, ReactDOM) { 'use strict';
12
12
 
13
- function _interopNamespace(e) {
14
- if (e && e.__esModule) return e;
13
+ function _interopNamespaceDefault(e) {
15
14
  var n = Object.create(null);
16
15
  if (e) {
17
16
  Object.keys(e).forEach(function (k) {
@@ -24,12 +23,12 @@
24
23
  }
25
24
  });
26
25
  }
27
- n["default"] = e;
26
+ n.default = e;
28
27
  return Object.freeze(n);
29
28
  }
30
29
 
31
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
32
- var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
30
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
31
+ var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
33
32
 
34
33
  class TransferObject {
35
34
  constructor() {
@@ -199,12 +198,12 @@
199
198
  };
200
199
  })(Disposable || (Disposable = {}));
201
200
  class CompositeDisposable {
202
- constructor(...args) {
203
- this.disposables = args;
204
- }
205
201
  static from(...args) {
206
202
  return new CompositeDisposable(...args);
207
203
  }
204
+ constructor(...args) {
205
+ this.disposables = args;
206
+ }
208
207
  addDisposables(...args) {
209
208
  args.forEach((arg) => this.disposables.push(arg));
210
209
  }
@@ -422,21 +421,6 @@
422
421
  }
423
422
 
424
423
  class ViewItem {
425
- constructor(container, view, size, disposable) {
426
- this.container = container;
427
- this.view = view;
428
- this.disposable = disposable;
429
- this._cachedVisibleSize = undefined;
430
- if (typeof size === 'number') {
431
- this._size = size;
432
- this._cachedVisibleSize = undefined;
433
- container.classList.add('visible');
434
- }
435
- else {
436
- this._size = 0;
437
- this._cachedVisibleSize = size.cachedVisibleSize;
438
- }
439
- }
440
424
  set size(size) {
441
425
  this._size = size;
442
426
  }
@@ -489,6 +473,21 @@
489
473
  set enabled(enabled) {
490
474
  this.container.style.pointerEvents = enabled ? '' : 'none';
491
475
  }
476
+ constructor(container, view, size, disposable) {
477
+ this.container = container;
478
+ this.view = view;
479
+ this.disposable = disposable;
480
+ this._cachedVisibleSize = undefined;
481
+ if (typeof size === 'number') {
482
+ this._size = size;
483
+ this._cachedVisibleSize = undefined;
484
+ container.classList.add('visible');
485
+ }
486
+ else {
487
+ this._size = 0;
488
+ this._cachedVisibleSize = size.cachedVisibleSize;
489
+ }
490
+ }
492
491
  // layout(offset: number, layoutContext: TLayoutContext | undefined): void {
493
492
  // this.layoutContainer(offset);
494
493
  // this.view.layout(this.size, offset, layoutContext);
@@ -535,6 +534,65 @@
535
534
  Sizing.Invisible = Invisible;
536
535
  })(exports.Sizing || (exports.Sizing = {}));
537
536
  class Splitview {
537
+ get size() {
538
+ return this._size;
539
+ }
540
+ set size(value) {
541
+ this._size = value;
542
+ }
543
+ get orthogonalSize() {
544
+ return this._orthogonalSize;
545
+ }
546
+ set orthogonalSize(value) {
547
+ this._orthogonalSize = value;
548
+ }
549
+ get length() {
550
+ return this.views.length;
551
+ }
552
+ get proportions() {
553
+ return this._proportions ? [...this._proportions] : undefined;
554
+ }
555
+ get orientation() {
556
+ return this._orientation;
557
+ }
558
+ set orientation(value) {
559
+ this._orientation = value;
560
+ const tmp = this.size;
561
+ this.size = this.orthogonalSize;
562
+ this.orthogonalSize = tmp;
563
+ removeClasses(this.element, 'horizontal', 'vertical');
564
+ this.element.classList.add(this.orientation == exports.Orientation.HORIZONTAL
565
+ ? 'horizontal'
566
+ : 'vertical');
567
+ }
568
+ get minimumSize() {
569
+ return this.views.reduce((r, item) => r + item.minimumSize, 0);
570
+ }
571
+ get maximumSize() {
572
+ return this.length === 0
573
+ ? Number.POSITIVE_INFINITY
574
+ : this.views.reduce((r, item) => r + item.maximumSize, 0);
575
+ }
576
+ get startSnappingEnabled() {
577
+ return this._startSnappingEnabled;
578
+ }
579
+ set startSnappingEnabled(startSnappingEnabled) {
580
+ if (this._startSnappingEnabled === startSnappingEnabled) {
581
+ return;
582
+ }
583
+ this._startSnappingEnabled = startSnappingEnabled;
584
+ this.updateSashEnablement();
585
+ }
586
+ get endSnappingEnabled() {
587
+ return this._endSnappingEnabled;
588
+ }
589
+ set endSnappingEnabled(endSnappingEnabled) {
590
+ if (this._endSnappingEnabled === endSnappingEnabled) {
591
+ return;
592
+ }
593
+ this._endSnappingEnabled = endSnappingEnabled;
594
+ this.updateSashEnablement();
595
+ }
538
596
  constructor(container, options) {
539
597
  this.container = container;
540
598
  this.views = [];
@@ -664,65 +722,6 @@
664
722
  this.saveProportions();
665
723
  }
666
724
  }
667
- get size() {
668
- return this._size;
669
- }
670
- set size(value) {
671
- this._size = value;
672
- }
673
- get orthogonalSize() {
674
- return this._orthogonalSize;
675
- }
676
- set orthogonalSize(value) {
677
- this._orthogonalSize = value;
678
- }
679
- get length() {
680
- return this.views.length;
681
- }
682
- get proportions() {
683
- return this._proportions ? [...this._proportions] : undefined;
684
- }
685
- get orientation() {
686
- return this._orientation;
687
- }
688
- set orientation(value) {
689
- this._orientation = value;
690
- const tmp = this.size;
691
- this.size = this.orthogonalSize;
692
- this.orthogonalSize = tmp;
693
- removeClasses(this.element, 'horizontal', 'vertical');
694
- this.element.classList.add(this.orientation == exports.Orientation.HORIZONTAL
695
- ? 'horizontal'
696
- : 'vertical');
697
- }
698
- get minimumSize() {
699
- return this.views.reduce((r, item) => r + item.minimumSize, 0);
700
- }
701
- get maximumSize() {
702
- return this.length === 0
703
- ? Number.POSITIVE_INFINITY
704
- : this.views.reduce((r, item) => r + item.maximumSize, 0);
705
- }
706
- get startSnappingEnabled() {
707
- return this._startSnappingEnabled;
708
- }
709
- set startSnappingEnabled(startSnappingEnabled) {
710
- if (this._startSnappingEnabled === startSnappingEnabled) {
711
- return;
712
- }
713
- this._startSnappingEnabled = startSnappingEnabled;
714
- this.updateSashEnablement();
715
- }
716
- get endSnappingEnabled() {
717
- return this._endSnappingEnabled;
718
- }
719
- set endSnappingEnabled(endSnappingEnabled) {
720
- if (this._endSnappingEnabled === endSnappingEnabled) {
721
- return;
722
- }
723
- this._endSnappingEnabled = endSnappingEnabled;
724
- this.updateSashEnablement();
725
- }
726
725
  style(styles) {
727
726
  if ((styles === null || styles === void 0 ? void 0 : styles.separatorBorder) === 'transparent') {
728
727
  removeClasses(this.element, 'separator-border');
@@ -1186,6 +1185,27 @@
1186
1185
  }
1187
1186
 
1188
1187
  class Paneview extends CompositeDisposable {
1188
+ get onDidAddView() {
1189
+ return this.splitview.onDidAddView;
1190
+ }
1191
+ get onDidRemoveView() {
1192
+ return this.splitview.onDidRemoveView;
1193
+ }
1194
+ get minimumSize() {
1195
+ return this.splitview.minimumSize;
1196
+ }
1197
+ get maximumSize() {
1198
+ return this.splitview.maximumSize;
1199
+ }
1200
+ get orientation() {
1201
+ return this.splitview.orientation;
1202
+ }
1203
+ get size() {
1204
+ return this.splitview.size;
1205
+ }
1206
+ get orthogonalSize() {
1207
+ return this.splitview.orthogonalSize;
1208
+ }
1189
1209
  constructor(container, options) {
1190
1210
  var _a;
1191
1211
  super();
@@ -1228,27 +1248,6 @@
1228
1248
  this._onDidChange.fire();
1229
1249
  }));
1230
1250
  }
1231
- get onDidAddView() {
1232
- return this.splitview.onDidAddView;
1233
- }
1234
- get onDidRemoveView() {
1235
- return this.splitview.onDidRemoveView;
1236
- }
1237
- get minimumSize() {
1238
- return this.splitview.minimumSize;
1239
- }
1240
- get maximumSize() {
1241
- return this.splitview.maximumSize;
1242
- }
1243
- get orientation() {
1244
- return this.splitview.orientation;
1245
- }
1246
- get size() {
1247
- return this.splitview.size;
1248
- }
1249
- get orthogonalSize() {
1250
- return this.splitview.orthogonalSize;
1251
- }
1252
1251
  addPane(pane, size, index = this.splitview.length, skipLayout = false) {
1253
1252
  const disposable = pane.onDidChangeExpansionState(() => {
1254
1253
  this.setupAnimation();
@@ -1327,243 +1326,16 @@
1327
1326
  }
1328
1327
  }
1329
1328
 
1330
- class DragAndDropObserver extends CompositeDisposable {
1331
- constructor(element, callbacks) {
1332
- super();
1333
- this.element = element;
1334
- this.callbacks = callbacks;
1335
- // A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE
1336
- // calls see https://github.com/microsoft/vscode/issues/14470
1337
- // when the element has child elements where the events are fired
1338
- // repeadedly.
1339
- this.counter = 0;
1340
- this.registerListeners();
1329
+ /*---------------------------------------------------------------------------------------------
1330
+ * Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:
1331
+ * https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
1332
+ *--------------------------------------------------------------------------------------------*/
1333
+ class LeafNode {
1334
+ get minimumWidth() {
1335
+ return this.view.minimumWidth;
1341
1336
  }
1342
- registerListeners() {
1343
- this.addDisposables(addDisposableListener(this.element, 'dragenter', (e) => {
1344
- this.counter++;
1345
- this.callbacks.onDragEnter(e);
1346
- }));
1347
- this.addDisposables(addDisposableListener(this.element, 'dragover', (e) => {
1348
- e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)
1349
- if (this.callbacks.onDragOver) {
1350
- this.callbacks.onDragOver(e);
1351
- }
1352
- }));
1353
- this.addDisposables(addDisposableListener(this.element, 'dragleave', (e) => {
1354
- this.counter--;
1355
- if (this.counter === 0) {
1356
- this.callbacks.onDragLeave(e);
1357
- }
1358
- }));
1359
- this.addDisposables(addDisposableListener(this.element, 'dragend', (e) => {
1360
- this.counter = 0;
1361
- this.callbacks.onDragEnd(e);
1362
- }));
1363
- this.addDisposables(addDisposableListener(this.element, 'drop', (e) => {
1364
- this.counter = 0;
1365
- this.callbacks.onDrop(e);
1366
- }));
1367
- }
1368
- }
1369
-
1370
- exports.Position = void 0;
1371
- (function (Position) {
1372
- Position["Top"] = "Top";
1373
- Position["Left"] = "Left";
1374
- Position["Bottom"] = "Bottom";
1375
- Position["Right"] = "Right";
1376
- Position["Center"] = "Center";
1377
- })(exports.Position || (exports.Position = {}));
1378
- function isBooleanValue(canDisplayOverlay) {
1379
- return typeof canDisplayOverlay === 'boolean';
1380
- }
1381
- class Droptarget extends CompositeDisposable {
1382
- constructor(element, options) {
1383
- super();
1384
- this.element = element;
1385
- this.options = options;
1386
- this._onDrop = new Emitter();
1387
- this.onDrop = this._onDrop.event;
1388
- this.addDisposables(this._onDrop, new DragAndDropObserver(this.element, {
1389
- onDragEnter: () => undefined,
1390
- onDragOver: (e) => {
1391
- const width = this.element.clientWidth;
1392
- const height = this.element.clientHeight;
1393
- if (width === 0 || height === 0) {
1394
- return; // avoid div!0
1395
- }
1396
- const x = e.offsetX;
1397
- const y = e.offsetY;
1398
- const xp = (100 * x) / width;
1399
- const yp = (100 * y) / height;
1400
- const quadrant = this.calculateQuadrant(this.options.validOverlays, xp, yp);
1401
- if (isBooleanValue(this.options.canDisplayOverlay)) {
1402
- if (!this.options.canDisplayOverlay) {
1403
- return;
1404
- }
1405
- }
1406
- else if (!this.options.canDisplayOverlay(e, quadrant)) {
1407
- return;
1408
- }
1409
- if (!this.target) {
1410
- this.target = document.createElement('div');
1411
- this.target.className = 'drop-target-dropzone';
1412
- this.overlay = document.createElement('div');
1413
- this.overlay.className = 'drop-target-selection';
1414
- this._state = exports.Position.Center;
1415
- this.target.appendChild(this.overlay);
1416
- this.element.classList.add('drop-target');
1417
- this.element.append(this.target);
1418
- }
1419
- if (this.options.validOverlays === 'none') {
1420
- return;
1421
- }
1422
- if (!this.target || !this.overlay) {
1423
- return;
1424
- }
1425
- const isSmallX = width < 100;
1426
- const isSmallY = height < 100;
1427
- this.toggleClasses(quadrant, isSmallX, isSmallY);
1428
- this.setState(quadrant);
1429
- },
1430
- onDragLeave: () => {
1431
- this.removeDropTarget();
1432
- },
1433
- onDragEnd: () => {
1434
- this.removeDropTarget();
1435
- },
1436
- onDrop: (e) => {
1437
- e.preventDefault();
1438
- e.stopPropagation();
1439
- const state = this._state;
1440
- this.removeDropTarget();
1441
- if (state) {
1442
- this._onDrop.fire({ position: state, nativeEvent: e });
1443
- }
1444
- },
1445
- }));
1446
- }
1447
- get state() {
1448
- return this._state;
1449
- }
1450
- set validOverlays(value) {
1451
- this.options.validOverlays = value;
1452
- }
1453
- set canDisplayOverlay(value) {
1454
- this.options.canDisplayOverlay = value;
1455
- }
1456
- dispose() {
1457
- this.removeDropTarget();
1458
- }
1459
- toggleClasses(quadrant, isSmallX, isSmallY) {
1460
- if (!this.overlay) {
1461
- return;
1462
- }
1463
- const isLeft = quadrant === 'left';
1464
- const isRight = quadrant === 'right';
1465
- const isTop = quadrant === 'top';
1466
- const isBottom = quadrant === 'bottom';
1467
- toggleClass(this.overlay, 'right', !isSmallX && isRight);
1468
- toggleClass(this.overlay, 'left', !isSmallX && isLeft);
1469
- toggleClass(this.overlay, 'top', !isSmallY && isTop);
1470
- toggleClass(this.overlay, 'bottom', !isSmallY && isBottom);
1471
- toggleClass(this.overlay, 'small-right', isSmallX && isRight);
1472
- toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
1473
- toggleClass(this.overlay, 'small-top', isSmallY && isTop);
1474
- toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
1475
- }
1476
- setState(quadrant) {
1477
- switch (quadrant) {
1478
- case 'top':
1479
- this._state = exports.Position.Top;
1480
- break;
1481
- case 'left':
1482
- this._state = exports.Position.Left;
1483
- break;
1484
- case 'bottom':
1485
- this._state = exports.Position.Bottom;
1486
- break;
1487
- case 'right':
1488
- this._state = exports.Position.Right;
1489
- break;
1490
- default:
1491
- this._state = exports.Position.Center;
1492
- break;
1493
- }
1494
- }
1495
- calculateQuadrant(overlayType, xp, yp) {
1496
- switch (overlayType) {
1497
- case 'all':
1498
- if (xp < 20) {
1499
- return 'left';
1500
- }
1501
- if (xp > 80) {
1502
- return 'right';
1503
- }
1504
- if (yp < 20) {
1505
- return 'top';
1506
- }
1507
- if (yp > 80) {
1508
- return 'bottom';
1509
- }
1510
- break;
1511
- case 'vertical':
1512
- if (yp < 50) {
1513
- return 'top';
1514
- }
1515
- return 'bottom';
1516
- case 'horizontal':
1517
- if (xp < 50) {
1518
- return 'left';
1519
- }
1520
- return 'right';
1521
- }
1522
- return null;
1523
- }
1524
- removeDropTarget() {
1525
- if (this.target) {
1526
- this._state = undefined;
1527
- this.element.removeChild(this.target);
1528
- this.target = undefined;
1529
- this.element.classList.remove('drop-target');
1530
- }
1531
- }
1532
- }
1533
-
1534
- /*---------------------------------------------------------------------------------------------
1535
- * Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:
1536
- * https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
1537
- *--------------------------------------------------------------------------------------------*/
1538
- class LeafNode {
1539
- constructor(view, orientation, orthogonalSize, size = 0) {
1540
- this.view = view;
1541
- this.orientation = orientation;
1542
- this._onDidChange = new Emitter();
1543
- this.onDidChange = this._onDidChange.event;
1544
- this._orthogonalSize = orthogonalSize;
1545
- this._size = size;
1546
- this._disposable = this.view.onDidChange((event) => {
1547
- if (event) {
1548
- this._onDidChange.fire({
1549
- size: this.orientation === exports.Orientation.VERTICAL
1550
- ? event.width
1551
- : event.height,
1552
- orthogonalSize: this.orientation === exports.Orientation.VERTICAL
1553
- ? event.height
1554
- : event.width,
1555
- });
1556
- }
1557
- else {
1558
- this._onDidChange.fire({});
1559
- }
1560
- });
1561
- }
1562
- get minimumWidth() {
1563
- return this.view.minimumWidth;
1564
- }
1565
- get maximumWidth() {
1566
- return this.view.maximumWidth;
1337
+ get maximumWidth() {
1338
+ return this.view.maximumWidth;
1567
1339
  }
1568
1340
  get minimumHeight() {
1569
1341
  return this.view.minimumHeight;
@@ -1616,6 +1388,29 @@
1616
1388
  ? this.size
1617
1389
  : this.orthogonalSize;
1618
1390
  }
1391
+ constructor(view, orientation, orthogonalSize, size = 0) {
1392
+ this.view = view;
1393
+ this.orientation = orientation;
1394
+ this._onDidChange = new Emitter();
1395
+ this.onDidChange = this._onDidChange.event;
1396
+ this._orthogonalSize = orthogonalSize;
1397
+ this._size = size;
1398
+ this._disposable = this.view.onDidChange((event) => {
1399
+ if (event) {
1400
+ this._onDidChange.fire({
1401
+ size: this.orientation === exports.Orientation.VERTICAL
1402
+ ? event.width
1403
+ : event.height,
1404
+ orthogonalSize: this.orientation === exports.Orientation.VERTICAL
1405
+ ? event.height
1406
+ : event.width,
1407
+ });
1408
+ }
1409
+ else {
1410
+ this._onDidChange.fire({});
1411
+ }
1412
+ });
1413
+ }
1619
1414
  setVisible(visible) {
1620
1415
  if (this.view.setVisible) {
1621
1416
  this.view.setVisible(visible);
@@ -1638,53 +1433,6 @@
1638
1433
  * https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
1639
1434
  *--------------------------------------------------------------------------------------------*/
1640
1435
  class BranchNode extends CompositeDisposable {
1641
- constructor(orientation, proportionalLayout, styles, size, orthogonalSize, childDescriptors) {
1642
- super();
1643
- this.orientation = orientation;
1644
- this.proportionalLayout = proportionalLayout;
1645
- this.styles = styles;
1646
- this.children = [];
1647
- this._onDidChange = new Emitter();
1648
- this.onDidChange = this._onDidChange.event;
1649
- this._childrenDisposable = Disposable.NONE;
1650
- this._orthogonalSize = orthogonalSize;
1651
- this._size = size;
1652
- this.element = document.createElement('div');
1653
- this.element.className = 'branch-node';
1654
- if (!childDescriptors) {
1655
- this.splitview = new Splitview(this.element, {
1656
- orientation: this.orientation,
1657
- proportionalLayout,
1658
- styles,
1659
- });
1660
- this.splitview.layout(this.size, this.orthogonalSize);
1661
- }
1662
- else {
1663
- const descriptor = {
1664
- views: childDescriptors.map((childDescriptor) => {
1665
- return {
1666
- view: childDescriptor.node,
1667
- size: childDescriptor.node.size,
1668
- visible: childDescriptor.node instanceof LeafNode &&
1669
- childDescriptor.visible !== undefined
1670
- ? childDescriptor.visible
1671
- : true,
1672
- };
1673
- }),
1674
- size: this.size,
1675
- };
1676
- this.children = childDescriptors.map((c) => c.node);
1677
- this.splitview = new Splitview(this.element, {
1678
- orientation: this.orientation,
1679
- descriptor,
1680
- proportionalLayout,
1681
- });
1682
- }
1683
- this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {
1684
- this._onDidChange.fire({});
1685
- }));
1686
- this.setupChildrenEvents();
1687
- }
1688
1436
  get width() {
1689
1437
  return this.orientation === exports.Orientation.HORIZONTAL
1690
1438
  ? this.size
@@ -1750,6 +1498,53 @@
1750
1498
  }
1751
1499
  return exports.LayoutPriority.Normal;
1752
1500
  }
1501
+ constructor(orientation, proportionalLayout, styles, size, orthogonalSize, childDescriptors) {
1502
+ super();
1503
+ this.orientation = orientation;
1504
+ this.proportionalLayout = proportionalLayout;
1505
+ this.styles = styles;
1506
+ this.children = [];
1507
+ this._onDidChange = new Emitter();
1508
+ this.onDidChange = this._onDidChange.event;
1509
+ this._childrenDisposable = Disposable.NONE;
1510
+ this._orthogonalSize = orthogonalSize;
1511
+ this._size = size;
1512
+ this.element = document.createElement('div');
1513
+ this.element.className = 'branch-node';
1514
+ if (!childDescriptors) {
1515
+ this.splitview = new Splitview(this.element, {
1516
+ orientation: this.orientation,
1517
+ proportionalLayout,
1518
+ styles,
1519
+ });
1520
+ this.splitview.layout(this.size, this.orthogonalSize);
1521
+ }
1522
+ else {
1523
+ const descriptor = {
1524
+ views: childDescriptors.map((childDescriptor) => {
1525
+ return {
1526
+ view: childDescriptor.node,
1527
+ size: childDescriptor.node.size,
1528
+ visible: childDescriptor.node instanceof LeafNode &&
1529
+ childDescriptor.visible !== undefined
1530
+ ? childDescriptor.visible
1531
+ : true,
1532
+ };
1533
+ }),
1534
+ size: this.size,
1535
+ };
1536
+ this.children = childDescriptors.map((c) => c.node);
1537
+ this.splitview = new Splitview(this.element, {
1538
+ orientation: this.orientation,
1539
+ descriptor,
1540
+ proportionalLayout,
1541
+ });
1542
+ }
1543
+ this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {
1544
+ this._onDidChange.fire({});
1545
+ }));
1546
+ this.setupChildrenEvents();
1547
+ }
1753
1548
  setVisible(visible) {
1754
1549
  for (const child of this.children) {
1755
1550
  child.setVisible(visible);
@@ -1921,20 +1716,18 @@
1921
1716
  if (orientation === directionOrientation) {
1922
1717
  const [rest, _index] = tail(location);
1923
1718
  let index = _index;
1924
- if (direction === exports.Position.Right || direction === exports.Position.Bottom) {
1719
+ if (direction === 'right' || direction === 'bottom') {
1925
1720
  index += 1;
1926
1721
  }
1927
1722
  return [...rest, index];
1928
1723
  }
1929
1724
  else {
1930
- const index = direction === exports.Position.Right || direction === exports.Position.Bottom
1931
- ? 1
1932
- : 0;
1725
+ const index = direction === 'right' || direction === 'bottom' ? 1 : 0;
1933
1726
  return [...location, index];
1934
1727
  }
1935
1728
  }
1936
1729
  function getDirectionOrientation(direction) {
1937
- return direction === exports.Position.Top || direction === exports.Position.Bottom
1730
+ return direction === 'top' || direction === 'bottom'
1938
1731
  ? exports.Orientation.VERTICAL
1939
1732
  : exports.Orientation.HORIZONTAL;
1940
1733
  }
@@ -1969,15 +1762,8 @@
1969
1762
  };
1970
1763
  };
1971
1764
  class Gridview {
1972
- constructor(proportionalLayout, styles, orientation) {
1973
- this.proportionalLayout = proportionalLayout;
1974
- this.styles = styles;
1975
- this.disposable = new MutableDisposable();
1976
- this._onDidChange = new Emitter();
1977
- this.onDidChange = this._onDidChange.event;
1978
- this.element = document.createElement('div');
1979
- this.element.className = 'grid-view';
1980
- this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
1765
+ get length() {
1766
+ return this._root ? this._root.children.length : 0;
1981
1767
  }
1982
1768
  serialize() {
1983
1769
  const root = serializeBranchNode(this.getView(), this.orientation);
@@ -2051,6 +1837,32 @@
2051
1837
  this._onDidChange.fire(e);
2052
1838
  });
2053
1839
  }
1840
+ /**
1841
+ * If the root is orientated as a VERTICAL node then nest the existing root within a new HORIZIONTAL root node
1842
+ * If the root is orientated as a HORIZONTAL node then nest the existing root within a new VERITCAL root node
1843
+ */
1844
+ insertOrthogonalSplitviewAtRoot() {
1845
+ if (!this._root) {
1846
+ return;
1847
+ }
1848
+ const oldRoot = this.root;
1849
+ oldRoot.element.remove();
1850
+ this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size);
1851
+ if (oldRoot.children.length === 1) {
1852
+ // can remove one level of redundant branching if there is only a single child
1853
+ const childReference = oldRoot.children[0];
1854
+ oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
1855
+ oldRoot.dispose();
1856
+ this._root.addChild(childReference, exports.Sizing.Distribute, 0);
1857
+ }
1858
+ else {
1859
+ this._root.addChild(oldRoot, exports.Sizing.Distribute, 0);
1860
+ }
1861
+ this.element.appendChild(this._root.element);
1862
+ this.disposable.value = this._root.onDidChange((e) => {
1863
+ this._onDidChange.fire(e);
1864
+ });
1865
+ }
2054
1866
  next(location) {
2055
1867
  return this.progmaticSelect(location);
2056
1868
  }
@@ -2109,6 +1921,16 @@
2109
1921
  get maximumHeight() {
2110
1922
  return this.root.maximumHeight;
2111
1923
  }
1924
+ constructor(proportionalLayout, styles, orientation) {
1925
+ this.proportionalLayout = proportionalLayout;
1926
+ this.styles = styles;
1927
+ this.disposable = new MutableDisposable();
1928
+ this._onDidChange = new Emitter();
1929
+ this.onDidChange = this._onDidChange.event;
1930
+ this.element = document.createElement('div');
1931
+ this.element.className = 'grid-view';
1932
+ this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
1933
+ }
2112
1934
  isViewVisible(location) {
2113
1935
  const [rest, index] = tail(location);
2114
1936
  const [, parent] = this.getNode(rest);
@@ -2240,9 +2062,6 @@
2240
2062
  }
2241
2063
 
2242
2064
  class SplitviewApi {
2243
- constructor(component) {
2244
- this.component = component;
2245
- }
2246
2065
  get minimumSize() {
2247
2066
  return this.component.minimumSize;
2248
2067
  }
@@ -2276,6 +2095,9 @@
2276
2095
  get onDidRemoveView() {
2277
2096
  return this.component.onDidRemoveView;
2278
2097
  }
2098
+ constructor(component) {
2099
+ this.component = component;
2100
+ }
2279
2101
  updateOptions(options) {
2280
2102
  this.component.updateOptions(options);
2281
2103
  }
@@ -2308,9 +2130,6 @@
2308
2130
  }
2309
2131
  }
2310
2132
  class PaneviewApi {
2311
- constructor(component) {
2312
- this.component = component;
2313
- }
2314
2133
  get minimumSize() {
2315
2134
  return this.component.minimumSize;
2316
2135
  }
@@ -2349,6 +2168,9 @@
2349
2168
  };
2350
2169
  return emitter.event;
2351
2170
  }
2171
+ constructor(component) {
2172
+ this.component = component;
2173
+ }
2352
2174
  removePanel(panel) {
2353
2175
  this.component.removePanel(panel);
2354
2176
  }
@@ -2378,9 +2200,6 @@
2378
2200
  }
2379
2201
  }
2380
2202
  class GridviewApi {
2381
- constructor(component) {
2382
- this.component = component;
2383
- }
2384
2203
  get minimumHeight() {
2385
2204
  return this.component.minimumHeight;
2386
2205
  }
@@ -2423,6 +2242,9 @@
2423
2242
  set orientation(value) {
2424
2243
  this.component.updateOptions({ orientation: value });
2425
2244
  }
2245
+ constructor(component) {
2246
+ this.component = component;
2247
+ }
2426
2248
  focus() {
2427
2249
  this.component.focus();
2428
2250
  }
@@ -2452,8 +2274,8 @@
2452
2274
  }
2453
2275
  }
2454
2276
  class DockviewApi {
2455
- constructor(component) {
2456
- this.component = component;
2277
+ get id() {
2278
+ return this.component.id;
2457
2279
  }
2458
2280
  get width() {
2459
2281
  return this.component.width;
@@ -2518,6 +2340,9 @@
2518
2340
  get activeGroup() {
2519
2341
  return this.component.activeGroup;
2520
2342
  }
2343
+ constructor(component) {
2344
+ this.component = component;
2345
+ }
2521
2346
  getTabHeight() {
2522
2347
  return this.component.tabHeight;
2523
2348
  }
@@ -2536,8 +2361,8 @@
2536
2361
  addPanel(options) {
2537
2362
  return this.component.addPanel(options);
2538
2363
  }
2539
- addEmptyGroup(options) {
2540
- this.component.addEmptyGroup(options);
2364
+ addGroup(options) {
2365
+ return this.component.addGroup(options);
2541
2366
  }
2542
2367
  moveToNext(options) {
2543
2368
  this.component.moveToNext(options);
@@ -2565,7 +2390,293 @@
2565
2390
  }
2566
2391
  }
2567
2392
 
2393
+ class DragAndDropObserver extends CompositeDisposable {
2394
+ constructor(element, callbacks) {
2395
+ super();
2396
+ this.element = element;
2397
+ this.callbacks = callbacks;
2398
+ this.target = null;
2399
+ this.registerListeners();
2400
+ }
2401
+ registerListeners() {
2402
+ this.addDisposables(addDisposableListener(this.element, 'dragenter', (e) => {
2403
+ this.target = e.target;
2404
+ this.callbacks.onDragEnter(e);
2405
+ }, true));
2406
+ this.addDisposables(addDisposableListener(this.element, 'dragover', (e) => {
2407
+ e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)
2408
+ if (this.callbacks.onDragOver) {
2409
+ this.callbacks.onDragOver(e);
2410
+ }
2411
+ }, true));
2412
+ this.addDisposables(addDisposableListener(this.element, 'dragleave', (e) => {
2413
+ if (this.target === e.target) {
2414
+ this.target = null;
2415
+ this.callbacks.onDragLeave(e);
2416
+ }
2417
+ }));
2418
+ this.addDisposables(addDisposableListener(this.element, 'dragend', (e) => {
2419
+ this.target = null;
2420
+ this.callbacks.onDragEnd(e);
2421
+ }));
2422
+ this.addDisposables(addDisposableListener(this.element, 'drop', (e) => {
2423
+ this.callbacks.onDrop(e);
2424
+ }));
2425
+ }
2426
+ }
2427
+
2428
+ function isBooleanValue(value) {
2429
+ return typeof value === 'boolean';
2430
+ }
2431
+
2432
+ function numberOrFallback(maybeNumber, fallback) {
2433
+ return typeof maybeNumber === 'number' ? maybeNumber : fallback;
2434
+ }
2435
+ function directionToPosition(direction) {
2436
+ switch (direction) {
2437
+ case 'above':
2438
+ return 'top';
2439
+ case 'below':
2440
+ return 'bottom';
2441
+ case 'left':
2442
+ return 'left';
2443
+ case 'right':
2444
+ return 'right';
2445
+ case 'within':
2446
+ return 'center';
2447
+ default:
2448
+ throw new Error(`invalid direction '${direction}'`);
2449
+ }
2450
+ }
2451
+ function positionToDirection(position) {
2452
+ switch (position) {
2453
+ case 'top':
2454
+ return 'above';
2455
+ case 'bottom':
2456
+ return 'below';
2457
+ case 'left':
2458
+ return 'left';
2459
+ case 'right':
2460
+ return 'right';
2461
+ case 'center':
2462
+ return 'within';
2463
+ default:
2464
+ throw new Error(`invalid position '${position}'`);
2465
+ }
2466
+ }
2467
+ class Droptarget extends CompositeDisposable {
2468
+ get state() {
2469
+ return this._state;
2470
+ }
2471
+ constructor(element, options) {
2472
+ super();
2473
+ this.element = element;
2474
+ this.options = options;
2475
+ this._onDrop = new Emitter();
2476
+ this.onDrop = this._onDrop.event;
2477
+ // use a set to take advantage of #<set>.has
2478
+ const acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
2479
+ this.addDisposables(this._onDrop, new DragAndDropObserver(this.element, {
2480
+ onDragEnter: () => undefined,
2481
+ onDragOver: (e) => {
2482
+ const width = this.element.clientWidth;
2483
+ const height = this.element.clientHeight;
2484
+ if (width === 0 || height === 0) {
2485
+ return; // avoid div!0
2486
+ }
2487
+ const rect = e.currentTarget.getBoundingClientRect();
2488
+ const x = e.clientX - rect.left;
2489
+ const y = e.clientY - rect.top;
2490
+ const quadrant = this.calculateQuadrant(acceptedTargetZonesSet, x, y, width, height);
2491
+ if (quadrant === null) {
2492
+ // no drop target should be displayed
2493
+ this.removeDropTarget();
2494
+ return;
2495
+ }
2496
+ if (isBooleanValue(this.options.canDisplayOverlay)) {
2497
+ if (!this.options.canDisplayOverlay) {
2498
+ return;
2499
+ }
2500
+ }
2501
+ else if (!this.options.canDisplayOverlay(e, quadrant)) {
2502
+ return;
2503
+ }
2504
+ if (!this.target) {
2505
+ this.target = document.createElement('div');
2506
+ this.target.className = 'drop-target-dropzone';
2507
+ this.overlay = document.createElement('div');
2508
+ this.overlay.className = 'drop-target-selection';
2509
+ this._state = 'center';
2510
+ this.target.appendChild(this.overlay);
2511
+ this.element.classList.add('drop-target');
2512
+ this.element.append(this.target);
2513
+ }
2514
+ if (this.options.acceptedTargetZones.length === 0) {
2515
+ return;
2516
+ }
2517
+ if (!this.target || !this.overlay) {
2518
+ return;
2519
+ }
2520
+ this.toggleClasses(quadrant, width, height);
2521
+ this.setState(quadrant);
2522
+ },
2523
+ onDragLeave: () => {
2524
+ this.removeDropTarget();
2525
+ },
2526
+ onDragEnd: () => {
2527
+ this.removeDropTarget();
2528
+ },
2529
+ onDrop: (e) => {
2530
+ e.preventDefault();
2531
+ e.stopPropagation();
2532
+ const state = this._state;
2533
+ this.removeDropTarget();
2534
+ if (state) {
2535
+ this._onDrop.fire({ position: state, nativeEvent: e });
2536
+ }
2537
+ },
2538
+ }));
2539
+ }
2540
+ dispose() {
2541
+ this.removeDropTarget();
2542
+ }
2543
+ toggleClasses(quadrant, width, height) {
2544
+ var _a, _b, _c, _d;
2545
+ if (!this.overlay) {
2546
+ return;
2547
+ }
2548
+ const isSmallX = width < 100;
2549
+ const isSmallY = height < 100;
2550
+ const isLeft = quadrant === 'left';
2551
+ const isRight = quadrant === 'right';
2552
+ const isTop = quadrant === 'top';
2553
+ const isBottom = quadrant === 'bottom';
2554
+ const rightClass = !isSmallX && isRight;
2555
+ const leftClass = !isSmallX && isLeft;
2556
+ const topClass = !isSmallY && isTop;
2557
+ const bottomClass = !isSmallY && isBottom;
2558
+ let size = 0.5;
2559
+ if (((_b = (_a = this.options.overlayModel) === null || _a === void 0 ? void 0 : _a.size) === null || _b === void 0 ? void 0 : _b.type) === 'percentage') {
2560
+ size = clamp(this.options.overlayModel.size.value, 0, 100) / 100;
2561
+ }
2562
+ if (((_d = (_c = this.options.overlayModel) === null || _c === void 0 ? void 0 : _c.size) === null || _d === void 0 ? void 0 : _d.type) === 'pixels') {
2563
+ if (rightClass || leftClass) {
2564
+ size =
2565
+ clamp(0, this.options.overlayModel.size.value, width) /
2566
+ width;
2567
+ }
2568
+ if (topClass || bottomClass) {
2569
+ size =
2570
+ clamp(0, this.options.overlayModel.size.value, height) /
2571
+ height;
2572
+ }
2573
+ }
2574
+ const translate = (1 - size) / 2;
2575
+ const scale = size;
2576
+ let transform;
2577
+ if (rightClass) {
2578
+ transform = `translateX(${100 * translate}%) scaleX(${scale})`;
2579
+ }
2580
+ else if (leftClass) {
2581
+ transform = `translateX(-${100 * translate}%) scaleX(${scale})`;
2582
+ }
2583
+ else if (topClass) {
2584
+ transform = `translateY(-${100 * translate}%) scaleY(${scale})`;
2585
+ }
2586
+ else if (bottomClass) {
2587
+ transform = `translateY(${100 * translate}%) scaleY(${scale})`;
2588
+ }
2589
+ else {
2590
+ transform = '';
2591
+ }
2592
+ this.overlay.style.transform = transform;
2593
+ toggleClass(this.overlay, 'small-right', isSmallX && isRight);
2594
+ toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
2595
+ toggleClass(this.overlay, 'small-top', isSmallY && isTop);
2596
+ toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
2597
+ }
2598
+ setState(quadrant) {
2599
+ switch (quadrant) {
2600
+ case 'top':
2601
+ this._state = 'top';
2602
+ break;
2603
+ case 'left':
2604
+ this._state = 'left';
2605
+ break;
2606
+ case 'bottom':
2607
+ this._state = 'bottom';
2608
+ break;
2609
+ case 'right':
2610
+ this._state = 'right';
2611
+ break;
2612
+ case 'center':
2613
+ this._state = 'center';
2614
+ break;
2615
+ }
2616
+ }
2617
+ calculateQuadrant(overlayType, x, y, width, height) {
2618
+ var _a, _b, _c, _d, _e, _f;
2619
+ const isPercentage = ((_a = this.options.overlayModel) === null || _a === void 0 ? void 0 : _a.activationSize) === undefined ||
2620
+ ((_c = (_b = this.options.overlayModel) === null || _b === void 0 ? void 0 : _b.activationSize) === null || _c === void 0 ? void 0 : _c.type) === 'percentage';
2621
+ 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);
2622
+ if (isPercentage) {
2623
+ return calculateQuadrantAsPercentage(overlayType, x, y, width, height, value);
2624
+ }
2625
+ return calculateQuadrantAsPixels(overlayType, x, y, width, height, value);
2626
+ }
2627
+ removeDropTarget() {
2628
+ if (this.target) {
2629
+ this._state = undefined;
2630
+ this.element.removeChild(this.target);
2631
+ this.target = undefined;
2632
+ this.overlay = undefined;
2633
+ this.element.classList.remove('drop-target');
2634
+ }
2635
+ }
2636
+ }
2637
+ function calculateQuadrantAsPercentage(overlayType, x, y, width, height, threshold) {
2638
+ const xp = (100 * x) / width;
2639
+ const yp = (100 * y) / height;
2640
+ if (overlayType.has('left') && xp < threshold) {
2641
+ return 'left';
2642
+ }
2643
+ if (overlayType.has('right') && xp > 100 - threshold) {
2644
+ return 'right';
2645
+ }
2646
+ if (overlayType.has('top') && yp < threshold) {
2647
+ return 'top';
2648
+ }
2649
+ if (overlayType.has('bottom') && yp > 100 - threshold) {
2650
+ return 'bottom';
2651
+ }
2652
+ if (!overlayType.has('center')) {
2653
+ return null;
2654
+ }
2655
+ return 'center';
2656
+ }
2657
+ function calculateQuadrantAsPixels(overlayType, x, y, width, height, threshold) {
2658
+ if (overlayType.has('left') && x < threshold) {
2659
+ return 'left';
2660
+ }
2661
+ if (overlayType.has('right') && x > width - threshold) {
2662
+ return 'right';
2663
+ }
2664
+ if (overlayType.has('top') && y < threshold) {
2665
+ return 'top';
2666
+ }
2667
+ if (overlayType.has('bottom') && y > height - threshold) {
2668
+ return 'bottom';
2669
+ }
2670
+ if (!overlayType.has('center')) {
2671
+ return null;
2672
+ }
2673
+ return 'center';
2674
+ }
2675
+
2568
2676
  class ContentContainer extends CompositeDisposable {
2677
+ get element() {
2678
+ return this._element;
2679
+ }
2569
2680
  constructor() {
2570
2681
  super();
2571
2682
  this.disposable = new MutableDisposable();
@@ -2583,9 +2694,6 @@
2583
2694
  // 3) register dragEnd events
2584
2695
  // 4) register mouseMove events (if no buttons are present we take this as a dragEnd event)
2585
2696
  }
2586
- get element() {
2587
- return this._element;
2588
- }
2589
2697
  show() {
2590
2698
  this.element.style.display = '';
2591
2699
  }
@@ -2641,6 +2749,7 @@
2641
2749
  DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
2642
2750
  DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
2643
2751
  DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
2752
+ DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
2644
2753
  })(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
2645
2754
 
2646
2755
  class DragHandler extends CompositeDisposable {
@@ -2662,9 +2771,9 @@
2662
2771
  for (const iframe of this.iframes) {
2663
2772
  iframe.style.pointerEvents = 'none';
2664
2773
  }
2665
- this.el.classList.add('dragged');
2666
- setTimeout(() => this.el.classList.remove('dragged'), 0);
2667
- this.disposable.value = this.getData();
2774
+ this.el.classList.add('dv-dragged');
2775
+ setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
2776
+ this.disposable.value = this.getData(event.dataTransfer);
2668
2777
  if (event.dataTransfer) {
2669
2778
  event.dataTransfer.effectAllowed = 'move';
2670
2779
  }
@@ -2678,11 +2787,10 @@
2678
2787
  }
2679
2788
  }
2680
2789
 
2681
- exports.MouseEventKind = void 0;
2682
- (function (MouseEventKind) {
2683
- MouseEventKind["CLICK"] = "CLICK";
2684
- })(exports.MouseEventKind || (exports.MouseEventKind = {}));
2685
2790
  class Tab extends CompositeDisposable {
2791
+ get element() {
2792
+ return this._element;
2793
+ }
2686
2794
  constructor(panelId, accessor, group) {
2687
2795
  super();
2688
2796
  this.panelId = panelId;
@@ -2726,25 +2834,30 @@
2726
2834
  * on the tabs-container. I cannot use event.preventDefault() since I need the on DragStart event to occur
2727
2835
  */
2728
2836
  event.stopPropagation();
2729
- this._onChanged.fire({ kind: exports.MouseEventKind.CLICK, event });
2837
+ this._onChanged.fire(event);
2730
2838
  }));
2731
2839
  this.droptarget = new Droptarget(this._element, {
2732
- validOverlays: 'none',
2733
- canDisplayOverlay: (event) => {
2840
+ acceptedTargetZones: ['center'],
2841
+ canDisplayOverlay: (event, position) => {
2842
+ if (this.group.locked) {
2843
+ return false;
2844
+ }
2734
2845
  const data = getPanelData();
2735
2846
  if (data && this.accessor.id === data.viewId) {
2847
+ if (data.panelId === null &&
2848
+ data.groupId === this.group.id) {
2849
+ // don't allow group move to drop on self
2850
+ return false;
2851
+ }
2736
2852
  return this.panelId !== data.panelId;
2737
2853
  }
2738
- return this.group.model.canDisplayOverlay(event, exports.DockviewDropTargets.Tab);
2854
+ return this.group.model.canDisplayOverlay(event, position, exports.DockviewDropTargets.Tab);
2739
2855
  },
2740
2856
  });
2741
2857
  this.addDisposables(this.droptarget.onDrop((event) => {
2742
2858
  this._onDropped.fire(event);
2743
2859
  }));
2744
2860
  }
2745
- get element() {
2746
- return this._element;
2747
- }
2748
2861
  setActive(isActive) {
2749
2862
  toggleClass(this.element, 'active-tab', isActive);
2750
2863
  toggleClass(this.element, 'inactive-tab', !isActive);
@@ -2762,56 +2875,94 @@
2762
2875
  }
2763
2876
  }
2764
2877
 
2765
- class TabsContainer extends CompositeDisposable {
2766
- constructor(accessor, group, options) {
2878
+ function addGhostImage(dataTransfer, ghostElement) {
2879
+ // class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
2880
+ addClasses(ghostElement, 'dv-dragged');
2881
+ document.body.appendChild(ghostElement);
2882
+ dataTransfer.setDragImage(ghostElement, 0, 0);
2883
+ setTimeout(() => {
2884
+ ghostElement.remove();
2885
+ }, 0);
2886
+ }
2887
+
2888
+ class GroupDragHandler extends DragHandler {
2889
+ constructor(element, accessorId, group) {
2890
+ super(element);
2891
+ this.accessorId = accessorId;
2892
+ this.group = group;
2893
+ this.panelTransfer = LocalSelectionTransfer.getInstance();
2894
+ }
2895
+ getData(dataTransfer) {
2896
+ this.panelTransfer.setData([new PanelTransfer(this.accessorId, this.group.id, null)], PanelTransfer.prototype);
2897
+ const style = window.getComputedStyle(this.el);
2898
+ const bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
2899
+ const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
2900
+ if (dataTransfer) {
2901
+ const ghostElement = document.createElement('div');
2902
+ ghostElement.style.backgroundColor = bgColor;
2903
+ ghostElement.style.color = color;
2904
+ ghostElement.style.padding = '2px 8px';
2905
+ ghostElement.style.height = '24px';
2906
+ ghostElement.style.fontSize = '11px';
2907
+ ghostElement.style.lineHeight = '20px';
2908
+ ghostElement.style.borderRadius = '12px';
2909
+ ghostElement.style.position = 'absolute';
2910
+ ghostElement.textContent = `Multiple Panels (${this.group.size})`;
2911
+ addGhostImage(dataTransfer, ghostElement);
2912
+ }
2913
+ return {
2914
+ dispose: () => {
2915
+ this.panelTransfer.clearData(PanelTransfer.prototype);
2916
+ },
2917
+ };
2918
+ }
2919
+ dispose() {
2920
+ //
2921
+ }
2922
+ }
2923
+
2924
+ class VoidContainer extends CompositeDisposable {
2925
+ get element() {
2926
+ return this._element;
2927
+ }
2928
+ constructor(accessor, group) {
2767
2929
  super();
2768
2930
  this.accessor = accessor;
2769
2931
  this.group = group;
2770
- this.tabs = [];
2771
- this.selectedIndex = -1;
2772
- this._hidden = false;
2773
2932
  this._onDrop = new Emitter();
2774
2933
  this.onDrop = this._onDrop.event;
2775
- this.addDisposables(this._onDrop);
2776
2934
  this._element = document.createElement('div');
2777
- this._element.className = 'tabs-and-actions-container';
2778
- this.height = options.tabHeight;
2779
- this.actionContainer = document.createElement('div');
2780
- this.actionContainer.className = 'action-container';
2781
- this.tabContainer = document.createElement('div');
2782
- this.tabContainer.className = 'tabs-container';
2783
- this.voidContainer = document.createElement('div');
2784
- this.voidContainer.className = 'void-container';
2785
- this._element.appendChild(this.tabContainer);
2786
- this._element.appendChild(this.voidContainer);
2787
- this._element.appendChild(this.actionContainer);
2788
- this.voidDropTarget = new Droptarget(this.voidContainer, {
2789
- validOverlays: 'none',
2790
- canDisplayOverlay: (event) => {
2935
+ this._element.className = 'void-container';
2936
+ this._element.tabIndex = 0;
2937
+ this._element.draggable = true;
2938
+ this.addDisposables(this._onDrop, addDisposableListener(this._element, 'click', () => {
2939
+ this.accessor.doSetGroupActive(this.group);
2940
+ }));
2941
+ const handler = new GroupDragHandler(this._element, accessor.id, group);
2942
+ this.voidDropTarget = new Droptarget(this._element, {
2943
+ acceptedTargetZones: ['center'],
2944
+ canDisplayOverlay: (event, position) => {
2791
2945
  var _a;
2792
2946
  const data = getPanelData();
2793
2947
  if (data && this.accessor.id === data.viewId) {
2948
+ if (data.panelId === null &&
2949
+ data.groupId === this.group.id) {
2950
+ // don't allow group move to drop on self
2951
+ return false;
2952
+ }
2794
2953
  // don't show the overlay if the tab being dragged is the last panel of this group
2795
- return ((_a = last(this.tabs)) === null || _a === void 0 ? void 0 : _a.value.panelId) !== data.panelId;
2954
+ return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
2796
2955
  }
2797
- return group.model.canDisplayOverlay(event, exports.DockviewDropTargets.Panel);
2956
+ return group.model.canDisplayOverlay(event, position, exports.DockviewDropTargets.Panel);
2798
2957
  },
2799
2958
  });
2800
- this.addDisposables(this.voidDropTarget.onDrop((event) => {
2801
- this._onDrop.fire({
2802
- event: event.nativeEvent,
2803
- index: this.tabs.length,
2804
- });
2805
- }), this.voidDropTarget, addDisposableListener(this.tabContainer, 'mousedown', (event) => {
2806
- if (event.defaultPrevented) {
2807
- return;
2808
- }
2809
- const isLeftClick = event.button === 0;
2810
- if (isLeftClick) {
2811
- this.accessor.doSetGroupActive(this.group);
2812
- }
2813
- }));
2959
+ this.addDisposables(handler, this.voidDropTarget.onDrop((event) => {
2960
+ this._onDrop.fire(event);
2961
+ }), this.voidDropTarget);
2814
2962
  }
2963
+ }
2964
+
2965
+ class TabsContainer extends CompositeDisposable {
2815
2966
  get panels() {
2816
2967
  return this.tabs.map((_) => _.value.panelId);
2817
2968
  }
@@ -2872,6 +3023,52 @@
2872
3023
  indexOf(id) {
2873
3024
  return this.tabs.findIndex((tab) => tab.value.panelId === id);
2874
3025
  }
3026
+ constructor(accessor, group) {
3027
+ super();
3028
+ this.accessor = accessor;
3029
+ this.group = group;
3030
+ this.tabs = [];
3031
+ this.selectedIndex = -1;
3032
+ this._hidden = false;
3033
+ this._onDrop = new Emitter();
3034
+ this.onDrop = this._onDrop.event;
3035
+ this.addDisposables(this._onDrop);
3036
+ this._element = document.createElement('div');
3037
+ this._element.className = 'tabs-and-actions-container';
3038
+ this.height = accessor.options.tabHeight;
3039
+ toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
3040
+ this.addDisposables(this.accessor.onDidAddPanel((e) => {
3041
+ if (e.api.group === this.group) {
3042
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
3043
+ }
3044
+ }), this.accessor.onDidRemovePanel((e) => {
3045
+ if (e.api.group === this.group) {
3046
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
3047
+ }
3048
+ }));
3049
+ this.actionContainer = document.createElement('div');
3050
+ this.actionContainer.className = 'action-container';
3051
+ this.tabContainer = document.createElement('div');
3052
+ this.tabContainer.className = 'tabs-container';
3053
+ this.voidContainer = new VoidContainer(this.accessor, this.group);
3054
+ this._element.appendChild(this.tabContainer);
3055
+ this._element.appendChild(this.voidContainer.element);
3056
+ this._element.appendChild(this.actionContainer);
3057
+ this.addDisposables(this.voidContainer, this.voidContainer.onDrop((event) => {
3058
+ this._onDrop.fire({
3059
+ event: event.nativeEvent,
3060
+ index: this.tabs.length,
3061
+ });
3062
+ }), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
3063
+ if (event.defaultPrevented) {
3064
+ return;
3065
+ }
3066
+ const isLeftClick = event.button === 0;
3067
+ if (isLeftClick) {
3068
+ this.accessor.doSetGroupActive(this.group);
3069
+ }
3070
+ }));
3071
+ }
2875
3072
  setActive(_isGroupActive) {
2876
3073
  // noop
2877
3074
  }
@@ -2916,15 +3113,13 @@
2916
3113
  var _a;
2917
3114
  const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
2918
3115
  this.group.model.isContentFocused;
2919
- const isLeftClick = event.event.button === 0;
2920
- if (!isLeftClick || event.event.defaultPrevented) {
3116
+ const isLeftClick = event.button === 0;
3117
+ if (!isLeftClick || event.defaultPrevented) {
2921
3118
  return;
2922
3119
  }
2923
- if (event.kind === exports.MouseEventKind.CLICK) {
2924
- this.group.model.openPanel(panel, {
2925
- skipFocus: alreadyFocused,
2926
- });
2927
- }
3120
+ this.group.model.openPanel(panel, {
3121
+ skipFocus: alreadyFocused,
3122
+ });
2928
3123
  }), tabToAdd.onDrop((event) => {
2929
3124
  this._onDrop.fire({
2930
3125
  event: event.nativeEvent,
@@ -2947,63 +3142,6 @@
2947
3142
  }
2948
3143
 
2949
3144
  class Groupview extends CompositeDisposable {
2950
- constructor(container, accessor, id, options, parent) {
2951
- super();
2952
- this.container = container;
2953
- this.accessor = accessor;
2954
- this.id = id;
2955
- this.options = options;
2956
- this.parent = parent;
2957
- this._isGroupActive = false;
2958
- this._locked = false;
2959
- this.mostRecentlyUsed = [];
2960
- this._onDidChange = new Emitter();
2961
- this.onDidChange = this._onDidChange.event;
2962
- this._width = 0;
2963
- this._height = 0;
2964
- this._panels = [];
2965
- this._onMove = new Emitter();
2966
- this.onMove = this._onMove.event;
2967
- this._onDidDrop = new Emitter();
2968
- this.onDidDrop = this._onDidDrop.event;
2969
- this._onDidAddPanel = new Emitter();
2970
- this.onDidAddPanel = this._onDidAddPanel.event;
2971
- this._onDidRemovePanel = new Emitter();
2972
- this.onDidRemovePanel = this._onDidRemovePanel.event;
2973
- this._onDidActivePanelChange = new Emitter();
2974
- this.onDidActivePanelChange = this._onDidActivePanelChange.event;
2975
- this.container.classList.add('groupview');
2976
- this.tabsContainer = new TabsContainer(this.accessor, this.parent, {
2977
- tabHeight: options.tabHeight,
2978
- });
2979
- this.contentContainer = new ContentContainer();
2980
- this.dropTarget = new Droptarget(this.contentContainer.element, {
2981
- validOverlays: 'all',
2982
- canDisplayOverlay: (event, quadrant) => {
2983
- if (this.locked && !quadrant) {
2984
- return false;
2985
- }
2986
- const data = getPanelData();
2987
- if (data && data.viewId === this.accessor.id) {
2988
- const groupHasOnePanelAndIsActiveDragElement = this._panels.length === 1 && data.groupId === this.id;
2989
- return !groupHasOnePanelAndIsActiveDragElement;
2990
- }
2991
- return this.canDisplayOverlay(event, exports.DockviewDropTargets.Panel);
2992
- },
2993
- });
2994
- container.append(this.tabsContainer.element, this.contentContainer.element);
2995
- this.header.hidden = !!options.hideHeader;
2996
- this.locked = !!options.locked;
2997
- this.addDisposables(this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this.tabsContainer.onDrop((event) => {
2998
- this.handleDropEvent(event.event, exports.Position.Center, event.index);
2999
- }), this.contentContainer.onDidFocus(() => {
3000
- this.accessor.doSetGroupActive(this.parent, true);
3001
- }), this.contentContainer.onDidBlur(() => {
3002
- // noop
3003
- }), this.dropTarget.onDrop((event) => {
3004
- this.handleDropEvent(event.nativeEvent, event.position);
3005
- }));
3006
- }
3007
3145
  get element() {
3008
3146
  throw new Error('not supported');
3009
3147
  }
@@ -3015,6 +3153,7 @@
3015
3153
  }
3016
3154
  set locked(value) {
3017
3155
  this._locked = value;
3156
+ toggleClass(this.container, 'locked-groupview', value);
3018
3157
  }
3019
3158
  get isActive() {
3020
3159
  return this._isGroupActive;
@@ -3052,6 +3191,71 @@
3052
3191
  }
3053
3192
  return isAncestor(document.activeElement, this.contentContainer.element);
3054
3193
  }
3194
+ constructor(container, accessor, id, options, groupPanel) {
3195
+ super();
3196
+ this.container = container;
3197
+ this.accessor = accessor;
3198
+ this.id = id;
3199
+ this.options = options;
3200
+ this.groupPanel = groupPanel;
3201
+ this._isGroupActive = false;
3202
+ this._locked = false;
3203
+ this.mostRecentlyUsed = [];
3204
+ this._onDidChange = new Emitter();
3205
+ this.onDidChange = this._onDidChange.event;
3206
+ this._width = 0;
3207
+ this._height = 0;
3208
+ this._panels = [];
3209
+ this._onMove = new Emitter();
3210
+ this.onMove = this._onMove.event;
3211
+ this._onDidDrop = new Emitter();
3212
+ this.onDidDrop = this._onDidDrop.event;
3213
+ this._onDidAddPanel = new Emitter();
3214
+ this.onDidAddPanel = this._onDidAddPanel.event;
3215
+ this._onDidRemovePanel = new Emitter();
3216
+ this.onDidRemovePanel = this._onDidRemovePanel.event;
3217
+ this._onDidActivePanelChange = new Emitter();
3218
+ this.onDidActivePanelChange = this._onDidActivePanelChange.event;
3219
+ this.container.classList.add('groupview');
3220
+ this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
3221
+ this.contentContainer = new ContentContainer();
3222
+ this.dropTarget = new Droptarget(this.contentContainer.element, {
3223
+ acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
3224
+ canDisplayOverlay: (event, position) => {
3225
+ if (this.locked && position === 'center') {
3226
+ return false;
3227
+ }
3228
+ const data = getPanelData();
3229
+ if (data && data.viewId === this.accessor.id) {
3230
+ if (data.groupId === this.id) {
3231
+ if (position === 'center') {
3232
+ // don't allow to drop on self for center position
3233
+ return false;
3234
+ }
3235
+ if (data.panelId === null) {
3236
+ // don't allow group move to drop anywhere on self
3237
+ return false;
3238
+ }
3239
+ }
3240
+ const groupHasOnePanelAndIsActiveDragElement = this._panels.length === 1 && data.groupId === this.id;
3241
+ return !groupHasOnePanelAndIsActiveDragElement;
3242
+ }
3243
+ return this.canDisplayOverlay(event, position, exports.DockviewDropTargets.Panel);
3244
+ },
3245
+ });
3246
+ container.append(this.tabsContainer.element, this.contentContainer.element);
3247
+ this.header.hidden = !!options.hideHeader;
3248
+ this.locked = !!options.locked;
3249
+ this.addDisposables(this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this.tabsContainer.onDrop((event) => {
3250
+ this.handleDropEvent(event.event, 'center', event.index);
3251
+ }), this.contentContainer.onDidFocus(() => {
3252
+ this.accessor.doSetGroupActive(this.groupPanel, true);
3253
+ }), this.contentContainer.onDidBlur(() => {
3254
+ // noop
3255
+ }), this.dropTarget.onDrop((event) => {
3256
+ this.handleDropEvent(event.nativeEvent, event.position);
3257
+ }));
3258
+ }
3055
3259
  initialize() {
3056
3260
  var _a, _b;
3057
3261
  if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
@@ -3067,11 +3271,11 @@
3067
3271
  this.setActive(this.isActive, true, true);
3068
3272
  this.updateContainer();
3069
3273
  if (this.accessor.options.createGroupControlElement) {
3070
- this._control = this.accessor.options.createGroupControlElement(this.parent);
3274
+ this._control = this.accessor.options.createGroupControlElement(this.groupPanel);
3071
3275
  this.addDisposables(this._control);
3072
3276
  this._control.init({
3073
3277
  containerApi: new DockviewApi(this.accessor),
3074
- api: this.parent.api,
3278
+ api: this.groupPanel.api,
3075
3279
  });
3076
3280
  this.tabsContainer.setActionElement(this._control.element);
3077
3281
  }
@@ -3158,10 +3362,10 @@
3158
3362
  const skipSetPanelActive = !!options.skipSetPanelActive;
3159
3363
  const skipSetGroupActive = !!options.skipSetGroupActive;
3160
3364
  // ensure the group is updated before we fire any events
3161
- panel.updateParentGroup(this.parent, true);
3365
+ panel.updateParentGroup(this.groupPanel, true);
3162
3366
  if (this._activePanel === panel) {
3163
3367
  if (!skipSetGroupActive) {
3164
- this.accessor.doSetGroupActive(this.parent);
3368
+ this.accessor.doSetGroupActive(this.groupPanel);
3165
3369
  }
3166
3370
  return;
3167
3371
  }
@@ -3170,7 +3374,7 @@
3170
3374
  this.doSetActivePanel(panel);
3171
3375
  }
3172
3376
  if (!skipSetGroupActive) {
3173
- this.accessor.doSetGroupActive(this.parent, !!options.skipFocus);
3377
+ this.accessor.doSetGroupActive(this.groupPanel, !!options.skipFocus);
3174
3378
  }
3175
3379
  this.updateContainer();
3176
3380
  }
@@ -3193,7 +3397,7 @@
3193
3397
  }
3194
3398
  }
3195
3399
  else {
3196
- this.accessor.removeGroup(this.parent);
3400
+ this.accessor.removeGroup(this.groupPanel);
3197
3401
  }
3198
3402
  }
3199
3403
  closePanel(panel) {
@@ -3298,7 +3502,7 @@
3298
3502
  }
3299
3503
  updateContainer() {
3300
3504
  toggleClass(this.container, 'empty', this.isEmpty);
3301
- this.panels.forEach((panel) => panel.updateParentGroup(this.parent, this.isActive));
3505
+ this.panels.forEach((panel) => panel.updateParentGroup(this.groupPanel, this.isActive));
3302
3506
  if (this.isEmpty && !this.watermark) {
3303
3507
  const watermark = this.accessor.createWatermarkComponent();
3304
3508
  watermark.init({
@@ -3310,29 +3514,28 @@
3310
3514
  this.watermark = watermark;
3311
3515
  addDisposableListener(this.watermark.element, 'click', () => {
3312
3516
  if (!this.isActive) {
3313
- this.accessor.doSetGroupActive(this.parent);
3517
+ this.accessor.doSetGroupActive(this.groupPanel);
3314
3518
  }
3315
3519
  });
3316
- this.contentContainer.hide();
3317
3520
  this.tabsContainer.hide();
3318
- this.container.appendChild(this.watermark.element);
3319
- this.watermark.updateParentGroup(this.parent, true);
3521
+ this.contentContainer.element.appendChild(this.watermark.element);
3522
+ this.watermark.updateParentGroup(this.groupPanel, true);
3320
3523
  }
3321
3524
  if (!this.isEmpty && this.watermark) {
3322
3525
  this.watermark.element.remove();
3323
3526
  this.watermark.dispose();
3324
3527
  this.watermark = undefined;
3325
- this.contentContainer.show();
3326
3528
  this.tabsContainer.show();
3327
3529
  }
3328
3530
  }
3329
- canDisplayOverlay(event, target) {
3531
+ canDisplayOverlay(event, position, target) {
3330
3532
  // custom overlay handler
3331
3533
  if (this.accessor.options.showDndOverlay) {
3332
3534
  return this.accessor.options.showDndOverlay({
3333
3535
  nativeEvent: event,
3334
3536
  target,
3335
3537
  group: this.accessor.getPanel(this.id),
3538
+ position,
3336
3539
  getData: getPanelData,
3337
3540
  });
3338
3541
  }
@@ -3340,7 +3543,17 @@
3340
3543
  }
3341
3544
  handleDropEvent(event, position, index) {
3342
3545
  const data = getPanelData();
3343
- if (data) {
3546
+ if (data && data.viewId === this.accessor.id) {
3547
+ if (data.panelId === null) {
3548
+ // this is a group move dnd event
3549
+ const { groupId } = data;
3550
+ this._onMove.fire({
3551
+ target: position,
3552
+ groupId: groupId,
3553
+ index,
3554
+ });
3555
+ return;
3556
+ }
3344
3557
  const fromSameGroup = this.tabsContainer.indexOf(data.panelId) !== -1;
3345
3558
  if (fromSameGroup && this.tabsContainer.size === 1) {
3346
3559
  return;
@@ -3386,45 +3599,19 @@
3386
3599
  function toTarget(direction) {
3387
3600
  switch (direction) {
3388
3601
  case 'left':
3389
- return exports.Position.Left;
3602
+ return 'left';
3390
3603
  case 'right':
3391
- return exports.Position.Right;
3604
+ return 'right';
3392
3605
  case 'above':
3393
- return exports.Position.Top;
3606
+ return 'top';
3394
3607
  case 'below':
3395
- return exports.Position.Bottom;
3608
+ return 'bottom';
3396
3609
  case 'within':
3397
3610
  default:
3398
- return exports.Position.Center;
3611
+ return 'center';
3399
3612
  }
3400
3613
  }
3401
3614
  class BaseGrid extends CompositeDisposable {
3402
- constructor(_element, options) {
3403
- super();
3404
- this._element = _element;
3405
- this._id = nextLayoutId$1.next();
3406
- this._groups = new Map();
3407
- this._onDidLayoutChange = new Emitter();
3408
- this.onDidLayoutChange = this._onDidLayoutChange.event;
3409
- this._onDidRemoveGroup = new Emitter();
3410
- this.onDidRemoveGroup = this._onDidRemoveGroup.event;
3411
- this._onDidAddGroup = new Emitter();
3412
- this.onDidAddGroup = this._onDidAddGroup.event;
3413
- this._onDidActiveGroupChange = new Emitter();
3414
- this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3415
- this._bufferOnDidLayoutChange = new TickDelayedEvent();
3416
- this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
3417
- this.element.appendChild(this.gridview.element);
3418
- this.layout(0, 0, true); // set some elements height/widths
3419
- this.addDisposables(this.gridview.onDidChange(() => {
3420
- this._bufferOnDidLayoutChange.fire();
3421
- }));
3422
- this.addDisposables(exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
3423
- this._bufferOnDidLayoutChange.fire();
3424
- }), this._bufferOnDidLayoutChange.onEvent(() => {
3425
- this._onDidLayoutChange.fire();
3426
- }), this._bufferOnDidLayoutChange);
3427
- }
3428
3615
  get id() {
3429
3616
  return this._id;
3430
3617
  }
@@ -3458,6 +3645,32 @@
3458
3645
  get activeGroup() {
3459
3646
  return this._activeGroup;
3460
3647
  }
3648
+ constructor(_element, options) {
3649
+ super();
3650
+ this._element = _element;
3651
+ this._id = nextLayoutId$1.next();
3652
+ this._groups = new Map();
3653
+ this._onDidLayoutChange = new Emitter();
3654
+ this.onDidLayoutChange = this._onDidLayoutChange.event;
3655
+ this._onDidRemoveGroup = new Emitter();
3656
+ this.onDidRemoveGroup = this._onDidRemoveGroup.event;
3657
+ this._onDidAddGroup = new Emitter();
3658
+ this.onDidAddGroup = this._onDidAddGroup.event;
3659
+ this._onDidActiveGroupChange = new Emitter();
3660
+ this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3661
+ this._bufferOnDidLayoutChange = new TickDelayedEvent();
3662
+ this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
3663
+ this.element.appendChild(this.gridview.element);
3664
+ this.layout(0, 0, true); // set some elements height/widths
3665
+ this.addDisposables(this.gridview.onDidChange(() => {
3666
+ this._bufferOnDidLayoutChange.fire();
3667
+ }));
3668
+ this.addDisposables(exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
3669
+ this._bufferOnDidLayoutChange.fire();
3670
+ }), this._bufferOnDidLayoutChange.onEvent(() => {
3671
+ this._onDidLayoutChange.fire();
3672
+ }), this._bufferOnDidLayoutChange);
3673
+ }
3461
3674
  setVisible(panel, visible) {
3462
3675
  this.gridview.setViewVisible(getGridLocation(panel.element), visible);
3463
3676
  this._onDidLayoutChange.fire();
@@ -3566,10 +3779,51 @@
3566
3779
  }
3567
3780
  }
3568
3781
 
3782
+ function isPanelOptionsWithPanel(data) {
3783
+ if (data.referencePanel) {
3784
+ return true;
3785
+ }
3786
+ return false;
3787
+ }
3788
+ function isPanelOptionsWithGroup(data) {
3789
+ if (data.referenceGroup) {
3790
+ return true;
3791
+ }
3792
+ return false;
3793
+ }
3794
+ function isGroupOptionsWithPanel(data) {
3795
+ if (data.referencePanel) {
3796
+ return true;
3797
+ }
3798
+ return false;
3799
+ }
3800
+ function isGroupOptionsWithGroup(data) {
3801
+ if (data.referenceGroup) {
3802
+ return true;
3803
+ }
3804
+ return false;
3805
+ }
3806
+
3569
3807
  /**
3570
3808
  * A core api implementation that should be used across all panel-like objects
3571
3809
  */
3572
3810
  class PanelApiImpl extends CompositeDisposable {
3811
+ //
3812
+ get isFocused() {
3813
+ return this._isFocused;
3814
+ }
3815
+ get isActive() {
3816
+ return this._isActive;
3817
+ }
3818
+ get isVisible() {
3819
+ return this._isVisible;
3820
+ }
3821
+ get width() {
3822
+ return this._width;
3823
+ }
3824
+ get height() {
3825
+ return this._height;
3826
+ }
3573
3827
  constructor(id) {
3574
3828
  super();
3575
3829
  this.id = id;
@@ -3578,6 +3832,7 @@
3578
3832
  this._isVisible = true;
3579
3833
  this._width = 0;
3580
3834
  this._height = 0;
3835
+ this.panelUpdatesDisposable = new MutableDisposable();
3581
3836
  this._onDidDimensionChange = new Emitter({
3582
3837
  replay: true,
3583
3838
  });
@@ -3606,32 +3861,28 @@
3606
3861
  //
3607
3862
  this._onActiveChange = new Emitter();
3608
3863
  this.onActiveChange = this._onActiveChange.event;
3609
- this.addDisposables(this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this.onDidFocusChange((event) => {
3864
+ //
3865
+ this._onUpdateParameters = new Emitter();
3866
+ this.onUpdateParameters = this._onUpdateParameters.event;
3867
+ this.addDisposables(this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this._onUpdateParameters, this.onDidFocusChange((event) => {
3610
3868
  this._isFocused = event.isFocused;
3611
3869
  }), this.onDidActiveChange((event) => {
3612
3870
  this._isActive = event.isActive;
3613
3871
  }), this.onDidVisibilityChange((event) => {
3614
3872
  this._isVisible = event.isVisible;
3615
- }), this.onDidDimensionsChange((event) => {
3616
- this._width = event.width;
3617
- this._height = event.height;
3618
- }));
3619
- }
3620
- //
3621
- get isFocused() {
3622
- return this._isFocused;
3623
- }
3624
- get isActive() {
3625
- return this._isActive;
3626
- }
3627
- get isVisible() {
3628
- return this._isVisible;
3629
- }
3630
- get width() {
3631
- return this._width;
3873
+ }), this.onDidDimensionsChange((event) => {
3874
+ this._width = event.width;
3875
+ this._height = event.height;
3876
+ }));
3632
3877
  }
3633
- get height() {
3634
- return this._height;
3878
+ initialize(panel) {
3879
+ this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
3880
+ panel.update({
3881
+ params: {
3882
+ params: parameters,
3883
+ },
3884
+ });
3885
+ });
3635
3886
  }
3636
3887
  setVisible(isVisible) {
3637
3888
  this._onVisibilityChange.fire({ isVisible });
@@ -3639,26 +3890,29 @@
3639
3890
  setActive() {
3640
3891
  this._onActiveChange.fire();
3641
3892
  }
3893
+ updateParameters(parameters) {
3894
+ this._onUpdateParameters.fire(parameters);
3895
+ }
3642
3896
  dispose() {
3643
3897
  super.dispose();
3644
3898
  }
3645
3899
  }
3646
3900
 
3647
3901
  class GridviewPanelApiImpl extends PanelApiImpl {
3648
- //
3649
- constructor(id) {
3902
+ constructor(id, panel) {
3650
3903
  super(id);
3651
3904
  this._onDidConstraintsChangeInternal = new Emitter();
3652
3905
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
3653
- //
3654
3906
  this._onDidConstraintsChange = new Emitter({
3655
3907
  replay: true,
3656
3908
  });
3657
3909
  this.onDidConstraintsChange = this._onDidConstraintsChange.event;
3658
- //
3659
3910
  this._onDidSizeChange = new Emitter();
3660
3911
  this.onDidSizeChange = this._onDidSizeChange.event;
3661
3912
  this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
3913
+ if (panel) {
3914
+ this.initialize(panel);
3915
+ }
3662
3916
  }
3663
3917
  setConstraints(value) {
3664
3918
  this._onDidConstraintsChangeInternal.fire(value);
@@ -3669,19 +3923,6 @@
3669
3923
  }
3670
3924
 
3671
3925
  class DockviewPanelApiImpl extends GridviewPanelApiImpl {
3672
- constructor(panel, group) {
3673
- super(panel.id);
3674
- this.panel = panel;
3675
- this._onDidTitleChange = new Emitter();
3676
- this.onDidTitleChange = this._onDidTitleChange.event;
3677
- this._onDidActiveGroupChange = new Emitter();
3678
- this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3679
- this._onDidGroupChange = new Emitter();
3680
- this.onDidGroupChange = this._onDidGroupChange.event;
3681
- this.disposable = new MutableDisposable();
3682
- this._group = group;
3683
- this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
3684
- }
3685
3926
  get title() {
3686
3927
  return this.panel.title;
3687
3928
  }
@@ -3705,30 +3946,29 @@
3705
3946
  get group() {
3706
3947
  return this._group;
3707
3948
  }
3949
+ constructor(panel, group) {
3950
+ super(panel.id);
3951
+ this.panel = panel;
3952
+ this._onDidTitleChange = new Emitter();
3953
+ this.onDidTitleChange = this._onDidTitleChange.event;
3954
+ this._onDidActiveGroupChange = new Emitter();
3955
+ this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3956
+ this._onDidGroupChange = new Emitter();
3957
+ this.onDidGroupChange = this._onDidGroupChange.event;
3958
+ this.disposable = new MutableDisposable();
3959
+ this.initialize(panel);
3960
+ this._group = group;
3961
+ this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
3962
+ }
3708
3963
  setTitle(title) {
3709
- this._onDidTitleChange.fire({ title });
3964
+ this.panel.update({ params: { title } });
3710
3965
  }
3711
3966
  close() {
3712
- if (!this.group) {
3713
- throw new Error(`panel ${this.id} has no group`);
3714
- }
3715
- return this.group.model.closePanel(this.panel);
3967
+ this.group.model.closePanel(this.panel);
3716
3968
  }
3717
3969
  }
3718
3970
 
3719
- class DockviewGroupPanel extends CompositeDisposable {
3720
- constructor(id, accessor, containerApi, group) {
3721
- super();
3722
- this.id = id;
3723
- this.containerApi = containerApi;
3724
- this.mutableDisposable = new MutableDisposable();
3725
- this._title = '';
3726
- this._group = group;
3727
- this.api = new DockviewPanelApiImpl(this, this._group);
3728
- this.addDisposables(this.api.onActiveChange(() => {
3729
- accessor.setActivePanel(this);
3730
- }));
3731
- }
3971
+ class DockviewPanel extends CompositeDisposable {
3732
3972
  get params() {
3733
3973
  return this._params;
3734
3974
  }
@@ -3741,6 +3981,22 @@
3741
3981
  get view() {
3742
3982
  return this._view;
3743
3983
  }
3984
+ constructor(id, accessor, containerApi, group) {
3985
+ super();
3986
+ this.id = id;
3987
+ this.containerApi = containerApi;
3988
+ this.mutableDisposable = new MutableDisposable();
3989
+ this._title = '';
3990
+ this._group = group;
3991
+ this.api = new DockviewPanelApiImpl(this, this._group);
3992
+ this.addDisposables(this.api.onActiveChange(() => {
3993
+ accessor.setActivePanel(this);
3994
+ }), this.api.onDidSizeChange((event) => {
3995
+ // forward the resize event to the group since if you want to resize a panel
3996
+ // you are actually just resizing the panels parent which is the group
3997
+ this.group.api.setSize(event);
3998
+ }));
3999
+ }
3744
4000
  init(params) {
3745
4001
  var _a;
3746
4002
  this._params = params.params;
@@ -3823,6 +4079,9 @@
3823
4079
  }
3824
4080
 
3825
4081
  class ActionContainer {
4082
+ get element() {
4083
+ return this._element;
4084
+ }
3826
4085
  constructor() {
3827
4086
  this._element = document.createElement('div');
3828
4087
  this._element.className = 'actions-bar';
@@ -3830,9 +4089,6 @@
3830
4089
  this._list.className = 'actions-container';
3831
4090
  this._element.appendChild(this._list);
3832
4091
  }
3833
- get element() {
3834
- return this._element;
3835
- }
3836
4092
  add(element) {
3837
4093
  const listItem = document.createElement('li');
3838
4094
  listItem.className = 'action-item';
@@ -3873,6 +4129,9 @@
3873
4129
  });
3874
4130
 
3875
4131
  class Watermark extends CompositeDisposable {
4132
+ get id() {
4133
+ return 'watermark';
4134
+ }
3876
4135
  constructor() {
3877
4136
  super();
3878
4137
  this._element = document.createElement('div');
@@ -3900,9 +4159,6 @@
3900
4159
  }
3901
4160
  }));
3902
4161
  }
3903
- get id() {
3904
- return 'watermark';
3905
- }
3906
4162
  update(_event) {
3907
4163
  // noop
3908
4164
  }
@@ -3965,6 +4221,12 @@
3965
4221
 
3966
4222
  const DEFAULT_TAB_IDENTIFIER = '__default__tab__';
3967
4223
  class DefaultTab extends CompositeDisposable {
4224
+ get element() {
4225
+ return this._element;
4226
+ }
4227
+ get id() {
4228
+ return DEFAULT_TAB_IDENTIFIER;
4229
+ }
3968
4230
  constructor() {
3969
4231
  super();
3970
4232
  this._isPanelVisible = false;
@@ -3997,12 +4259,6 @@
3997
4259
  }));
3998
4260
  this.render();
3999
4261
  }
4000
- get element() {
4001
- return this._element;
4002
- }
4003
- get id() {
4004
- return DEFAULT_TAB_IDENTIFIER;
4005
- }
4006
4262
  update(event) {
4007
4263
  this.params = Object.assign(Object.assign({}, this.params), event.params);
4008
4264
  this.render();
@@ -4041,6 +4297,19 @@
4041
4297
  }
4042
4298
 
4043
4299
  class BasePanelView extends CompositeDisposable {
4300
+ get element() {
4301
+ return this._element;
4302
+ }
4303
+ get width() {
4304
+ return this._width;
4305
+ }
4306
+ get height() {
4307
+ return this._height;
4308
+ }
4309
+ get params() {
4310
+ var _a;
4311
+ return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
4312
+ }
4044
4313
  constructor(id, component, api) {
4045
4314
  super();
4046
4315
  this.id = id;
@@ -4061,19 +4330,6 @@
4061
4330
  this.api._onDidChangeFocus.fire({ isFocused: false });
4062
4331
  }));
4063
4332
  }
4064
- get element() {
4065
- return this._element;
4066
- }
4067
- get width() {
4068
- return this._width;
4069
- }
4070
- get height() {
4071
- return this._height;
4072
- }
4073
- get params() {
4074
- var _a;
4075
- return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
4076
- }
4077
4333
  focus() {
4078
4334
  this.api._onFocusEvent.fire();
4079
4335
  }
@@ -4114,50 +4370,6 @@
4114
4370
  }
4115
4371
 
4116
4372
  class GridviewPanel extends BasePanelView {
4117
- constructor(id, component, api = new GridviewPanelApiImpl(id)) {
4118
- super(id, component, api);
4119
- this._evaluatedMinimumWidth = 0;
4120
- this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
4121
- this._evaluatedMinimumHeight = 0;
4122
- this._evaluatedMaximumHeight = Number.MAX_SAFE_INTEGER;
4123
- this._minimumWidth = 0;
4124
- this._minimumHeight = 0;
4125
- this._maximumWidth = Number.MAX_SAFE_INTEGER;
4126
- this._maximumHeight = Number.MAX_SAFE_INTEGER;
4127
- this._snap = false;
4128
- this._onDidChange = new Emitter();
4129
- this.onDidChange = this._onDidChange.event;
4130
- this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
4131
- const { isVisible } = event;
4132
- const { accessor } = this._params;
4133
- accessor.setVisible(this, isVisible);
4134
- }), this.api.onActiveChange(() => {
4135
- const { accessor } = this._params;
4136
- accessor.setActive(this);
4137
- }), this.api.onDidConstraintsChangeInternal((event) => {
4138
- if (typeof event.minimumWidth === 'number' ||
4139
- typeof event.minimumWidth === 'function') {
4140
- this._minimumWidth = event.minimumWidth;
4141
- }
4142
- if (typeof event.minimumHeight === 'number' ||
4143
- typeof event.minimumHeight === 'function') {
4144
- this._minimumHeight = event.minimumHeight;
4145
- }
4146
- if (typeof event.maximumWidth === 'number' ||
4147
- typeof event.maximumWidth === 'function') {
4148
- this._maximumWidth = event.maximumWidth;
4149
- }
4150
- if (typeof event.maximumHeight === 'number' ||
4151
- typeof event.maximumHeight === 'function') {
4152
- this._maximumHeight = event.maximumHeight;
4153
- }
4154
- }), this.api.onDidSizeChange((event) => {
4155
- this._onDidChange.fire({
4156
- height: event.height,
4157
- width: event.width,
4158
- });
4159
- }));
4160
- }
4161
4373
  get priority() {
4162
4374
  return this._priority;
4163
4375
  }
@@ -4207,6 +4419,51 @@
4207
4419
  get isActive() {
4208
4420
  return this.api.isActive;
4209
4421
  }
4422
+ constructor(id, component, api) {
4423
+ super(id, component, api);
4424
+ this._evaluatedMinimumWidth = 0;
4425
+ this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
4426
+ this._evaluatedMinimumHeight = 0;
4427
+ this._evaluatedMaximumHeight = Number.MAX_SAFE_INTEGER;
4428
+ this._minimumWidth = 0;
4429
+ this._minimumHeight = 0;
4430
+ this._maximumWidth = Number.MAX_SAFE_INTEGER;
4431
+ this._maximumHeight = Number.MAX_SAFE_INTEGER;
4432
+ this._snap = false;
4433
+ this._onDidChange = new Emitter();
4434
+ this.onDidChange = this._onDidChange.event;
4435
+ this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
4436
+ this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
4437
+ const { isVisible } = event;
4438
+ const { accessor } = this._params;
4439
+ accessor.setVisible(this, isVisible);
4440
+ }), this.api.onActiveChange(() => {
4441
+ const { accessor } = this._params;
4442
+ accessor.setActive(this);
4443
+ }), this.api.onDidConstraintsChangeInternal((event) => {
4444
+ if (typeof event.minimumWidth === 'number' ||
4445
+ typeof event.minimumWidth === 'function') {
4446
+ this._minimumWidth = event.minimumWidth;
4447
+ }
4448
+ if (typeof event.minimumHeight === 'number' ||
4449
+ typeof event.minimumHeight === 'function') {
4450
+ this._minimumHeight = event.minimumHeight;
4451
+ }
4452
+ if (typeof event.maximumWidth === 'number' ||
4453
+ typeof event.maximumWidth === 'function') {
4454
+ this._maximumWidth = event.maximumWidth;
4455
+ }
4456
+ if (typeof event.maximumHeight === 'number' ||
4457
+ typeof event.maximumHeight === 'function') {
4458
+ this._maximumHeight = event.maximumHeight;
4459
+ }
4460
+ }), this.api.onDidSizeChange((event) => {
4461
+ this._onDidChange.fire({
4462
+ height: event.height,
4463
+ width: event.width,
4464
+ });
4465
+ }));
4466
+ }
4210
4467
  setVisible(isVisible) {
4211
4468
  this.api._onDidVisibilityChange.fire({ isVisible });
4212
4469
  }
@@ -4252,10 +4509,6 @@
4252
4509
  class GroupviewApi extends GridviewPanelApiImpl {
4253
4510
  }
4254
4511
  class GroupPanel extends GridviewPanel {
4255
- constructor(accessor, id, options) {
4256
- super(id, 'groupview_default', new GroupviewApi(id));
4257
- this._model = new Groupview(this.element, accessor, id, options, this);
4258
- }
4259
4512
  get panels() {
4260
4513
  return this._model.panels;
4261
4514
  }
@@ -4289,6 +4542,10 @@
4289
4542
  get header() {
4290
4543
  return this._model.header;
4291
4544
  }
4545
+ constructor(accessor, id, options) {
4546
+ super(id, 'groupview_default', new GroupviewApi(id));
4547
+ this._model = new Groupview(this.element, accessor, id, options, this);
4548
+ }
4292
4549
  initialize() {
4293
4550
  this._model.initialize();
4294
4551
  }
@@ -4309,17 +4566,17 @@
4309
4566
  }
4310
4567
 
4311
4568
  class DefaultGroupPanelView {
4312
- constructor(renderers) {
4313
- var _a;
4314
- this._content = renderers.content;
4315
- this._tab = (_a = renderers.tab) !== null && _a !== void 0 ? _a : new DefaultTab();
4316
- }
4317
4569
  get content() {
4318
4570
  return this._content;
4319
4571
  }
4320
4572
  get tab() {
4321
4573
  return this._tab;
4322
4574
  }
4575
+ constructor(renderers) {
4576
+ var _a;
4577
+ this._content = renderers.content;
4578
+ this._tab = (_a = renderers.tab) !== null && _a !== void 0 ? _a : new DefaultTab();
4579
+ }
4323
4580
  init(params) {
4324
4581
  this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
4325
4582
  this.tab.init(params);
@@ -4341,25 +4598,60 @@
4341
4598
  if (tab && Object.keys(tab).length === 0) {
4342
4599
  tab = undefined;
4343
4600
  }
4344
- return {
4345
- content: this.content.toJSON(),
4346
- tab,
4347
- };
4601
+ return {
4602
+ content: this.content.toJSON(),
4603
+ tab,
4604
+ };
4605
+ }
4606
+ dispose() {
4607
+ this.content.dispose();
4608
+ this.tab.dispose();
4609
+ }
4610
+ }
4611
+
4612
+ class DockviewComponent extends BaseGrid {
4613
+ get orientation() {
4614
+ return this.gridview.orientation;
4615
+ }
4616
+ get totalPanels() {
4617
+ return this.panels.length;
4618
+ }
4619
+ get panels() {
4620
+ return this.groups.flatMap((group) => group.panels);
4621
+ }
4622
+ get deserializer() {
4623
+ return this._deserializer;
4624
+ }
4625
+ set deserializer(value) {
4626
+ this._deserializer = value;
4627
+ }
4628
+ get options() {
4629
+ return this._options;
4630
+ }
4631
+ get activePanel() {
4632
+ const activeGroup = this.activeGroup;
4633
+ if (!activeGroup) {
4634
+ return undefined;
4635
+ }
4636
+ return activeGroup.activePanel;
4348
4637
  }
4349
- dispose() {
4350
- this.content.dispose();
4351
- this.tab.dispose();
4638
+ set tabHeight(height) {
4639
+ this.options.tabHeight = height;
4640
+ this._groups.forEach((value) => {
4641
+ value.value.model.header.height = height;
4642
+ });
4643
+ }
4644
+ get tabHeight() {
4645
+ return this.options.tabHeight;
4352
4646
  }
4353
- }
4354
-
4355
- const nextGroupId = sequentialNumberGenerator();
4356
- class DockviewComponent extends BaseGrid {
4357
4647
  constructor(element, options) {
4358
4648
  super(element, {
4359
4649
  proportionalLayout: true,
4360
4650
  orientation: options.orientation || exports.Orientation.HORIZONTAL,
4361
4651
  styles: options.styles,
4362
4652
  });
4653
+ this.nextGroupId = sequentialNumberGenerator();
4654
+ this.watermark = null;
4363
4655
  this._onDidDrop = new Emitter();
4364
4656
  this.onDidDrop = this._onDidDrop.event;
4365
4657
  this._onDidRemovePanel = new Emitter();
@@ -4370,7 +4662,10 @@
4370
4662
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
4371
4663
  this._onDidActivePanelChange = new Emitter();
4372
4664
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
4373
- this.addDisposables(this._onDidDrop, exports.Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
4665
+ this.element.classList.add('dv-dockview');
4666
+ this.addDisposables(this._onDidDrop, exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
4667
+ this.updateWatermark();
4668
+ }), exports.Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
4374
4669
  this._bufferOnDidLayoutChange.fire();
4375
4670
  }));
4376
4671
  this._options = options;
@@ -4390,38 +4685,72 @@
4390
4685
  !this.options.watermarkFrameworkComponent) {
4391
4686
  this.options.watermarkComponent = Watermark;
4392
4687
  }
4688
+ const dropTarget = new Droptarget(this.element, {
4689
+ canDisplayOverlay: (event, position) => {
4690
+ const data = getPanelData();
4691
+ if (data) {
4692
+ if (data.viewId !== this.id) {
4693
+ return false;
4694
+ }
4695
+ return true;
4696
+ }
4697
+ if (this.options.showDndOverlay) {
4698
+ return this.options.showDndOverlay({
4699
+ nativeEvent: event,
4700
+ position: position,
4701
+ target: exports.DockviewDropTargets.Edge,
4702
+ getData: getPanelData,
4703
+ });
4704
+ }
4705
+ return false;
4706
+ },
4707
+ acceptedTargetZones: ['top', 'bottom', 'left', 'right'],
4708
+ overlayModel: {
4709
+ activationSize: { type: 'pixels', value: 10 },
4710
+ size: { type: 'pixels', value: 20 },
4711
+ },
4712
+ });
4713
+ this.addDisposables(dropTarget, dropTarget.onDrop((event) => {
4714
+ const data = getPanelData();
4715
+ if (data) {
4716
+ this.moveGroupOrPanel(this.orthogonalize(event.position), data.groupId, data.panelId || undefined, 'center');
4717
+ }
4718
+ else {
4719
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
4720
+ }
4721
+ }));
4393
4722
  this._api = new DockviewApi(this);
4723
+ this.updateWatermark();
4394
4724
  }
4395
- get totalPanels() {
4396
- return this.panels.length;
4397
- }
4398
- get panels() {
4399
- return this.groups.flatMap((group) => group.panels);
4400
- }
4401
- get deserializer() {
4402
- return this._deserializer;
4403
- }
4404
- set deserializer(value) {
4405
- this._deserializer = value;
4406
- }
4407
- get options() {
4408
- return this._options;
4409
- }
4410
- get activePanel() {
4411
- const activeGroup = this.activeGroup;
4412
- if (!activeGroup) {
4413
- return undefined;
4725
+ orthogonalize(position) {
4726
+ switch (position) {
4727
+ case 'top':
4728
+ case 'bottom':
4729
+ if (this.gridview.orientation === exports.Orientation.HORIZONTAL) {
4730
+ // we need to add to a vertical splitview but the current root is a horizontal splitview.
4731
+ // insert a vertical splitview at the root level and add the existing view as a child
4732
+ this.gridview.insertOrthogonalSplitviewAtRoot();
4733
+ }
4734
+ break;
4735
+ case 'left':
4736
+ case 'right':
4737
+ if (this.gridview.orientation === exports.Orientation.VERTICAL) {
4738
+ // we need to add to a horizontal splitview but the current root is a vertical splitview.
4739
+ // insert a horiziontal splitview at the root level and add the existing view as a child
4740
+ this.gridview.insertOrthogonalSplitviewAtRoot();
4741
+ }
4742
+ break;
4743
+ }
4744
+ switch (position) {
4745
+ case 'top':
4746
+ case 'left':
4747
+ return this.createGroupAtLocation([0]); // insert into first position
4748
+ case 'bottom':
4749
+ case 'right':
4750
+ return this.createGroupAtLocation([this.gridview.length]); // insert into last position
4751
+ default:
4752
+ throw new Error(`unsupported position ${position}`);
4414
4753
  }
4415
- return activeGroup.activePanel;
4416
- }
4417
- set tabHeight(height) {
4418
- this.options.tabHeight = height;
4419
- this._groups.forEach((value) => {
4420
- value.value.model.header.height = height;
4421
- });
4422
- }
4423
- get tabHeight() {
4424
- return this.options.tabHeight;
4425
4754
  }
4426
4755
  updateOptions(options) {
4427
4756
  const hasOrientationChanged = typeof options.orientation === 'string' &&
@@ -4471,8 +4800,7 @@
4471
4800
  options.group = this.activeGroup;
4472
4801
  }
4473
4802
  if (options.includePanel && options.group) {
4474
- if (options.group.activePanel !==
4475
- options.group.panels[0]) {
4803
+ if (options.group.activePanel !== options.group.panels[0]) {
4476
4804
  options.group.model.moveToPrevious({ suppressRoll: true });
4477
4805
  return;
4478
4806
  }
@@ -4505,14 +4833,14 @@
4505
4833
  fromJSON(data) {
4506
4834
  this.clear();
4507
4835
  if (!this.deserializer) {
4508
- throw new Error('invalid deserializer');
4836
+ throw new Error('no deserializer provided');
4509
4837
  }
4510
4838
  const { grid, panels, options, activeGroup } = data;
4511
4839
  if (typeof (options === null || options === void 0 ? void 0 : options.tabHeight) === 'number') {
4512
4840
  this.tabHeight = options.tabHeight;
4513
4841
  }
4514
- if (!this.deserializer) {
4515
- throw new Error('no deserializer provided');
4842
+ if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
4843
+ throw new Error('root must be of type branch');
4516
4844
  }
4517
4845
  this.gridview.deserialize(grid, {
4518
4846
  fromJSON: (node) => {
@@ -4525,19 +4853,20 @@
4525
4853
  this._onDidAddGroup.fire(group);
4526
4854
  for (const child of views) {
4527
4855
  const panel = this.deserializer.fromJSON(panels[child], group);
4528
- const isActive = typeof activeView === 'string' && activeView === panel.id;
4856
+ const isActive = typeof activeView === 'string' &&
4857
+ activeView === panel.id;
4529
4858
  group.model.openPanel(panel, {
4530
4859
  skipSetPanelActive: !isActive,
4531
- skipSetGroupActive: true
4860
+ skipSetGroupActive: true,
4532
4861
  });
4533
4862
  }
4534
4863
  if (!group.activePanel && group.panels.length > 0) {
4535
4864
  group.model.openPanel(group.panels[group.panels.length - 1], {
4536
- skipSetGroupActive: true
4865
+ skipSetGroupActive: true,
4537
4866
  });
4538
4867
  }
4539
4868
  return group;
4540
- }
4869
+ },
4541
4870
  });
4542
4871
  if (typeof activeGroup === 'string') {
4543
4872
  const panel = this.getPanel(activeGroup);
@@ -4576,12 +4905,31 @@
4576
4905
  throw new Error(`panel with id ${options.id} already exists`);
4577
4906
  }
4578
4907
  let referenceGroup;
4579
- if ((_a = options.position) === null || _a === void 0 ? void 0 : _a.referencePanel) {
4580
- const referencePanel = this.getGroupPanel(options.position.referencePanel);
4581
- if (!referencePanel) {
4582
- throw new Error(`referencePanel ${options.position.referencePanel} does not exist`);
4908
+ if (options.position) {
4909
+ if (isPanelOptionsWithPanel(options.position)) {
4910
+ const referencePanel = typeof options.position.referencePanel === 'string'
4911
+ ? this.getGroupPanel(options.position.referencePanel)
4912
+ : options.position.referencePanel;
4913
+ if (!referencePanel) {
4914
+ throw new Error(`referencePanel ${options.position.referencePanel} does not exist`);
4915
+ }
4916
+ referenceGroup = this.findGroup(referencePanel);
4917
+ }
4918
+ else if (isPanelOptionsWithGroup(options.position)) {
4919
+ referenceGroup =
4920
+ typeof options.position.referenceGroup === 'string'
4921
+ ? (_a = this._groups.get(options.position.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
4922
+ : options.position.referenceGroup;
4923
+ if (!referenceGroup) {
4924
+ throw new Error(`referencePanel ${options.position.referenceGroup} does not exist`);
4925
+ }
4926
+ }
4927
+ else {
4928
+ const group = this.orthogonalize(directionToPosition(options.position.direction));
4929
+ const panel = this.createPanel(options, group);
4930
+ group.model.openPanel(panel);
4931
+ return panel;
4583
4932
  }
4584
- referenceGroup = this.findGroup(referencePanel);
4585
4933
  }
4586
4934
  else {
4587
4935
  referenceGroup = this.activeGroup;
@@ -4589,7 +4937,7 @@
4589
4937
  let panel;
4590
4938
  if (referenceGroup) {
4591
4939
  const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
4592
- if (target === exports.Position.Center) {
4940
+ if (target === 'center') {
4593
4941
  panel = this.createPanel(options, referenceGroup);
4594
4942
  referenceGroup.model.openPanel(panel);
4595
4943
  }
@@ -4618,10 +4966,7 @@
4618
4966
  }
4619
4967
  group.model.removePanel(panel);
4620
4968
  panel.dispose();
4621
- const retainGroupForWatermark = this.size === 1;
4622
- if (!retainGroupForWatermark &&
4623
- group.size === 0 &&
4624
- options.removeEmptyGroup) {
4969
+ if (group.size === 0 && options.removeEmptyGroup) {
4625
4970
  this.removeGroup(group);
4626
4971
  }
4627
4972
  }
@@ -4633,24 +4978,67 @@
4633
4978
  ? { 'watermark-name': this.options.watermarkFrameworkComponent }
4634
4979
  : {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
4635
4980
  }
4636
- addEmptyGroup(options) {
4981
+ updateWatermark() {
4982
+ if (this.groups.length === 0) {
4983
+ if (!this.watermark) {
4984
+ this.watermark = this.createWatermarkComponent();
4985
+ this.watermark.init({
4986
+ containerApi: new DockviewApi(this),
4987
+ params: {},
4988
+ title: '',
4989
+ api: null,
4990
+ });
4991
+ const watermarkContainer = document.createElement('div');
4992
+ watermarkContainer.className = 'dv-watermark-container';
4993
+ watermarkContainer.appendChild(this.watermark.element);
4994
+ this.element.appendChild(watermarkContainer);
4995
+ }
4996
+ }
4997
+ else if (this.watermark) {
4998
+ this.watermark.element.parentElement.remove();
4999
+ this.watermark.dispose();
5000
+ this.watermark = null;
5001
+ }
5002
+ }
5003
+ addGroup(options) {
5004
+ var _a;
4637
5005
  const group = this.createGroup();
4638
5006
  if (options) {
4639
- const referencePanel = this.panels.find((panel) => panel.id === options.referencePanel);
4640
- if (!referencePanel) {
4641
- throw new Error(`reference panel ${options.referencePanel} does not exist`);
5007
+ let referenceGroup;
5008
+ if (isGroupOptionsWithPanel(options)) {
5009
+ const referencePanel = typeof options.referencePanel === 'string'
5010
+ ? this.panels.find((panel) => panel.id === options.referencePanel)
5011
+ : options.referencePanel;
5012
+ if (!referencePanel) {
5013
+ throw new Error(`reference panel ${options.referencePanel} does not exist`);
5014
+ }
5015
+ referenceGroup = this.findGroup(referencePanel);
5016
+ if (!referenceGroup) {
5017
+ throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
5018
+ }
4642
5019
  }
4643
- const referenceGroup = this.findGroup(referencePanel);
4644
- if (!referenceGroup) {
4645
- throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
5020
+ else if (isGroupOptionsWithGroup(options)) {
5021
+ referenceGroup =
5022
+ typeof options.referenceGroup === 'string'
5023
+ ? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
5024
+ : options.referenceGroup;
5025
+ if (!referenceGroup) {
5026
+ throw new Error(`reference group ${options.referenceGroup} does not exist`);
5027
+ }
5028
+ }
5029
+ else {
5030
+ const group = this.orthogonalize(directionToPosition(options.direction));
5031
+ return group;
4646
5032
  }
4647
5033
  const target = toTarget(options.direction || 'within');
4648
5034
  const location = getGridLocation(referenceGroup.element);
4649
5035
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
4650
5036
  this.doAddGroup(group, relativeLocation);
5037
+ return group;
4651
5038
  }
4652
5039
  else {
4653
5040
  this.doAddGroup(group);
5041
+ return group;
4654
5042
  }
4655
5043
  }
4656
5044
  removeGroup(group, skipActive = false) {
@@ -4668,7 +5056,13 @@
4668
5056
  const sourceGroup = groupId
4669
5057
  ? (_a = this._groups.get(groupId)) === null || _a === void 0 ? void 0 : _a.value
4670
5058
  : undefined;
4671
- if (!target || target === exports.Position.Center) {
5059
+ if (itemId === undefined) {
5060
+ if (sourceGroup) {
5061
+ this.moveGroup(sourceGroup, referenceGroup, target);
5062
+ }
5063
+ return;
5064
+ }
5065
+ if (!target || target === 'center') {
4672
5066
  const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(itemId)) ||
4673
5067
  this.panels.find((panel) => panel.id === itemId);
4674
5068
  if (!groupItem) {
@@ -4716,6 +5110,28 @@
4716
5110
  }
4717
5111
  }
4718
5112
  }
5113
+ moveGroup(sourceGroup, referenceGroup, target) {
5114
+ if (sourceGroup) {
5115
+ if (!target || target === 'center') {
5116
+ const activePanel = sourceGroup.activePanel;
5117
+ const panels = [...sourceGroup.panels].map((p) => sourceGroup.model.removePanel(p.id));
5118
+ if ((sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.size) === 0) {
5119
+ this.doRemoveGroup(sourceGroup);
5120
+ }
5121
+ for (const panel of panels) {
5122
+ referenceGroup.model.openPanel(panel, {
5123
+ skipSetPanelActive: panel !== activePanel,
5124
+ });
5125
+ }
5126
+ }
5127
+ else {
5128
+ this.gridview.removeView(getGridLocation(sourceGroup.element));
5129
+ const referenceLocation = getGridLocation(referenceGroup.element);
5130
+ const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
5131
+ this.gridview.addView(sourceGroup, exports.Sizing.Distribute, dropLocation);
5132
+ }
5133
+ }
5134
+ }
4719
5135
  doSetGroupActive(group, skipFocus) {
4720
5136
  var _a, _b;
4721
5137
  const isGroupAlreadyFocused = this._activeGroup === group;
@@ -4737,9 +5153,9 @@
4737
5153
  id = undefined;
4738
5154
  }
4739
5155
  if (!id) {
4740
- id = nextGroupId.next();
5156
+ id = this.nextGroupId.next();
4741
5157
  while (this._groups.has(id)) {
4742
- id = nextGroupId.next();
5158
+ id = this.nextGroupId.next();
4743
5159
  }
4744
5160
  }
4745
5161
  const view = new GroupPanel(this, id, options);
@@ -4772,7 +5188,7 @@
4772
5188
  content: this.createContentComponent(options.id, options.component),
4773
5189
  tab: this.createTabComponent(options.id, options.tabComponent || this.options.defaultTabComponent),
4774
5190
  });
4775
- const panel = new DockviewGroupPanel(options.id, this, this._api, group);
5191
+ const panel = new DockviewPanel(options.id, this, this._api, group);
4776
5192
  panel.init({
4777
5193
  view,
4778
5194
  title: options.title || options.id,
@@ -4807,6 +5223,21 @@
4807
5223
  }
4808
5224
 
4809
5225
  class GridviewComponent extends BaseGrid {
5226
+ get orientation() {
5227
+ return this.gridview.orientation;
5228
+ }
5229
+ set orientation(value) {
5230
+ this.gridview.orientation = value;
5231
+ }
5232
+ get options() {
5233
+ return this._options;
5234
+ }
5235
+ get deserializer() {
5236
+ return this._deserializer;
5237
+ }
5238
+ set deserializer(value) {
5239
+ this._deserializer = value;
5240
+ }
4810
5241
  constructor(element, options) {
4811
5242
  super(element, {
4812
5243
  proportionalLayout: options.proportionalLayout,
@@ -4823,21 +5254,6 @@
4823
5254
  this.options.frameworkComponents = {};
4824
5255
  }
4825
5256
  }
4826
- get orientation() {
4827
- return this.gridview.orientation;
4828
- }
4829
- set orientation(value) {
4830
- this.gridview.orientation = value;
4831
- }
4832
- get options() {
4833
- return this._options;
4834
- }
4835
- get deserializer() {
4836
- return this._deserializer;
4837
- }
4838
- set deserializer(value) {
4839
- this._deserializer = value;
4840
- }
4841
5257
  updateOptions(options) {
4842
5258
  const hasOrientationChanged = typeof options.orientation === 'string' &&
4843
5259
  this.gridview.orientation !== options.orientation;
@@ -4935,7 +5351,7 @@
4935
5351
  throw new Error(`reference group ${options.reference} does not exist`);
4936
5352
  }
4937
5353
  const target = toTarget(options.direction);
4938
- if (target === exports.Position.Center) {
5354
+ if (target === 'center') {
4939
5355
  throw new Error(`${target} not supported as an option`);
4940
5356
  }
4941
5357
  else {
@@ -4953,7 +5369,7 @@
4953
5369
  throw new Error(`reference group ${options.position.referencePanel} does not exist`);
4954
5370
  }
4955
5371
  const target = toTarget(options.position.direction);
4956
- if (target === exports.Position.Center) {
5372
+ if (target === 'center') {
4957
5373
  throw new Error(`${target} not supported as an option`);
4958
5374
  }
4959
5375
  else {
@@ -5042,29 +5458,6 @@
5042
5458
  * A high-level implementation of splitview that works using 'panels'
5043
5459
  */
5044
5460
  class SplitviewComponent extends CompositeDisposable {
5045
- constructor(element, options) {
5046
- super();
5047
- this.element = element;
5048
- this._disposable = new MutableDisposable();
5049
- this._panels = new Map();
5050
- this._onDidLayoutfromJSON = new Emitter();
5051
- this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5052
- this._onDidAddView = new Emitter();
5053
- this.onDidAddView = this._onDidAddView.event;
5054
- this._onDidRemoveView = new Emitter();
5055
- this.onDidRemoveView = this._onDidRemoveView.event;
5056
- this._onDidLayoutChange = new Emitter();
5057
- this.onDidLayoutChange = this._onDidLayoutChange.event;
5058
- this._options = options;
5059
- if (!options.components) {
5060
- options.components = {};
5061
- }
5062
- if (!options.frameworkComponents) {
5063
- options.frameworkComponents = {};
5064
- }
5065
- this.splitview = new Splitview(this.element, options);
5066
- this.addDisposables(this._disposable, this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
5067
- }
5068
5461
  get panels() {
5069
5462
  return this.splitview.getViews();
5070
5463
  }
@@ -5102,6 +5495,29 @@
5102
5495
  ? this.splitview.size
5103
5496
  : this.splitview.orthogonalSize;
5104
5497
  }
5498
+ constructor(element, options) {
5499
+ super();
5500
+ this.element = element;
5501
+ this._disposable = new MutableDisposable();
5502
+ this._panels = new Map();
5503
+ this._onDidLayoutfromJSON = new Emitter();
5504
+ this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5505
+ this._onDidAddView = new Emitter();
5506
+ this.onDidAddView = this._onDidAddView.event;
5507
+ this._onDidRemoveView = new Emitter();
5508
+ this.onDidRemoveView = this._onDidRemoveView.event;
5509
+ this._onDidLayoutChange = new Emitter();
5510
+ this.onDidLayoutChange = this._onDidLayoutChange.event;
5511
+ this._options = options;
5512
+ if (!options.components) {
5513
+ options.components = {};
5514
+ }
5515
+ if (!options.frameworkComponents) {
5516
+ options.frameworkComponents = {};
5517
+ }
5518
+ this.splitview = new Splitview(this.element, options);
5519
+ this.addDisposables(this._disposable, this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
5520
+ }
5105
5521
  updateOptions(options) {
5106
5522
  const hasOrientationChanged = typeof options.orientation === 'string' &&
5107
5523
  this.options.orientation !== options.orientation;
@@ -5303,38 +5719,85 @@
5303
5719
  setConstraints(value) {
5304
5720
  this._onDidConstraintsChangeInternal.fire(value);
5305
5721
  }
5306
- setSize(event) {
5307
- this._onDidSizeChange.fire(event);
5722
+ setSize(event) {
5723
+ this._onDidSizeChange.fire(event);
5724
+ }
5725
+ }
5726
+
5727
+ class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
5728
+ set pane(pane) {
5729
+ this._pane = pane;
5730
+ }
5731
+ constructor(id) {
5732
+ super(id);
5733
+ this._onDidExpansionChange = new Emitter({
5734
+ replay: true,
5735
+ });
5736
+ this.onDidExpansionChange = this._onDidExpansionChange.event;
5737
+ this._onMouseEnter = new Emitter({});
5738
+ this.onMouseEnter = this._onMouseEnter.event;
5739
+ this._onMouseLeave = new Emitter({});
5740
+ this.onMouseLeave = this._onMouseLeave.event;
5741
+ this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
5742
+ }
5743
+ setExpanded(isExpanded) {
5744
+ var _a;
5745
+ (_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
5746
+ }
5747
+ get isExpanded() {
5748
+ var _a;
5749
+ return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
5750
+ }
5751
+ }
5752
+
5753
+ class PaneviewPanel extends BasePanelView {
5754
+ set orientation(value) {
5755
+ this._orientation = value;
5756
+ }
5757
+ get orientation() {
5758
+ return this._orientation;
5759
+ }
5760
+ get minimumSize() {
5761
+ const headerSize = this.headerSize;
5762
+ const expanded = this.isExpanded();
5763
+ const minimumBodySize = expanded ? this._minimumBodySize : 0;
5764
+ return headerSize + minimumBodySize;
5765
+ }
5766
+ get maximumSize() {
5767
+ const headerSize = this.headerSize;
5768
+ const expanded = this.isExpanded();
5769
+ const maximumBodySize = expanded ? this._maximumBodySize : 0;
5770
+ return headerSize + maximumBodySize;
5771
+ }
5772
+ get size() {
5773
+ return this._size;
5774
+ }
5775
+ get orthogonalSize() {
5776
+ return this._orthogonalSize;
5777
+ }
5778
+ set orthogonalSize(size) {
5779
+ this._orthogonalSize = size;
5780
+ }
5781
+ get minimumBodySize() {
5782
+ return this._minimumBodySize;
5783
+ }
5784
+ set minimumBodySize(value) {
5785
+ this._minimumBodySize = typeof value === 'number' ? value : 0;
5308
5786
  }
5309
- }
5310
-
5311
- class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
5312
- constructor(id) {
5313
- super(id);
5314
- this._onDidExpansionChange = new Emitter({
5315
- replay: true,
5316
- });
5317
- this.onDidExpansionChange = this._onDidExpansionChange.event;
5318
- this._onMouseEnter = new Emitter({});
5319
- this.onMouseEnter = this._onMouseEnter.event;
5320
- this._onMouseLeave = new Emitter({});
5321
- this.onMouseLeave = this._onMouseLeave.event;
5322
- this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
5787
+ get maximumBodySize() {
5788
+ return this._maximumBodySize;
5323
5789
  }
5324
- set pane(pane) {
5325
- this._pane = pane;
5790
+ set maximumBodySize(value) {
5791
+ this._maximumBodySize =
5792
+ typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
5326
5793
  }
5327
- setExpanded(isExpanded) {
5328
- var _a;
5329
- (_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
5794
+ get headerVisible() {
5795
+ return this._headerVisible;
5330
5796
  }
5331
- get isExpanded() {
5332
- var _a;
5333
- return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
5797
+ set headerVisible(value) {
5798
+ this._headerVisible = value;
5799
+ this.header.style.display = value ? '' : 'none';
5334
5800
  }
5335
- }
5336
-
5337
- class PaneviewPanel extends BasePanelView {
5338
5801
  constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
5339
5802
  super(id, component, new PaneviewPanelApiImpl(id));
5340
5803
  this.headerComponent = headerComponent;
@@ -5350,6 +5813,7 @@
5350
5813
  this._isExpanded = false;
5351
5814
  this.expandedSize = 0;
5352
5815
  this.api.pane = this; // TODO cannot use 'this' before 'super'
5816
+ this.api.initialize(this);
5353
5817
  this._isExpanded = isExpanded;
5354
5818
  this._headerVisible = isHeaderVisible;
5355
5819
  this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
@@ -5379,53 +5843,6 @@
5379
5843
  }));
5380
5844
  this.renderOnce();
5381
5845
  }
5382
- set orientation(value) {
5383
- this._orientation = value;
5384
- }
5385
- get orientation() {
5386
- return this._orientation;
5387
- }
5388
- get minimumSize() {
5389
- const headerSize = this.headerSize;
5390
- const expanded = this.isExpanded();
5391
- const minimumBodySize = expanded ? this._minimumBodySize : 0;
5392
- return headerSize + minimumBodySize;
5393
- }
5394
- get maximumSize() {
5395
- const headerSize = this.headerSize;
5396
- const expanded = this.isExpanded();
5397
- const maximumBodySize = expanded ? this._maximumBodySize : 0;
5398
- return headerSize + maximumBodySize;
5399
- }
5400
- get size() {
5401
- return this._size;
5402
- }
5403
- get orthogonalSize() {
5404
- return this._orthogonalSize;
5405
- }
5406
- set orthogonalSize(size) {
5407
- this._orthogonalSize = size;
5408
- }
5409
- get minimumBodySize() {
5410
- return this._minimumBodySize;
5411
- }
5412
- set minimumBodySize(value) {
5413
- this._minimumBodySize = typeof value === 'number' ? value : 0;
5414
- }
5415
- get maximumBodySize() {
5416
- return this._maximumBodySize;
5417
- }
5418
- set maximumBodySize(value) {
5419
- this._maximumBodySize =
5420
- typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
5421
- }
5422
- get headerVisible() {
5423
- return this._headerVisible;
5424
- }
5425
- set headerVisible(value) {
5426
- this._headerVisible = value;
5427
- this.header.style.display = value ? '' : 'none';
5428
- }
5429
5846
  setVisible(isVisible) {
5430
5847
  this.api._onDidVisibilityChange.fire({ isVisible });
5431
5848
  }
@@ -5549,7 +5966,10 @@
5549
5966
  }
5550
5967
  })(this.header);
5551
5968
  this.target = new Droptarget(this.element, {
5552
- validOverlays: 'vertical',
5969
+ acceptedTargetZones: ['top', 'bottom'],
5970
+ overlayModel: {
5971
+ activationSize: { type: 'percentage', value: 50 },
5972
+ },
5553
5973
  canDisplayOverlay: (event) => {
5554
5974
  const data = getPaneData();
5555
5975
  if (data) {
@@ -5592,12 +6012,10 @@
5592
6012
  const allPanels = containerApi.panels;
5593
6013
  const fromIndex = allPanels.indexOf(existingPanel);
5594
6014
  let toIndex = containerApi.panels.indexOf(this);
5595
- if (event.position === exports.Position.Left ||
5596
- event.position === exports.Position.Top) {
6015
+ if (event.position === 'left' || event.position === 'top') {
5597
6016
  toIndex = Math.max(0, toIndex - 1);
5598
6017
  }
5599
- if (event.position === exports.Position.Right ||
5600
- event.position === exports.Position.Bottom) {
6018
+ if (event.position === 'right' || event.position === 'bottom') {
5601
6019
  if (fromIndex > toIndex) {
5602
6020
  toIndex++;
5603
6021
  }
@@ -5608,6 +6026,9 @@
5608
6026
  }
5609
6027
 
5610
6028
  class DefaultHeader extends CompositeDisposable {
6029
+ get element() {
6030
+ return this._element;
6031
+ }
5611
6032
  constructor() {
5612
6033
  super();
5613
6034
  this._expandedIcon = createExpandMoreButton();
@@ -5626,9 +6047,6 @@
5626
6047
  (_a = this.apiRef.api) === null || _a === void 0 ? void 0 : _a.setExpanded(!this.apiRef.api.isExpanded);
5627
6048
  }));
5628
6049
  }
5629
- get element() {
5630
- return this._element;
5631
- }
5632
6050
  init(params) {
5633
6051
  this.apiRef.api = params.api;
5634
6052
  this._content.textContent = params.title;
@@ -5681,36 +6099,6 @@
5681
6099
  }
5682
6100
  }
5683
6101
  class PaneviewComponent extends CompositeDisposable {
5684
- constructor(element, options) {
5685
- super();
5686
- this.element = element;
5687
- this._id = nextLayoutId.next();
5688
- this._disposable = new MutableDisposable();
5689
- this._viewDisposables = new Map();
5690
- this._onDidLayoutfromJSON = new Emitter();
5691
- this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5692
- this._onDidLayoutChange = new Emitter();
5693
- this.onDidLayoutChange = this._onDidLayoutChange.event;
5694
- this._onDidDrop = new Emitter();
5695
- this.onDidDrop = this._onDidDrop.event;
5696
- this._onDidAddView = new Emitter();
5697
- this.onDidAddView = this._onDidAddView.event;
5698
- this._onDidRemoveView = new Emitter();
5699
- this.onDidRemoveView = this._onDidRemoveView.event;
5700
- this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
5701
- this._options = options;
5702
- if (!options.components) {
5703
- options.components = {};
5704
- }
5705
- if (!options.frameworkComponents) {
5706
- options.frameworkComponents = {};
5707
- }
5708
- this.paneview = new Paneview(this.element, {
5709
- // only allow paneview in the vertical orientation for now
5710
- orientation: exports.Orientation.VERTICAL,
5711
- });
5712
- this.addDisposables(this._disposable);
5713
- }
5714
6102
  get id() {
5715
6103
  return this._id;
5716
6104
  }
@@ -5745,6 +6133,36 @@
5745
6133
  get options() {
5746
6134
  return this._options;
5747
6135
  }
6136
+ constructor(element, options) {
6137
+ super();
6138
+ this.element = element;
6139
+ this._id = nextLayoutId.next();
6140
+ this._disposable = new MutableDisposable();
6141
+ this._viewDisposables = new Map();
6142
+ this._onDidLayoutfromJSON = new Emitter();
6143
+ this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
6144
+ this._onDidLayoutChange = new Emitter();
6145
+ this.onDidLayoutChange = this._onDidLayoutChange.event;
6146
+ this._onDidDrop = new Emitter();
6147
+ this.onDidDrop = this._onDidDrop.event;
6148
+ this._onDidAddView = new Emitter();
6149
+ this.onDidAddView = this._onDidAddView.event;
6150
+ this._onDidRemoveView = new Emitter();
6151
+ this.onDidRemoveView = this._onDidRemoveView.event;
6152
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
6153
+ this._options = options;
6154
+ if (!options.components) {
6155
+ options.components = {};
6156
+ }
6157
+ if (!options.frameworkComponents) {
6158
+ options.frameworkComponents = {};
6159
+ }
6160
+ this.paneview = new Paneview(this.element, {
6161
+ // only allow paneview in the vertical orientation for now
6162
+ orientation: exports.Orientation.VERTICAL,
6163
+ });
6164
+ this.addDisposables(this._disposable);
6165
+ }
5748
6166
  focus() {
5749
6167
  //
5750
6168
  }
@@ -5930,36 +6348,6 @@
5930
6348
  }
5931
6349
 
5932
6350
  class SplitviewPanel extends BasePanelView {
5933
- constructor(id, componentName) {
5934
- super(id, componentName, new SplitviewPanelApiImpl(id));
5935
- this._evaluatedMinimumSize = 0;
5936
- this._evaluatedMaximumSize = Number.POSITIVE_INFINITY;
5937
- this._minimumSize = 0;
5938
- this._maximumSize = Number.POSITIVE_INFINITY;
5939
- this._snap = false;
5940
- this._onDidChange = new Emitter();
5941
- this.onDidChange = this._onDidChange.event;
5942
- this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
5943
- const { isVisible } = event;
5944
- const { accessor } = this._params;
5945
- accessor.setVisible(this, isVisible);
5946
- }), this.api.onActiveChange(() => {
5947
- const { accessor } = this._params;
5948
- accessor.setActive(this);
5949
- }), this.api.onDidConstraintsChangeInternal((event) => {
5950
- if (typeof event.minimumSize === 'number' ||
5951
- typeof event.minimumSize === 'function') {
5952
- this._minimumSize = event.minimumSize;
5953
- }
5954
- if (typeof event.maximumSize === 'number' ||
5955
- typeof event.maximumSize === 'function') {
5956
- this._maximumSize = event.maximumSize;
5957
- }
5958
- this.updateConstraints();
5959
- }), this.api.onDidSizeChange((event) => {
5960
- this._onDidChange.fire({ size: event.size });
5961
- }));
5962
- }
5963
6351
  get priority() {
5964
6352
  return this._priority;
5965
6353
  }
@@ -5992,6 +6380,37 @@
5992
6380
  get snap() {
5993
6381
  return this._snap;
5994
6382
  }
6383
+ constructor(id, componentName) {
6384
+ super(id, componentName, new SplitviewPanelApiImpl(id));
6385
+ this._evaluatedMinimumSize = 0;
6386
+ this._evaluatedMaximumSize = Number.POSITIVE_INFINITY;
6387
+ this._minimumSize = 0;
6388
+ this._maximumSize = Number.POSITIVE_INFINITY;
6389
+ this._snap = false;
6390
+ this._onDidChange = new Emitter();
6391
+ this.onDidChange = this._onDidChange.event;
6392
+ this.api.initialize(this);
6393
+ this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
6394
+ const { isVisible } = event;
6395
+ const { accessor } = this._params;
6396
+ accessor.setVisible(this, isVisible);
6397
+ }), this.api.onActiveChange(() => {
6398
+ const { accessor } = this._params;
6399
+ accessor.setActive(this);
6400
+ }), this.api.onDidConstraintsChangeInternal((event) => {
6401
+ if (typeof event.minimumSize === 'number' ||
6402
+ typeof event.minimumSize === 'function') {
6403
+ this._minimumSize = event.minimumSize;
6404
+ }
6405
+ if (typeof event.maximumSize === 'number' ||
6406
+ typeof event.maximumSize === 'function') {
6407
+ this._maximumSize = event.maximumSize;
6408
+ }
6409
+ this.updateConstraints();
6410
+ }), this.api.onDidSizeChange((event) => {
6411
+ this._onDidChange.fire({ size: event.size });
6412
+ }));
6413
+ }
5995
6414
  setVisible(isVisible) {
5996
6415
  this.api._onDidVisibilityChange.fire({ isVisible });
5997
6416
  }
@@ -6157,6 +6576,9 @@
6157
6576
  }
6158
6577
 
6159
6578
  class ReactPanelContentPart {
6579
+ get element() {
6580
+ return this._element;
6581
+ }
6160
6582
  constructor(id, component, reactPortalStore) {
6161
6583
  this.id = id;
6162
6584
  this.component = component;
@@ -6168,9 +6590,6 @@
6168
6590
  this._element = document.createElement('div');
6169
6591
  this._element.className = 'dockview-react-part';
6170
6592
  }
6171
- get element() {
6172
- return this._element;
6173
- }
6174
6593
  focus() {
6175
6594
  // TODO
6176
6595
  }
@@ -6205,6 +6624,9 @@
6205
6624
  }
6206
6625
 
6207
6626
  class ReactPanelHeaderPart {
6627
+ get element() {
6628
+ return this._element;
6629
+ }
6208
6630
  constructor(id, component, reactPortalStore) {
6209
6631
  this.id = id;
6210
6632
  this.component = component;
@@ -6212,9 +6634,6 @@
6212
6634
  this._element = document.createElement('div');
6213
6635
  this._element.className = 'dockview-react-part';
6214
6636
  }
6215
- get element() {
6216
- return this._element;
6217
- }
6218
6637
  focus() {
6219
6638
  //noop
6220
6639
  }
@@ -6273,7 +6692,7 @@
6273
6692
  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),
6274
6693
  tab,
6275
6694
  });
6276
- const panel = new DockviewGroupPanel(panelId, this.layout, new DockviewApi(this.layout), group);
6695
+ const panel = new DockviewPanel(panelId, this.layout, new DockviewApi(this.layout), group);
6277
6696
  panel.init({
6278
6697
  view,
6279
6698
  title,
@@ -6284,6 +6703,9 @@
6284
6703
  }
6285
6704
 
6286
6705
  class ReactWatermarkPart {
6706
+ get element() {
6707
+ return this._element;
6708
+ }
6287
6709
  constructor(id, component, reactPortalStore) {
6288
6710
  this.id = id;
6289
6711
  this.component = component;
@@ -6294,9 +6716,6 @@
6294
6716
  this._element = document.createElement('div');
6295
6717
  this._element.className = 'dockview-react-part';
6296
6718
  }
6297
- get element() {
6298
- return this._element;
6299
- }
6300
6719
  init(parameters) {
6301
6720
  this.parameters = parameters;
6302
6721
  this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
@@ -6339,14 +6758,6 @@
6339
6758
  }
6340
6759
 
6341
6760
  class ReactGroupControlsRendererPart {
6342
- constructor(component, reactPortalStore, _group) {
6343
- this.component = component;
6344
- this.reactPortalStore = reactPortalStore;
6345
- this._group = _group;
6346
- this.mutableDisposable = new MutableDisposable();
6347
- this._element = document.createElement('div');
6348
- this._element.className = 'dockview-react-part';
6349
- }
6350
6761
  get element() {
6351
6762
  return this._element;
6352
6763
  }
@@ -6356,6 +6767,14 @@
6356
6767
  get group() {
6357
6768
  return this._group;
6358
6769
  }
6770
+ constructor(component, reactPortalStore, _group) {
6771
+ this.component = component;
6772
+ this.reactPortalStore = reactPortalStore;
6773
+ this._group = _group;
6774
+ this.mutableDisposable = new MutableDisposable();
6775
+ this._element = document.createElement('div');
6776
+ this._element.className = 'dockview-react-part';
6777
+ }
6359
6778
  focus() {
6360
6779
  // TODO
6361
6780
  }
@@ -6470,6 +6889,7 @@
6470
6889
  : undefined,
6471
6890
  showDndOverlay: props.showDndOverlay,
6472
6891
  createGroupControlElement: createGroupControlElement(props.groupControlComponent, { addPortal }),
6892
+ singleTabMode: props.singleTabMode,
6473
6893
  });
6474
6894
  (_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
6475
6895
  dockview.deserializer = new ReactPanelDeserialzier(dockview);
@@ -6682,7 +7102,7 @@
6682
7102
 
6683
7103
  class ReactGridPanelView extends GridviewPanel {
6684
7104
  constructor(id, component, reactComponent, reactPortalStore) {
6685
- super(id, component);
7105
+ super(id, component, new GridviewPanelApiImpl(id));
6686
7106
  this.reactComponent = reactComponent;
6687
7107
  this.reactPortalStore = reactPortalStore;
6688
7108
  }
@@ -6761,6 +7181,9 @@
6761
7181
  GridviewReact.displayName = 'GridviewComponent';
6762
7182
 
6763
7183
  class PanePanelSection {
7184
+ get element() {
7185
+ return this._element;
7186
+ }
6764
7187
  constructor(id, component, reactPortalStore) {
6765
7188
  this.id = id;
6766
7189
  this.component = component;
@@ -6769,9 +7192,6 @@
6769
7192
  this._element.style.height = '100%';
6770
7193
  this._element.style.width = '100%';
6771
7194
  }
6772
- get element() {
6773
- return this._element;
6774
- }
6775
7195
  init(parameters) {
6776
7196
  this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
6777
7197
  params: parameters.params,
@@ -6919,6 +7339,7 @@
6919
7339
  exports.SplitviewPanel = SplitviewPanel;
6920
7340
  exports.SplitviewReact = SplitviewReact;
6921
7341
  exports.Tab = Tab;
7342
+ exports.directionToPosition = directionToPosition;
6922
7343
  exports.getDirectionOrientation = getDirectionOrientation;
6923
7344
  exports.getGridLocation = getGridLocation;
6924
7345
  exports.getLocationOrientation = getLocationOrientation;
@@ -6927,11 +7348,14 @@
6927
7348
  exports.getRelativeLocation = getRelativeLocation;
6928
7349
  exports.indexInParent = indexInParent;
6929
7350
  exports.isGridBranchNode = isGridBranchNode;
7351
+ exports.isGroupOptionsWithGroup = isGroupOptionsWithGroup;
7352
+ exports.isGroupOptionsWithPanel = isGroupOptionsWithPanel;
7353
+ exports.isPanelOptionsWithGroup = isPanelOptionsWithGroup;
7354
+ exports.isPanelOptionsWithPanel = isPanelOptionsWithPanel;
6930
7355
  exports.isReactElement = isReactElement;
6931
7356
  exports.orthogonal = orthogonal;
7357
+ exports.positionToDirection = positionToDirection;
6932
7358
  exports.toTarget = toTarget;
6933
7359
  exports.usePortalsLifecycle = usePortalsLifecycle;
6934
7360
 
6935
- Object.defineProperty(exports, '__esModule', { value: true });
6936
-
6937
7361
  }));