dockview 1.4.2 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +4 -195
  2. package/dist/cjs/api/component.api.d.ts +5 -0
  3. package/dist/cjs/api/component.api.js +13 -1
  4. package/dist/cjs/api/component.api.js.map +1 -1
  5. package/dist/cjs/api/groupPanelApi.d.ts +6 -13
  6. package/dist/cjs/api/groupPanelApi.js +1 -12
  7. package/dist/cjs/api/groupPanelApi.js.map +1 -1
  8. package/dist/cjs/dnd/droptarget.d.ts +1 -2
  9. package/dist/cjs/dockview/components/tab/defaultTab.d.ts +1 -0
  10. package/dist/cjs/dockview/components/tab/defaultTab.js +10 -12
  11. package/dist/cjs/dockview/components/tab/defaultTab.js.map +1 -1
  12. package/dist/cjs/dockview/components/watermark/watermark.js +3 -1
  13. package/dist/cjs/dockview/components/watermark/watermark.js.map +1 -1
  14. package/dist/cjs/dockview/defaultGroupPanelView.d.ts +1 -5
  15. package/dist/cjs/dockview/defaultGroupPanelView.js +5 -20
  16. package/dist/cjs/dockview/defaultGroupPanelView.js.map +1 -1
  17. package/dist/cjs/dockview/deserializer.d.ts +0 -12
  18. package/dist/cjs/dockview/deserializer.js +0 -52
  19. package/dist/cjs/dockview/deserializer.js.map +1 -1
  20. package/dist/cjs/dockview/dockviewComponent.d.ts +7 -14
  21. package/dist/cjs/dockview/dockviewComponent.js +84 -73
  22. package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
  23. package/dist/cjs/dockview/dockviewGroupPanel.d.ts +2 -4
  24. package/dist/cjs/dockview/dockviewGroupPanel.js +12 -31
  25. package/dist/cjs/dockview/dockviewGroupPanel.js.map +1 -1
  26. package/dist/cjs/dockview/options.d.ts +11 -2
  27. package/dist/cjs/gridview/baseComponentGridview.d.ts +4 -2
  28. package/dist/cjs/gridview/baseComponentGridview.js +1 -1
  29. package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
  30. package/dist/cjs/gridview/gridviewComponent.d.ts +1 -0
  31. package/dist/cjs/gridview/gridviewComponent.js +26 -18
  32. package/dist/cjs/gridview/gridviewComponent.js.map +1 -1
  33. package/dist/cjs/groupview/groupPanel.d.ts +0 -3
  34. package/dist/cjs/groupview/groupview.d.ts +20 -18
  35. package/dist/cjs/groupview/groupview.js +39 -39
  36. package/dist/cjs/groupview/groupview.js.map +1 -1
  37. package/dist/cjs/groupview/groupviewPanel.d.ts +2 -2
  38. package/dist/cjs/groupview/groupviewPanel.js.map +1 -1
  39. package/dist/cjs/groupview/tab.d.ts +2 -2
  40. package/dist/cjs/groupview/tab.js +2 -7
  41. package/dist/cjs/groupview/tab.js.map +1 -1
  42. package/dist/cjs/groupview/titlebar/tabsContainer.d.ts +2 -2
  43. package/dist/cjs/groupview/titlebar/tabsContainer.js +1 -13
  44. package/dist/cjs/groupview/titlebar/tabsContainer.js.map +1 -1
  45. package/dist/cjs/groupview/types.d.ts +0 -5
  46. package/dist/cjs/index.d.ts +3 -1
  47. package/dist/cjs/index.js +1 -0
  48. package/dist/cjs/index.js.map +1 -1
  49. package/dist/cjs/paneview/defaultPaneviewHeader.d.ts +3 -0
  50. package/dist/cjs/paneview/defaultPaneviewHeader.js +32 -6
  51. package/dist/cjs/paneview/defaultPaneviewHeader.js.map +1 -1
  52. package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +3 -1
  53. package/dist/cjs/paneview/draggablePaneviewPanel.js +24 -9
  54. package/dist/cjs/paneview/draggablePaneviewPanel.js.map +1 -1
  55. package/dist/cjs/paneview/options.d.ts +2 -0
  56. package/dist/cjs/paneview/paneviewComponent.d.ts +14 -1
  57. package/dist/cjs/paneview/paneviewComponent.js +32 -17
  58. package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
  59. package/dist/cjs/react/deserializer.js +13 -7
  60. package/dist/cjs/react/deserializer.js.map +1 -1
  61. package/dist/cjs/react/dockview/defaultTab.d.ts +4 -0
  62. package/dist/cjs/react/dockview/defaultTab.js +73 -0
  63. package/dist/cjs/react/dockview/defaultTab.js.map +1 -0
  64. package/dist/cjs/react/dockview/dockview.d.ts +5 -4
  65. package/dist/cjs/react/dockview/dockview.js +42 -15
  66. package/dist/cjs/react/dockview/dockview.js.map +1 -1
  67. package/dist/cjs/react/dockview/groupControlsRenderer.d.ts +43 -0
  68. package/dist/cjs/react/dockview/groupControlsRenderer.js +87 -0
  69. package/dist/cjs/react/dockview/groupControlsRenderer.js.map +1 -0
  70. package/dist/cjs/react/dockview/reactContentPart.d.ts +1 -16
  71. package/dist/cjs/react/dockview/reactContentPart.js +2 -18
  72. package/dist/cjs/react/dockview/reactContentPart.js.map +1 -1
  73. package/dist/cjs/react/dockview/reactHeaderPart.d.ts +2 -0
  74. package/dist/cjs/react/dockview/reactHeaderPart.js +4 -0
  75. package/dist/cjs/react/dockview/reactHeaderPart.js.map +1 -1
  76. package/dist/cjs/react/index.d.ts +2 -2
  77. package/dist/cjs/react/index.js +1 -2
  78. package/dist/cjs/react/index.js.map +1 -1
  79. package/dist/cjs/react/paneview/paneview.d.ts +2 -0
  80. package/dist/cjs/react/paneview/paneview.js +9 -0
  81. package/dist/cjs/react/paneview/paneview.js.map +1 -1
  82. package/dist/cjs/react/react.d.ts +1 -0
  83. package/dist/cjs/react/react.js +12 -2
  84. package/dist/cjs/react/react.js.map +1 -1
  85. package/dist/cjs/react/svg.d.ts +3 -0
  86. package/dist/cjs/react/svg.js +36 -0
  87. package/dist/cjs/react/svg.js.map +1 -0
  88. package/dist/cjs/splitview/splitviewComponent.d.ts +2 -0
  89. package/dist/cjs/splitview/splitviewComponent.js +20 -17
  90. package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
  91. package/dist/cjs/svg.d.ts +3 -0
  92. package/dist/cjs/svg.js +44 -0
  93. package/dist/cjs/svg.js.map +1 -0
  94. package/dist/dockview.amd.js +458 -274
  95. package/dist/dockview.amd.min.js +2 -2
  96. package/dist/dockview.amd.min.noStyle.js +2 -2
  97. package/dist/dockview.amd.noStyle.js +457 -273
  98. package/dist/dockview.cjs.js +458 -274
  99. package/dist/dockview.esm.js +453 -268
  100. package/dist/dockview.esm.min.js +2 -2
  101. package/dist/dockview.js +458 -274
  102. package/dist/dockview.min.js +2 -2
  103. package/dist/dockview.min.noStyle.js +2 -2
  104. package/dist/dockview.noStyle.js +457 -273
  105. package/dist/esm/api/component.api.d.ts +5 -0
  106. package/dist/esm/api/component.api.js +13 -1
  107. package/dist/esm/api/groupPanelApi.d.ts +6 -13
  108. package/dist/esm/api/groupPanelApi.js +1 -8
  109. package/dist/esm/dnd/droptarget.d.ts +1 -2
  110. package/dist/esm/dockview/components/tab/defaultTab.d.ts +1 -0
  111. package/dist/esm/dockview/components/tab/defaultTab.js +9 -11
  112. package/dist/esm/dockview/components/watermark/watermark.js +3 -1
  113. package/dist/esm/dockview/defaultGroupPanelView.d.ts +1 -5
  114. package/dist/esm/dockview/defaultGroupPanelView.js +5 -16
  115. package/dist/esm/dockview/deserializer.d.ts +0 -12
  116. package/dist/esm/dockview/deserializer.js +1 -27
  117. package/dist/esm/dockview/dockviewComponent.d.ts +7 -14
  118. package/dist/esm/dockview/dockviewComponent.js +56 -56
  119. package/dist/esm/dockview/dockviewGroupPanel.d.ts +2 -4
  120. package/dist/esm/dockview/dockviewGroupPanel.js +12 -27
  121. package/dist/esm/dockview/options.d.ts +11 -2
  122. package/dist/esm/gridview/baseComponentGridview.d.ts +4 -2
  123. package/dist/esm/gridview/baseComponentGridview.js +1 -1
  124. package/dist/esm/gridview/gridviewComponent.d.ts +1 -0
  125. package/dist/esm/gridview/gridviewComponent.js +15 -7
  126. package/dist/esm/groupview/groupPanel.d.ts +0 -3
  127. package/dist/esm/groupview/groupview.d.ts +20 -18
  128. package/dist/esm/groupview/groupview.js +38 -38
  129. package/dist/esm/groupview/groupviewPanel.d.ts +2 -2
  130. package/dist/esm/groupview/tab.d.ts +2 -2
  131. package/dist/esm/groupview/tab.js +2 -7
  132. package/dist/esm/groupview/titlebar/tabsContainer.d.ts +2 -2
  133. package/dist/esm/groupview/titlebar/tabsContainer.js +1 -2
  134. package/dist/esm/groupview/types.d.ts +0 -5
  135. package/dist/esm/index.d.ts +3 -1
  136. package/dist/esm/index.js +1 -0
  137. package/dist/esm/paneview/defaultPaneviewHeader.d.ts +3 -0
  138. package/dist/esm/paneview/defaultPaneviewHeader.js +32 -6
  139. package/dist/esm/paneview/draggablePaneviewPanel.d.ts +3 -1
  140. package/dist/esm/paneview/draggablePaneviewPanel.js +24 -9
  141. package/dist/esm/paneview/options.d.ts +2 -0
  142. package/dist/esm/paneview/paneviewComponent.d.ts +14 -1
  143. package/dist/esm/paneview/paneviewComponent.js +17 -6
  144. package/dist/esm/react/deserializer.js +13 -7
  145. package/dist/esm/react/dockview/defaultTab.d.ts +4 -0
  146. package/dist/esm/react/dockview/defaultTab.js +34 -0
  147. package/dist/esm/react/dockview/dockview.d.ts +5 -4
  148. package/dist/esm/react/dockview/dockview.js +27 -13
  149. package/dist/esm/react/dockview/groupControlsRenderer.d.ts +43 -0
  150. package/dist/esm/react/dockview/groupControlsRenderer.js +68 -0
  151. package/dist/esm/react/dockview/reactContentPart.d.ts +1 -16
  152. package/dist/esm/react/dockview/reactContentPart.js +2 -14
  153. package/dist/esm/react/dockview/reactHeaderPart.d.ts +2 -0
  154. package/dist/esm/react/dockview/reactHeaderPart.js +4 -0
  155. package/dist/esm/react/index.d.ts +2 -2
  156. package/dist/esm/react/index.js +1 -2
  157. package/dist/esm/react/paneview/paneview.d.ts +2 -0
  158. package/dist/esm/react/paneview/paneview.js +9 -0
  159. package/dist/esm/react/react.d.ts +1 -0
  160. package/dist/esm/react/react.js +12 -2
  161. package/dist/esm/react/svg.d.ts +3 -0
  162. package/dist/esm/react/svg.js +7 -0
  163. package/dist/esm/splitview/splitviewComponent.d.ts +2 -0
  164. package/dist/esm/splitview/splitviewComponent.js +9 -6
  165. package/dist/esm/svg.d.ts +3 -0
  166. package/dist/esm/svg.js +31 -0
  167. package/dist/styles/dockview.css +158 -43
  168. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview
3
- * @version 1.4.2
3
+ * @version 1.5.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -2294,6 +2294,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2294
2294
  toJSON() {
2295
2295
  return this.component.toJSON();
2296
2296
  }
2297
+ clear() {
2298
+ this.component.clear();
2299
+ }
2297
2300
  }
2298
2301
  class PaneviewApi {
2299
2302
  constructor(component) {
@@ -2361,6 +2364,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2361
2364
  toJSON() {
2362
2365
  return this.component.toJSON();
2363
2366
  }
2367
+ clear() {
2368
+ this.component.clear();
2369
+ }
2364
2370
  }
2365
2371
  class GridviewApi {
2366
2372
  constructor(component) {
@@ -2432,6 +2438,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2432
2438
  toJSON() {
2433
2439
  return this.component.toJSON();
2434
2440
  }
2441
+ clear() {
2442
+ this.component.clear();
2443
+ }
2435
2444
  }
2436
2445
  class DockviewApi {
2437
2446
  constructor(component) {
@@ -2480,7 +2489,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2480
2489
  return this.component.onDidRemovePanel;
2481
2490
  }
2482
2491
  get onDidLayoutFromJSON() {
2483
- return this.component.onDidLayoutfromJSON;
2492
+ return this.component.onDidLayoutFromJSON;
2484
2493
  }
2485
2494
  get onDidLayoutChange() {
2486
2495
  return this.component.onDidLayoutChange;
@@ -2542,6 +2551,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2542
2551
  toJSON() {
2543
2552
  return this.component.toJSON();
2544
2553
  }
2554
+ clear() {
2555
+ this.component.clear();
2556
+ }
2545
2557
  }
2546
2558
 
2547
2559
  class ContentContainer extends CompositeDisposable {
@@ -2615,12 +2627,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2615
2627
  }
2616
2628
  }
2617
2629
 
2618
- var DockviewDropTargets;
2630
+ exports.DockviewDropTargets = void 0;
2619
2631
  (function (DockviewDropTargets) {
2620
2632
  DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
2621
2633
  DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
2622
2634
  DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
2623
- })(DockviewDropTargets || (DockviewDropTargets = {}));
2635
+ })(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
2624
2636
 
2625
2637
  class DragHandler extends CompositeDisposable {
2626
2638
  constructor(el) {
@@ -2660,12 +2672,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2660
2672
  exports.MouseEventKind = void 0;
2661
2673
  (function (MouseEventKind) {
2662
2674
  MouseEventKind["CLICK"] = "CLICK";
2663
- MouseEventKind["CONTEXT_MENU"] = "CONTEXT_MENU";
2664
2675
  })(exports.MouseEventKind || (exports.MouseEventKind = {}));
2665
2676
  class Tab extends CompositeDisposable {
2666
2677
  constructor(panelId, accessor, group) {
2667
2678
  super();
2668
2679
  this.panelId = panelId;
2680
+ this.accessor = accessor;
2669
2681
  this.group = group;
2670
2682
  this._onChanged = new Emitter();
2671
2683
  this.onChanged = this._onChanged.event;
@@ -2706,20 +2718,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2706
2718
  */
2707
2719
  event.stopPropagation();
2708
2720
  this._onChanged.fire({ kind: exports.MouseEventKind.CLICK, event });
2709
- }), addDisposableListener(this._element, 'contextmenu', (event) => {
2710
- this._onChanged.fire({
2711
- kind: exports.MouseEventKind.CONTEXT_MENU,
2712
- event,
2713
- });
2714
2721
  }));
2715
2722
  this.droptarget = new Droptarget(this._element, {
2716
2723
  validOverlays: 'none',
2717
2724
  canDisplayOverlay: (event) => {
2718
2725
  const data = getPanelData();
2719
- if (data) {
2726
+ if (data && this.accessor.id === data.viewId) {
2720
2727
  return this.panelId !== data.panelId;
2721
2728
  }
2722
- return this.group.model.canDisplayOverlay(event, DockviewDropTargets.Tab);
2729
+ return this.group.model.canDisplayOverlay(event, exports.DockviewDropTargets.Tab);
2723
2730
  },
2724
2731
  });
2725
2732
  this.addDisposables(this.droptarget.onDrop((event) => {
@@ -2774,11 +2781,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2774
2781
  canDisplayOverlay: (event) => {
2775
2782
  var _a;
2776
2783
  const data = getPanelData();
2777
- if (data) {
2784
+ if (data && this.accessor.id === data.viewId) {
2778
2785
  // don't show the overlay if the tab being dragged is the last panel of this group
2779
2786
  return ((_a = last(this.tabs)) === null || _a === void 0 ? void 0 : _a.value.panelId) !== data.panelId;
2780
2787
  }
2781
- return group.model.canDisplayOverlay(event, DockviewDropTargets.Panel);
2788
+ return group.model.canDisplayOverlay(event, exports.DockviewDropTargets.Panel);
2782
2789
  },
2783
2790
  });
2784
2791
  this.addDisposables(this.voidDropTarget.onDrop((event) => {
@@ -2900,7 +2907,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2900
2907
  var _a;
2901
2908
  const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
2902
2909
  this.group.model.isContentFocused;
2903
- this.accessor.fireMouseEvent(Object.assign(Object.assign({}, event), { panel, tab: true }));
2904
2910
  const isLeftClick = event.event.button === 0;
2905
2911
  if (!isLeftClick || event.event.defaultPrevented) {
2906
2912
  return;
@@ -2931,12 +2937,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2931
2937
  }
2932
2938
  }
2933
2939
 
2934
- exports.GroupChangeKind2 = void 0;
2935
- (function (GroupChangeKind2) {
2936
- GroupChangeKind2["ADD_PANEL"] = "ADD_PANEL";
2937
- GroupChangeKind2["REMOVE_PANEL"] = "REMOVE_PANEL";
2938
- GroupChangeKind2["PANEL_ACTIVE"] = "PANEL_ACTIVE";
2939
- })(exports.GroupChangeKind2 || (exports.GroupChangeKind2 = {}));
2940
2940
  class Groupview extends CompositeDisposable {
2941
2941
  constructor(container, accessor, id, options, parent) {
2942
2942
  super();
@@ -2955,12 +2955,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2955
2955
  this._panels = [];
2956
2956
  this._onMove = new Emitter();
2957
2957
  this.onMove = this._onMove.event;
2958
- this._onDidGroupChange = new Emitter();
2959
- this.onDidGroupChange = this._onDidGroupChange.event;
2960
2958
  this._onDidDrop = new Emitter();
2961
2959
  this.onDidDrop = this._onDidDrop.event;
2960
+ this._onDidAddPanel = new Emitter();
2961
+ this.onDidAddPanel = this._onDidAddPanel.event;
2962
+ this._onDidRemovePanel = new Emitter();
2963
+ this.onDidRemovePanel = this._onDidRemovePanel.event;
2964
+ this._onDidActivePanelChange = new Emitter();
2965
+ this.onDidActivePanelChange = this._onDidActivePanelChange.event;
2962
2966
  this.container.classList.add('groupview');
2963
- this.addDisposables(this._onMove, this._onDidGroupChange, this._onDidChange, this._onDidDrop);
2964
2967
  this.tabsContainer = new TabsContainer(this.accessor, this.parent, {
2965
2968
  tabHeight: options.tabHeight,
2966
2969
  });
@@ -2972,17 +2975,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2972
2975
  return false;
2973
2976
  }
2974
2977
  const data = getPanelData();
2975
- if (data) {
2978
+ if (data && data.viewId === this.accessor.id) {
2976
2979
  const groupHasOnePanelAndIsActiveDragElement = this._panels.length === 1 && data.groupId === this.id;
2977
2980
  return !groupHasOnePanelAndIsActiveDragElement;
2978
2981
  }
2979
- return this.canDisplayOverlay(event, DockviewDropTargets.Panel);
2982
+ return this.canDisplayOverlay(event, exports.DockviewDropTargets.Panel);
2980
2983
  },
2981
2984
  });
2982
2985
  container.append(this.tabsContainer.element, this.contentContainer.element);
2983
2986
  this.header.hidden = !!options.hideHeader;
2984
2987
  this.locked = !!options.locked;
2985
- this.addDisposables(this._onMove, this._onDidGroupChange, this.tabsContainer.onDrop((event) => {
2988
+ this.addDisposables(this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this.tabsContainer.onDrop((event) => {
2986
2989
  this.handleDropEvent(event.event, exports.Position.Center, event.index);
2987
2990
  }), this.contentContainer.onDidFocus(() => {
2988
2991
  this.accessor.doSetGroupActive(this.parent, true);
@@ -3054,6 +3057,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3054
3057
  // correctly initialized
3055
3058
  this.setActive(this.isActive, true, true);
3056
3059
  this.updateContainer();
3060
+ if (this.accessor.options.createGroupControlElement) {
3061
+ this._control = this.accessor.options.createGroupControlElement(this.parent);
3062
+ this.addDisposables(this._control);
3063
+ this._control.init({
3064
+ containerApi: new DockviewApi(this.accessor),
3065
+ api: this.parent.api,
3066
+ });
3067
+ this.tabsContainer.setActionElement(this._control.element);
3068
+ }
3057
3069
  }
3058
3070
  indexOf(panel) {
3059
3071
  return this.tabsContainer.indexOf(panel.id);
@@ -3134,16 +3146,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3134
3146
  options.index > this.panels.length) {
3135
3147
  options.index = this.panels.length;
3136
3148
  }
3137
- const skipSetActive = !!options.skipSetActive;
3149
+ const skipSetPanelActive = !!options.skipSetPanelActive;
3150
+ const skipSetGroupActive = !!options.skipSetGroupActive;
3138
3151
  // ensure the group is updated before we fire any events
3139
3152
  panel.updateParentGroup(this.parent, true);
3140
- if (!skipSetActive && this._activePanel === panel) {
3141
- this.accessor.doSetGroupActive(this.parent);
3153
+ if (this._activePanel === panel) {
3154
+ if (!skipSetGroupActive) {
3155
+ this.accessor.doSetGroupActive(this.parent);
3156
+ }
3142
3157
  return;
3143
3158
  }
3144
- this.doAddPanel(panel, options.index, skipSetActive);
3145
- if (!skipSetActive) {
3159
+ this.doAddPanel(panel, options.index, skipSetPanelActive);
3160
+ if (!skipSetPanelActive) {
3146
3161
  this.doSetActivePanel(panel);
3162
+ }
3163
+ if (!skipSetGroupActive) {
3147
3164
  this.accessor.doSetGroupActive(this.parent, !!options.skipFocus);
3148
3165
  }
3149
3166
  this.updateContainer();
@@ -3179,14 +3196,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3179
3196
  isPanelActive(panel) {
3180
3197
  return this._activePanel === panel;
3181
3198
  }
3182
- updateActions() {
3183
- var _a, _b;
3184
- if (this.isActive && ((_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.actions)) {
3185
- this.tabsContainer.setActionElement(this._activePanel.view.actions.element);
3186
- }
3187
- else {
3188
- this.tabsContainer.setActionElement(undefined);
3189
- }
3199
+ updateActions(element) {
3200
+ this.tabsContainer.setActionElement(element);
3190
3201
  }
3191
3202
  setActive(isGroupActive, skipFocus = false, force = false) {
3192
3203
  var _a, _b;
@@ -3242,10 +3253,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3242
3253
  if (this.mostRecentlyUsed.includes(panel)) {
3243
3254
  this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
3244
3255
  }
3245
- this._onDidGroupChange.fire({
3246
- kind: exports.GroupChangeKind2.REMOVE_PANEL,
3247
- panel,
3248
- });
3256
+ this._onDidRemovePanel.fire({ panel });
3249
3257
  }
3250
3258
  doAddPanel(panel, index = this.panels.length, skipSetActive = false) {
3251
3259
  const existingPanel = this._panels.indexOf(panel);
@@ -3262,10 +3270,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3262
3270
  }
3263
3271
  this.updateMru(panel);
3264
3272
  this.panels.splice(index, 0, panel);
3265
- this._onDidGroupChange.fire({
3266
- kind: exports.GroupChangeKind2.ADD_PANEL,
3267
- panel,
3268
- });
3273
+ this._onDidAddPanel.fire({ panel });
3269
3274
  }
3270
3275
  doSetActivePanel(panel) {
3271
3276
  this._activePanel = panel;
@@ -3273,10 +3278,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3273
3278
  this.tabsContainer.setActivePanel(panel);
3274
3279
  panel.layout(this._width, this._height);
3275
3280
  this.updateMru(panel);
3276
- this._onDidGroupChange.fire({
3277
- kind: exports.GroupChangeKind2.PANEL_ACTIVE,
3278
- panel,
3279
- });
3281
+ this._onDidActivePanelChange.fire({ panel });
3280
3282
  }
3281
3283
  }
3282
3284
  updateMru(panel) {
@@ -3286,7 +3288,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3286
3288
  this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];
3287
3289
  }
3288
3290
  updateContainer() {
3289
- this.updateActions();
3290
3291
  toggleClass(this.container, 'empty', this.isEmpty);
3291
3292
  this.panels.forEach((panel) => panel.updateParentGroup(this.parent, this.isActive));
3292
3293
  if (this.isEmpty && !this.watermark) {
@@ -3319,7 +3320,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3319
3320
  canDisplayOverlay(event, target) {
3320
3321
  // custom overlay handler
3321
3322
  if (this.accessor.options.showDndOverlay) {
3322
- return this.accessor.options.showDndOverlay(event, target);
3323
+ return this.accessor.options.showDndOverlay({
3324
+ nativeEvent: event,
3325
+ target,
3326
+ group: this.accessor.getPanel(this.id),
3327
+ getData: getPanelData,
3328
+ });
3323
3329
  }
3324
3330
  return false;
3325
3331
  }
@@ -3367,7 +3373,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3367
3373
  }
3368
3374
  }
3369
3375
 
3370
- const nextLayoutId = sequentialNumberGenerator();
3376
+ const nextLayoutId$1 = sequentialNumberGenerator();
3371
3377
  function toTarget(direction) {
3372
3378
  switch (direction) {
3373
3379
  case 'left':
@@ -3387,7 +3393,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3387
3393
  constructor(_element, options) {
3388
3394
  super();
3389
3395
  this._element = _element;
3390
- this._id = nextLayoutId.next();
3396
+ this._id = nextLayoutId$1.next();
3391
3397
  this._groups = new Map();
3392
3398
  this._onDidLayoutChange = new Emitter();
3393
3399
  this.onDidLayoutChange = this._onDidLayoutChange.event;
@@ -3402,7 +3408,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3402
3408
  this.element.appendChild(this.gridview.element);
3403
3409
  this.layout(0, 0, true); // set some elements height/widths
3404
3410
  this.addDisposables(this.gridview.onDidChange(() => {
3405
- this._onDidLayoutChange.fire();
3411
+ this._bufferOnDidLayoutChange.fire();
3406
3412
  }));
3407
3413
  this.addDisposables(exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
3408
3414
  this._bufferOnDidLayoutChange.fire();
@@ -3659,24 +3665,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3659
3665
  this.panel = panel;
3660
3666
  this._onDidTitleChange = new Emitter();
3661
3667
  this.onDidTitleChange = this._onDidTitleChange.event;
3662
- this._titleChanged = new Emitter();
3663
- this.titleChanged = this._titleChanged.event;
3664
- this._suppressClosableChanged = new Emitter();
3665
- this.suppressClosableChanged = this._suppressClosableChanged.event;
3666
3668
  this._onDidActiveGroupChange = new Emitter();
3667
3669
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3668
3670
  this._onDidGroupChange = new Emitter();
3669
3671
  this.onDidGroupChange = this._onDidGroupChange.event;
3670
3672
  this.disposable = new MutableDisposable();
3671
3673
  this._group = group;
3672
- this.addDisposables(this.disposable, this._onDidTitleChange, this._titleChanged, this._suppressClosableChanged, this._onDidGroupChange, this._onDidActiveGroupChange);
3674
+ this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
3673
3675
  }
3674
3676
  get title() {
3675
3677
  return this.panel.title;
3676
3678
  }
3677
- get suppressClosable() {
3678
- return !!this.panel.suppressClosable;
3679
- }
3680
3679
  get isGroupActive() {
3681
3680
  var _a;
3682
3681
  return !!((_a = this.group) === null || _a === void 0 ? void 0 : _a.isActive);
@@ -3714,27 +3713,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3714
3713
  this.id = id;
3715
3714
  this.containerApi = containerApi;
3716
3715
  this.mutableDisposable = new MutableDisposable();
3717
- this._suppressClosable = false;
3718
3716
  this._title = '';
3719
3717
  this._group = group;
3720
3718
  this.api = new DockviewPanelApiImpl(this, this._group);
3721
3719
  this.addDisposables(this.api.onActiveChange(() => {
3722
3720
  accessor.setActivePanel(this);
3723
- }), this.api.onDidTitleChange((event) => {
3724
- const title = event.title;
3725
- this.update({ params: { title } });
3726
3721
  }));
3727
3722
  }
3728
3723
  get params() {
3729
- var _a;
3730
- return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
3724
+ return this._params;
3731
3725
  }
3732
3726
  get title() {
3733
3727
  return this._title;
3734
3728
  }
3735
- get suppressClosable() {
3736
- return this._suppressClosable;
3737
- }
3738
3729
  get group() {
3739
3730
  return this._group;
3740
3731
  }
@@ -3746,7 +3737,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3746
3737
  this._params = params.params;
3747
3738
  this._view = params.view;
3748
3739
  this.setTitle(params.title);
3749
- this.setSuppressClosable(params.suppressClosable || false);
3750
3740
  (_a = this.view) === null || _a === void 0 ? void 0 : _a.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
3751
3741
  }
3752
3742
  focus() {
@@ -3759,26 +3749,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3759
3749
  params: Object.keys(this._params || {}).length > 0
3760
3750
  ? this._params
3761
3751
  : undefined,
3762
- suppressClosable: this.suppressClosable || undefined,
3763
3752
  title: this.title,
3764
3753
  };
3765
3754
  }
3766
3755
  setTitle(title) {
3767
- var _a;
3756
+ var _a, _b;
3768
3757
  const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
3769
3758
  if (didTitleChange) {
3770
3759
  this._title = title;
3771
- this.api._titleChanged.fire({ title: this.title });
3772
- }
3773
- }
3774
- setSuppressClosable(suppressClosable) {
3775
- var _a;
3776
- const didSuppressChangableClose = suppressClosable !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.suppressClosable);
3777
- if (didSuppressChangableClose) {
3778
- this._suppressClosable = suppressClosable;
3779
- this.api._suppressClosableChanged.fire({
3780
- suppressClosable: !!this.suppressClosable,
3760
+ (_b = this.view) === null || _b === void 0 ? void 0 : _b.update({
3761
+ params: {
3762
+ params: this._params,
3763
+ title: this.title,
3764
+ },
3781
3765
  });
3766
+ this.api._onDidTitleChange.fire({ title });
3782
3767
  }
3783
3768
  }
3784
3769
  update(event) {
@@ -3786,16 +3771,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3786
3771
  const params = event.params;
3787
3772
  this._params = Object.assign(Object.assign({}, (this._params || {})), event.params.params);
3788
3773
  if (typeof params.title === 'string') {
3789
- this.setTitle(params.title);
3790
- }
3791
- if (typeof params.suppressClosable === 'boolean') {
3792
- this.setSuppressClosable(params.suppressClosable);
3774
+ if (params.title !== this.title) {
3775
+ this._title = params.title;
3776
+ this.api._onDidTitleChange.fire({ title: this.title });
3777
+ }
3793
3778
  }
3794
3779
  (_a = this.view) === null || _a === void 0 ? void 0 : _a.update({
3795
3780
  params: {
3796
3781
  params: this._params,
3797
3782
  title: this.title,
3798
- suppressClosable: this.suppressClosable,
3799
3783
  },
3800
3784
  });
3801
3785
  }
@@ -3847,6 +3831,38 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3847
3831
  }
3848
3832
  }
3849
3833
 
3834
+ const createSvgElementFromPath = (params) => {
3835
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
3836
+ svg.setAttributeNS(null, 'height', params.height);
3837
+ svg.setAttributeNS(null, 'width', params.width);
3838
+ svg.setAttributeNS(null, 'viewBox', params.viewbox);
3839
+ svg.setAttributeNS(null, 'aria-hidden', 'false');
3840
+ svg.setAttributeNS(null, 'focusable', 'false');
3841
+ svg.classList.add('dockview-svg');
3842
+ const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
3843
+ path.setAttributeNS(null, 'd', params.path);
3844
+ svg.appendChild(path);
3845
+ return svg;
3846
+ };
3847
+ const createCloseButton = () => createSvgElementFromPath({
3848
+ width: '11',
3849
+ height: '11',
3850
+ viewbox: '0 0 28 28',
3851
+ path: 'M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z',
3852
+ });
3853
+ const createExpandMoreButton = () => createSvgElementFromPath({
3854
+ width: '11',
3855
+ height: '11',
3856
+ viewbox: '0 0 24 15',
3857
+ path: 'M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z',
3858
+ });
3859
+ const createChevronRightButton = () => createSvgElementFromPath({
3860
+ width: '11',
3861
+ height: '11',
3862
+ viewbox: '0 0 15 25',
3863
+ path: 'M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z',
3864
+ });
3865
+
3850
3866
  class Watermark extends CompositeDisposable {
3851
3867
  constructor() {
3852
3868
  super();
@@ -3863,8 +3879,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3863
3879
  const actions = new ActionContainer();
3864
3880
  title.appendChild(emptySpace);
3865
3881
  title.appendChild(actions.element);
3866
- const closeAnchor = document.createElement('a');
3882
+ const closeAnchor = document.createElement('div');
3867
3883
  closeAnchor.className = 'close-action';
3884
+ closeAnchor.appendChild(createCloseButton());
3868
3885
  actions.add(closeAnchor);
3869
3886
  this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
3870
3887
  var _a;
@@ -3912,34 +3929,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3912
3929
  }
3913
3930
  }
3914
3931
 
3915
- class DefaultDeserializer {
3916
- constructor(layout, panelDeserializer) {
3917
- this.layout = layout;
3918
- this.panelDeserializer = panelDeserializer;
3919
- }
3920
- fromJSON(node) {
3921
- const data = node.data;
3922
- const children = data.views;
3923
- const active = data.activeView;
3924
- const group = this.layout.createGroup({
3925
- id: data.id,
3926
- locked: !!data.locked,
3927
- hideHeader: !!data.hideHeader,
3928
- });
3929
- for (const child of children) {
3930
- const panel = this.panelDeserializer.createPanel(child, group);
3931
- const isActive = typeof active === 'string' && active === panel.id;
3932
- group.model.openPanel(panel, {
3933
- skipSetActive: !isActive,
3934
- });
3935
- }
3936
- if (!group.activePanel && group.panels.length > 0) {
3937
- group.model.openPanel(group.panels[group.panels.length - 1]);
3938
- }
3939
- return group;
3940
- }
3941
- }
3942
-
3943
3932
  function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
3944
3933
  const Component = typeof componentName === 'string'
3945
3934
  ? components[componentName]
@@ -3965,6 +3954,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3965
3954
  return new Component(id, componentName);
3966
3955
  }
3967
3956
 
3957
+ const DEFAULT_TAB_IDENTIFIER = '__default__tab__';
3968
3958
  class DefaultTab extends CompositeDisposable {
3969
3959
  constructor() {
3970
3960
  super();
@@ -3984,8 +3974,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3984
3974
  this._list = document.createElement('ul');
3985
3975
  this._list.className = 'tab-list';
3986
3976
  //
3987
- this.action = document.createElement('a');
3977
+ this.action = document.createElement('div');
3988
3978
  this.action.className = 'tab-action';
3979
+ this.action.appendChild(createCloseButton());
3989
3980
  //
3990
3981
  this._element.appendChild(this._content);
3991
3982
  this._element.appendChild(this._actionContainer);
@@ -4001,7 +3992,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4001
3992
  return this._element;
4002
3993
  }
4003
3994
  get id() {
4004
- return '__DEFAULT_TAB__';
3995
+ return DEFAULT_TAB_IDENTIFIER;
4005
3996
  }
4006
3997
  update(event) {
4007
3998
  this.params = Object.assign(Object.assign({}, this.params), event.params);
@@ -4016,15 +4007,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4016
4007
  init(params) {
4017
4008
  this.params = params;
4018
4009
  this._content.textContent = params.title;
4019
- if (!this.params.suppressClosable) {
4020
- addDisposableListener(this.action, 'click', (ev) => {
4021
- ev.preventDefault(); //
4022
- this.params.api.close();
4023
- });
4024
- }
4025
- else {
4026
- this.action.classList.add('disable-close');
4027
- }
4010
+ addDisposableListener(this.action, 'click', (ev) => {
4011
+ ev.preventDefault(); //
4012
+ this.params.api.close();
4013
+ });
4028
4014
  }
4029
4015
  updateParentGroup(group, isPanelVisible) {
4030
4016
  const changed = this._isPanelVisible !== isPanelVisible ||
@@ -4318,16 +4304,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4318
4304
  var _a;
4319
4305
  this._content = renderers.content;
4320
4306
  this._tab = (_a = renderers.tab) !== null && _a !== void 0 ? _a : new DefaultTab();
4321
- this._actions =
4322
- renderers.actions ||
4323
- (this.content.actions
4324
- ? {
4325
- element: this.content.actions,
4326
- dispose: () => {
4327
- //
4328
- },
4329
- }
4330
- : undefined);
4331
4307
  }
4332
4308
  get content() {
4333
4309
  return this._content;
@@ -4335,9 +4311,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4335
4311
  get tab() {
4336
4312
  return this._tab;
4337
4313
  }
4338
- get actions() {
4339
- return this._actions;
4340
- }
4341
4314
  init(params) {
4342
4315
  this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
4343
4316
  this.tab.init(params);
@@ -4355,16 +4328,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4355
4328
  this.tab.update(event);
4356
4329
  }
4357
4330
  toJSON() {
4331
+ let tab = this.tab instanceof DefaultTab ? undefined : this.tab.toJSON();
4332
+ if (tab && Object.keys(tab).length === 0) {
4333
+ tab = undefined;
4334
+ }
4358
4335
  return {
4359
4336
  content: this.content.toJSON(),
4360
- tab: this.tab instanceof DefaultTab ? undefined : this.tab.toJSON(),
4337
+ tab,
4361
4338
  };
4362
4339
  }
4363
4340
  dispose() {
4364
- var _a;
4365
4341
  this.content.dispose();
4366
4342
  this.tab.dispose();
4367
- (_a = this.actions) === null || _a === void 0 ? void 0 : _a.dispose();
4368
4343
  }
4369
4344
  }
4370
4345
 
@@ -4376,22 +4351,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4376
4351
  orientation: options.orientation || exports.Orientation.HORIZONTAL,
4377
4352
  styles: options.styles,
4378
4353
  });
4379
- // events
4380
- this._onTabInteractionEvent = new Emitter();
4381
- this.onTabInteractionEvent = this._onTabInteractionEvent.event;
4382
- this._onTabContextMenu = new Emitter();
4383
- this.onTabContextMenu = this._onTabContextMenu.event;
4384
4354
  this._onDidDrop = new Emitter();
4385
4355
  this.onDidDrop = this._onDidDrop.event;
4386
4356
  this._onDidRemovePanel = new Emitter();
4387
4357
  this.onDidRemovePanel = this._onDidRemovePanel.event;
4388
4358
  this._onDidAddPanel = new Emitter();
4389
4359
  this.onDidAddPanel = this._onDidAddPanel.event;
4390
- this._onDidLayoutfromJSON = new Emitter();
4391
- this.onDidLayoutfromJSON = this._onDidLayoutfromJSON.event;
4360
+ this._onDidLayoutFromJSON = new Emitter();
4361
+ this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
4392
4362
  this._onDidActivePanelChange = new Emitter();
4393
4363
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
4394
- this.addDisposables(this._onTabInteractionEvent, this._onTabContextMenu, this._onDidDrop, exports.Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
4364
+ this.addDisposables(this._onDidDrop, exports.Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
4395
4365
  this._bufferOnDidLayoutChange.fire();
4396
4366
  }));
4397
4367
  this._options = options;
@@ -4446,7 +4416,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4446
4416
  }
4447
4417
  updateOptions(options) {
4448
4418
  const hasOrientationChanged = typeof options.orientation === 'string' &&
4449
- this.options.orientation !== options.orientation;
4419
+ this.gridview.orientation !== options.orientation;
4450
4420
  this._options = Object.assign(Object.assign({}, this.options), options);
4451
4421
  if (hasOrientationChanged) {
4452
4422
  this.gridview.orientation = options.orientation;
@@ -4524,12 +4494,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4524
4494
  };
4525
4495
  }
4526
4496
  fromJSON(data) {
4527
- const groups = Array.from(this._groups.values()).map((_) => _.value);
4528
- for (const group of groups) {
4529
- // remove the group will automatically remove the panels
4530
- this.removeGroup(group, true);
4531
- }
4532
- this.gridview.clear();
4497
+ this.clear();
4533
4498
  if (!this.deserializer) {
4534
4499
  throw new Error('invalid deserializer');
4535
4500
  }
@@ -4540,12 +4505,31 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4540
4505
  if (!this.deserializer) {
4541
4506
  throw new Error('no deserializer provided');
4542
4507
  }
4543
- this.gridview.deserialize(grid, new DefaultDeserializer(this, {
4544
- createPanel: (id, group) => {
4545
- const panelData = panels[id];
4546
- return this.deserializer.fromJSON(panelData, group);
4547
- },
4548
- }));
4508
+ this.gridview.deserialize(grid, {
4509
+ fromJSON: (node) => {
4510
+ const { id, locked, hideHeader, views, activeView } = node.data;
4511
+ const group = this.createGroup({
4512
+ id,
4513
+ locked: !!locked,
4514
+ hideHeader: !!hideHeader,
4515
+ });
4516
+ this._onDidAddGroup.fire(group);
4517
+ for (const child of views) {
4518
+ const panel = this.deserializer.fromJSON(panels[child], group);
4519
+ const isActive = typeof activeView === 'string' && activeView === panel.id;
4520
+ group.model.openPanel(panel, {
4521
+ skipSetPanelActive: !isActive,
4522
+ skipSetGroupActive: true
4523
+ });
4524
+ }
4525
+ if (!group.activePanel && group.panels.length > 0) {
4526
+ group.model.openPanel(group.panels[group.panels.length - 1], {
4527
+ skipSetGroupActive: true
4528
+ });
4529
+ }
4530
+ return group;
4531
+ }
4532
+ });
4549
4533
  if (typeof activeGroup === 'string') {
4550
4534
  const panel = this.getPanel(activeGroup);
4551
4535
  if (panel) {
@@ -4553,7 +4537,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4553
4537
  }
4554
4538
  }
4555
4539
  this.gridview.layout(this.width, this.height);
4556
- this._onDidLayoutfromJSON.fire();
4540
+ this._onDidLayoutFromJSON.fire();
4541
+ }
4542
+ clear() {
4543
+ const groups = Array.from(this._groups.values()).map((_) => _.value);
4544
+ const hasActiveGroup = !!this.activeGroup;
4545
+ const hasActivePanel = !!this.activePanel;
4546
+ for (const group of groups) {
4547
+ // remove the group will automatically remove the panels
4548
+ this.removeGroup(group, true);
4549
+ }
4550
+ if (hasActiveGroup) {
4551
+ this.doSetGroupActive(undefined);
4552
+ }
4553
+ if (hasActivePanel) {
4554
+ this._onDidActivePanelChange.fire(undefined);
4555
+ }
4556
+ this.gridview.clear();
4557
4557
  }
4558
4558
  closeAllGroups() {
4559
4559
  for (const entry of this._groups.entries()) {
@@ -4561,17 +4561,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4561
4561
  group.value.model.closeAllPanels();
4562
4562
  }
4563
4563
  }
4564
- fireMouseEvent(event) {
4565
- if (event.kind === exports.MouseEventKind.CONTEXT_MENU) {
4566
- if (event.tab && event.panel) {
4567
- this._onTabContextMenu.fire({
4568
- event: event.event,
4569
- api: this._api,
4570
- panel: event.panel,
4571
- });
4572
- }
4573
- }
4574
- }
4575
4564
  addPanel(options) {
4576
4565
  var _a, _b;
4577
4566
  if (this.panels.find((_) => _.id === options.id)) {
@@ -4751,23 +4740,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4751
4740
  const { groupId, itemId, target, index } = event;
4752
4741
  this.moveGroupOrPanel(view, groupId, itemId, target, index);
4753
4742
  }), view.model.onDidDrop((event) => {
4754
- this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api }));
4755
- }), view.model.onDidGroupChange((event) => {
4756
- switch (event.kind) {
4757
- case exports.GroupChangeKind2.ADD_PANEL:
4758
- if (event.panel) {
4759
- this._onDidAddPanel.fire(event.panel);
4760
- }
4761
- break;
4762
- case exports.GroupChangeKind2.REMOVE_PANEL:
4763
- if (event.panel) {
4764
- this._onDidRemovePanel.fire(event.panel);
4765
- }
4766
- break;
4767
- case exports.GroupChangeKind2.PANEL_ACTIVE:
4768
- this._onDidActivePanelChange.fire(event.panel);
4769
- break;
4770
- }
4743
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: view }));
4744
+ }), view.model.onDidAddPanel((event) => {
4745
+ this._onDidAddPanel.fire(event.panel);
4746
+ }), view.model.onDidRemovePanel((event) => {
4747
+ this._onDidRemovePanel.fire(event.panel);
4748
+ }), view.model.onDidActivePanelChange((event) => {
4749
+ this._onDidActivePanelChange.fire(event.panel);
4771
4750
  }));
4772
4751
  this._groups.set(view.id, { value: view, disposable });
4773
4752
  }
@@ -4782,13 +4761,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4782
4761
  createPanel(options, group) {
4783
4762
  const view = new DefaultGroupPanelView({
4784
4763
  content: this.createContentComponent(options.id, options.component),
4785
- tab: this.createTabComponent(options.id, options.tabComponent),
4764
+ tab: this.createTabComponent(options.id, options.tabComponent || this.options.defaultTabComponent),
4786
4765
  });
4787
4766
  const panel = new DockviewGroupPanel(options.id, this, this._api, group);
4788
4767
  panel.init({
4789
4768
  view,
4790
4769
  title: options.title || options.id,
4791
- suppressClosable: options === null || options === void 0 ? void 0 : options.suppressClosable,
4792
4770
  params: (options === null || options === void 0 ? void 0 : options.params) || {},
4793
4771
  });
4794
4772
  return panel;
@@ -4815,7 +4793,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4815
4793
  this._onDidActivePanelChange.dispose();
4816
4794
  this._onDidAddPanel.dispose();
4817
4795
  this._onDidRemovePanel.dispose();
4818
- this._onDidLayoutfromJSON.dispose();
4796
+ this._onDidLayoutFromJSON.dispose();
4819
4797
  }
4820
4798
  }
4821
4799
 
@@ -4853,7 +4831,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4853
4831
  }
4854
4832
  updateOptions(options) {
4855
4833
  const hasOrientationChanged = typeof options.orientation === 'string' &&
4856
- this.options.orientation !== options.orientation;
4834
+ this.gridview.orientation !== options.orientation;
4857
4835
  this._options = Object.assign(Object.assign({}, this.options), options);
4858
4836
  if (hasOrientationChanged) {
4859
4837
  this.gridview.orientation = options.orientation;
@@ -4889,13 +4867,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4889
4867
  (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
4890
4868
  }
4891
4869
  fromJSON(serializedGridview) {
4870
+ this.clear();
4892
4871
  const { grid, activePanel } = serializedGridview;
4893
- const groups = Array.from(this._groups.values()); // reassign since group panels will mutate
4894
- for (const group of groups) {
4895
- group.disposable.dispose();
4896
- this.doRemoveGroup(group.value, { skipActive: true });
4897
- }
4898
- this.gridview.clear();
4899
4872
  const queue = [];
4900
4873
  this.gridview.deserialize(grid, {
4901
4874
  fromJSON: (node) => {
@@ -4917,6 +4890,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4917
4890
  accessor: this,
4918
4891
  isVisible: node.visible,
4919
4892
  }));
4893
+ this._onDidAddGroup.fire(view);
4920
4894
  this.registerPanel(view);
4921
4895
  return view;
4922
4896
  },
@@ -4931,6 +4905,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4931
4905
  }
4932
4906
  this._onDidLayoutfromJSON.fire();
4933
4907
  }
4908
+ clear() {
4909
+ const hasActiveGroup = this.activeGroup;
4910
+ const groups = Array.from(this._groups.values()); // reassign since group panels will mutate
4911
+ for (const group of groups) {
4912
+ group.disposable.dispose();
4913
+ this.doRemoveGroup(group.value, { skipActive: true });
4914
+ }
4915
+ if (hasActiveGroup) {
4916
+ this.doSetGroupActive(undefined);
4917
+ }
4918
+ this.gridview.clear();
4919
+ }
4934
4920
  movePanel(panel, options) {
4935
4921
  var _a;
4936
4922
  let relativeLocation;
@@ -5221,13 +5207,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5221
5207
  };
5222
5208
  }
5223
5209
  fromJSON(serializedSplitview) {
5210
+ this.clear();
5224
5211
  const { views, orientation, size, activeView } = serializedSplitview;
5225
- for (const [_, value] of this._panels.entries()) {
5226
- value.disposable.dispose();
5227
- value.value.dispose();
5228
- }
5229
- this._panels.clear();
5230
- this.splitview.dispose();
5231
5212
  const queue = [];
5232
5213
  this.splitview = new Splitview(this.element, {
5233
5214
  orientation,
@@ -5275,6 +5256,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5275
5256
  }
5276
5257
  this._onDidLayoutfromJSON.fire();
5277
5258
  }
5259
+ clear() {
5260
+ for (const [_, value] of this._panels.entries()) {
5261
+ value.disposable.dispose();
5262
+ value.value.dispose();
5263
+ }
5264
+ this._panels.clear();
5265
+ this.splitview.dispose();
5266
+ }
5278
5267
  dispose() {
5279
5268
  for (const [_, value] of this._panels.entries()) {
5280
5269
  value.disposable.dispose();
@@ -5524,8 +5513,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5524
5513
  }
5525
5514
 
5526
5515
  class DraggablePaneviewPanel extends PaneviewPanel {
5527
- constructor(id, component, headerComponent, orientation, isExpanded, disableDnd) {
5516
+ constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
5528
5517
  super(id, component, headerComponent, orientation, isExpanded, true);
5518
+ this.accessor = accessor;
5529
5519
  this._onDidDrop = new Emitter();
5530
5520
  this.onDidDrop = this._onDidDrop.event;
5531
5521
  if (!disableDnd) {
@@ -5537,10 +5527,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5537
5527
  return;
5538
5528
  }
5539
5529
  const id = this.id;
5530
+ const accessorId = this.accessor.id;
5540
5531
  this.header.draggable = true;
5541
5532
  this.handler = new (class PaneDragHandler extends DragHandler {
5542
5533
  getData() {
5543
- LocalSelectionTransfer.getInstance().setData([new PaneTransfer('paneview', id)], PaneTransfer.prototype);
5534
+ LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);
5544
5535
  return {
5545
5536
  dispose: () => {
5546
5537
  LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
@@ -5550,12 +5541,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5550
5541
  })(this.header);
5551
5542
  this.target = new Droptarget(this.element, {
5552
5543
  validOverlays: 'vertical',
5553
- canDisplayOverlay: () => {
5544
+ canDisplayOverlay: (event) => {
5554
5545
  const data = getPaneData();
5555
- if (!data) {
5556
- return true;
5546
+ if (data) {
5547
+ if (data.paneId !== this.id &&
5548
+ data.viewId === this.accessor.id) {
5549
+ return true;
5550
+ }
5557
5551
  }
5558
- return data.paneId !== this.id;
5552
+ if (this.accessor.options.showDndOverlay) {
5553
+ return this.accessor.options.showDndOverlay({
5554
+ nativeEvent: event,
5555
+ getData: getPaneData,
5556
+ panel: this,
5557
+ });
5558
+ }
5559
+ return false;
5559
5560
  },
5560
5561
  });
5561
5562
  this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
@@ -5564,8 +5565,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5564
5565
  }
5565
5566
  onDrop(event) {
5566
5567
  const data = getPaneData();
5567
- if (!data) {
5568
- this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
5568
+ if (!data || data.viewId !== this.accessor.id) {
5569
+ // if there is no local drag event for this panel
5570
+ // or if the drag event was creating by another Paneview instance
5571
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
5569
5572
  return;
5570
5573
  }
5571
5574
  const containerApi = this._params
@@ -5573,7 +5576,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5573
5576
  const panelId = data.paneId;
5574
5577
  const existingPanel = containerApi.getPanel(panelId);
5575
5578
  if (!existingPanel) {
5576
- this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
5579
+ // if the panel doesn't exist
5580
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
5577
5581
  return;
5578
5582
  }
5579
5583
  const allPanels = containerApi.panels;
@@ -5597,15 +5601,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5597
5601
  class DefaultHeader extends CompositeDisposable {
5598
5602
  constructor() {
5599
5603
  super();
5604
+ this._expandedIcon = createExpandMoreButton();
5605
+ this._collapsedIcon = createChevronRightButton();
5600
5606
  this.disposable = new MutableDisposable();
5601
5607
  this.apiRef = { api: null };
5602
5608
  this._element = document.createElement('div');
5603
5609
  this.element.className = 'default-header';
5604
5610
  this._content = document.createElement('span');
5605
- this._expander = document.createElement('a');
5606
- this.element.appendChild(this._content);
5611
+ this._expander = document.createElement('div');
5612
+ this._expander.className = 'dockview-pane-header-icon';
5607
5613
  this.element.appendChild(this._expander);
5608
- this.addDisposables(addDisposableListener(this._expander, 'click', () => {
5614
+ this.element.appendChild(this._content);
5615
+ this.addDisposables(addDisposableListener(this._element, 'click', () => {
5609
5616
  var _a;
5610
5617
  (_a = this.apiRef.api) === null || _a === void 0 ? void 0 : _a.setExpanded(!this.apiRef.api.isExpanded);
5611
5618
  }));
@@ -5616,11 +5623,32 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5616
5623
  init(params) {
5617
5624
  this.apiRef.api = params.api;
5618
5625
  this._content.textContent = params.title;
5619
- this._expander.textContent = params.api.isExpanded ? '<' : '>';
5620
- this.disposable.value = params.api.onDidExpansionChange((e) => {
5621
- this._expander.textContent = e.isExpanded ? '<' : '>';
5626
+ this.updateIcon();
5627
+ this.disposable.value = params.api.onDidExpansionChange(() => {
5628
+ this.updateIcon();
5622
5629
  });
5623
5630
  }
5631
+ updateIcon() {
5632
+ var _a;
5633
+ const isExpanded = !!((_a = this.apiRef.api) === null || _a === void 0 ? void 0 : _a.isExpanded);
5634
+ toggleClass(this._expander, 'collapsed', !isExpanded);
5635
+ if (isExpanded) {
5636
+ if (this._expander.contains(this._collapsedIcon)) {
5637
+ this._collapsedIcon.remove();
5638
+ }
5639
+ if (!this._expander.contains(this._expandedIcon)) {
5640
+ this._expander.appendChild(this._expandedIcon);
5641
+ }
5642
+ }
5643
+ else {
5644
+ if (this._expander.contains(this._expandedIcon)) {
5645
+ this._expandedIcon.remove();
5646
+ }
5647
+ if (!this._expander.contains(this._collapsedIcon)) {
5648
+ this._expander.appendChild(this._collapsedIcon);
5649
+ }
5650
+ }
5651
+ }
5624
5652
  update(_params) {
5625
5653
  //
5626
5654
  }
@@ -5630,9 +5658,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5630
5658
  }
5631
5659
  }
5632
5660
 
5661
+ const nextLayoutId = sequentialNumberGenerator();
5633
5662
  class PaneFramework extends DraggablePaneviewPanel {
5634
5663
  constructor(options) {
5635
- super(options.id, options.component, options.headerComponent, options.orientation, options.isExpanded, options.disableDnd);
5664
+ super(options.accessor, options.id, options.component, options.headerComponent, options.orientation, options.isExpanded, options.disableDnd);
5636
5665
  this.options = options;
5637
5666
  }
5638
5667
  getBodyComponent() {
@@ -5646,6 +5675,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5646
5675
  constructor(element, options) {
5647
5676
  super();
5648
5677
  this.element = element;
5678
+ this._id = nextLayoutId.next();
5649
5679
  this._disposable = new MutableDisposable();
5650
5680
  this._viewDisposables = new Map();
5651
5681
  this._onDidLayoutfromJSON = new Emitter();
@@ -5672,6 +5702,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5672
5702
  });
5673
5703
  this.addDisposables(this._disposable);
5674
5704
  }
5705
+ get id() {
5706
+ return this._id;
5707
+ }
5675
5708
  get panels() {
5676
5709
  return this.paneview.getPanes();
5677
5710
  }
@@ -5736,6 +5769,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5736
5769
  orientation: exports.Orientation.VERTICAL,
5737
5770
  isExpanded: !!options.isExpanded,
5738
5771
  disableDnd: !!this.options.disableDnd,
5772
+ accessor: this,
5739
5773
  });
5740
5774
  this.doAddPanel(view);
5741
5775
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
@@ -5794,13 +5828,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5794
5828
  };
5795
5829
  }
5796
5830
  fromJSON(serializedPaneview) {
5831
+ this.clear();
5797
5832
  const { views, size } = serializedPaneview;
5798
5833
  const queue = [];
5799
- for (const [_, value] of this._viewDisposables.entries()) {
5800
- value.dispose();
5801
- }
5802
- this._viewDisposables.clear();
5803
- this.paneview.dispose();
5804
5834
  this.paneview = new Paneview(this.element, {
5805
5835
  orientation: exports.Orientation.VERTICAL,
5806
5836
  descriptor: {
@@ -5834,6 +5864,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5834
5864
  orientation: exports.Orientation.VERTICAL,
5835
5865
  isExpanded: !!view.expanded,
5836
5866
  disableDnd: !!this.options.disableDnd,
5867
+ accessor: this,
5837
5868
  });
5838
5869
  this.doAddPanel(panel);
5839
5870
  queue.push(() => {
@@ -5859,6 +5890,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5859
5890
  queue.forEach((f) => f());
5860
5891
  this._onDidLayoutfromJSON.fire();
5861
5892
  }
5893
+ clear() {
5894
+ for (const [_, value] of this._viewDisposables.entries()) {
5895
+ value.dispose();
5896
+ }
5897
+ this._viewDisposables.clear();
5898
+ this.paneview.dispose();
5899
+ }
5862
5900
  doAddPanel(panel) {
5863
5901
  const disposable = panel.onDidDrop((event) => {
5864
5902
  this._onDidDrop.fire(event);
@@ -6026,15 +6064,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6026
6064
  this.component = component;
6027
6065
  this.parameters = parameters;
6028
6066
  this.context = context;
6067
+ this._initialProps = {};
6029
6068
  this.disposed = false;
6030
6069
  this.createPortal();
6031
6070
  }
6032
6071
  update(props) {
6033
- var _a;
6034
6072
  if (this.disposed) {
6035
6073
  throw new Error('invalid operation: resource is already disposed');
6036
6074
  }
6037
- (_a = this.componentInstance) === null || _a === void 0 ? void 0 : _a.update(props);
6075
+ if (!this.componentInstance) {
6076
+ // if the component is yet to be mounted store the props
6077
+ this._initialProps = Object.assign(Object.assign({}, this._initialProps), props);
6078
+ }
6079
+ else {
6080
+ this.componentInstance.update(props);
6081
+ }
6038
6082
  }
6039
6083
  createPortal() {
6040
6084
  if (this.disposed) {
@@ -6054,6 +6098,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6054
6098
  componentProps: this.parameters,
6055
6099
  ref: (element) => {
6056
6100
  this.componentInstance = element;
6101
+ if (Object.keys(this._initialProps).length > 0) {
6102
+ this.componentInstance.update(this._initialProps);
6103
+ this._initialProps = {}; // don't keep a reference to the users object once no longer required
6104
+ }
6057
6105
  },
6058
6106
  });
6059
6107
  const node = this.context
@@ -6110,30 +6158,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6110
6158
  this.onDidBlur = this._onDidBlur.event;
6111
6159
  this._element = document.createElement('div');
6112
6160
  this._element.className = 'dockview-react-part';
6113
- this._actionsElement = document.createElement('div');
6114
- this._actionsElement.className = 'dockview-react-part';
6115
6161
  }
6116
6162
  get element() {
6117
6163
  return this._element;
6118
6164
  }
6119
- get actions() {
6120
- return this._actionsElement;
6121
- }
6122
6165
  focus() {
6123
6166
  // TODO
6124
6167
  }
6125
6168
  init(parameters) {
6126
- const context = {
6127
- api: parameters.api,
6128
- containerApi: parameters.containerApi,
6129
- actionsPortalElement: this._actionsElement,
6130
- tabPortalElement: parameters.tab,
6131
- };
6132
6169
  this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
6133
6170
  params: parameters.params,
6134
6171
  api: parameters.api,
6135
6172
  containerApi: parameters.containerApi,
6136
- }, context);
6173
+ });
6137
6174
  }
6138
6175
  toJSON() {
6139
6176
  return {
@@ -6151,11 +6188,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6151
6188
  // noop
6152
6189
  }
6153
6190
  dispose() {
6154
- var _a, _b;
6191
+ var _a;
6155
6192
  this._onDidFocus.dispose();
6156
6193
  this._onDidBlur.dispose();
6157
6194
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
6158
- (_b = this.actionsPart) === null || _b === void 0 ? void 0 : _b.dispose();
6159
6195
  }
6160
6196
  }
6161
6197
 
@@ -6185,6 +6221,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6185
6221
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
6186
6222
  }
6187
6223
  toJSON() {
6224
+ if (this.id === DEFAULT_TAB_IDENTIFIER) {
6225
+ return {};
6226
+ }
6188
6227
  return {
6189
6228
  id: this.id,
6190
6229
  };
@@ -6206,23 +6245,29 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6206
6245
  this.layout = layout;
6207
6246
  }
6208
6247
  fromJSON(panelData, group) {
6209
- var _a, _b, _c;
6248
+ var _a, _b, _c, _d;
6210
6249
  const panelId = panelData.id;
6211
6250
  const params = panelData.params;
6212
6251
  const title = panelData.title;
6213
- const suppressClosable = panelData.suppressClosable;
6214
6252
  const viewData = panelData.view;
6253
+ let tab;
6254
+ if ((_a = viewData.tab) === null || _a === void 0 ? void 0 : _a.id) {
6255
+ tab = createComponent(viewData.tab.id, viewData.tab.id, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_b = this.layout.options.frameworkComponentFactory) === null || _b === void 0 ? void 0 : _b.tab, () => new DefaultTab());
6256
+ }
6257
+ else if (this.layout.options.defaultTabComponent) {
6258
+ tab = createComponent(this.layout.options.defaultTabComponent, this.layout.options.defaultTabComponent, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_c = this.layout.options.frameworkComponentFactory) === null || _c === void 0 ? void 0 : _c.tab, () => new DefaultTab());
6259
+ }
6260
+ else {
6261
+ tab = new DefaultTab();
6262
+ }
6215
6263
  const view = new DefaultGroupPanelView({
6216
- content: createComponent(viewData.content.id, viewData.content.id, this.layout.options.components, this.layout.options.frameworkComponents, (_a = this.layout.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.content),
6217
- tab: ((_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id)
6218
- ? createComponent(viewData.tab.id, viewData.tab.id, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_c = this.layout.options.frameworkComponentFactory) === null || _c === void 0 ? void 0 : _c.tab)
6219
- : new DefaultTab(),
6264
+ 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),
6265
+ tab,
6220
6266
  });
6221
6267
  const panel = new DockviewGroupPanel(panelId, this.layout, new DockviewApi(this.layout), group);
6222
6268
  panel.init({
6223
6269
  view,
6224
6270
  title,
6225
- suppressClosable,
6226
6271
  params: params || {},
6227
6272
  });
6228
6273
  return panel;
@@ -6284,6 +6329,80 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6284
6329
  }
6285
6330
  }
6286
6331
 
6332
+ class ReactGroupControlsRendererPart {
6333
+ constructor(component, reactPortalStore, _group) {
6334
+ this.component = component;
6335
+ this.reactPortalStore = reactPortalStore;
6336
+ this._group = _group;
6337
+ this.mutableDisposable = new MutableDisposable();
6338
+ this._element = document.createElement('div');
6339
+ this._element.className = 'dockview-react-part';
6340
+ }
6341
+ get element() {
6342
+ return this._element;
6343
+ }
6344
+ get part() {
6345
+ return this._part;
6346
+ }
6347
+ get group() {
6348
+ return this._group;
6349
+ }
6350
+ focus() {
6351
+ // TODO
6352
+ }
6353
+ init(parameters) {
6354
+ this.mutableDisposable.value = new CompositeDisposable(this._group.model.onDidAddPanel(() => {
6355
+ this.updatePanels();
6356
+ }), this._group.model.onDidRemovePanel(() => {
6357
+ this.updatePanels();
6358
+ }), this._group.model.onDidActivePanelChange(() => {
6359
+ this.updateActivePanel();
6360
+ }), parameters.api.onDidActiveChange(() => {
6361
+ this.updateGroupActive();
6362
+ }));
6363
+ this._part = new ReactPart(this.element, this.reactPortalStore, this.component, {
6364
+ api: parameters.api,
6365
+ containerApi: parameters.containerApi,
6366
+ panels: this._group.model.panels,
6367
+ activePanel: this._group.model.activePanel,
6368
+ isGroupActive: this._group.api.isActive,
6369
+ });
6370
+ }
6371
+ update(event) {
6372
+ var _a;
6373
+ (_a = this._part) === null || _a === void 0 ? void 0 : _a.update(event.params);
6374
+ }
6375
+ dispose() {
6376
+ var _a;
6377
+ this.mutableDisposable.dispose();
6378
+ (_a = this._part) === null || _a === void 0 ? void 0 : _a.dispose();
6379
+ }
6380
+ updatePanels() {
6381
+ this.update({ params: { panels: this._group.model.panels } });
6382
+ }
6383
+ updateActivePanel() {
6384
+ this.update({
6385
+ params: {
6386
+ activePanel: this._group.model.activePanel,
6387
+ },
6388
+ });
6389
+ }
6390
+ updateGroupActive() {
6391
+ this.update({
6392
+ params: {
6393
+ isGroupActive: this._group.api.isActive,
6394
+ },
6395
+ });
6396
+ }
6397
+ }
6398
+
6399
+ function createGroupControlElement(component, store) {
6400
+ return component
6401
+ ? (groupPanel) => {
6402
+ return new ReactGroupControlsRendererPart(component, store, groupPanel);
6403
+ }
6404
+ : undefined;
6405
+ }
6287
6406
  const DockviewReact = React__namespace.forwardRef((props, ref) => {
6288
6407
  const domRef = React__namespace.useRef(null);
6289
6408
  const dockviewRef = React__namespace.useRef();
@@ -6333,12 +6452,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6333
6452
  const dockview = new DockviewComponent(element, {
6334
6453
  frameworkComponentFactory: factory,
6335
6454
  frameworkComponents: props.components,
6336
- frameworkTabComponents: props.tabComponents,
6455
+ frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
6337
6456
  tabHeight: props.tabHeight,
6338
6457
  watermarkFrameworkComponent: props.watermarkComponent,
6458
+ defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
6339
6459
  styles: props.hideBorders
6340
6460
  ? { separatorBorder: 'transparent' }
6341
6461
  : undefined,
6462
+ showDndOverlay: props.showDndOverlay,
6463
+ createGroupControlElement: createGroupControlElement(props.groupControlComponent, { addPortal }),
6342
6464
  });
6343
6465
  (_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
6344
6466
  dockview.deserializer = new ReactPanelDeserialzier(dockview);
@@ -6401,24 +6523,78 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6401
6523
  });
6402
6524
  }, [props.tabComponents]);
6403
6525
  React__namespace.useEffect(() => {
6404
- if (!props.onTabContextMenu || !dockviewRef.current) {
6405
- return () => {
6406
- //noop
6407
- };
6526
+ if (!dockviewRef.current) {
6527
+ return;
6408
6528
  }
6409
- const disposable = dockviewRef.current.onTabContextMenu((event) => {
6410
- if (props.onTabContextMenu) {
6411
- props.onTabContextMenu(event);
6412
- }
6529
+ dockviewRef.current.updateOptions({
6530
+ defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
6531
+ frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
6413
6532
  });
6414
- return () => {
6415
- disposable.dispose();
6416
- };
6417
- }, [props.onTabContextMenu]);
6533
+ }, [props.defaultTabComponent]);
6534
+ React__namespace.useEffect(() => {
6535
+ if (!dockviewRef.current) {
6536
+ return;
6537
+ }
6538
+ dockviewRef.current.updateOptions({
6539
+ createGroupControlElement: createGroupControlElement(props.groupControlComponent, { addPortal }),
6540
+ });
6541
+ }, [props.groupControlComponent]);
6418
6542
  return (React__namespace.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
6419
6543
  });
6420
6544
  DockviewReact.displayName = 'DockviewComponent';
6421
6545
 
6546
+ /******************************************************************************
6547
+ Copyright (c) Microsoft Corporation.
6548
+
6549
+ Permission to use, copy, modify, and/or distribute this software for any
6550
+ purpose with or without fee is hereby granted.
6551
+
6552
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
6553
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
6554
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
6555
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
6556
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
6557
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
6558
+ PERFORMANCE OF THIS SOFTWARE.
6559
+ ***************************************************************************** */
6560
+
6561
+ function __rest(s, e) {
6562
+ var t = {};
6563
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
6564
+ t[p] = s[p];
6565
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6566
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
6567
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
6568
+ t[p[i]] = s[p[i]];
6569
+ }
6570
+ return t;
6571
+ }
6572
+
6573
+ const CloseButton = () => (React__namespace.createElement("svg", { height: "11", width: "11", viewBox: "0 0 28 28", "aria-hidden": 'false', focusable: false, className: "dockview-svg" },
6574
+ React__namespace.createElement("path", { d: "M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z" })));
6575
+
6576
+ const DockviewDefaultTab = (_a) => {
6577
+ var { api, containerApi: _containerApi, params: _params } = _a, rest = __rest(_a, ["api", "containerApi", "params"]);
6578
+ const onClose = React__namespace.useCallback((event) => {
6579
+ event.stopPropagation();
6580
+ api.close();
6581
+ }, [api]);
6582
+ const onClick = React__namespace.useCallback((event) => {
6583
+ api.setActive();
6584
+ if (rest.onClick) {
6585
+ rest.onClick(event);
6586
+ }
6587
+ }, [api, rest.onClick]);
6588
+ const iconClassname = React__namespace.useMemo(() => {
6589
+ const cn = ['dockview-react-tab-action'];
6590
+ return cn.join(',');
6591
+ }, []);
6592
+ return (React__namespace.createElement("div", Object.assign({}, rest, { onClick: onClick, className: "dockview-react-tab" }),
6593
+ React__namespace.createElement("span", { className: "dockview-react-tab-title" }, api.title),
6594
+ React__namespace.createElement("div", { className: iconClassname, onClick: onClose },
6595
+ React__namespace.createElement(CloseButton, null))));
6596
+ };
6597
+
6422
6598
  class ReactPanelView extends SplitviewPanel {
6423
6599
  constructor(id, component, reactComponent, reactPortalStore) {
6424
6600
  super(id, component);
@@ -6648,6 +6824,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6648
6824
  createComponent,
6649
6825
  },
6650
6826
  },
6827
+ showDndOverlay: props.showDndOverlay,
6651
6828
  });
6652
6829
  const api = new PaneviewApi(paneview);
6653
6830
  const { clientWidth, clientHeight } = domRef.current;
@@ -6692,6 +6869,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6692
6869
  disposable.dispose();
6693
6870
  };
6694
6871
  }, [props.onDidDrop]);
6872
+ React__namespace.useEffect(() => {
6873
+ if (!paneviewRef.current) {
6874
+ return;
6875
+ }
6876
+ paneviewRef.current.updateOptions({
6877
+ showDndOverlay: props.showDndOverlay,
6878
+ });
6879
+ }, [props.showDndOverlay]);
6695
6880
  return (React__namespace.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
6696
6881
  });
6697
6882
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -6700,6 +6885,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6700
6885
  exports.ContentContainer = ContentContainer;
6701
6886
  exports.DockviewApi = DockviewApi;
6702
6887
  exports.DockviewComponent = DockviewComponent;
6888
+ exports.DockviewDefaultTab = DockviewDefaultTab;
6703
6889
  exports.DockviewReact = DockviewReact;
6704
6890
  exports.Gridview = Gridview;
6705
6891
  exports.GridviewApi = GridviewApi;
@@ -6716,8 +6902,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6716
6902
  exports.PaneviewComponent = PaneviewComponent;
6717
6903
  exports.PaneviewPanel = PaneviewPanel;
6718
6904
  exports.PaneviewReact = PaneviewReact;
6719
- exports.ReactPanelContentPart = ReactPanelContentPart;
6720
- exports.ReactPanelHeaderPart = ReactPanelHeaderPart;
6721
6905
  exports.ReactPart = ReactPart;
6722
6906
  exports.ReactPartContext = ReactPartContext;
6723
6907
  exports.Splitview = Splitview;