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
  */
@@ -2298,6 +2298,9 @@
2298
2298
  toJSON() {
2299
2299
  return this.component.toJSON();
2300
2300
  }
2301
+ clear() {
2302
+ this.component.clear();
2303
+ }
2301
2304
  }
2302
2305
  class PaneviewApi {
2303
2306
  constructor(component) {
@@ -2365,6 +2368,9 @@
2365
2368
  toJSON() {
2366
2369
  return this.component.toJSON();
2367
2370
  }
2371
+ clear() {
2372
+ this.component.clear();
2373
+ }
2368
2374
  }
2369
2375
  class GridviewApi {
2370
2376
  constructor(component) {
@@ -2436,6 +2442,9 @@
2436
2442
  toJSON() {
2437
2443
  return this.component.toJSON();
2438
2444
  }
2445
+ clear() {
2446
+ this.component.clear();
2447
+ }
2439
2448
  }
2440
2449
  class DockviewApi {
2441
2450
  constructor(component) {
@@ -2484,7 +2493,7 @@
2484
2493
  return this.component.onDidRemovePanel;
2485
2494
  }
2486
2495
  get onDidLayoutFromJSON() {
2487
- return this.component.onDidLayoutfromJSON;
2496
+ return this.component.onDidLayoutFromJSON;
2488
2497
  }
2489
2498
  get onDidLayoutChange() {
2490
2499
  return this.component.onDidLayoutChange;
@@ -2546,6 +2555,9 @@
2546
2555
  toJSON() {
2547
2556
  return this.component.toJSON();
2548
2557
  }
2558
+ clear() {
2559
+ this.component.clear();
2560
+ }
2549
2561
  }
2550
2562
 
2551
2563
  class ContentContainer extends CompositeDisposable {
@@ -2619,12 +2631,12 @@
2619
2631
  }
2620
2632
  }
2621
2633
 
2622
- var DockviewDropTargets;
2634
+ exports.DockviewDropTargets = void 0;
2623
2635
  (function (DockviewDropTargets) {
2624
2636
  DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
2625
2637
  DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
2626
2638
  DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
2627
- })(DockviewDropTargets || (DockviewDropTargets = {}));
2639
+ })(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
2628
2640
 
2629
2641
  class DragHandler extends CompositeDisposable {
2630
2642
  constructor(el) {
@@ -2664,12 +2676,12 @@
2664
2676
  exports.MouseEventKind = void 0;
2665
2677
  (function (MouseEventKind) {
2666
2678
  MouseEventKind["CLICK"] = "CLICK";
2667
- MouseEventKind["CONTEXT_MENU"] = "CONTEXT_MENU";
2668
2679
  })(exports.MouseEventKind || (exports.MouseEventKind = {}));
2669
2680
  class Tab extends CompositeDisposable {
2670
2681
  constructor(panelId, accessor, group) {
2671
2682
  super();
2672
2683
  this.panelId = panelId;
2684
+ this.accessor = accessor;
2673
2685
  this.group = group;
2674
2686
  this._onChanged = new Emitter();
2675
2687
  this.onChanged = this._onChanged.event;
@@ -2710,20 +2722,15 @@
2710
2722
  */
2711
2723
  event.stopPropagation();
2712
2724
  this._onChanged.fire({ kind: exports.MouseEventKind.CLICK, event });
2713
- }), addDisposableListener(this._element, 'contextmenu', (event) => {
2714
- this._onChanged.fire({
2715
- kind: exports.MouseEventKind.CONTEXT_MENU,
2716
- event,
2717
- });
2718
2725
  }));
2719
2726
  this.droptarget = new Droptarget(this._element, {
2720
2727
  validOverlays: 'none',
2721
2728
  canDisplayOverlay: (event) => {
2722
2729
  const data = getPanelData();
2723
- if (data) {
2730
+ if (data && this.accessor.id === data.viewId) {
2724
2731
  return this.panelId !== data.panelId;
2725
2732
  }
2726
- return this.group.model.canDisplayOverlay(event, DockviewDropTargets.Tab);
2733
+ return this.group.model.canDisplayOverlay(event, exports.DockviewDropTargets.Tab);
2727
2734
  },
2728
2735
  });
2729
2736
  this.addDisposables(this.droptarget.onDrop((event) => {
@@ -2778,11 +2785,11 @@
2778
2785
  canDisplayOverlay: (event) => {
2779
2786
  var _a;
2780
2787
  const data = getPanelData();
2781
- if (data) {
2788
+ if (data && this.accessor.id === data.viewId) {
2782
2789
  // don't show the overlay if the tab being dragged is the last panel of this group
2783
2790
  return ((_a = last(this.tabs)) === null || _a === void 0 ? void 0 : _a.value.panelId) !== data.panelId;
2784
2791
  }
2785
- return group.model.canDisplayOverlay(event, DockviewDropTargets.Panel);
2792
+ return group.model.canDisplayOverlay(event, exports.DockviewDropTargets.Panel);
2786
2793
  },
2787
2794
  });
2788
2795
  this.addDisposables(this.voidDropTarget.onDrop((event) => {
@@ -2904,7 +2911,6 @@
2904
2911
  var _a;
2905
2912
  const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
2906
2913
  this.group.model.isContentFocused;
2907
- this.accessor.fireMouseEvent(Object.assign(Object.assign({}, event), { panel, tab: true }));
2908
2914
  const isLeftClick = event.event.button === 0;
2909
2915
  if (!isLeftClick || event.event.defaultPrevented) {
2910
2916
  return;
@@ -2935,12 +2941,6 @@
2935
2941
  }
2936
2942
  }
2937
2943
 
2938
- exports.GroupChangeKind2 = void 0;
2939
- (function (GroupChangeKind2) {
2940
- GroupChangeKind2["ADD_PANEL"] = "ADD_PANEL";
2941
- GroupChangeKind2["REMOVE_PANEL"] = "REMOVE_PANEL";
2942
- GroupChangeKind2["PANEL_ACTIVE"] = "PANEL_ACTIVE";
2943
- })(exports.GroupChangeKind2 || (exports.GroupChangeKind2 = {}));
2944
2944
  class Groupview extends CompositeDisposable {
2945
2945
  constructor(container, accessor, id, options, parent) {
2946
2946
  super();
@@ -2959,12 +2959,15 @@
2959
2959
  this._panels = [];
2960
2960
  this._onMove = new Emitter();
2961
2961
  this.onMove = this._onMove.event;
2962
- this._onDidGroupChange = new Emitter();
2963
- this.onDidGroupChange = this._onDidGroupChange.event;
2964
2962
  this._onDidDrop = new Emitter();
2965
2963
  this.onDidDrop = this._onDidDrop.event;
2964
+ this._onDidAddPanel = new Emitter();
2965
+ this.onDidAddPanel = this._onDidAddPanel.event;
2966
+ this._onDidRemovePanel = new Emitter();
2967
+ this.onDidRemovePanel = this._onDidRemovePanel.event;
2968
+ this._onDidActivePanelChange = new Emitter();
2969
+ this.onDidActivePanelChange = this._onDidActivePanelChange.event;
2966
2970
  this.container.classList.add('groupview');
2967
- this.addDisposables(this._onMove, this._onDidGroupChange, this._onDidChange, this._onDidDrop);
2968
2971
  this.tabsContainer = new TabsContainer(this.accessor, this.parent, {
2969
2972
  tabHeight: options.tabHeight,
2970
2973
  });
@@ -2976,17 +2979,17 @@
2976
2979
  return false;
2977
2980
  }
2978
2981
  const data = getPanelData();
2979
- if (data) {
2982
+ if (data && data.viewId === this.accessor.id) {
2980
2983
  const groupHasOnePanelAndIsActiveDragElement = this._panels.length === 1 && data.groupId === this.id;
2981
2984
  return !groupHasOnePanelAndIsActiveDragElement;
2982
2985
  }
2983
- return this.canDisplayOverlay(event, DockviewDropTargets.Panel);
2986
+ return this.canDisplayOverlay(event, exports.DockviewDropTargets.Panel);
2984
2987
  },
2985
2988
  });
2986
2989
  container.append(this.tabsContainer.element, this.contentContainer.element);
2987
2990
  this.header.hidden = !!options.hideHeader;
2988
2991
  this.locked = !!options.locked;
2989
- this.addDisposables(this._onMove, this._onDidGroupChange, this.tabsContainer.onDrop((event) => {
2992
+ this.addDisposables(this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this.tabsContainer.onDrop((event) => {
2990
2993
  this.handleDropEvent(event.event, exports.Position.Center, event.index);
2991
2994
  }), this.contentContainer.onDidFocus(() => {
2992
2995
  this.accessor.doSetGroupActive(this.parent, true);
@@ -3058,6 +3061,15 @@
3058
3061
  // correctly initialized
3059
3062
  this.setActive(this.isActive, true, true);
3060
3063
  this.updateContainer();
3064
+ if (this.accessor.options.createGroupControlElement) {
3065
+ this._control = this.accessor.options.createGroupControlElement(this.parent);
3066
+ this.addDisposables(this._control);
3067
+ this._control.init({
3068
+ containerApi: new DockviewApi(this.accessor),
3069
+ api: this.parent.api,
3070
+ });
3071
+ this.tabsContainer.setActionElement(this._control.element);
3072
+ }
3061
3073
  }
3062
3074
  indexOf(panel) {
3063
3075
  return this.tabsContainer.indexOf(panel.id);
@@ -3138,16 +3150,21 @@
3138
3150
  options.index > this.panels.length) {
3139
3151
  options.index = this.panels.length;
3140
3152
  }
3141
- const skipSetActive = !!options.skipSetActive;
3153
+ const skipSetPanelActive = !!options.skipSetPanelActive;
3154
+ const skipSetGroupActive = !!options.skipSetGroupActive;
3142
3155
  // ensure the group is updated before we fire any events
3143
3156
  panel.updateParentGroup(this.parent, true);
3144
- if (!skipSetActive && this._activePanel === panel) {
3145
- this.accessor.doSetGroupActive(this.parent);
3157
+ if (this._activePanel === panel) {
3158
+ if (!skipSetGroupActive) {
3159
+ this.accessor.doSetGroupActive(this.parent);
3160
+ }
3146
3161
  return;
3147
3162
  }
3148
- this.doAddPanel(panel, options.index, skipSetActive);
3149
- if (!skipSetActive) {
3163
+ this.doAddPanel(panel, options.index, skipSetPanelActive);
3164
+ if (!skipSetPanelActive) {
3150
3165
  this.doSetActivePanel(panel);
3166
+ }
3167
+ if (!skipSetGroupActive) {
3151
3168
  this.accessor.doSetGroupActive(this.parent, !!options.skipFocus);
3152
3169
  }
3153
3170
  this.updateContainer();
@@ -3183,14 +3200,8 @@
3183
3200
  isPanelActive(panel) {
3184
3201
  return this._activePanel === panel;
3185
3202
  }
3186
- updateActions() {
3187
- var _a, _b;
3188
- if (this.isActive && ((_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.actions)) {
3189
- this.tabsContainer.setActionElement(this._activePanel.view.actions.element);
3190
- }
3191
- else {
3192
- this.tabsContainer.setActionElement(undefined);
3193
- }
3203
+ updateActions(element) {
3204
+ this.tabsContainer.setActionElement(element);
3194
3205
  }
3195
3206
  setActive(isGroupActive, skipFocus = false, force = false) {
3196
3207
  var _a, _b;
@@ -3246,10 +3257,7 @@
3246
3257
  if (this.mostRecentlyUsed.includes(panel)) {
3247
3258
  this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
3248
3259
  }
3249
- this._onDidGroupChange.fire({
3250
- kind: exports.GroupChangeKind2.REMOVE_PANEL,
3251
- panel,
3252
- });
3260
+ this._onDidRemovePanel.fire({ panel });
3253
3261
  }
3254
3262
  doAddPanel(panel, index = this.panels.length, skipSetActive = false) {
3255
3263
  const existingPanel = this._panels.indexOf(panel);
@@ -3266,10 +3274,7 @@
3266
3274
  }
3267
3275
  this.updateMru(panel);
3268
3276
  this.panels.splice(index, 0, panel);
3269
- this._onDidGroupChange.fire({
3270
- kind: exports.GroupChangeKind2.ADD_PANEL,
3271
- panel,
3272
- });
3277
+ this._onDidAddPanel.fire({ panel });
3273
3278
  }
3274
3279
  doSetActivePanel(panel) {
3275
3280
  this._activePanel = panel;
@@ -3277,10 +3282,7 @@
3277
3282
  this.tabsContainer.setActivePanel(panel);
3278
3283
  panel.layout(this._width, this._height);
3279
3284
  this.updateMru(panel);
3280
- this._onDidGroupChange.fire({
3281
- kind: exports.GroupChangeKind2.PANEL_ACTIVE,
3282
- panel,
3283
- });
3285
+ this._onDidActivePanelChange.fire({ panel });
3284
3286
  }
3285
3287
  }
3286
3288
  updateMru(panel) {
@@ -3290,7 +3292,6 @@
3290
3292
  this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];
3291
3293
  }
3292
3294
  updateContainer() {
3293
- this.updateActions();
3294
3295
  toggleClass(this.container, 'empty', this.isEmpty);
3295
3296
  this.panels.forEach((panel) => panel.updateParentGroup(this.parent, this.isActive));
3296
3297
  if (this.isEmpty && !this.watermark) {
@@ -3323,7 +3324,12 @@
3323
3324
  canDisplayOverlay(event, target) {
3324
3325
  // custom overlay handler
3325
3326
  if (this.accessor.options.showDndOverlay) {
3326
- return this.accessor.options.showDndOverlay(event, target);
3327
+ return this.accessor.options.showDndOverlay({
3328
+ nativeEvent: event,
3329
+ target,
3330
+ group: this.accessor.getPanel(this.id),
3331
+ getData: getPanelData,
3332
+ });
3327
3333
  }
3328
3334
  return false;
3329
3335
  }
@@ -3371,7 +3377,7 @@
3371
3377
  }
3372
3378
  }
3373
3379
 
3374
- const nextLayoutId = sequentialNumberGenerator();
3380
+ const nextLayoutId$1 = sequentialNumberGenerator();
3375
3381
  function toTarget(direction) {
3376
3382
  switch (direction) {
3377
3383
  case 'left':
@@ -3391,7 +3397,7 @@
3391
3397
  constructor(_element, options) {
3392
3398
  super();
3393
3399
  this._element = _element;
3394
- this._id = nextLayoutId.next();
3400
+ this._id = nextLayoutId$1.next();
3395
3401
  this._groups = new Map();
3396
3402
  this._onDidLayoutChange = new Emitter();
3397
3403
  this.onDidLayoutChange = this._onDidLayoutChange.event;
@@ -3406,7 +3412,7 @@
3406
3412
  this.element.appendChild(this.gridview.element);
3407
3413
  this.layout(0, 0, true); // set some elements height/widths
3408
3414
  this.addDisposables(this.gridview.onDidChange(() => {
3409
- this._onDidLayoutChange.fire();
3415
+ this._bufferOnDidLayoutChange.fire();
3410
3416
  }));
3411
3417
  this.addDisposables(exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
3412
3418
  this._bufferOnDidLayoutChange.fire();
@@ -3663,24 +3669,17 @@
3663
3669
  this.panel = panel;
3664
3670
  this._onDidTitleChange = new Emitter();
3665
3671
  this.onDidTitleChange = this._onDidTitleChange.event;
3666
- this._titleChanged = new Emitter();
3667
- this.titleChanged = this._titleChanged.event;
3668
- this._suppressClosableChanged = new Emitter();
3669
- this.suppressClosableChanged = this._suppressClosableChanged.event;
3670
3672
  this._onDidActiveGroupChange = new Emitter();
3671
3673
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3672
3674
  this._onDidGroupChange = new Emitter();
3673
3675
  this.onDidGroupChange = this._onDidGroupChange.event;
3674
3676
  this.disposable = new MutableDisposable();
3675
3677
  this._group = group;
3676
- this.addDisposables(this.disposable, this._onDidTitleChange, this._titleChanged, this._suppressClosableChanged, this._onDidGroupChange, this._onDidActiveGroupChange);
3678
+ this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
3677
3679
  }
3678
3680
  get title() {
3679
3681
  return this.panel.title;
3680
3682
  }
3681
- get suppressClosable() {
3682
- return !!this.panel.suppressClosable;
3683
- }
3684
3683
  get isGroupActive() {
3685
3684
  var _a;
3686
3685
  return !!((_a = this.group) === null || _a === void 0 ? void 0 : _a.isActive);
@@ -3718,27 +3717,19 @@
3718
3717
  this.id = id;
3719
3718
  this.containerApi = containerApi;
3720
3719
  this.mutableDisposable = new MutableDisposable();
3721
- this._suppressClosable = false;
3722
3720
  this._title = '';
3723
3721
  this._group = group;
3724
3722
  this.api = new DockviewPanelApiImpl(this, this._group);
3725
3723
  this.addDisposables(this.api.onActiveChange(() => {
3726
3724
  accessor.setActivePanel(this);
3727
- }), this.api.onDidTitleChange((event) => {
3728
- const title = event.title;
3729
- this.update({ params: { title } });
3730
3725
  }));
3731
3726
  }
3732
3727
  get params() {
3733
- var _a;
3734
- return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
3728
+ return this._params;
3735
3729
  }
3736
3730
  get title() {
3737
3731
  return this._title;
3738
3732
  }
3739
- get suppressClosable() {
3740
- return this._suppressClosable;
3741
- }
3742
3733
  get group() {
3743
3734
  return this._group;
3744
3735
  }
@@ -3750,7 +3741,6 @@
3750
3741
  this._params = params.params;
3751
3742
  this._view = params.view;
3752
3743
  this.setTitle(params.title);
3753
- this.setSuppressClosable(params.suppressClosable || false);
3754
3744
  (_a = this.view) === null || _a === void 0 ? void 0 : _a.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
3755
3745
  }
3756
3746
  focus() {
@@ -3763,26 +3753,21 @@
3763
3753
  params: Object.keys(this._params || {}).length > 0
3764
3754
  ? this._params
3765
3755
  : undefined,
3766
- suppressClosable: this.suppressClosable || undefined,
3767
3756
  title: this.title,
3768
3757
  };
3769
3758
  }
3770
3759
  setTitle(title) {
3771
- var _a;
3760
+ var _a, _b;
3772
3761
  const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
3773
3762
  if (didTitleChange) {
3774
3763
  this._title = title;
3775
- this.api._titleChanged.fire({ title: this.title });
3776
- }
3777
- }
3778
- setSuppressClosable(suppressClosable) {
3779
- var _a;
3780
- const didSuppressChangableClose = suppressClosable !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.suppressClosable);
3781
- if (didSuppressChangableClose) {
3782
- this._suppressClosable = suppressClosable;
3783
- this.api._suppressClosableChanged.fire({
3784
- suppressClosable: !!this.suppressClosable,
3764
+ (_b = this.view) === null || _b === void 0 ? void 0 : _b.update({
3765
+ params: {
3766
+ params: this._params,
3767
+ title: this.title,
3768
+ },
3785
3769
  });
3770
+ this.api._onDidTitleChange.fire({ title });
3786
3771
  }
3787
3772
  }
3788
3773
  update(event) {
@@ -3790,16 +3775,15 @@
3790
3775
  const params = event.params;
3791
3776
  this._params = Object.assign(Object.assign({}, (this._params || {})), event.params.params);
3792
3777
  if (typeof params.title === 'string') {
3793
- this.setTitle(params.title);
3794
- }
3795
- if (typeof params.suppressClosable === 'boolean') {
3796
- this.setSuppressClosable(params.suppressClosable);
3778
+ if (params.title !== this.title) {
3779
+ this._title = params.title;
3780
+ this.api._onDidTitleChange.fire({ title: this.title });
3781
+ }
3797
3782
  }
3798
3783
  (_a = this.view) === null || _a === void 0 ? void 0 : _a.update({
3799
3784
  params: {
3800
3785
  params: this._params,
3801
3786
  title: this.title,
3802
- suppressClosable: this.suppressClosable,
3803
3787
  },
3804
3788
  });
3805
3789
  }
@@ -3851,6 +3835,38 @@
3851
3835
  }
3852
3836
  }
3853
3837
 
3838
+ const createSvgElementFromPath = (params) => {
3839
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
3840
+ svg.setAttributeNS(null, 'height', params.height);
3841
+ svg.setAttributeNS(null, 'width', params.width);
3842
+ svg.setAttributeNS(null, 'viewBox', params.viewbox);
3843
+ svg.setAttributeNS(null, 'aria-hidden', 'false');
3844
+ svg.setAttributeNS(null, 'focusable', 'false');
3845
+ svg.classList.add('dockview-svg');
3846
+ const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
3847
+ path.setAttributeNS(null, 'd', params.path);
3848
+ svg.appendChild(path);
3849
+ return svg;
3850
+ };
3851
+ const createCloseButton = () => createSvgElementFromPath({
3852
+ width: '11',
3853
+ height: '11',
3854
+ viewbox: '0 0 28 28',
3855
+ 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',
3856
+ });
3857
+ const createExpandMoreButton = () => createSvgElementFromPath({
3858
+ width: '11',
3859
+ height: '11',
3860
+ viewbox: '0 0 24 15',
3861
+ path: 'M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z',
3862
+ });
3863
+ const createChevronRightButton = () => createSvgElementFromPath({
3864
+ width: '11',
3865
+ height: '11',
3866
+ viewbox: '0 0 15 25',
3867
+ path: 'M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z',
3868
+ });
3869
+
3854
3870
  class Watermark extends CompositeDisposable {
3855
3871
  constructor() {
3856
3872
  super();
@@ -3867,8 +3883,9 @@
3867
3883
  const actions = new ActionContainer();
3868
3884
  title.appendChild(emptySpace);
3869
3885
  title.appendChild(actions.element);
3870
- const closeAnchor = document.createElement('a');
3886
+ const closeAnchor = document.createElement('div');
3871
3887
  closeAnchor.className = 'close-action';
3888
+ closeAnchor.appendChild(createCloseButton());
3872
3889
  actions.add(closeAnchor);
3873
3890
  this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
3874
3891
  var _a;
@@ -3916,34 +3933,6 @@
3916
3933
  }
3917
3934
  }
3918
3935
 
3919
- class DefaultDeserializer {
3920
- constructor(layout, panelDeserializer) {
3921
- this.layout = layout;
3922
- this.panelDeserializer = panelDeserializer;
3923
- }
3924
- fromJSON(node) {
3925
- const data = node.data;
3926
- const children = data.views;
3927
- const active = data.activeView;
3928
- const group = this.layout.createGroup({
3929
- id: data.id,
3930
- locked: !!data.locked,
3931
- hideHeader: !!data.hideHeader,
3932
- });
3933
- for (const child of children) {
3934
- const panel = this.panelDeserializer.createPanel(child, group);
3935
- const isActive = typeof active === 'string' && active === panel.id;
3936
- group.model.openPanel(panel, {
3937
- skipSetActive: !isActive,
3938
- });
3939
- }
3940
- if (!group.activePanel && group.panels.length > 0) {
3941
- group.model.openPanel(group.panels[group.panels.length - 1]);
3942
- }
3943
- return group;
3944
- }
3945
- }
3946
-
3947
3936
  function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
3948
3937
  const Component = typeof componentName === 'string'
3949
3938
  ? components[componentName]
@@ -3969,6 +3958,7 @@
3969
3958
  return new Component(id, componentName);
3970
3959
  }
3971
3960
 
3961
+ const DEFAULT_TAB_IDENTIFIER = '__default__tab__';
3972
3962
  class DefaultTab extends CompositeDisposable {
3973
3963
  constructor() {
3974
3964
  super();
@@ -3988,8 +3978,9 @@
3988
3978
  this._list = document.createElement('ul');
3989
3979
  this._list.className = 'tab-list';
3990
3980
  //
3991
- this.action = document.createElement('a');
3981
+ this.action = document.createElement('div');
3992
3982
  this.action.className = 'tab-action';
3983
+ this.action.appendChild(createCloseButton());
3993
3984
  //
3994
3985
  this._element.appendChild(this._content);
3995
3986
  this._element.appendChild(this._actionContainer);
@@ -4005,7 +3996,7 @@
4005
3996
  return this._element;
4006
3997
  }
4007
3998
  get id() {
4008
- return '__DEFAULT_TAB__';
3999
+ return DEFAULT_TAB_IDENTIFIER;
4009
4000
  }
4010
4001
  update(event) {
4011
4002
  this.params = Object.assign(Object.assign({}, this.params), event.params);
@@ -4020,15 +4011,10 @@
4020
4011
  init(params) {
4021
4012
  this.params = params;
4022
4013
  this._content.textContent = params.title;
4023
- if (!this.params.suppressClosable) {
4024
- addDisposableListener(this.action, 'click', (ev) => {
4025
- ev.preventDefault(); //
4026
- this.params.api.close();
4027
- });
4028
- }
4029
- else {
4030
- this.action.classList.add('disable-close');
4031
- }
4014
+ addDisposableListener(this.action, 'click', (ev) => {
4015
+ ev.preventDefault(); //
4016
+ this.params.api.close();
4017
+ });
4032
4018
  }
4033
4019
  updateParentGroup(group, isPanelVisible) {
4034
4020
  const changed = this._isPanelVisible !== isPanelVisible ||
@@ -4322,16 +4308,6 @@
4322
4308
  var _a;
4323
4309
  this._content = renderers.content;
4324
4310
  this._tab = (_a = renderers.tab) !== null && _a !== void 0 ? _a : new DefaultTab();
4325
- this._actions =
4326
- renderers.actions ||
4327
- (this.content.actions
4328
- ? {
4329
- element: this.content.actions,
4330
- dispose: () => {
4331
- //
4332
- },
4333
- }
4334
- : undefined);
4335
4311
  }
4336
4312
  get content() {
4337
4313
  return this._content;
@@ -4339,9 +4315,6 @@
4339
4315
  get tab() {
4340
4316
  return this._tab;
4341
4317
  }
4342
- get actions() {
4343
- return this._actions;
4344
- }
4345
4318
  init(params) {
4346
4319
  this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
4347
4320
  this.tab.init(params);
@@ -4359,16 +4332,18 @@
4359
4332
  this.tab.update(event);
4360
4333
  }
4361
4334
  toJSON() {
4335
+ let tab = this.tab instanceof DefaultTab ? undefined : this.tab.toJSON();
4336
+ if (tab && Object.keys(tab).length === 0) {
4337
+ tab = undefined;
4338
+ }
4362
4339
  return {
4363
4340
  content: this.content.toJSON(),
4364
- tab: this.tab instanceof DefaultTab ? undefined : this.tab.toJSON(),
4341
+ tab,
4365
4342
  };
4366
4343
  }
4367
4344
  dispose() {
4368
- var _a;
4369
4345
  this.content.dispose();
4370
4346
  this.tab.dispose();
4371
- (_a = this.actions) === null || _a === void 0 ? void 0 : _a.dispose();
4372
4347
  }
4373
4348
  }
4374
4349
 
@@ -4380,22 +4355,17 @@
4380
4355
  orientation: options.orientation || exports.Orientation.HORIZONTAL,
4381
4356
  styles: options.styles,
4382
4357
  });
4383
- // events
4384
- this._onTabInteractionEvent = new Emitter();
4385
- this.onTabInteractionEvent = this._onTabInteractionEvent.event;
4386
- this._onTabContextMenu = new Emitter();
4387
- this.onTabContextMenu = this._onTabContextMenu.event;
4388
4358
  this._onDidDrop = new Emitter();
4389
4359
  this.onDidDrop = this._onDidDrop.event;
4390
4360
  this._onDidRemovePanel = new Emitter();
4391
4361
  this.onDidRemovePanel = this._onDidRemovePanel.event;
4392
4362
  this._onDidAddPanel = new Emitter();
4393
4363
  this.onDidAddPanel = this._onDidAddPanel.event;
4394
- this._onDidLayoutfromJSON = new Emitter();
4395
- this.onDidLayoutfromJSON = this._onDidLayoutfromJSON.event;
4364
+ this._onDidLayoutFromJSON = new Emitter();
4365
+ this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
4396
4366
  this._onDidActivePanelChange = new Emitter();
4397
4367
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
4398
- this.addDisposables(this._onTabInteractionEvent, this._onTabContextMenu, this._onDidDrop, exports.Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
4368
+ this.addDisposables(this._onDidDrop, exports.Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
4399
4369
  this._bufferOnDidLayoutChange.fire();
4400
4370
  }));
4401
4371
  this._options = options;
@@ -4450,7 +4420,7 @@
4450
4420
  }
4451
4421
  updateOptions(options) {
4452
4422
  const hasOrientationChanged = typeof options.orientation === 'string' &&
4453
- this.options.orientation !== options.orientation;
4423
+ this.gridview.orientation !== options.orientation;
4454
4424
  this._options = Object.assign(Object.assign({}, this.options), options);
4455
4425
  if (hasOrientationChanged) {
4456
4426
  this.gridview.orientation = options.orientation;
@@ -4528,12 +4498,7 @@
4528
4498
  };
4529
4499
  }
4530
4500
  fromJSON(data) {
4531
- const groups = Array.from(this._groups.values()).map((_) => _.value);
4532
- for (const group of groups) {
4533
- // remove the group will automatically remove the panels
4534
- this.removeGroup(group, true);
4535
- }
4536
- this.gridview.clear();
4501
+ this.clear();
4537
4502
  if (!this.deserializer) {
4538
4503
  throw new Error('invalid deserializer');
4539
4504
  }
@@ -4544,12 +4509,31 @@
4544
4509
  if (!this.deserializer) {
4545
4510
  throw new Error('no deserializer provided');
4546
4511
  }
4547
- this.gridview.deserialize(grid, new DefaultDeserializer(this, {
4548
- createPanel: (id, group) => {
4549
- const panelData = panels[id];
4550
- return this.deserializer.fromJSON(panelData, group);
4551
- },
4552
- }));
4512
+ this.gridview.deserialize(grid, {
4513
+ fromJSON: (node) => {
4514
+ const { id, locked, hideHeader, views, activeView } = node.data;
4515
+ const group = this.createGroup({
4516
+ id,
4517
+ locked: !!locked,
4518
+ hideHeader: !!hideHeader,
4519
+ });
4520
+ this._onDidAddGroup.fire(group);
4521
+ for (const child of views) {
4522
+ const panel = this.deserializer.fromJSON(panels[child], group);
4523
+ const isActive = typeof activeView === 'string' && activeView === panel.id;
4524
+ group.model.openPanel(panel, {
4525
+ skipSetPanelActive: !isActive,
4526
+ skipSetGroupActive: true
4527
+ });
4528
+ }
4529
+ if (!group.activePanel && group.panels.length > 0) {
4530
+ group.model.openPanel(group.panels[group.panels.length - 1], {
4531
+ skipSetGroupActive: true
4532
+ });
4533
+ }
4534
+ return group;
4535
+ }
4536
+ });
4553
4537
  if (typeof activeGroup === 'string') {
4554
4538
  const panel = this.getPanel(activeGroup);
4555
4539
  if (panel) {
@@ -4557,7 +4541,23 @@
4557
4541
  }
4558
4542
  }
4559
4543
  this.gridview.layout(this.width, this.height);
4560
- this._onDidLayoutfromJSON.fire();
4544
+ this._onDidLayoutFromJSON.fire();
4545
+ }
4546
+ clear() {
4547
+ const groups = Array.from(this._groups.values()).map((_) => _.value);
4548
+ const hasActiveGroup = !!this.activeGroup;
4549
+ const hasActivePanel = !!this.activePanel;
4550
+ for (const group of groups) {
4551
+ // remove the group will automatically remove the panels
4552
+ this.removeGroup(group, true);
4553
+ }
4554
+ if (hasActiveGroup) {
4555
+ this.doSetGroupActive(undefined);
4556
+ }
4557
+ if (hasActivePanel) {
4558
+ this._onDidActivePanelChange.fire(undefined);
4559
+ }
4560
+ this.gridview.clear();
4561
4561
  }
4562
4562
  closeAllGroups() {
4563
4563
  for (const entry of this._groups.entries()) {
@@ -4565,17 +4565,6 @@
4565
4565
  group.value.model.closeAllPanels();
4566
4566
  }
4567
4567
  }
4568
- fireMouseEvent(event) {
4569
- if (event.kind === exports.MouseEventKind.CONTEXT_MENU) {
4570
- if (event.tab && event.panel) {
4571
- this._onTabContextMenu.fire({
4572
- event: event.event,
4573
- api: this._api,
4574
- panel: event.panel,
4575
- });
4576
- }
4577
- }
4578
- }
4579
4568
  addPanel(options) {
4580
4569
  var _a, _b;
4581
4570
  if (this.panels.find((_) => _.id === options.id)) {
@@ -4755,23 +4744,13 @@
4755
4744
  const { groupId, itemId, target, index } = event;
4756
4745
  this.moveGroupOrPanel(view, groupId, itemId, target, index);
4757
4746
  }), view.model.onDidDrop((event) => {
4758
- this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api }));
4759
- }), view.model.onDidGroupChange((event) => {
4760
- switch (event.kind) {
4761
- case exports.GroupChangeKind2.ADD_PANEL:
4762
- if (event.panel) {
4763
- this._onDidAddPanel.fire(event.panel);
4764
- }
4765
- break;
4766
- case exports.GroupChangeKind2.REMOVE_PANEL:
4767
- if (event.panel) {
4768
- this._onDidRemovePanel.fire(event.panel);
4769
- }
4770
- break;
4771
- case exports.GroupChangeKind2.PANEL_ACTIVE:
4772
- this._onDidActivePanelChange.fire(event.panel);
4773
- break;
4774
- }
4747
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: view }));
4748
+ }), view.model.onDidAddPanel((event) => {
4749
+ this._onDidAddPanel.fire(event.panel);
4750
+ }), view.model.onDidRemovePanel((event) => {
4751
+ this._onDidRemovePanel.fire(event.panel);
4752
+ }), view.model.onDidActivePanelChange((event) => {
4753
+ this._onDidActivePanelChange.fire(event.panel);
4775
4754
  }));
4776
4755
  this._groups.set(view.id, { value: view, disposable });
4777
4756
  }
@@ -4786,13 +4765,12 @@
4786
4765
  createPanel(options, group) {
4787
4766
  const view = new DefaultGroupPanelView({
4788
4767
  content: this.createContentComponent(options.id, options.component),
4789
- tab: this.createTabComponent(options.id, options.tabComponent),
4768
+ tab: this.createTabComponent(options.id, options.tabComponent || this.options.defaultTabComponent),
4790
4769
  });
4791
4770
  const panel = new DockviewGroupPanel(options.id, this, this._api, group);
4792
4771
  panel.init({
4793
4772
  view,
4794
4773
  title: options.title || options.id,
4795
- suppressClosable: options === null || options === void 0 ? void 0 : options.suppressClosable,
4796
4774
  params: (options === null || options === void 0 ? void 0 : options.params) || {},
4797
4775
  });
4798
4776
  return panel;
@@ -4819,7 +4797,7 @@
4819
4797
  this._onDidActivePanelChange.dispose();
4820
4798
  this._onDidAddPanel.dispose();
4821
4799
  this._onDidRemovePanel.dispose();
4822
- this._onDidLayoutfromJSON.dispose();
4800
+ this._onDidLayoutFromJSON.dispose();
4823
4801
  }
4824
4802
  }
4825
4803
 
@@ -4857,7 +4835,7 @@
4857
4835
  }
4858
4836
  updateOptions(options) {
4859
4837
  const hasOrientationChanged = typeof options.orientation === 'string' &&
4860
- this.options.orientation !== options.orientation;
4838
+ this.gridview.orientation !== options.orientation;
4861
4839
  this._options = Object.assign(Object.assign({}, this.options), options);
4862
4840
  if (hasOrientationChanged) {
4863
4841
  this.gridview.orientation = options.orientation;
@@ -4893,13 +4871,8 @@
4893
4871
  (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
4894
4872
  }
4895
4873
  fromJSON(serializedGridview) {
4874
+ this.clear();
4896
4875
  const { grid, activePanel } = serializedGridview;
4897
- const groups = Array.from(this._groups.values()); // reassign since group panels will mutate
4898
- for (const group of groups) {
4899
- group.disposable.dispose();
4900
- this.doRemoveGroup(group.value, { skipActive: true });
4901
- }
4902
- this.gridview.clear();
4903
4876
  const queue = [];
4904
4877
  this.gridview.deserialize(grid, {
4905
4878
  fromJSON: (node) => {
@@ -4921,6 +4894,7 @@
4921
4894
  accessor: this,
4922
4895
  isVisible: node.visible,
4923
4896
  }));
4897
+ this._onDidAddGroup.fire(view);
4924
4898
  this.registerPanel(view);
4925
4899
  return view;
4926
4900
  },
@@ -4935,6 +4909,18 @@
4935
4909
  }
4936
4910
  this._onDidLayoutfromJSON.fire();
4937
4911
  }
4912
+ clear() {
4913
+ const hasActiveGroup = this.activeGroup;
4914
+ const groups = Array.from(this._groups.values()); // reassign since group panels will mutate
4915
+ for (const group of groups) {
4916
+ group.disposable.dispose();
4917
+ this.doRemoveGroup(group.value, { skipActive: true });
4918
+ }
4919
+ if (hasActiveGroup) {
4920
+ this.doSetGroupActive(undefined);
4921
+ }
4922
+ this.gridview.clear();
4923
+ }
4938
4924
  movePanel(panel, options) {
4939
4925
  var _a;
4940
4926
  let relativeLocation;
@@ -5225,13 +5211,8 @@
5225
5211
  };
5226
5212
  }
5227
5213
  fromJSON(serializedSplitview) {
5214
+ this.clear();
5228
5215
  const { views, orientation, size, activeView } = serializedSplitview;
5229
- for (const [_, value] of this._panels.entries()) {
5230
- value.disposable.dispose();
5231
- value.value.dispose();
5232
- }
5233
- this._panels.clear();
5234
- this.splitview.dispose();
5235
5216
  const queue = [];
5236
5217
  this.splitview = new Splitview(this.element, {
5237
5218
  orientation,
@@ -5279,6 +5260,14 @@
5279
5260
  }
5280
5261
  this._onDidLayoutfromJSON.fire();
5281
5262
  }
5263
+ clear() {
5264
+ for (const [_, value] of this._panels.entries()) {
5265
+ value.disposable.dispose();
5266
+ value.value.dispose();
5267
+ }
5268
+ this._panels.clear();
5269
+ this.splitview.dispose();
5270
+ }
5282
5271
  dispose() {
5283
5272
  for (const [_, value] of this._panels.entries()) {
5284
5273
  value.disposable.dispose();
@@ -5528,8 +5517,9 @@
5528
5517
  }
5529
5518
 
5530
5519
  class DraggablePaneviewPanel extends PaneviewPanel {
5531
- constructor(id, component, headerComponent, orientation, isExpanded, disableDnd) {
5520
+ constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
5532
5521
  super(id, component, headerComponent, orientation, isExpanded, true);
5522
+ this.accessor = accessor;
5533
5523
  this._onDidDrop = new Emitter();
5534
5524
  this.onDidDrop = this._onDidDrop.event;
5535
5525
  if (!disableDnd) {
@@ -5541,10 +5531,11 @@
5541
5531
  return;
5542
5532
  }
5543
5533
  const id = this.id;
5534
+ const accessorId = this.accessor.id;
5544
5535
  this.header.draggable = true;
5545
5536
  this.handler = new (class PaneDragHandler extends DragHandler {
5546
5537
  getData() {
5547
- LocalSelectionTransfer.getInstance().setData([new PaneTransfer('paneview', id)], PaneTransfer.prototype);
5538
+ LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);
5548
5539
  return {
5549
5540
  dispose: () => {
5550
5541
  LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
@@ -5554,12 +5545,22 @@
5554
5545
  })(this.header);
5555
5546
  this.target = new Droptarget(this.element, {
5556
5547
  validOverlays: 'vertical',
5557
- canDisplayOverlay: () => {
5548
+ canDisplayOverlay: (event) => {
5558
5549
  const data = getPaneData();
5559
- if (!data) {
5560
- return true;
5550
+ if (data) {
5551
+ if (data.paneId !== this.id &&
5552
+ data.viewId === this.accessor.id) {
5553
+ return true;
5554
+ }
5561
5555
  }
5562
- return data.paneId !== this.id;
5556
+ if (this.accessor.options.showDndOverlay) {
5557
+ return this.accessor.options.showDndOverlay({
5558
+ nativeEvent: event,
5559
+ getData: getPaneData,
5560
+ panel: this,
5561
+ });
5562
+ }
5563
+ return false;
5563
5564
  },
5564
5565
  });
5565
5566
  this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
@@ -5568,8 +5569,10 @@
5568
5569
  }
5569
5570
  onDrop(event) {
5570
5571
  const data = getPaneData();
5571
- if (!data) {
5572
- this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
5572
+ if (!data || data.viewId !== this.accessor.id) {
5573
+ // if there is no local drag event for this panel
5574
+ // or if the drag event was creating by another Paneview instance
5575
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
5573
5576
  return;
5574
5577
  }
5575
5578
  const containerApi = this._params
@@ -5577,7 +5580,8 @@
5577
5580
  const panelId = data.paneId;
5578
5581
  const existingPanel = containerApi.getPanel(panelId);
5579
5582
  if (!existingPanel) {
5580
- this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
5583
+ // if the panel doesn't exist
5584
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
5581
5585
  return;
5582
5586
  }
5583
5587
  const allPanels = containerApi.panels;
@@ -5601,15 +5605,18 @@
5601
5605
  class DefaultHeader extends CompositeDisposable {
5602
5606
  constructor() {
5603
5607
  super();
5608
+ this._expandedIcon = createExpandMoreButton();
5609
+ this._collapsedIcon = createChevronRightButton();
5604
5610
  this.disposable = new MutableDisposable();
5605
5611
  this.apiRef = { api: null };
5606
5612
  this._element = document.createElement('div');
5607
5613
  this.element.className = 'default-header';
5608
5614
  this._content = document.createElement('span');
5609
- this._expander = document.createElement('a');
5610
- this.element.appendChild(this._content);
5615
+ this._expander = document.createElement('div');
5616
+ this._expander.className = 'dockview-pane-header-icon';
5611
5617
  this.element.appendChild(this._expander);
5612
- this.addDisposables(addDisposableListener(this._expander, 'click', () => {
5618
+ this.element.appendChild(this._content);
5619
+ this.addDisposables(addDisposableListener(this._element, 'click', () => {
5613
5620
  var _a;
5614
5621
  (_a = this.apiRef.api) === null || _a === void 0 ? void 0 : _a.setExpanded(!this.apiRef.api.isExpanded);
5615
5622
  }));
@@ -5620,11 +5627,32 @@
5620
5627
  init(params) {
5621
5628
  this.apiRef.api = params.api;
5622
5629
  this._content.textContent = params.title;
5623
- this._expander.textContent = params.api.isExpanded ? '<' : '>';
5624
- this.disposable.value = params.api.onDidExpansionChange((e) => {
5625
- this._expander.textContent = e.isExpanded ? '<' : '>';
5630
+ this.updateIcon();
5631
+ this.disposable.value = params.api.onDidExpansionChange(() => {
5632
+ this.updateIcon();
5626
5633
  });
5627
5634
  }
5635
+ updateIcon() {
5636
+ var _a;
5637
+ const isExpanded = !!((_a = this.apiRef.api) === null || _a === void 0 ? void 0 : _a.isExpanded);
5638
+ toggleClass(this._expander, 'collapsed', !isExpanded);
5639
+ if (isExpanded) {
5640
+ if (this._expander.contains(this._collapsedIcon)) {
5641
+ this._collapsedIcon.remove();
5642
+ }
5643
+ if (!this._expander.contains(this._expandedIcon)) {
5644
+ this._expander.appendChild(this._expandedIcon);
5645
+ }
5646
+ }
5647
+ else {
5648
+ if (this._expander.contains(this._expandedIcon)) {
5649
+ this._expandedIcon.remove();
5650
+ }
5651
+ if (!this._expander.contains(this._collapsedIcon)) {
5652
+ this._expander.appendChild(this._collapsedIcon);
5653
+ }
5654
+ }
5655
+ }
5628
5656
  update(_params) {
5629
5657
  //
5630
5658
  }
@@ -5634,9 +5662,10 @@
5634
5662
  }
5635
5663
  }
5636
5664
 
5665
+ const nextLayoutId = sequentialNumberGenerator();
5637
5666
  class PaneFramework extends DraggablePaneviewPanel {
5638
5667
  constructor(options) {
5639
- super(options.id, options.component, options.headerComponent, options.orientation, options.isExpanded, options.disableDnd);
5668
+ super(options.accessor, options.id, options.component, options.headerComponent, options.orientation, options.isExpanded, options.disableDnd);
5640
5669
  this.options = options;
5641
5670
  }
5642
5671
  getBodyComponent() {
@@ -5650,6 +5679,7 @@
5650
5679
  constructor(element, options) {
5651
5680
  super();
5652
5681
  this.element = element;
5682
+ this._id = nextLayoutId.next();
5653
5683
  this._disposable = new MutableDisposable();
5654
5684
  this._viewDisposables = new Map();
5655
5685
  this._onDidLayoutfromJSON = new Emitter();
@@ -5676,6 +5706,9 @@
5676
5706
  });
5677
5707
  this.addDisposables(this._disposable);
5678
5708
  }
5709
+ get id() {
5710
+ return this._id;
5711
+ }
5679
5712
  get panels() {
5680
5713
  return this.paneview.getPanes();
5681
5714
  }
@@ -5740,6 +5773,7 @@
5740
5773
  orientation: exports.Orientation.VERTICAL,
5741
5774
  isExpanded: !!options.isExpanded,
5742
5775
  disableDnd: !!this.options.disableDnd,
5776
+ accessor: this,
5743
5777
  });
5744
5778
  this.doAddPanel(view);
5745
5779
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
@@ -5798,13 +5832,9 @@
5798
5832
  };
5799
5833
  }
5800
5834
  fromJSON(serializedPaneview) {
5835
+ this.clear();
5801
5836
  const { views, size } = serializedPaneview;
5802
5837
  const queue = [];
5803
- for (const [_, value] of this._viewDisposables.entries()) {
5804
- value.dispose();
5805
- }
5806
- this._viewDisposables.clear();
5807
- this.paneview.dispose();
5808
5838
  this.paneview = new Paneview(this.element, {
5809
5839
  orientation: exports.Orientation.VERTICAL,
5810
5840
  descriptor: {
@@ -5838,6 +5868,7 @@
5838
5868
  orientation: exports.Orientation.VERTICAL,
5839
5869
  isExpanded: !!view.expanded,
5840
5870
  disableDnd: !!this.options.disableDnd,
5871
+ accessor: this,
5841
5872
  });
5842
5873
  this.doAddPanel(panel);
5843
5874
  queue.push(() => {
@@ -5863,6 +5894,13 @@
5863
5894
  queue.forEach((f) => f());
5864
5895
  this._onDidLayoutfromJSON.fire();
5865
5896
  }
5897
+ clear() {
5898
+ for (const [_, value] of this._viewDisposables.entries()) {
5899
+ value.dispose();
5900
+ }
5901
+ this._viewDisposables.clear();
5902
+ this.paneview.dispose();
5903
+ }
5866
5904
  doAddPanel(panel) {
5867
5905
  const disposable = panel.onDidDrop((event) => {
5868
5906
  this._onDidDrop.fire(event);
@@ -6030,15 +6068,21 @@
6030
6068
  this.component = component;
6031
6069
  this.parameters = parameters;
6032
6070
  this.context = context;
6071
+ this._initialProps = {};
6033
6072
  this.disposed = false;
6034
6073
  this.createPortal();
6035
6074
  }
6036
6075
  update(props) {
6037
- var _a;
6038
6076
  if (this.disposed) {
6039
6077
  throw new Error('invalid operation: resource is already disposed');
6040
6078
  }
6041
- (_a = this.componentInstance) === null || _a === void 0 ? void 0 : _a.update(props);
6079
+ if (!this.componentInstance) {
6080
+ // if the component is yet to be mounted store the props
6081
+ this._initialProps = Object.assign(Object.assign({}, this._initialProps), props);
6082
+ }
6083
+ else {
6084
+ this.componentInstance.update(props);
6085
+ }
6042
6086
  }
6043
6087
  createPortal() {
6044
6088
  if (this.disposed) {
@@ -6058,6 +6102,10 @@
6058
6102
  componentProps: this.parameters,
6059
6103
  ref: (element) => {
6060
6104
  this.componentInstance = element;
6105
+ if (Object.keys(this._initialProps).length > 0) {
6106
+ this.componentInstance.update(this._initialProps);
6107
+ this._initialProps = {}; // don't keep a reference to the users object once no longer required
6108
+ }
6061
6109
  },
6062
6110
  });
6063
6111
  const node = this.context
@@ -6114,30 +6162,19 @@
6114
6162
  this.onDidBlur = this._onDidBlur.event;
6115
6163
  this._element = document.createElement('div');
6116
6164
  this._element.className = 'dockview-react-part';
6117
- this._actionsElement = document.createElement('div');
6118
- this._actionsElement.className = 'dockview-react-part';
6119
6165
  }
6120
6166
  get element() {
6121
6167
  return this._element;
6122
6168
  }
6123
- get actions() {
6124
- return this._actionsElement;
6125
- }
6126
6169
  focus() {
6127
6170
  // TODO
6128
6171
  }
6129
6172
  init(parameters) {
6130
- const context = {
6131
- api: parameters.api,
6132
- containerApi: parameters.containerApi,
6133
- actionsPortalElement: this._actionsElement,
6134
- tabPortalElement: parameters.tab,
6135
- };
6136
6173
  this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
6137
6174
  params: parameters.params,
6138
6175
  api: parameters.api,
6139
6176
  containerApi: parameters.containerApi,
6140
- }, context);
6177
+ });
6141
6178
  }
6142
6179
  toJSON() {
6143
6180
  return {
@@ -6155,11 +6192,10 @@
6155
6192
  // noop
6156
6193
  }
6157
6194
  dispose() {
6158
- var _a, _b;
6195
+ var _a;
6159
6196
  this._onDidFocus.dispose();
6160
6197
  this._onDidBlur.dispose();
6161
6198
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
6162
- (_b = this.actionsPart) === null || _b === void 0 ? void 0 : _b.dispose();
6163
6199
  }
6164
6200
  }
6165
6201
 
@@ -6189,6 +6225,9 @@
6189
6225
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
6190
6226
  }
6191
6227
  toJSON() {
6228
+ if (this.id === DEFAULT_TAB_IDENTIFIER) {
6229
+ return {};
6230
+ }
6192
6231
  return {
6193
6232
  id: this.id,
6194
6233
  };
@@ -6210,23 +6249,29 @@
6210
6249
  this.layout = layout;
6211
6250
  }
6212
6251
  fromJSON(panelData, group) {
6213
- var _a, _b, _c;
6252
+ var _a, _b, _c, _d;
6214
6253
  const panelId = panelData.id;
6215
6254
  const params = panelData.params;
6216
6255
  const title = panelData.title;
6217
- const suppressClosable = panelData.suppressClosable;
6218
6256
  const viewData = panelData.view;
6257
+ let tab;
6258
+ if ((_a = viewData.tab) === null || _a === void 0 ? void 0 : _a.id) {
6259
+ 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());
6260
+ }
6261
+ else if (this.layout.options.defaultTabComponent) {
6262
+ 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());
6263
+ }
6264
+ else {
6265
+ tab = new DefaultTab();
6266
+ }
6219
6267
  const view = new DefaultGroupPanelView({
6220
- 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),
6221
- tab: ((_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id)
6222
- ? 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)
6223
- : new DefaultTab(),
6268
+ 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),
6269
+ tab,
6224
6270
  });
6225
6271
  const panel = new DockviewGroupPanel(panelId, this.layout, new DockviewApi(this.layout), group);
6226
6272
  panel.init({
6227
6273
  view,
6228
6274
  title,
6229
- suppressClosable,
6230
6275
  params: params || {},
6231
6276
  });
6232
6277
  return panel;
@@ -6288,6 +6333,80 @@
6288
6333
  }
6289
6334
  }
6290
6335
 
6336
+ class ReactGroupControlsRendererPart {
6337
+ constructor(component, reactPortalStore, _group) {
6338
+ this.component = component;
6339
+ this.reactPortalStore = reactPortalStore;
6340
+ this._group = _group;
6341
+ this.mutableDisposable = new MutableDisposable();
6342
+ this._element = document.createElement('div');
6343
+ this._element.className = 'dockview-react-part';
6344
+ }
6345
+ get element() {
6346
+ return this._element;
6347
+ }
6348
+ get part() {
6349
+ return this._part;
6350
+ }
6351
+ get group() {
6352
+ return this._group;
6353
+ }
6354
+ focus() {
6355
+ // TODO
6356
+ }
6357
+ init(parameters) {
6358
+ this.mutableDisposable.value = new CompositeDisposable(this._group.model.onDidAddPanel(() => {
6359
+ this.updatePanels();
6360
+ }), this._group.model.onDidRemovePanel(() => {
6361
+ this.updatePanels();
6362
+ }), this._group.model.onDidActivePanelChange(() => {
6363
+ this.updateActivePanel();
6364
+ }), parameters.api.onDidActiveChange(() => {
6365
+ this.updateGroupActive();
6366
+ }));
6367
+ this._part = new ReactPart(this.element, this.reactPortalStore, this.component, {
6368
+ api: parameters.api,
6369
+ containerApi: parameters.containerApi,
6370
+ panels: this._group.model.panels,
6371
+ activePanel: this._group.model.activePanel,
6372
+ isGroupActive: this._group.api.isActive,
6373
+ });
6374
+ }
6375
+ update(event) {
6376
+ var _a;
6377
+ (_a = this._part) === null || _a === void 0 ? void 0 : _a.update(event.params);
6378
+ }
6379
+ dispose() {
6380
+ var _a;
6381
+ this.mutableDisposable.dispose();
6382
+ (_a = this._part) === null || _a === void 0 ? void 0 : _a.dispose();
6383
+ }
6384
+ updatePanels() {
6385
+ this.update({ params: { panels: this._group.model.panels } });
6386
+ }
6387
+ updateActivePanel() {
6388
+ this.update({
6389
+ params: {
6390
+ activePanel: this._group.model.activePanel,
6391
+ },
6392
+ });
6393
+ }
6394
+ updateGroupActive() {
6395
+ this.update({
6396
+ params: {
6397
+ isGroupActive: this._group.api.isActive,
6398
+ },
6399
+ });
6400
+ }
6401
+ }
6402
+
6403
+ function createGroupControlElement(component, store) {
6404
+ return component
6405
+ ? (groupPanel) => {
6406
+ return new ReactGroupControlsRendererPart(component, store, groupPanel);
6407
+ }
6408
+ : undefined;
6409
+ }
6291
6410
  const DockviewReact = React__namespace.forwardRef((props, ref) => {
6292
6411
  const domRef = React__namespace.useRef(null);
6293
6412
  const dockviewRef = React__namespace.useRef();
@@ -6337,12 +6456,15 @@
6337
6456
  const dockview = new DockviewComponent(element, {
6338
6457
  frameworkComponentFactory: factory,
6339
6458
  frameworkComponents: props.components,
6340
- frameworkTabComponents: props.tabComponents,
6459
+ frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
6341
6460
  tabHeight: props.tabHeight,
6342
6461
  watermarkFrameworkComponent: props.watermarkComponent,
6462
+ defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
6343
6463
  styles: props.hideBorders
6344
6464
  ? { separatorBorder: 'transparent' }
6345
6465
  : undefined,
6466
+ showDndOverlay: props.showDndOverlay,
6467
+ createGroupControlElement: createGroupControlElement(props.groupControlComponent, { addPortal }),
6346
6468
  });
6347
6469
  (_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
6348
6470
  dockview.deserializer = new ReactPanelDeserialzier(dockview);
@@ -6405,24 +6527,78 @@
6405
6527
  });
6406
6528
  }, [props.tabComponents]);
6407
6529
  React__namespace.useEffect(() => {
6408
- if (!props.onTabContextMenu || !dockviewRef.current) {
6409
- return () => {
6410
- //noop
6411
- };
6530
+ if (!dockviewRef.current) {
6531
+ return;
6412
6532
  }
6413
- const disposable = dockviewRef.current.onTabContextMenu((event) => {
6414
- if (props.onTabContextMenu) {
6415
- props.onTabContextMenu(event);
6416
- }
6533
+ dockviewRef.current.updateOptions({
6534
+ defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
6535
+ frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
6417
6536
  });
6418
- return () => {
6419
- disposable.dispose();
6420
- };
6421
- }, [props.onTabContextMenu]);
6537
+ }, [props.defaultTabComponent]);
6538
+ React__namespace.useEffect(() => {
6539
+ if (!dockviewRef.current) {
6540
+ return;
6541
+ }
6542
+ dockviewRef.current.updateOptions({
6543
+ createGroupControlElement: createGroupControlElement(props.groupControlComponent, { addPortal }),
6544
+ });
6545
+ }, [props.groupControlComponent]);
6422
6546
  return (React__namespace.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
6423
6547
  });
6424
6548
  DockviewReact.displayName = 'DockviewComponent';
6425
6549
 
6550
+ /******************************************************************************
6551
+ Copyright (c) Microsoft Corporation.
6552
+
6553
+ Permission to use, copy, modify, and/or distribute this software for any
6554
+ purpose with or without fee is hereby granted.
6555
+
6556
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
6557
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
6558
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
6559
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
6560
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
6561
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
6562
+ PERFORMANCE OF THIS SOFTWARE.
6563
+ ***************************************************************************** */
6564
+
6565
+ function __rest(s, e) {
6566
+ var t = {};
6567
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
6568
+ t[p] = s[p];
6569
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6570
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
6571
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
6572
+ t[p[i]] = s[p[i]];
6573
+ }
6574
+ return t;
6575
+ }
6576
+
6577
+ const CloseButton = () => (React__namespace.createElement("svg", { height: "11", width: "11", viewBox: "0 0 28 28", "aria-hidden": 'false', focusable: false, className: "dockview-svg" },
6578
+ 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" })));
6579
+
6580
+ const DockviewDefaultTab = (_a) => {
6581
+ var { api, containerApi: _containerApi, params: _params } = _a, rest = __rest(_a, ["api", "containerApi", "params"]);
6582
+ const onClose = React__namespace.useCallback((event) => {
6583
+ event.stopPropagation();
6584
+ api.close();
6585
+ }, [api]);
6586
+ const onClick = React__namespace.useCallback((event) => {
6587
+ api.setActive();
6588
+ if (rest.onClick) {
6589
+ rest.onClick(event);
6590
+ }
6591
+ }, [api, rest.onClick]);
6592
+ const iconClassname = React__namespace.useMemo(() => {
6593
+ const cn = ['dockview-react-tab-action'];
6594
+ return cn.join(',');
6595
+ }, []);
6596
+ return (React__namespace.createElement("div", Object.assign({}, rest, { onClick: onClick, className: "dockview-react-tab" }),
6597
+ React__namespace.createElement("span", { className: "dockview-react-tab-title" }, api.title),
6598
+ React__namespace.createElement("div", { className: iconClassname, onClick: onClose },
6599
+ React__namespace.createElement(CloseButton, null))));
6600
+ };
6601
+
6426
6602
  class ReactPanelView extends SplitviewPanel {
6427
6603
  constructor(id, component, reactComponent, reactPortalStore) {
6428
6604
  super(id, component);
@@ -6652,6 +6828,7 @@
6652
6828
  createComponent,
6653
6829
  },
6654
6830
  },
6831
+ showDndOverlay: props.showDndOverlay,
6655
6832
  });
6656
6833
  const api = new PaneviewApi(paneview);
6657
6834
  const { clientWidth, clientHeight } = domRef.current;
@@ -6696,6 +6873,14 @@
6696
6873
  disposable.dispose();
6697
6874
  };
6698
6875
  }, [props.onDidDrop]);
6876
+ React__namespace.useEffect(() => {
6877
+ if (!paneviewRef.current) {
6878
+ return;
6879
+ }
6880
+ paneviewRef.current.updateOptions({
6881
+ showDndOverlay: props.showDndOverlay,
6882
+ });
6883
+ }, [props.showDndOverlay]);
6699
6884
  return (React__namespace.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
6700
6885
  });
6701
6886
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -6704,6 +6889,7 @@
6704
6889
  exports.ContentContainer = ContentContainer;
6705
6890
  exports.DockviewApi = DockviewApi;
6706
6891
  exports.DockviewComponent = DockviewComponent;
6892
+ exports.DockviewDefaultTab = DockviewDefaultTab;
6707
6893
  exports.DockviewReact = DockviewReact;
6708
6894
  exports.Gridview = Gridview;
6709
6895
  exports.GridviewApi = GridviewApi;
@@ -6720,8 +6906,6 @@
6720
6906
  exports.PaneviewComponent = PaneviewComponent;
6721
6907
  exports.PaneviewPanel = PaneviewPanel;
6722
6908
  exports.PaneviewReact = PaneviewReact;
6723
- exports.ReactPanelContentPart = ReactPanelContentPart;
6724
- exports.ReactPanelHeaderPart = ReactPanelHeaderPart;
6725
6909
  exports.ReactPart = ReactPart;
6726
6910
  exports.ReactPartContext = ReactPartContext;
6727
6911
  exports.Splitview = Splitview;