dockview-core 1.7.6 → 1.8.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 (214) hide show
  1. package/README.md +2 -1
  2. package/dist/cjs/api/component.api.d.ts +6 -1
  3. package/dist/cjs/api/component.api.d.ts.map +1 -1
  4. package/dist/cjs/api/component.api.js +6 -0
  5. package/dist/cjs/api/component.api.js.map +1 -1
  6. package/dist/cjs/api/dockviewGroupPanelApi.d.ts +30 -0
  7. package/dist/cjs/api/dockviewGroupPanelApi.d.ts.map +1 -0
  8. package/dist/cjs/api/dockviewGroupPanelApi.js +54 -0
  9. package/dist/cjs/api/dockviewGroupPanelApi.js.map +1 -0
  10. package/dist/cjs/api/dockviewPanelApi.d.ts +14 -1
  11. package/dist/cjs/api/dockviewPanelApi.d.ts.map +1 -1
  12. package/dist/cjs/api/dockviewPanelApi.js +6 -1
  13. package/dist/cjs/api/dockviewPanelApi.js.map +1 -1
  14. package/dist/cjs/array.d.ts +1 -0
  15. package/dist/cjs/array.d.ts.map +1 -1
  16. package/dist/cjs/array.js +10 -1
  17. package/dist/cjs/array.js.map +1 -1
  18. package/dist/cjs/dnd/abstractDragHandler.d.ts +1 -0
  19. package/dist/cjs/dnd/abstractDragHandler.d.ts.map +1 -1
  20. package/dist/cjs/dnd/abstractDragHandler.js +7 -0
  21. package/dist/cjs/dnd/abstractDragHandler.js.map +1 -1
  22. package/dist/cjs/dnd/droptarget.d.ts +11 -0
  23. package/dist/cjs/dnd/droptarget.d.ts.map +1 -1
  24. package/dist/cjs/dnd/droptarget.js +32 -9
  25. package/dist/cjs/dnd/droptarget.js.map +1 -1
  26. package/dist/cjs/dnd/groupDragHandler.d.ts +1 -0
  27. package/dist/cjs/dnd/groupDragHandler.d.ts.map +1 -1
  28. package/dist/cjs/dnd/groupDragHandler.js +18 -0
  29. package/dist/cjs/dnd/groupDragHandler.js.map +1 -1
  30. package/dist/cjs/dnd/overlay.d.ts +40 -0
  31. package/dist/cjs/dnd/overlay.d.ts.map +1 -0
  32. package/dist/cjs/dnd/overlay.js +382 -0
  33. package/dist/cjs/dnd/overlay.js.map +1 -0
  34. package/dist/cjs/dockview/components/tab/tab.d.ts +2 -2
  35. package/dist/cjs/dockview/components/tab/tab.d.ts.map +1 -1
  36. package/dist/cjs/dockview/components/tab/tab.js +0 -7
  37. package/dist/cjs/dockview/components/tab/tab.js.map +1 -1
  38. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +8 -4
  39. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts.map +1 -1
  40. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +54 -10
  41. package/dist/cjs/dockview/components/titlebar/tabsContainer.js.map +1 -1
  42. package/dist/cjs/dockview/deserializer.d.ts +2 -2
  43. package/dist/cjs/dockview/deserializer.d.ts.map +1 -1
  44. package/dist/cjs/dockview/deserializer.js.map +1 -1
  45. package/dist/cjs/dockview/dockviewComponent.d.ts +41 -9
  46. package/dist/cjs/dockview/dockviewComponent.d.ts.map +1 -1
  47. package/dist/cjs/dockview/dockviewComponent.js +285 -76
  48. package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
  49. package/dist/cjs/dockview/dockviewFloatingGroupPanel.d.ts +24 -0
  50. package/dist/cjs/dockview/dockviewFloatingGroupPanel.d.ts.map +1 -0
  51. package/dist/cjs/dockview/dockviewFloatingGroupPanel.js +35 -0
  52. package/dist/cjs/dockview/dockviewFloatingGroupPanel.js.map +1 -0
  53. package/dist/cjs/dockview/dockviewGroupPanel.d.ts +5 -6
  54. package/dist/cjs/dockview/dockviewGroupPanel.d.ts.map +1 -1
  55. package/dist/cjs/dockview/dockviewGroupPanel.js +3 -2
  56. package/dist/cjs/dockview/dockviewGroupPanel.js.map +1 -1
  57. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +5 -1
  58. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts.map +1 -1
  59. package/dist/cjs/dockview/dockviewGroupPanelModel.js +43 -12
  60. package/dist/cjs/dockview/dockviewGroupPanelModel.js.map +1 -1
  61. package/dist/cjs/dockview/dockviewPanel.d.ts +2 -2
  62. package/dist/cjs/dockview/dockviewPanel.d.ts.map +1 -1
  63. package/dist/cjs/dockview/dockviewPanel.js +1 -1
  64. package/dist/cjs/dockview/dockviewPanel.js.map +1 -1
  65. package/dist/cjs/dockview/options.d.ts +22 -6
  66. package/dist/cjs/dockview/options.d.ts.map +1 -1
  67. package/dist/cjs/dockview/options.js.map +1 -1
  68. package/dist/cjs/dom.d.ts +5 -3
  69. package/dist/cjs/dom.d.ts.map +1 -1
  70. package/dist/cjs/dom.js +13 -1
  71. package/dist/cjs/dom.js.map +1 -1
  72. package/dist/cjs/events.d.ts.map +1 -1
  73. package/dist/cjs/gridview/branchNode.js +2 -2
  74. package/dist/cjs/gridview/branchNode.js.map +1 -1
  75. package/dist/cjs/gridview/gridview.d.ts.map +1 -1
  76. package/dist/cjs/gridview/gridview.js +9 -7
  77. package/dist/cjs/gridview/gridview.js.map +1 -1
  78. package/dist/cjs/gridview/gridviewComponent.d.ts.map +1 -1
  79. package/dist/cjs/gridview/gridviewComponent.js +4 -1
  80. package/dist/cjs/gridview/gridviewComponent.js.map +1 -1
  81. package/dist/cjs/gridview/gridviewPanel.d.ts +3 -3
  82. package/dist/cjs/gridview/gridviewPanel.d.ts.map +1 -1
  83. package/dist/cjs/gridview/gridviewPanel.js +2 -2
  84. package/dist/cjs/gridview/gridviewPanel.js.map +1 -1
  85. package/dist/cjs/index.d.ts +1 -1
  86. package/dist/cjs/index.d.ts.map +1 -1
  87. package/dist/cjs/index.js +1 -3
  88. package/dist/cjs/index.js.map +1 -1
  89. package/dist/cjs/math.d.ts.map +1 -1
  90. package/dist/cjs/paneview/paneviewComponent.d.ts.map +1 -1
  91. package/dist/cjs/paneview/paneviewComponent.js +4 -1
  92. package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
  93. package/dist/cjs/splitview/splitviewComponent.d.ts.map +1 -1
  94. package/dist/cjs/splitview/splitviewComponent.js +4 -1
  95. package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
  96. package/dist/dockview-core.amd.js +772 -133
  97. package/dist/dockview-core.amd.js.map +1 -0
  98. package/dist/dockview-core.amd.min.js +3 -2
  99. package/dist/dockview-core.amd.min.js.map +1 -0
  100. package/dist/dockview-core.amd.min.noStyle.js +3 -2
  101. package/dist/dockview-core.amd.min.noStyle.js.map +1 -0
  102. package/dist/dockview-core.amd.noStyle.js +771 -132
  103. package/dist/dockview-core.amd.noStyle.js.map +1 -0
  104. package/dist/dockview-core.cjs.js +772 -133
  105. package/dist/dockview-core.cjs.js.map +1 -0
  106. package/dist/dockview-core.esm.js +773 -133
  107. package/dist/dockview-core.esm.js.map +1 -0
  108. package/dist/dockview-core.esm.min.js +3 -2
  109. package/dist/dockview-core.esm.min.js.map +1 -0
  110. package/dist/dockview-core.js +772 -133
  111. package/dist/dockview-core.js.map +1 -0
  112. package/dist/dockview-core.min.js +3 -2
  113. package/dist/dockview-core.min.js.map +1 -0
  114. package/dist/dockview-core.min.noStyle.js +3 -2
  115. package/dist/dockview-core.min.noStyle.js.map +1 -0
  116. package/dist/dockview-core.noStyle.js +771 -132
  117. package/dist/dockview-core.noStyle.js.map +1 -0
  118. package/dist/esm/api/component.api.d.ts +6 -1
  119. package/dist/esm/api/component.api.d.ts.map +1 -1
  120. package/dist/esm/api/component.api.js +6 -0
  121. package/dist/esm/api/component.api.js.map +1 -1
  122. package/dist/esm/api/dockviewGroupPanelApi.d.ts +30 -0
  123. package/dist/esm/api/dockviewGroupPanelApi.d.ts.map +1 -0
  124. package/dist/esm/api/dockviewGroupPanelApi.js +28 -0
  125. package/dist/esm/api/dockviewGroupPanelApi.js.map +1 -0
  126. package/dist/esm/api/dockviewPanelApi.d.ts +14 -1
  127. package/dist/esm/api/dockviewPanelApi.d.ts.map +1 -1
  128. package/dist/esm/api/dockviewPanelApi.js +6 -1
  129. package/dist/esm/api/dockviewPanelApi.js.map +1 -1
  130. package/dist/esm/array.d.ts +1 -0
  131. package/dist/esm/array.d.ts.map +1 -1
  132. package/dist/esm/array.js +8 -0
  133. package/dist/esm/array.js.map +1 -1
  134. package/dist/esm/dnd/abstractDragHandler.d.ts +1 -0
  135. package/dist/esm/dnd/abstractDragHandler.d.ts.map +1 -1
  136. package/dist/esm/dnd/abstractDragHandler.js +7 -0
  137. package/dist/esm/dnd/abstractDragHandler.js.map +1 -1
  138. package/dist/esm/dnd/droptarget.d.ts +11 -0
  139. package/dist/esm/dnd/droptarget.d.ts.map +1 -1
  140. package/dist/esm/dnd/droptarget.js +32 -9
  141. package/dist/esm/dnd/droptarget.js.map +1 -1
  142. package/dist/esm/dnd/groupDragHandler.d.ts +1 -0
  143. package/dist/esm/dnd/groupDragHandler.d.ts.map +1 -1
  144. package/dist/esm/dnd/groupDragHandler.js +18 -0
  145. package/dist/esm/dnd/groupDragHandler.js.map +1 -1
  146. package/dist/esm/dnd/overlay.d.ts +40 -0
  147. package/dist/esm/dnd/overlay.d.ts.map +1 -0
  148. package/dist/esm/dnd/overlay.js +282 -0
  149. package/dist/esm/dnd/overlay.js.map +1 -0
  150. package/dist/esm/dockview/components/tab/tab.d.ts +2 -2
  151. package/dist/esm/dockview/components/tab/tab.d.ts.map +1 -1
  152. package/dist/esm/dockview/components/tab/tab.js +0 -7
  153. package/dist/esm/dockview/components/tab/tab.js.map +1 -1
  154. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +8 -4
  155. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts.map +1 -1
  156. package/dist/esm/dockview/components/titlebar/tabsContainer.js +54 -10
  157. package/dist/esm/dockview/components/titlebar/tabsContainer.js.map +1 -1
  158. package/dist/esm/dockview/deserializer.d.ts +2 -2
  159. package/dist/esm/dockview/deserializer.d.ts.map +1 -1
  160. package/dist/esm/dockview/deserializer.js.map +1 -1
  161. package/dist/esm/dockview/dockviewComponent.d.ts +41 -9
  162. package/dist/esm/dockview/dockviewComponent.d.ts.map +1 -1
  163. package/dist/esm/dockview/dockviewComponent.js +231 -54
  164. package/dist/esm/dockview/dockviewComponent.js.map +1 -1
  165. package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +24 -0
  166. package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts.map +1 -0
  167. package/dist/esm/dockview/dockviewFloatingGroupPanel.js +13 -0
  168. package/dist/esm/dockview/dockviewFloatingGroupPanel.js.map +1 -0
  169. package/dist/esm/dockview/dockviewGroupPanel.d.ts +5 -6
  170. package/dist/esm/dockview/dockviewGroupPanel.d.ts.map +1 -1
  171. package/dist/esm/dockview/dockviewGroupPanel.js +3 -2
  172. package/dist/esm/dockview/dockviewGroupPanel.js.map +1 -1
  173. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +5 -1
  174. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts.map +1 -1
  175. package/dist/esm/dockview/dockviewGroupPanelModel.js +36 -9
  176. package/dist/esm/dockview/dockviewGroupPanelModel.js.map +1 -1
  177. package/dist/esm/dockview/dockviewPanel.d.ts +2 -2
  178. package/dist/esm/dockview/dockviewPanel.d.ts.map +1 -1
  179. package/dist/esm/dockview/dockviewPanel.js +1 -1
  180. package/dist/esm/dockview/dockviewPanel.js.map +1 -1
  181. package/dist/esm/dockview/options.d.ts +22 -6
  182. package/dist/esm/dockview/options.d.ts.map +1 -1
  183. package/dist/esm/dockview/options.js.map +1 -1
  184. package/dist/esm/dom.d.ts +5 -3
  185. package/dist/esm/dom.d.ts.map +1 -1
  186. package/dist/esm/dom.js +10 -0
  187. package/dist/esm/dom.js.map +1 -1
  188. package/dist/esm/events.d.ts.map +1 -1
  189. package/dist/esm/gridview/branchNode.js +2 -2
  190. package/dist/esm/gridview/branchNode.js.map +1 -1
  191. package/dist/esm/gridview/gridview.d.ts.map +1 -1
  192. package/dist/esm/gridview/gridview.js +9 -6
  193. package/dist/esm/gridview/gridview.js.map +1 -1
  194. package/dist/esm/gridview/gridviewComponent.d.ts.map +1 -1
  195. package/dist/esm/gridview/gridviewComponent.js +4 -1
  196. package/dist/esm/gridview/gridviewComponent.js.map +1 -1
  197. package/dist/esm/gridview/gridviewPanel.d.ts +3 -3
  198. package/dist/esm/gridview/gridviewPanel.d.ts.map +1 -1
  199. package/dist/esm/gridview/gridviewPanel.js +2 -2
  200. package/dist/esm/gridview/gridviewPanel.js.map +1 -1
  201. package/dist/esm/index.d.ts +1 -1
  202. package/dist/esm/index.d.ts.map +1 -1
  203. package/dist/esm/index.js +0 -1
  204. package/dist/esm/index.js.map +1 -1
  205. package/dist/esm/math.d.ts.map +1 -1
  206. package/dist/esm/math.js.map +1 -1
  207. package/dist/esm/paneview/paneviewComponent.d.ts.map +1 -1
  208. package/dist/esm/paneview/paneviewComponent.js +4 -1
  209. package/dist/esm/paneview/paneviewComponent.js.map +1 -1
  210. package/dist/esm/splitview/splitviewComponent.d.ts.map +1 -1
  211. package/dist/esm/splitview/splitviewComponent.js +4 -1
  212. package/dist/esm/splitview/splitviewComponent.js.map +1 -1
  213. package/dist/styles/dockview.css +216 -1
  214. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 1.7.6
3
+ * @version 1.8.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -273,6 +273,31 @@ define(['exports'], (function (exports) { 'use strict';
273
273
  }
274
274
  }
275
275
 
276
+ function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
277
+ const Component = typeof componentName === 'string'
278
+ ? components[componentName]
279
+ : undefined;
280
+ const FrameworkComponent = typeof componentName === 'string'
281
+ ? frameworkComponents[componentName]
282
+ : undefined;
283
+ if (Component && FrameworkComponent) {
284
+ throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
285
+ }
286
+ if (FrameworkComponent) {
287
+ if (!createFrameworkComponent) {
288
+ throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
289
+ }
290
+ return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
291
+ }
292
+ if (!Component) {
293
+ if (fallback) {
294
+ return fallback();
295
+ }
296
+ throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
297
+ }
298
+ return new Component(id, componentName);
299
+ }
300
+
276
301
  function watchElementResize(element, cb) {
277
302
  const observer = new ResizeObserver((entires) => {
278
303
  /**
@@ -386,31 +411,16 @@ define(['exports'], (function (exports) { 'use strict';
386
411
  refreshState() {
387
412
  this._refreshStateHandler();
388
413
  }
389
- }
390
-
391
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
392
- const Component = typeof componentName === 'string'
393
- ? components[componentName]
394
- : undefined;
395
- const FrameworkComponent = typeof componentName === 'string'
396
- ? frameworkComponents[componentName]
397
- : undefined;
398
- if (Component && FrameworkComponent) {
399
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
400
- }
401
- if (FrameworkComponent) {
402
- if (!createFrameworkComponent) {
403
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
404
- }
405
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
406
- }
407
- if (!Component) {
408
- if (fallback) {
409
- return fallback();
410
- }
411
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
412
- }
413
- return new Component(id, componentName);
414
+ }
415
+ // quasi: apparently, but not really; seemingly
416
+ const QUASI_PREVENT_DEFAULT_KEY = 'dv-quasiPreventDefault';
417
+ // mark an event directly for other listeners to check
418
+ function quasiPreventDefault(event) {
419
+ event[QUASI_PREVENT_DEFAULT_KEY] = true;
420
+ }
421
+ // check if this event has been marked
422
+ function quasiDefaultPrevented(event) {
423
+ return event[QUASI_PREVENT_DEFAULT_KEY];
414
424
  }
415
425
 
416
426
  function tail(arr) {
@@ -461,6 +471,14 @@ define(['exports'], (function (exports) { 'use strict';
461
471
  }
462
472
  }
463
473
  return -1;
474
+ }
475
+ function remove(array, value) {
476
+ const index = array.findIndex((t) => t === value);
477
+ if (index > -1) {
478
+ array.splice(index, 1);
479
+ return true;
480
+ }
481
+ return false;
464
482
  }
465
483
 
466
484
  const clamp = (value, min, max) => {
@@ -1603,7 +1621,7 @@ define(['exports'], (function (exports) { 'use strict';
1603
1621
  : true,
1604
1622
  };
1605
1623
  }),
1606
- size: this.size,
1624
+ size: this.orthogonalSize,
1607
1625
  };
1608
1626
  this.children = childDescriptors.map((c) => c.node);
1609
1627
  this.splitview = new Splitview(this.element, {
@@ -1666,7 +1684,7 @@ define(['exports'], (function (exports) { 'use strict';
1666
1684
  layout(size, orthogonalSize) {
1667
1685
  this._size = orthogonalSize;
1668
1686
  this._orthogonalSize = size;
1669
- this.splitview.layout(this.size, this.orthogonalSize);
1687
+ this.splitview.layout(orthogonalSize, size);
1670
1688
  }
1671
1689
  addChild(node, size, index, skipLayout) {
1672
1690
  if (index < 0 || index > this.children.length) {
@@ -1891,9 +1909,9 @@ define(['exports'], (function (exports) { 'use strict';
1891
1909
  this._deserialize(json.root, orientation, deserializer, height);
1892
1910
  }
1893
1911
  _deserialize(root, orientation, deserializer, orthogonalSize) {
1894
- this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize, true);
1912
+ this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);
1895
1913
  }
1896
- _deserializeNode(node, orientation, deserializer, orthogonalSize, isRoot = false) {
1914
+ _deserializeNode(node, orientation, deserializer, orthogonalSize) {
1897
1915
  let result;
1898
1916
  if (node.type === 'branch') {
1899
1917
  const serializedChildren = node.data;
@@ -1903,9 +1921,9 @@ define(['exports'], (function (exports) { 'use strict';
1903
1921
  visible: serializedChild.visible,
1904
1922
  };
1905
1923
  });
1906
- // HORIZONTAL => height=orthogonalsize width=size
1907
- // VERTICAL => height=size width=orthogonalsize
1908
- result = new BranchNode(orientation, this.proportionalLayout, this.styles, isRoot ? orthogonalSize : node.size, isRoot ? node.size : orthogonalSize, children);
1924
+ result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
1925
+ orthogonalSize, // <- size - flips at each depth
1926
+ children);
1909
1927
  }
1910
1928
  else {
1911
1929
  result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
@@ -1938,7 +1956,8 @@ define(['exports'], (function (exports) { 'use strict';
1938
1956
  const oldRoot = this.root;
1939
1957
  oldRoot.element.remove();
1940
1958
  this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size);
1941
- if (oldRoot.children.length === 1) {
1959
+ if (oldRoot.children.length === 0) ;
1960
+ else if (oldRoot.children.length === 1) {
1942
1961
  // can remove one level of redundant branching if there is only a single child
1943
1962
  const childReference = oldRoot.children[0];
1944
1963
  const child = oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
@@ -2454,6 +2473,9 @@ define(['exports'], (function (exports) { 'use strict';
2454
2473
  addPanel(options) {
2455
2474
  return this.component.addPanel(options);
2456
2475
  }
2476
+ removePanel(panel) {
2477
+ this.component.removePanel(panel);
2478
+ }
2457
2479
  addGroup(options) {
2458
2480
  return this.component.addGroup(options);
2459
2481
  }
@@ -2472,6 +2494,9 @@ define(['exports'], (function (exports) { 'use strict';
2472
2494
  getGroup(id) {
2473
2495
  return this.component.getPanel(id);
2474
2496
  }
2497
+ addFloatingGroup(item, coord) {
2498
+ return this.component.addFloatingGroup(item, coord);
2499
+ }
2475
2500
  fromJSON(data) {
2476
2501
  this.component.fromJSON(data);
2477
2502
  }
@@ -2564,10 +2589,14 @@ define(['exports'], (function (exports) { 'use strict';
2564
2589
  this._onDrop = new Emitter();
2565
2590
  this.onDrop = this._onDrop.event;
2566
2591
  // use a set to take advantage of #<set>.has
2567
- const acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
2592
+ this._acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
2568
2593
  this.addDisposables(this._onDrop, new DragAndDropObserver(this.element, {
2569
2594
  onDragEnter: () => undefined,
2570
2595
  onDragOver: (e) => {
2596
+ if (this._acceptedTargetZonesSet.size === 0) {
2597
+ this.removeDropTarget();
2598
+ return;
2599
+ }
2571
2600
  const width = this.element.clientWidth;
2572
2601
  const height = this.element.clientHeight;
2573
2602
  if (width === 0 || height === 0) {
@@ -2576,20 +2605,28 @@ define(['exports'], (function (exports) { 'use strict';
2576
2605
  const rect = e.currentTarget.getBoundingClientRect();
2577
2606
  const x = e.clientX - rect.left;
2578
2607
  const y = e.clientY - rect.top;
2579
- const quadrant = this.calculateQuadrant(acceptedTargetZonesSet, x, y, width, height);
2580
- if (quadrant === null) {
2608
+ const quadrant = this.calculateQuadrant(this._acceptedTargetZonesSet, x, y, width, height);
2609
+ /**
2610
+ * If the event has already been used by another DropTarget instance
2611
+ * then don't show a second drop target, only one target should be
2612
+ * active at any one time
2613
+ */
2614
+ if (this.isAlreadyUsed(e) || quadrant === null) {
2581
2615
  // no drop target should be displayed
2582
2616
  this.removeDropTarget();
2583
2617
  return;
2584
2618
  }
2585
2619
  if (typeof this.options.canDisplayOverlay === 'boolean') {
2586
2620
  if (!this.options.canDisplayOverlay) {
2621
+ this.removeDropTarget();
2587
2622
  return;
2588
2623
  }
2589
2624
  }
2590
2625
  else if (!this.options.canDisplayOverlay(e, quadrant)) {
2626
+ this.removeDropTarget();
2591
2627
  return;
2592
2628
  }
2629
+ this.markAsUsed(e);
2593
2630
  if (!this.targetElement) {
2594
2631
  this.targetElement = document.createElement('div');
2595
2632
  this.targetElement.className = 'drop-target-dropzone';
@@ -2600,12 +2637,6 @@ define(['exports'], (function (exports) { 'use strict';
2600
2637
  this.element.classList.add('drop-target');
2601
2638
  this.element.append(this.targetElement);
2602
2639
  }
2603
- if (this.options.acceptedTargetZones.length === 0) {
2604
- return;
2605
- }
2606
- if (!this.targetElement || !this.overlayElement) {
2607
- return;
2608
- }
2609
2640
  this.toggleClasses(quadrant, width, height);
2610
2641
  this.setState(quadrant);
2611
2642
  },
@@ -2628,10 +2659,26 @@ define(['exports'], (function (exports) { 'use strict';
2628
2659
  },
2629
2660
  }));
2630
2661
  }
2662
+ setTargetZones(acceptedTargetZones) {
2663
+ this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
2664
+ }
2631
2665
  dispose() {
2632
2666
  this.removeDropTarget();
2633
2667
  super.dispose();
2634
2668
  }
2669
+ /**
2670
+ * Add a property to the event object for other potential listeners to check
2671
+ */
2672
+ markAsUsed(event) {
2673
+ event[Droptarget.USED_EVENT_ID] = true;
2674
+ }
2675
+ /**
2676
+ * Check is the event has already been used by another instance od DropTarget
2677
+ */
2678
+ isAlreadyUsed(event) {
2679
+ const value = event[Droptarget.USED_EVENT_ID];
2680
+ return typeof value === 'boolean' && value;
2681
+ }
2635
2682
  toggleClasses(quadrant, width, height) {
2636
2683
  var _a, _b, _c, _d;
2637
2684
  if (!this.overlayElement) {
@@ -2726,6 +2773,7 @@ define(['exports'], (function (exports) { 'use strict';
2726
2773
  }
2727
2774
  }
2728
2775
  }
2776
+ Droptarget.USED_EVENT_ID = '__dockview_droptarget_event_is_used__';
2729
2777
  function calculateQuadrantAsPercentage(overlayType, x, y, width, height, threshold) {
2730
2778
  const xp = (100 * x) / width;
2731
2779
  const yp = (100 * y) / height;
@@ -2855,8 +2903,15 @@ define(['exports'], (function (exports) { 'use strict';
2855
2903
  this.addDisposables(this._onDragStart, this.dataDisposable, this.pointerEventsDisposable);
2856
2904
  this.configure();
2857
2905
  }
2906
+ isCancelled(_event) {
2907
+ return false;
2908
+ }
2858
2909
  configure() {
2859
2910
  this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
2911
+ if (this.isCancelled(event)) {
2912
+ event.preventDefault();
2913
+ return;
2914
+ }
2860
2915
  const iframes = [
2861
2916
  ...getElementsByTagName('iframe'),
2862
2917
  ...getElementsByTagName('webview'),
@@ -2930,13 +2985,6 @@ define(['exports'], (function (exports) { 'use strict';
2930
2985
  if (event.defaultPrevented) {
2931
2986
  return;
2932
2987
  }
2933
- /**
2934
- * TODO: alternative to stopPropagation
2935
- *
2936
- * I need to stop the event propagation here since otherwise it'll be intercepted by event handlers
2937
- * on the tabs-container. I cannot use event.preventDefault() since I need the on DragStart event to occur
2938
- */
2939
- event.stopPropagation();
2940
2988
  this._onChanged.fire(event);
2941
2989
  }));
2942
2990
  this.droptarget = new Droptarget(this._element, {
@@ -2994,6 +3042,22 @@ define(['exports'], (function (exports) { 'use strict';
2994
3042
  this.accessorId = accessorId;
2995
3043
  this.group = group;
2996
3044
  this.panelTransfer = LocalSelectionTransfer.getInstance();
3045
+ this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
3046
+ if (e.shiftKey) {
3047
+ /**
3048
+ * You cannot call e.preventDefault() because that will prevent drag events from firing
3049
+ * but we also need to stop any group overlay drag events from occuring
3050
+ * Use a custom event marker that can be checked by the overlay drag events
3051
+ */
3052
+ quasiPreventDefault(e);
3053
+ }
3054
+ }, true));
3055
+ }
3056
+ isCancelled(_event) {
3057
+ if (this.group.api.isFloating && !_event.shiftKey) {
3058
+ return true;
3059
+ }
3060
+ return false;
2997
3061
  }
2998
3062
  getData(dataTransfer) {
2999
3063
  this.panelTransfer.setData([new PanelTransfer(this.accessorId, this.group.id, null)], PanelTransfer.prototype);
@@ -3084,17 +3148,30 @@ define(['exports'], (function (exports) { 'use strict';
3084
3148
  hide() {
3085
3149
  this._element.style.display = 'none';
3086
3150
  }
3087
- setActionElement(element) {
3088
- if (this.actions === element) {
3151
+ setRightActionsElement(element) {
3152
+ if (this.rightActions === element) {
3089
3153
  return;
3090
3154
  }
3091
- if (this.actions) {
3092
- this.actions.remove();
3093
- this.actions = undefined;
3155
+ if (this.rightActions) {
3156
+ this.rightActions.remove();
3157
+ this.rightActions = undefined;
3094
3158
  }
3095
3159
  if (element) {
3096
- this.actionContainer.appendChild(element);
3097
- this.actions = element;
3160
+ this.rightActionsContainer.appendChild(element);
3161
+ this.rightActions = element;
3162
+ }
3163
+ }
3164
+ setLeftActionsElement(element) {
3165
+ if (this.leftActions === element) {
3166
+ return;
3167
+ }
3168
+ if (this.leftActions) {
3169
+ this.leftActions.remove();
3170
+ this.leftActions = undefined;
3171
+ }
3172
+ if (element) {
3173
+ this.leftActionsContainer.appendChild(element);
3174
+ this.leftActions = element;
3098
3175
  }
3099
3176
  }
3100
3177
  get element() {
@@ -3129,19 +3206,35 @@ define(['exports'], (function (exports) { 'use strict';
3129
3206
  toggleClass(this._element, 'dv-single-tab', this.size === 1);
3130
3207
  }
3131
3208
  }));
3132
- this.actionContainer = document.createElement('div');
3133
- this.actionContainer.className = 'action-container';
3209
+ this.rightActionsContainer = document.createElement('div');
3210
+ this.rightActionsContainer.className = 'right-actions-container';
3211
+ this.leftActionsContainer = document.createElement('div');
3212
+ this.leftActionsContainer.className = 'left-actions-container';
3134
3213
  this.tabContainer = document.createElement('div');
3135
3214
  this.tabContainer.className = 'tabs-container';
3136
3215
  this.voidContainer = new VoidContainer(this.accessor, this.group);
3137
3216
  this._element.appendChild(this.tabContainer);
3217
+ this._element.appendChild(this.leftActionsContainer);
3138
3218
  this._element.appendChild(this.voidContainer.element);
3139
- this._element.appendChild(this.actionContainer);
3219
+ this._element.appendChild(this.rightActionsContainer);
3140
3220
  this.addDisposables(this.voidContainer, this.voidContainer.onDrop((event) => {
3141
3221
  this._onDrop.fire({
3142
3222
  event: event.nativeEvent,
3143
3223
  index: this.tabs.length,
3144
3224
  });
3225
+ }), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
3226
+ const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
3227
+ if (isFloatingGroupsEnabled &&
3228
+ event.shiftKey &&
3229
+ !this.group.api.isFloating) {
3230
+ event.preventDefault();
3231
+ const { top, left } = this.element.getBoundingClientRect();
3232
+ const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
3233
+ this.accessor.addFloatingGroup(this.group, {
3234
+ x: left - rootLeft + 20,
3235
+ y: top - rootTop + 20,
3236
+ }, { inDragMode: true });
3237
+ }
3145
3238
  }), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
3146
3239
  if (event.defaultPrevented) {
3147
3240
  return;
@@ -3195,6 +3288,21 @@ define(['exports'], (function (exports) { 'use strict';
3195
3288
  tabToAdd.setContent(panel.view.tab);
3196
3289
  const disposable = CompositeDisposable.from(tabToAdd.onChanged((event) => {
3197
3290
  var _a;
3291
+ const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
3292
+ const isFloatingWithOnePanel = this.group.api.isFloating && this.size === 1;
3293
+ if (isFloatingGroupsEnabled &&
3294
+ !isFloatingWithOnePanel &&
3295
+ event.shiftKey) {
3296
+ event.preventDefault();
3297
+ const panel = this.accessor.getGroupPanel(tabToAdd.panelId);
3298
+ const { top, left } = tabToAdd.element.getBoundingClientRect();
3299
+ const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
3300
+ this.accessor.addFloatingGroup(panel, {
3301
+ x: left - rootLeft,
3302
+ y: top - rootTop,
3303
+ }, { inDragMode: true });
3304
+ return;
3305
+ }
3198
3306
  const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
3199
3307
  this.group.model.isContentFocused;
3200
3308
  const isLeftClick = event.button === 0;
@@ -3264,6 +3372,17 @@ define(['exports'], (function (exports) { 'use strict';
3264
3372
  }
3265
3373
  return isAncestor(document.activeElement, this.contentContainer.element);
3266
3374
  }
3375
+ get isFloating() {
3376
+ return this._isFloating;
3377
+ }
3378
+ set isFloating(value) {
3379
+ this._isFloating = value;
3380
+ this.dropTarget.setTargetZones(value ? ['center'] : ['top', 'bottom', 'left', 'right', 'center']);
3381
+ toggleClass(this.container, 'dv-groupview-floating', value);
3382
+ this.groupPanel.api._onDidFloatingStateChange.fire({
3383
+ isFloating: this.isFloating,
3384
+ });
3385
+ }
3267
3386
  constructor(container, accessor, id, options, groupPanel) {
3268
3387
  super();
3269
3388
  this.container = container;
@@ -3273,6 +3392,7 @@ define(['exports'], (function (exports) { 'use strict';
3273
3392
  this.groupPanel = groupPanel;
3274
3393
  this._isGroupActive = false;
3275
3394
  this._locked = false;
3395
+ this._isFloating = false;
3276
3396
  this.mostRecentlyUsed = [];
3277
3397
  this._onDidChange = new Emitter();
3278
3398
  this.onDidChange = this._onDidChange.event;
@@ -3289,7 +3409,7 @@ define(['exports'], (function (exports) { 'use strict';
3289
3409
  this.onDidRemovePanel = this._onDidRemovePanel.event;
3290
3410
  this._onDidActivePanelChange = new Emitter();
3291
3411
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
3292
- this.container.classList.add('groupview');
3412
+ toggleClass(this.container, 'groupview', true);
3293
3413
  this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
3294
3414
  this.contentContainer = new ContentContainer();
3295
3415
  this.dropTarget = new Droptarget(this.contentContainer.element, {
@@ -3299,6 +3419,9 @@ define(['exports'], (function (exports) { 'use strict';
3299
3419
  return false;
3300
3420
  }
3301
3421
  const data = getPanelData();
3422
+ if (!data && event.shiftKey && !this.isFloating) {
3423
+ return false;
3424
+ }
3302
3425
  if (data && data.viewId === this.accessor.id) {
3303
3426
  if (data.groupId === this.id) {
3304
3427
  if (position === 'center') {
@@ -3343,14 +3466,25 @@ define(['exports'], (function (exports) { 'use strict';
3343
3466
  // correctly initialized
3344
3467
  this.setActive(this.isActive, true, true);
3345
3468
  this.updateContainer();
3346
- if (this.accessor.options.createGroupControlElement) {
3347
- this._control = this.accessor.options.createGroupControlElement(this.groupPanel);
3348
- this.addDisposables(this._control);
3349
- this._control.init({
3469
+ if (this.accessor.options.createRightHeaderActionsElement) {
3470
+ this._rightHeaderActions =
3471
+ this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
3472
+ this.addDisposables(this._rightHeaderActions);
3473
+ this._rightHeaderActions.init({
3474
+ containerApi: new DockviewApi(this.accessor),
3475
+ api: this.groupPanel.api,
3476
+ });
3477
+ this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
3478
+ }
3479
+ if (this.accessor.options.createLeftHeaderActionsElement) {
3480
+ this._leftHeaderActions =
3481
+ this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
3482
+ this.addDisposables(this._leftHeaderActions);
3483
+ this._leftHeaderActions.init({
3350
3484
  containerApi: new DockviewApi(this.accessor),
3351
3485
  api: this.groupPanel.api,
3352
3486
  });
3353
- this.tabsContainer.setActionElement(this._control.element);
3487
+ this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
3354
3488
  }
3355
3489
  }
3356
3490
  indexOf(panel) {
@@ -3483,7 +3617,7 @@ define(['exports'], (function (exports) { 'use strict';
3483
3617
  return this._activePanel === panel;
3484
3618
  }
3485
3619
  updateActions(element) {
3486
- this.tabsContainer.setActionElement(element);
3620
+ this.tabsContainer.setRightActionsElement(element);
3487
3621
  }
3488
3622
  setActive(isGroupActive, skipFocus = false, force = false) {
3489
3623
  var _a, _b, _c, _d;
@@ -3655,9 +3789,10 @@ define(['exports'], (function (exports) { 'use strict';
3655
3789
  }
3656
3790
  }
3657
3791
  dispose() {
3658
- var _a, _b;
3792
+ var _a, _b, _c;
3659
3793
  super.dispose();
3660
- (_b = (_a = this.watermark) === null || _a === void 0 ? void 0 : _a.dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
3794
+ (_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();
3795
+ (_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
3661
3796
  for (const panel of this.panels) {
3662
3797
  panel.dispose();
3663
3798
  }
@@ -4451,8 +4586,8 @@ define(['exports'], (function (exports) { 'use strict';
4451
4586
  get isActive() {
4452
4587
  return this.api.isActive;
4453
4588
  }
4454
- constructor(id, component, options) {
4455
- super(id, component, new GridviewPanelApiImpl(id));
4589
+ constructor(id, component, options, api) {
4590
+ super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id));
4456
4591
  this._evaluatedMinimumWidth = 0;
4457
4592
  this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
4458
4593
  this._evaluatedMinimumHeight = 0;
@@ -4550,6 +4685,32 @@ define(['exports'], (function (exports) { 'use strict';
4550
4685
  }
4551
4686
  }
4552
4687
 
4688
+ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
4689
+ get isFloating() {
4690
+ if (!this._group) {
4691
+ throw new Error(`DockviewGroupPanelApiImpl not initialized`);
4692
+ }
4693
+ return this._group.model.isFloating;
4694
+ }
4695
+ constructor(id, accessor) {
4696
+ super(id);
4697
+ this.accessor = accessor;
4698
+ this._onDidFloatingStateChange = new Emitter();
4699
+ this.onDidFloatingStateChange = this._onDidFloatingStateChange.event;
4700
+ this.addDisposables(this._onDidFloatingStateChange);
4701
+ }
4702
+ moveTo(options) {
4703
+ var _a;
4704
+ if (!this._group) {
4705
+ throw new Error(`DockviewGroupPanelApiImpl not initialized`);
4706
+ }
4707
+ this.accessor.moveGroupOrPanel(options.group, this._group.id, undefined, (_a = options.position) !== null && _a !== void 0 ? _a : 'center');
4708
+ }
4709
+ initialize(group) {
4710
+ this._group = group;
4711
+ }
4712
+ }
4713
+
4553
4714
  class DockviewGroupPanel extends GridviewPanel {
4554
4715
  get panels() {
4555
4716
  return this._model.panels;
@@ -4576,7 +4737,8 @@ define(['exports'], (function (exports) { 'use strict';
4576
4737
  super(id, 'groupview_default', {
4577
4738
  minimumHeight: 100,
4578
4739
  minimumWidth: 100,
4579
- });
4740
+ }, new DockviewGroupPanelApiImpl(id, accessor));
4741
+ this.api.initialize(this); // cannot use 'this' after after 'super' call
4580
4742
  this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
4581
4743
  }
4582
4744
  initialize() {
@@ -4594,7 +4756,6 @@ define(['exports'], (function (exports) { 'use strict';
4594
4756
  return this._model;
4595
4757
  }
4596
4758
  toJSON() {
4597
- // TODO fix typing
4598
4759
  return this.model.toJSON();
4599
4760
  }
4600
4761
  }
@@ -4648,9 +4809,10 @@ define(['exports'], (function (exports) { 'use strict';
4648
4809
  get group() {
4649
4810
  return this._group;
4650
4811
  }
4651
- constructor(panel, group) {
4812
+ constructor(panel, group, accessor) {
4652
4813
  super(panel.id);
4653
4814
  this.panel = panel;
4815
+ this.accessor = accessor;
4654
4816
  this._onDidTitleChange = new Emitter();
4655
4817
  this.onDidTitleChange = this._onDidTitleChange.event;
4656
4818
  this._onDidActiveGroupChange = new Emitter();
@@ -4662,6 +4824,10 @@ define(['exports'], (function (exports) { 'use strict';
4662
4824
  this._group = group;
4663
4825
  this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
4664
4826
  }
4827
+ moveTo(options) {
4828
+ var _a;
4829
+ this.accessor.moveGroupOrPanel(options.group, this._group.id, this.panel.id, (_a = options.position) !== null && _a !== void 0 ? _a : 'center', options.index);
4830
+ }
4665
4831
  setTitle(title) {
4666
4832
  this.panel.setTitle(title);
4667
4833
  }
@@ -4686,7 +4852,7 @@ define(['exports'], (function (exports) { 'use strict';
4686
4852
  this.containerApi = containerApi;
4687
4853
  this.view = view;
4688
4854
  this._group = group;
4689
- this.api = new DockviewPanelApiImpl(this, this._group);
4855
+ this.api = new DockviewPanelApiImpl(this, this._group, accessor);
4690
4856
  this.addDisposables(this.api.onActiveChange(() => {
4691
4857
  accessor.setActivePanel(this);
4692
4858
  }), this.api.onDidSizeChange((event) => {
@@ -5027,6 +5193,296 @@ define(['exports'], (function (exports) { 'use strict';
5027
5193
  }
5028
5194
  }
5029
5195
 
5196
+ const bringElementToFront = (() => {
5197
+ let previous = null;
5198
+ function pushToTop(element) {
5199
+ if (previous !== element && previous !== null) {
5200
+ toggleClass(previous, 'dv-bring-to-front', false);
5201
+ }
5202
+ toggleClass(element, 'dv-bring-to-front', true);
5203
+ previous = element;
5204
+ }
5205
+ return pushToTop;
5206
+ })();
5207
+ class Overlay extends CompositeDisposable {
5208
+ constructor(options) {
5209
+ super();
5210
+ this.options = options;
5211
+ this._element = document.createElement('div');
5212
+ this._onDidChange = new Emitter();
5213
+ this.onDidChange = this._onDidChange.event;
5214
+ this._onDidChangeEnd = new Emitter();
5215
+ this.onDidChangeEnd = this._onDidChangeEnd.event;
5216
+ this.addDisposables(this._onDidChange, this._onDidChangeEnd);
5217
+ this._element.className = 'dv-resize-container';
5218
+ this.setupResize('top');
5219
+ this.setupResize('bottom');
5220
+ this.setupResize('left');
5221
+ this.setupResize('right');
5222
+ this.setupResize('topleft');
5223
+ this.setupResize('topright');
5224
+ this.setupResize('bottomleft');
5225
+ this.setupResize('bottomright');
5226
+ this._element.appendChild(this.options.content);
5227
+ this.options.container.appendChild(this._element);
5228
+ // if input bad resize within acceptable boundaries
5229
+ this.setBounds({
5230
+ height: this.options.height,
5231
+ width: this.options.width,
5232
+ top: this.options.top,
5233
+ left: this.options.left,
5234
+ });
5235
+ }
5236
+ setBounds(bounds = {}) {
5237
+ if (typeof bounds.height === 'number') {
5238
+ this._element.style.height = `${bounds.height}px`;
5239
+ }
5240
+ if (typeof bounds.width === 'number') {
5241
+ this._element.style.width = `${bounds.width}px`;
5242
+ }
5243
+ if (typeof bounds.top === 'number') {
5244
+ this._element.style.top = `${bounds.top}px`;
5245
+ }
5246
+ if (typeof bounds.left === 'number') {
5247
+ this._element.style.left = `${bounds.left}px`;
5248
+ }
5249
+ const containerRect = this.options.container.getBoundingClientRect();
5250
+ const overlayRect = this._element.getBoundingClientRect();
5251
+ // region: ensure bounds within allowable limits
5252
+ // a minimum width of minimumViewportWidth must be inside the viewport
5253
+ const xOffset = Math.max(0, overlayRect.width - this.options.minimumInViewportWidth);
5254
+ // a minimum height of minimumViewportHeight must be inside the viewport
5255
+ const yOffset = Math.max(0, overlayRect.height - this.options.minimumInViewportHeight);
5256
+ const left = clamp(overlayRect.left - containerRect.left, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
5257
+ const top = clamp(overlayRect.top - containerRect.top, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
5258
+ this._element.style.left = `${left}px`;
5259
+ this._element.style.top = `${top}px`;
5260
+ this._onDidChange.fire();
5261
+ }
5262
+ toJSON() {
5263
+ const container = this.options.container.getBoundingClientRect();
5264
+ const element = this._element.getBoundingClientRect();
5265
+ return {
5266
+ top: element.top - container.top,
5267
+ left: element.left - container.left,
5268
+ width: element.width,
5269
+ height: element.height,
5270
+ };
5271
+ }
5272
+ setupDrag(dragTarget, options = { inDragMode: false }) {
5273
+ const move = new MutableDisposable();
5274
+ const track = () => {
5275
+ let offset = null;
5276
+ const iframes = [
5277
+ ...getElementsByTagName('iframe'),
5278
+ ...getElementsByTagName('webview'),
5279
+ ];
5280
+ for (const iframe of iframes) {
5281
+ iframe.style.pointerEvents = 'none';
5282
+ }
5283
+ move.value = new CompositeDisposable({
5284
+ dispose: () => {
5285
+ for (const iframe of iframes) {
5286
+ iframe.style.pointerEvents = 'auto';
5287
+ }
5288
+ },
5289
+ }, addDisposableWindowListener(window, 'mousemove', (e) => {
5290
+ const containerRect = this.options.container.getBoundingClientRect();
5291
+ const x = e.clientX - containerRect.left;
5292
+ const y = e.clientY - containerRect.top;
5293
+ toggleClass(this._element, 'dv-resize-container-dragging', true);
5294
+ const overlayRect = this._element.getBoundingClientRect();
5295
+ if (offset === null) {
5296
+ offset = {
5297
+ x: e.clientX - overlayRect.left,
5298
+ y: e.clientY - overlayRect.top,
5299
+ };
5300
+ }
5301
+ const xOffset = Math.max(0, overlayRect.width - this.options.minimumInViewportWidth);
5302
+ const yOffset = Math.max(0, overlayRect.height -
5303
+ this.options.minimumInViewportHeight);
5304
+ const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
5305
+ const top = clamp(y - offset.y, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
5306
+ this.setBounds({ top, left });
5307
+ }), addDisposableWindowListener(window, 'mouseup', () => {
5308
+ toggleClass(this._element, 'dv-resize-container-dragging', false);
5309
+ move.dispose();
5310
+ this._onDidChangeEnd.fire();
5311
+ }));
5312
+ };
5313
+ this.addDisposables(move, addDisposableListener(dragTarget, 'mousedown', (event) => {
5314
+ if (event.defaultPrevented) {
5315
+ event.preventDefault();
5316
+ return;
5317
+ }
5318
+ // if somebody has marked this event then treat as a defaultPrevented
5319
+ // without actually calling event.preventDefault()
5320
+ if (quasiDefaultPrevented(event)) {
5321
+ return;
5322
+ }
5323
+ track();
5324
+ }), addDisposableListener(this.options.content, 'mousedown', (event) => {
5325
+ if (event.defaultPrevented) {
5326
+ return;
5327
+ }
5328
+ // if somebody has marked this event then treat as a defaultPrevented
5329
+ // without actually calling event.preventDefault()
5330
+ if (quasiDefaultPrevented(event)) {
5331
+ return;
5332
+ }
5333
+ if (event.shiftKey) {
5334
+ track();
5335
+ }
5336
+ }), addDisposableListener(this.options.content, 'mousedown', () => {
5337
+ bringElementToFront(this._element);
5338
+ }, true));
5339
+ bringElementToFront(this._element);
5340
+ if (options.inDragMode) {
5341
+ track();
5342
+ }
5343
+ }
5344
+ setupResize(direction) {
5345
+ const resizeHandleElement = document.createElement('div');
5346
+ resizeHandleElement.className = `dv-resize-handle-${direction}`;
5347
+ this._element.appendChild(resizeHandleElement);
5348
+ const move = new MutableDisposable();
5349
+ this.addDisposables(move, addDisposableListener(resizeHandleElement, 'mousedown', (e) => {
5350
+ e.preventDefault();
5351
+ let startPosition = null;
5352
+ const iframes = [
5353
+ ...getElementsByTagName('iframe'),
5354
+ ...getElementsByTagName('webview'),
5355
+ ];
5356
+ for (const iframe of iframes) {
5357
+ iframe.style.pointerEvents = 'none';
5358
+ }
5359
+ move.value = new CompositeDisposable(addDisposableWindowListener(window, 'mousemove', (e) => {
5360
+ const containerRect = this.options.container.getBoundingClientRect();
5361
+ const overlayRect = this._element.getBoundingClientRect();
5362
+ const y = e.clientY - containerRect.top;
5363
+ const x = e.clientX - containerRect.left;
5364
+ if (startPosition === null) {
5365
+ // record the initial dimensions since as all subsequence moves are relative to this
5366
+ startPosition = {
5367
+ originalY: y,
5368
+ originalHeight: overlayRect.height,
5369
+ originalX: x,
5370
+ originalWidth: overlayRect.width,
5371
+ };
5372
+ }
5373
+ let top = undefined;
5374
+ let height = undefined;
5375
+ let left = undefined;
5376
+ let width = undefined;
5377
+ const minimumInViewportHeight = this.options.minimumInViewportHeight;
5378
+ const minimumInViewportWidth = this.options.minimumInViewportWidth;
5379
+ function moveTop() {
5380
+ top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
5381
+ startPosition.originalHeight >
5382
+ containerRect.height
5383
+ ? containerRect.height -
5384
+ minimumInViewportHeight
5385
+ : Math.max(0, startPosition.originalY +
5386
+ startPosition.originalHeight -
5387
+ Overlay.MINIMUM_HEIGHT));
5388
+ height =
5389
+ startPosition.originalY +
5390
+ startPosition.originalHeight -
5391
+ top;
5392
+ }
5393
+ function moveBottom() {
5394
+ top =
5395
+ startPosition.originalY -
5396
+ startPosition.originalHeight;
5397
+ height = clamp(y - top, top < 0
5398
+ ? -top + minimumInViewportHeight
5399
+ : Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
5400
+ }
5401
+ function moveLeft() {
5402
+ left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
5403
+ startPosition.originalWidth >
5404
+ containerRect.width
5405
+ ? containerRect.width -
5406
+ minimumInViewportWidth
5407
+ : Math.max(0, startPosition.originalX +
5408
+ startPosition.originalWidth -
5409
+ Overlay.MINIMUM_WIDTH));
5410
+ width =
5411
+ startPosition.originalX +
5412
+ startPosition.originalWidth -
5413
+ left;
5414
+ }
5415
+ function moveRight() {
5416
+ left =
5417
+ startPosition.originalX -
5418
+ startPosition.originalWidth;
5419
+ width = clamp(x - left, left < 0
5420
+ ? -left + minimumInViewportWidth
5421
+ : Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
5422
+ }
5423
+ switch (direction) {
5424
+ case 'top':
5425
+ moveTop();
5426
+ break;
5427
+ case 'bottom':
5428
+ moveBottom();
5429
+ break;
5430
+ case 'left':
5431
+ moveLeft();
5432
+ break;
5433
+ case 'right':
5434
+ moveRight();
5435
+ break;
5436
+ case 'topleft':
5437
+ moveTop();
5438
+ moveLeft();
5439
+ break;
5440
+ case 'topright':
5441
+ moveTop();
5442
+ moveRight();
5443
+ break;
5444
+ case 'bottomleft':
5445
+ moveBottom();
5446
+ moveLeft();
5447
+ break;
5448
+ case 'bottomright':
5449
+ moveBottom();
5450
+ moveRight();
5451
+ break;
5452
+ }
5453
+ this.setBounds({ height, width, top, left });
5454
+ }), {
5455
+ dispose: () => {
5456
+ for (const iframe of iframes) {
5457
+ iframe.style.pointerEvents = 'auto';
5458
+ }
5459
+ },
5460
+ }, addDisposableWindowListener(window, 'mouseup', () => {
5461
+ move.dispose();
5462
+ this._onDidChangeEnd.fire();
5463
+ }));
5464
+ }));
5465
+ }
5466
+ dispose() {
5467
+ this._element.remove();
5468
+ super.dispose();
5469
+ }
5470
+ }
5471
+ Overlay.MINIMUM_HEIGHT = 20;
5472
+ Overlay.MINIMUM_WIDTH = 20;
5473
+
5474
+ class DockviewFloatingGroupPanel extends CompositeDisposable {
5475
+ constructor(group, overlay) {
5476
+ super();
5477
+ this.group = group;
5478
+ this.overlay = overlay;
5479
+ this.addDisposables(overlay);
5480
+ }
5481
+ position(bounds) {
5482
+ this.overlay.setBounds(bounds);
5483
+ }
5484
+ }
5485
+
5030
5486
  class DockviewComponent extends BaseGrid {
5031
5487
  get orientation() {
5032
5488
  return this.gridview.orientation;
@@ -5067,7 +5523,8 @@ define(['exports'], (function (exports) { 'use strict';
5067
5523
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
5068
5524
  this._onDidActivePanelChange = new Emitter();
5069
5525
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
5070
- this.element.classList.add('dv-dockview');
5526
+ this.floatingGroups = [];
5527
+ toggleClass(this.gridview.element, 'dv-dockview', true);
5071
5528
  this.addDisposables(this._onDidDrop, exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
5072
5529
  this.updateWatermark();
5073
5530
  }), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
@@ -5097,9 +5554,22 @@ define(['exports'], (function (exports) { 'use strict';
5097
5554
  if (data.viewId !== this.id) {
5098
5555
  return false;
5099
5556
  }
5557
+ if (position === 'center') {
5558
+ // center drop target is only allowed if there are no panels in the grid
5559
+ // floating panels are allowed
5560
+ return this.gridview.length === 0;
5561
+ }
5100
5562
  return true;
5101
5563
  }
5102
5564
  if (this.options.showDndOverlay) {
5565
+ if (position === 'center') {
5566
+ /**
5567
+ * for external events only show the four-corner drag overlays, disable
5568
+ * the center position so that external drag events can fall through to the group
5569
+ * and panel drop target handlers
5570
+ */
5571
+ return false;
5572
+ }
5103
5573
  return this.options.showDndOverlay({
5104
5574
  nativeEvent: event,
5105
5575
  position: position,
@@ -5109,7 +5579,7 @@ define(['exports'], (function (exports) { 'use strict';
5109
5579
  }
5110
5580
  return false;
5111
5581
  },
5112
- acceptedTargetZones: ['top', 'bottom', 'left', 'right'],
5582
+ acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
5113
5583
  overlayModel: {
5114
5584
  activationSize: { type: 'pixels', value: 10 },
5115
5585
  size: { type: 'pixels', value: 20 },
@@ -5127,6 +5597,75 @@ define(['exports'], (function (exports) { 'use strict';
5127
5597
  this._api = new DockviewApi(this);
5128
5598
  this.updateWatermark();
5129
5599
  }
5600
+ addFloatingGroup(item, coord, options) {
5601
+ var _a, _b;
5602
+ let group;
5603
+ if (item instanceof DockviewPanel) {
5604
+ group = this.createGroup();
5605
+ this.removePanel(item, {
5606
+ removeEmptyGroup: true,
5607
+ skipDispose: true,
5608
+ });
5609
+ group.model.openPanel(item);
5610
+ }
5611
+ else {
5612
+ group = item;
5613
+ const skip = typeof (options === null || options === void 0 ? void 0 : options.skipRemoveGroup) === 'boolean' &&
5614
+ options.skipRemoveGroup;
5615
+ if (!skip) {
5616
+ this.doRemoveGroup(item, { skipDispose: true });
5617
+ }
5618
+ }
5619
+ group.model.isFloating = true;
5620
+ const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number' ? Math.max(coord.x, 0) : 100;
5621
+ const overlayTop = typeof (coord === null || coord === void 0 ? void 0 : coord.y) === 'number' ? Math.max(coord.y, 0) : 100;
5622
+ const overlay = new Overlay({
5623
+ container: this.gridview.element,
5624
+ content: group.element,
5625
+ height: (_a = coord === null || coord === void 0 ? void 0 : coord.height) !== null && _a !== void 0 ? _a : 300,
5626
+ width: (_b = coord === null || coord === void 0 ? void 0 : coord.width) !== null && _b !== void 0 ? _b : 300,
5627
+ left: overlayLeft,
5628
+ top: overlayTop,
5629
+ minimumInViewportWidth: 100,
5630
+ minimumInViewportHeight: 100,
5631
+ });
5632
+ const el = group.element.querySelector('.void-container');
5633
+ if (!el) {
5634
+ throw new Error('failed to find drag handle');
5635
+ }
5636
+ overlay.setupDrag(el, {
5637
+ inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'
5638
+ ? options.inDragMode
5639
+ : false,
5640
+ });
5641
+ const floatingGroupPanel = new DockviewFloatingGroupPanel(group, overlay);
5642
+ const disposable = watchElementResize(group.element, (entry) => {
5643
+ const { width, height } = entry.contentRect;
5644
+ group.layout(width, height); // let the group know it's size is changing so it can fire events to the panel
5645
+ });
5646
+ floatingGroupPanel.addDisposables(overlay.onDidChange(() => {
5647
+ // this is either a resize or a move
5648
+ // to inform the panels .layout(...) the group with it's current size
5649
+ // don't care about resize since the above watcher handles that
5650
+ group.layout(group.height, group.width);
5651
+ }), overlay.onDidChangeEnd(() => {
5652
+ this._bufferOnDidLayoutChange.fire();
5653
+ }), group.onDidChange((event) => {
5654
+ overlay.setBounds({
5655
+ height: event === null || event === void 0 ? void 0 : event.height,
5656
+ width: event === null || event === void 0 ? void 0 : event.width,
5657
+ });
5658
+ }), {
5659
+ dispose: () => {
5660
+ disposable.dispose();
5661
+ group.model.isFloating = false;
5662
+ remove(this.floatingGroups, floatingGroupPanel);
5663
+ this.updateWatermark();
5664
+ },
5665
+ });
5666
+ this.floatingGroups.push(floatingGroupPanel);
5667
+ this.updateWatermark();
5668
+ }
5130
5669
  orthogonalize(position) {
5131
5670
  switch (position) {
5132
5671
  case 'top':
@@ -5149,6 +5688,7 @@ define(['exports'], (function (exports) { 'use strict';
5149
5688
  switch (position) {
5150
5689
  case 'top':
5151
5690
  case 'left':
5691
+ case 'center':
5152
5692
  return this.createGroupAtLocation([0]); // insert into first position
5153
5693
  case 'bottom':
5154
5694
  case 'right':
@@ -5166,6 +5706,15 @@ define(['exports'], (function (exports) { 'use strict';
5166
5706
  }
5167
5707
  this.layout(this.gridview.width, this.gridview.height, true);
5168
5708
  }
5709
+ layout(width, height, forceResize) {
5710
+ super.layout(width, height, forceResize);
5711
+ if (this.floatingGroups) {
5712
+ for (const floating of this.floatingGroups) {
5713
+ // ensure floting groups stay within visible boundaries
5714
+ floating.overlay.setBounds();
5715
+ }
5716
+ }
5717
+ }
5169
5718
  focus() {
5170
5719
  var _a;
5171
5720
  (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
@@ -5228,51 +5777,81 @@ define(['exports'], (function (exports) { 'use strict';
5228
5777
  collection[panel.id] = panel.toJSON();
5229
5778
  return collection;
5230
5779
  }, {});
5231
- return {
5780
+ const floats = this.floatingGroups.map((floatingGroup) => {
5781
+ return {
5782
+ data: floatingGroup.group.toJSON(),
5783
+ position: floatingGroup.overlay.toJSON(),
5784
+ };
5785
+ });
5786
+ const result = {
5232
5787
  grid: data,
5233
5788
  panels,
5234
5789
  activeGroup: (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.id,
5235
5790
  };
5791
+ if (floats.length > 0) {
5792
+ result.floatingGroups = floats;
5793
+ }
5794
+ return result;
5236
5795
  }
5237
5796
  fromJSON(data) {
5797
+ var _a;
5238
5798
  this.clear();
5239
5799
  const { grid, panels, activeGroup } = data;
5240
5800
  if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
5241
5801
  throw new Error('root must be of type branch');
5242
5802
  }
5803
+ // take note of the existing dimensions
5804
+ const width = this.width;
5805
+ const height = this.height;
5806
+ const createGroupFromSerializedState = (data) => {
5807
+ const { id, locked, hideHeader, views, activeView } = data;
5808
+ const group = this.createGroup({
5809
+ id,
5810
+ locked: !!locked,
5811
+ hideHeader: !!hideHeader,
5812
+ });
5813
+ this._onDidAddGroup.fire(group);
5814
+ for (const child of views) {
5815
+ const panel = this._deserializer.fromJSON(panels[child], group);
5816
+ const isActive = typeof activeView === 'string' && activeView === panel.id;
5817
+ group.model.openPanel(panel, {
5818
+ skipSetPanelActive: !isActive,
5819
+ skipSetGroupActive: true,
5820
+ });
5821
+ }
5822
+ if (!group.activePanel && group.panels.length > 0) {
5823
+ group.model.openPanel(group.panels[group.panels.length - 1], {
5824
+ skipSetGroupActive: true,
5825
+ });
5826
+ }
5827
+ return group;
5828
+ };
5243
5829
  this.gridview.deserialize(grid, {
5244
5830
  fromJSON: (node) => {
5245
- const { id, locked, hideHeader, views, activeView } = node.data;
5246
- const group = this.createGroup({
5247
- id,
5248
- locked: !!locked,
5249
- hideHeader: !!hideHeader,
5250
- });
5251
- this._onDidAddGroup.fire(group);
5252
- for (const child of views) {
5253
- const panel = this._deserializer.fromJSON(panels[child], group);
5254
- const isActive = typeof activeView === 'string' &&
5255
- activeView === panel.id;
5256
- group.model.openPanel(panel, {
5257
- skipSetPanelActive: !isActive,
5258
- skipSetGroupActive: true,
5259
- });
5260
- }
5261
- if (!group.activePanel && group.panels.length > 0) {
5262
- group.model.openPanel(group.panels[group.panels.length - 1], {
5263
- skipSetGroupActive: true,
5264
- });
5265
- }
5266
- return group;
5831
+ return createGroupFromSerializedState(node.data);
5267
5832
  },
5268
5833
  });
5834
+ this.layout(width, height, true);
5835
+ const serializedFloatingGroups = (_a = data.floatingGroups) !== null && _a !== void 0 ? _a : [];
5836
+ for (const serializedFloatingGroup of serializedFloatingGroups) {
5837
+ const { data, position } = serializedFloatingGroup;
5838
+ const group = createGroupFromSerializedState(data);
5839
+ this.addFloatingGroup(group, {
5840
+ x: position.left,
5841
+ y: position.top,
5842
+ height: position.height,
5843
+ width: position.width,
5844
+ }, { skipRemoveGroup: true, inDragMode: false });
5845
+ }
5846
+ for (const floatingGroup of this.floatingGroups) {
5847
+ floatingGroup.overlay.setBounds();
5848
+ }
5269
5849
  if (typeof activeGroup === 'string') {
5270
5850
  const panel = this.getPanel(activeGroup);
5271
5851
  if (panel) {
5272
5852
  this.doSetGroupActive(panel);
5273
5853
  }
5274
5854
  }
5275
- this.gridview.layout(this.width, this.height);
5276
5855
  this._onDidLayoutFromJSON.fire();
5277
5856
  }
5278
5857
  clear() {
@@ -5281,7 +5860,7 @@ define(['exports'], (function (exports) { 'use strict';
5281
5860
  const hasActivePanel = !!this.activePanel;
5282
5861
  for (const group of groups) {
5283
5862
  // remove the group will automatically remove the panels
5284
- this.removeGroup(group, true);
5863
+ this.removeGroup(group, { skipActive: true });
5285
5864
  }
5286
5865
  if (hasActiveGroup) {
5287
5866
  this.doSetGroupActive(undefined);
@@ -5303,6 +5882,9 @@ define(['exports'], (function (exports) { 'use strict';
5303
5882
  throw new Error(`panel with id ${options.id} already exists`);
5304
5883
  }
5305
5884
  let referenceGroup;
5885
+ if (options.position && options.floating) {
5886
+ throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
5887
+ }
5306
5888
  if (options.position) {
5307
5889
  if (isPanelOptionsWithPanel(options.position)) {
5308
5890
  const referencePanel = typeof options.position.referencePanel === 'string'
@@ -5335,7 +5917,20 @@ define(['exports'], (function (exports) { 'use strict';
5335
5917
  let panel;
5336
5918
  if (referenceGroup) {
5337
5919
  const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
5338
- if (target === 'center') {
5920
+ if (options.floating) {
5921
+ const group = this.createGroup();
5922
+ panel = this.createPanel(options, group);
5923
+ group.model.openPanel(panel);
5924
+ const o = typeof options.floating === 'object' &&
5925
+ options.floating !== null
5926
+ ? options.floating
5927
+ : {};
5928
+ this.addFloatingGroup(group, o, {
5929
+ inDragMode: false,
5930
+ skipRemoveGroup: true,
5931
+ });
5932
+ }
5933
+ else if (referenceGroup.api.isFloating || target === 'center') {
5339
5934
  panel = this.createPanel(options, referenceGroup);
5340
5935
  referenceGroup.model.openPanel(panel);
5341
5936
  }
@@ -5347,6 +5942,19 @@ define(['exports'], (function (exports) { 'use strict';
5347
5942
  group.model.openPanel(panel);
5348
5943
  }
5349
5944
  }
5945
+ else if (options.floating) {
5946
+ const group = this.createGroup();
5947
+ panel = this.createPanel(options, group);
5948
+ group.model.openPanel(panel);
5949
+ const o = typeof options.floating === 'object' &&
5950
+ options.floating !== null
5951
+ ? options.floating
5952
+ : {};
5953
+ this.addFloatingGroup(group, o, {
5954
+ inDragMode: false,
5955
+ skipRemoveGroup: true,
5956
+ });
5957
+ }
5350
5958
  else {
5351
5959
  const group = this.createGroupAtLocation();
5352
5960
  panel = this.createPanel(options, group);
@@ -5363,7 +5971,9 @@ define(['exports'], (function (exports) { 'use strict';
5363
5971
  throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
5364
5972
  }
5365
5973
  group.model.removePanel(panel);
5366
- panel.dispose();
5974
+ if (!options.skipDispose) {
5975
+ panel.dispose();
5976
+ }
5367
5977
  if (group.size === 0 && options.removeEmptyGroup) {
5368
5978
  this.removeGroup(group);
5369
5979
  }
@@ -5378,7 +5988,7 @@ define(['exports'], (function (exports) { 'use strict';
5378
5988
  }
5379
5989
  updateWatermark() {
5380
5990
  var _a, _b;
5381
- if (this.groups.length === 0) {
5991
+ if (this.groups.filter((x) => !x.api.isFloating).length === 0) {
5382
5992
  if (!this.watermark) {
5383
5993
  this.watermark = this.createWatermarkComponent();
5384
5994
  this.watermark.init({
@@ -5387,7 +5997,7 @@ define(['exports'], (function (exports) { 'use strict';
5387
5997
  const watermarkContainer = document.createElement('div');
5388
5998
  watermarkContainer.className = 'dv-watermark-container';
5389
5999
  watermarkContainer.appendChild(this.watermark.element);
5390
- this.element.appendChild(watermarkContainer);
6000
+ this.gridview.element.appendChild(watermarkContainer);
5391
6001
  }
5392
6002
  }
5393
6003
  else if (this.watermark) {
@@ -5437,15 +6047,28 @@ define(['exports'], (function (exports) { 'use strict';
5437
6047
  return group;
5438
6048
  }
5439
6049
  }
5440
- removeGroup(group, skipActive = false) {
6050
+ removeGroup(group, options) {
6051
+ var _a;
5441
6052
  const panels = [...group.panels]; // reassign since group panels will mutate
5442
6053
  for (const panel of panels) {
5443
6054
  this.removePanel(panel, {
5444
6055
  removeEmptyGroup: false,
5445
- skipDispose: false,
6056
+ skipDispose: (_a = options === null || options === void 0 ? void 0 : options.skipDispose) !== null && _a !== void 0 ? _a : false,
5446
6057
  });
5447
6058
  }
5448
- super.doRemoveGroup(group, { skipActive });
6059
+ this.doRemoveGroup(group, options);
6060
+ }
6061
+ doRemoveGroup(group, options) {
6062
+ const floatingGroup = this.floatingGroups.find((_) => _.group === group);
6063
+ if (floatingGroup) {
6064
+ if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
6065
+ floatingGroup.group.dispose();
6066
+ this._groups.delete(group.id);
6067
+ }
6068
+ floatingGroup.dispose();
6069
+ return floatingGroup.group;
6070
+ }
6071
+ return super.doRemoveGroup(group, options);
5449
6072
  }
5450
6073
  moveGroupOrPanel(destinationGroup, sourceGroupId, sourceItemId, destinationTarget, destinationIndex) {
5451
6074
  var _a;
@@ -5476,25 +6099,26 @@ define(['exports'], (function (exports) { 'use strict';
5476
6099
  const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
5477
6100
  if (sourceGroup && sourceGroup.size < 2) {
5478
6101
  const [targetParentLocation, to] = tail(targetLocation);
5479
- const sourceLocation = getGridLocation(sourceGroup.element);
5480
- const [sourceParentLocation, from] = tail(sourceLocation);
5481
- if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
5482
- // special case when 'swapping' two views within same grid location
5483
- // if a group has one tab - we are essentially moving the 'group'
5484
- // which is equivalent to swapping two views in this case
5485
- this.gridview.moveView(sourceParentLocation, from, to);
5486
- }
5487
- else {
5488
- // source group will become empty so delete the group
5489
- const targetGroup = this.doRemoveGroup(sourceGroup, {
5490
- skipActive: true,
5491
- skipDispose: true,
5492
- });
5493
- // after deleting the group we need to re-evaulate the ref location
5494
- const updatedReferenceLocation = getGridLocation(destinationGroup.element);
5495
- const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
5496
- this.doAddGroup(targetGroup, location);
6102
+ const isFloating = this.floatingGroups.find((x) => x.group === sourceGroup);
6103
+ if (!isFloating) {
6104
+ const sourceLocation = getGridLocation(sourceGroup.element);
6105
+ const [sourceParentLocation, from] = tail(sourceLocation);
6106
+ if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
6107
+ // special case when 'swapping' two views within same grid location
6108
+ // if a group has one tab - we are essentially moving the 'group'
6109
+ // which is equivalent to swapping two views in this case
6110
+ this.gridview.moveView(sourceParentLocation, from, to);
6111
+ }
5497
6112
  }
6113
+ // source group will become empty so delete the group
6114
+ const targetGroup = this.doRemoveGroup(sourceGroup, {
6115
+ skipActive: true,
6116
+ skipDispose: true,
6117
+ });
6118
+ // after deleting the group we need to re-evaulate the ref location
6119
+ const updatedReferenceLocation = getGridLocation(destinationGroup.element);
6120
+ const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
6121
+ this.doAddGroup(targetGroup, location);
5498
6122
  }
5499
6123
  else {
5500
6124
  const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
@@ -5523,7 +6147,13 @@ define(['exports'], (function (exports) { 'use strict';
5523
6147
  }
5524
6148
  }
5525
6149
  else {
5526
- this.gridview.removeView(getGridLocation(sourceGroup.element));
6150
+ const floatingGroup = this.floatingGroups.find((x) => x.group === sourceGroup);
6151
+ if (floatingGroup) {
6152
+ floatingGroup.dispose();
6153
+ }
6154
+ else {
6155
+ this.gridview.removeView(getGridLocation(sourceGroup.element));
6156
+ }
5527
6157
  const referenceLocation = getGridLocation(referenceGroup.element);
5528
6158
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
5529
6159
  this.gridview.addView(sourceGroup, exports.Sizing.Distribute, dropLocation);
@@ -5678,6 +6308,9 @@ define(['exports'], (function (exports) { 'use strict';
5678
6308
  this.clear();
5679
6309
  const { grid, activePanel } = serializedGridview;
5680
6310
  const queue = [];
6311
+ // take note of the existing dimensions
6312
+ const width = this.width;
6313
+ const height = this.height;
5681
6314
  this.gridview.deserialize(grid, {
5682
6315
  fromJSON: (node) => {
5683
6316
  const { data } = node;
@@ -5703,7 +6336,7 @@ define(['exports'], (function (exports) { 'use strict';
5703
6336
  return view;
5704
6337
  },
5705
6338
  });
5706
- this.layout(this.width, this.height, true);
6339
+ this.layout(width, height, true);
5707
6340
  queue.forEach((f) => f());
5708
6341
  if (typeof activePanel === 'string') {
5709
6342
  const panel = this.getPanel(activePanel);
@@ -6017,6 +6650,9 @@ define(['exports'], (function (exports) { 'use strict';
6017
6650
  this.clear();
6018
6651
  const { views, orientation, size, activeView } = serializedSplitview;
6019
6652
  const queue = [];
6653
+ // take note of the existing dimensions
6654
+ const width = this.width;
6655
+ const height = this.height;
6020
6656
  this.splitview = new Splitview(this.element, {
6021
6657
  orientation,
6022
6658
  proportionalLayout: this.options.proportionalLayout,
@@ -6053,7 +6689,7 @@ define(['exports'], (function (exports) { 'use strict';
6053
6689
  }),
6054
6690
  },
6055
6691
  });
6056
- this.layout(this.width, this.height);
6692
+ this.layout(width, height);
6057
6693
  queue.forEach((f) => f());
6058
6694
  if (typeof activeView === 'string') {
6059
6695
  const panel = this.getPanel(activeView);
@@ -6320,6 +6956,9 @@ define(['exports'], (function (exports) { 'use strict';
6320
6956
  this.clear();
6321
6957
  const { views, size } = serializedPaneview;
6322
6958
  const queue = [];
6959
+ // take note of the existing dimensions
6960
+ const width = this.width;
6961
+ const height = this.height;
6323
6962
  this.paneview = new Paneview(this.element, {
6324
6963
  orientation: exports.Orientation.VERTICAL,
6325
6964
  descriptor: {
@@ -6375,7 +7014,7 @@ define(['exports'], (function (exports) { 'use strict';
6375
7014
  }),
6376
7015
  },
6377
7016
  });
6378
- this.layout(this.width, this.height);
7017
+ this.layout(width, height);
6379
7018
  queue.forEach((f) => f());
6380
7019
  this._onDidLayoutfromJSON.fire();
6381
7020
  }
@@ -6561,6 +7200,6 @@ define(['exports'], (function (exports) { 'use strict';
6561
7200
  exports.orthogonal = orthogonal;
6562
7201
  exports.positionToDirection = positionToDirection;
6563
7202
  exports.toTarget = toTarget;
6564
- exports.watchElementResize = watchElementResize;
6565
7203
 
6566
7204
  }));
7205
+ //# sourceMappingURL=dockview-core.amd.noStyle.js.map