dockview-core 1.14.2 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/cjs/api/component.api.d.ts +4 -5
  2. package/dist/cjs/api/component.api.js +12 -2
  3. package/dist/cjs/constants.d.ts +2 -0
  4. package/dist/cjs/constants.js +1 -1
  5. package/dist/cjs/dnd/overlay.d.ts +6 -4
  6. package/dist/cjs/dnd/overlay.js +119 -28
  7. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +4 -2
  8. package/dist/cjs/dockview/dockviewComponent.d.ts +20 -17
  9. package/dist/cjs/dockview/dockviewComponent.js +92 -45
  10. package/dist/cjs/dockview/dockviewFloatingGroupPanel.d.ts +3 -12
  11. package/dist/cjs/dockview/options.d.ts +10 -6
  12. package/dist/cjs/dockview/options.js +1 -0
  13. package/dist/cjs/dom.d.ts +1 -0
  14. package/dist/cjs/dom.js +5 -1
  15. package/dist/cjs/gridview/baseComponentGridview.d.ts +3 -0
  16. package/dist/cjs/gridview/baseComponentGridview.js +8 -2
  17. package/dist/cjs/gridview/branchNode.d.ts +7 -3
  18. package/dist/cjs/gridview/branchNode.js +24 -29
  19. package/dist/cjs/gridview/gridview.d.ts +7 -1
  20. package/dist/cjs/gridview/gridview.js +31 -8
  21. package/dist/cjs/gridview/gridviewPanel.d.ts +1 -0
  22. package/dist/cjs/gridview/gridviewPanel.js +7 -0
  23. package/dist/cjs/math.js +5 -1
  24. package/dist/cjs/splitview/splitview.d.ts +13 -0
  25. package/dist/cjs/splitview/splitview.js +42 -12
  26. package/dist/cjs/types.d.ts +23 -0
  27. package/dist/dockview-core.amd.js +317 -110
  28. package/dist/dockview-core.amd.js.map +1 -1
  29. package/dist/dockview-core.amd.min.js +2 -2
  30. package/dist/dockview-core.amd.min.js.map +1 -1
  31. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  32. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  33. package/dist/dockview-core.amd.noStyle.js +316 -109
  34. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  35. package/dist/dockview-core.cjs.js +317 -110
  36. package/dist/dockview-core.cjs.js.map +1 -1
  37. package/dist/dockview-core.esm.js +317 -110
  38. package/dist/dockview-core.esm.js.map +1 -1
  39. package/dist/dockview-core.esm.min.js +2 -2
  40. package/dist/dockview-core.esm.min.js.map +1 -1
  41. package/dist/dockview-core.js +317 -110
  42. package/dist/dockview-core.js.map +1 -1
  43. package/dist/dockview-core.min.js +2 -2
  44. package/dist/dockview-core.min.js.map +1 -1
  45. package/dist/dockview-core.min.noStyle.js +2 -2
  46. package/dist/dockview-core.min.noStyle.js.map +1 -1
  47. package/dist/dockview-core.noStyle.js +316 -109
  48. package/dist/dockview-core.noStyle.js.map +1 -1
  49. package/dist/esm/api/component.api.d.ts +4 -5
  50. package/dist/esm/api/component.api.js +8 -2
  51. package/dist/esm/constants.d.ts +2 -0
  52. package/dist/esm/constants.js +1 -1
  53. package/dist/esm/dnd/overlay.d.ts +6 -4
  54. package/dist/esm/dnd/overlay.js +108 -28
  55. package/dist/esm/dockview/components/titlebar/tabsContainer.js +4 -2
  56. package/dist/esm/dockview/dockviewComponent.d.ts +20 -17
  57. package/dist/esm/dockview/dockviewComponent.js +93 -46
  58. package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +3 -12
  59. package/dist/esm/dockview/options.d.ts +10 -6
  60. package/dist/esm/dockview/options.js +1 -0
  61. package/dist/esm/dom.d.ts +1 -0
  62. package/dist/esm/dom.js +3 -0
  63. package/dist/esm/gridview/baseComponentGridview.d.ts +3 -0
  64. package/dist/esm/gridview/baseComponentGridview.js +6 -2
  65. package/dist/esm/gridview/branchNode.d.ts +7 -3
  66. package/dist/esm/gridview/branchNode.js +19 -7
  67. package/dist/esm/gridview/gridview.d.ts +7 -1
  68. package/dist/esm/gridview/gridview.js +27 -8
  69. package/dist/esm/gridview/gridviewPanel.d.ts +1 -0
  70. package/dist/esm/gridview/gridviewPanel.js +3 -0
  71. package/dist/esm/math.js +5 -1
  72. package/dist/esm/splitview/splitview.d.ts +13 -0
  73. package/dist/esm/splitview/splitview.js +38 -12
  74. package/dist/esm/types.d.ts +23 -0
  75. package/dist/styles/dockview.css +0 -13
  76. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 1.14.2
3
+ * @version 1.15.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -532,6 +532,9 @@
532
532
  }
533
533
  return false;
534
534
  }
535
+ function addTestId(element, id) {
536
+ element.setAttribute('data-testid', id);
537
+ }
535
538
 
536
539
  function tail(arr) {
537
540
  if (arr.length === 0) {
@@ -593,7 +596,11 @@
593
596
 
594
597
  const clamp = (value, min, max) => {
595
598
  if (min > max) {
596
- throw new Error(`${min} > ${max} is an invalid condition`);
599
+ /**
600
+ * caveat: an error should be thrown here if this was a proper `clamp` function but we need to handle
601
+ * cases where `min` > `max` and in those cases return `min`.
602
+ */
603
+ return min;
597
604
  }
598
605
  return Math.min(max, Math.max(value, min));
599
606
  };
@@ -798,7 +805,14 @@
798
805
  this._disabled = value;
799
806
  toggleClass(this.element, 'dv-splitview-disabled', value);
800
807
  }
808
+ get margin() {
809
+ return this._margin;
810
+ }
811
+ set margin(value) {
812
+ this._margin = value;
813
+ }
801
814
  constructor(container, options) {
815
+ var _a;
802
816
  this.container = container;
803
817
  this.viewItems = [];
804
818
  this.sashes = [];
@@ -809,6 +823,7 @@
809
823
  this._startSnappingEnabled = true;
810
824
  this._endSnappingEnabled = true;
811
825
  this._disabled = false;
826
+ this._margin = 0;
812
827
  this._onDidSashEnd = new Emitter();
813
828
  this.onDidSashEnd = this._onDidSashEnd.event;
814
829
  this._onDidAddView = new Emitter();
@@ -897,6 +912,7 @@
897
912
  };
898
913
  this._orientation = options.orientation;
899
914
  this.element = this.createContainer();
915
+ this.margin = (_a = options.margin) !== null && _a !== void 0 ? _a : 0;
900
916
  this.proportionalLayout =
901
917
  options.proportionalLayout === undefined
902
918
  ? true
@@ -951,9 +967,7 @@
951
967
  if (index < 0 || index >= this.viewItems.length) {
952
968
  throw new Error('Index out of bounds');
953
969
  }
954
- toggleClass(this.container, 'visible', visible);
955
970
  const viewItem = this.viewItems[index];
956
- toggleClass(this.container, 'visible', visible);
957
971
  viewItem.setVisible(visible, viewItem.size);
958
972
  this.distributeEmptySpace(index);
959
973
  this.layoutViews();
@@ -1265,15 +1279,29 @@
1265
1279
  this._proportions = this.viewItems.map((i) => i.visible ? i.size / this._contentSize : undefined);
1266
1280
  }
1267
1281
  }
1282
+ /**
1283
+ * Margin explain:
1284
+ *
1285
+ * For `n` views in a splitview there will be `n-1` margins `m`.
1286
+ *
1287
+ * To fit the margins each view must reduce in size by `(m * (n - 1)) / n`.
1288
+ *
1289
+ * For each view `i` the offet must be adjusted by `m * i/(n - 1)`.
1290
+ */
1268
1291
  layoutViews() {
1269
1292
  this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
1270
- let sum = 0;
1271
- const x = [];
1272
1293
  this.updateSashEnablement();
1294
+ if (this.viewItems.length === 0) {
1295
+ return;
1296
+ }
1297
+ const sashCount = this.viewItems.length - 1;
1298
+ const marginReducedSize = (this.margin * sashCount) / this.viewItems.length;
1299
+ let totalLeftOffset = 0;
1300
+ const viewLeftOffsets = [];
1273
1301
  for (let i = 0; i < this.viewItems.length - 1; i++) {
1274
- sum += this.viewItems[i].size;
1275
- x.push(sum);
1276
- const offset = Math.min(Math.max(0, sum - 2), this.size - 4);
1302
+ totalLeftOffset += this.viewItems[i].size;
1303
+ viewLeftOffsets.push(totalLeftOffset);
1304
+ const offset = Math.min(Math.max(0, totalLeftOffset - 2), this.size - this.margin);
1277
1305
  if (this._orientation === exports.Orientation.HORIZONTAL) {
1278
1306
  this.sashes[i].container.style.left = `${offset}px`;
1279
1307
  this.sashes[i].container.style.top = `0px`;
@@ -1284,19 +1312,24 @@
1284
1312
  }
1285
1313
  }
1286
1314
  this.viewItems.forEach((view, i) => {
1315
+ const size = view.size - marginReducedSize;
1316
+ const offset = i === 0
1317
+ ? 0
1318
+ : viewLeftOffsets[i - 1] +
1319
+ (i / sashCount) * marginReducedSize;
1287
1320
  if (this._orientation === exports.Orientation.HORIZONTAL) {
1288
- view.container.style.width = `${view.size}px`;
1289
- view.container.style.left = i == 0 ? '0px' : `${x[i - 1]}px`;
1321
+ view.container.style.width = `${size}px`;
1322
+ view.container.style.left = `${offset}px`;
1290
1323
  view.container.style.top = '';
1291
1324
  view.container.style.height = '';
1292
1325
  }
1293
1326
  if (this._orientation === exports.Orientation.VERTICAL) {
1294
- view.container.style.height = `${view.size}px`;
1295
- view.container.style.top = i == 0 ? '0px' : `${x[i - 1]}px`;
1327
+ view.container.style.height = `${size}px`;
1328
+ view.container.style.top = `${offset}px`;
1296
1329
  view.container.style.width = '';
1297
1330
  view.container.style.left = '';
1298
1331
  }
1299
- view.view.layout(view.size, this._orthogonalSize);
1332
+ view.view.layout(view.size - marginReducedSize, this._orthogonalSize);
1300
1333
  });
1301
1334
  }
1302
1335
  findFirstSnapIndex(indexes) {
@@ -1745,7 +1778,18 @@
1745
1778
  set disabled(value) {
1746
1779
  this.splitview.disabled = value;
1747
1780
  }
1748
- constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, childDescriptors) {
1781
+ get margin() {
1782
+ return this.splitview.margin;
1783
+ }
1784
+ set margin(value) {
1785
+ this.splitview.margin = value;
1786
+ this.children.forEach((child) => {
1787
+ if (child instanceof BranchNode) {
1788
+ child.margin = value;
1789
+ }
1790
+ });
1791
+ }
1792
+ constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, margin, childDescriptors) {
1749
1793
  super();
1750
1794
  this.orientation = orientation;
1751
1795
  this.proportionalLayout = proportionalLayout;
@@ -1765,6 +1809,7 @@
1765
1809
  orientation: this.orientation,
1766
1810
  proportionalLayout,
1767
1811
  styles,
1812
+ margin,
1768
1813
  });
1769
1814
  this.splitview.layout(this.size, this.orthogonalSize);
1770
1815
  }
@@ -1788,6 +1833,7 @@
1788
1833
  descriptor,
1789
1834
  proportionalLayout,
1790
1835
  styles,
1836
+ margin,
1791
1837
  });
1792
1838
  }
1793
1839
  this.disabled = disabled;
@@ -1796,10 +1842,8 @@
1796
1842
  }));
1797
1843
  this.setupChildrenEvents();
1798
1844
  }
1799
- setVisible(visible) {
1800
- for (const child of this.children) {
1801
- child.setVisible(visible);
1802
- }
1845
+ setVisible(_visible) {
1846
+ // noop
1803
1847
  }
1804
1848
  isChildVisible(index) {
1805
1849
  if (index < 0 || index >= this.children.length) {
@@ -1816,12 +1860,13 @@
1816
1860
  }
1817
1861
  const wereAllChildrenHidden = this.splitview.contentSize === 0;
1818
1862
  this.splitview.setViewVisible(index, visible);
1863
+ // }
1819
1864
  const areAllChildrenHidden = this.splitview.contentSize === 0;
1820
1865
  // If all children are hidden then the parent should hide the entire splitview
1821
1866
  // If the entire splitview is hidden then the parent should show the splitview when a child is shown
1822
1867
  if ((visible && wereAllChildrenHidden) ||
1823
1868
  (!visible && areAllChildrenHidden)) {
1824
- this._onDidVisibilityChange.fire(visible);
1869
+ this._onDidVisibilityChange.fire({ visible });
1825
1870
  }
1826
1871
  }
1827
1872
  moveChild(from, to) {
@@ -1894,7 +1939,7 @@
1894
1939
  this._onDidChange.fire({ size: e.orthogonalSize });
1895
1940
  }), ...this.children.map((c, i) => {
1896
1941
  if (c instanceof BranchNode) {
1897
- return c.onDidVisibilityChange((visible) => {
1942
+ return c.onDidVisibilityChange(({ visible }) => {
1898
1943
  this.setChildVisible(i, visible);
1899
1944
  });
1900
1945
  }
@@ -1924,7 +1969,7 @@
1924
1969
  }
1925
1970
  function flipNode(node, size, orthogonalSize) {
1926
1971
  if (node instanceof BranchNode) {
1927
- const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled);
1972
+ const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled, node.margin);
1928
1973
  let totalSize = 0;
1929
1974
  for (let i = node.children.length - 1; i >= 0; i--) {
1930
1975
  const child = node.children[i];
@@ -2079,6 +2124,13 @@
2079
2124
  }
2080
2125
  }
2081
2126
  }
2127
+ get margin() {
2128
+ return this._margin;
2129
+ }
2130
+ set margin(value) {
2131
+ this._margin = value;
2132
+ this.root.margin = value;
2133
+ }
2082
2134
  maximizedView() {
2083
2135
  var _a;
2084
2136
  return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
@@ -2164,13 +2216,14 @@
2164
2216
  this.disposable.dispose();
2165
2217
  this._onDidChange.dispose();
2166
2218
  this._onDidMaximizedNodeChange.dispose();
2219
+ this._onDidViewVisibilityChange.dispose();
2167
2220
  this.root.dispose();
2168
2221
  this._maximizedNode = undefined;
2169
2222
  this.element.remove();
2170
2223
  }
2171
2224
  clear() {
2172
2225
  const orientation = this.root.orientation;
2173
- this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this._locked);
2226
+ this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this.locked, this.margin);
2174
2227
  }
2175
2228
  deserialize(json, deserializer) {
2176
2229
  const orientation = json.orientation;
@@ -2181,6 +2234,7 @@
2181
2234
  this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);
2182
2235
  }
2183
2236
  _deserializeNode(node, orientation, deserializer, orthogonalSize) {
2237
+ var _a;
2184
2238
  let result;
2185
2239
  if (node.type === 'branch') {
2186
2240
  const serializedChildren = node.data;
@@ -2192,10 +2246,14 @@
2192
2246
  });
2193
2247
  result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
2194
2248
  orthogonalSize, // <- size - flips at each depth,
2195
- this._locked, children);
2249
+ this.locked, this.margin, children);
2196
2250
  }
2197
2251
  else {
2198
- result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
2252
+ const view = deserializer.fromJSON(node);
2253
+ if (typeof node.visible === 'boolean') {
2254
+ (_a = view.setVisible) === null || _a === void 0 ? void 0 : _a.call(view, node.visible);
2255
+ }
2256
+ result = new LeafNode(view, orientation, orthogonalSize, node.size);
2199
2257
  }
2200
2258
  return result;
2201
2259
  }
@@ -2225,7 +2283,7 @@
2225
2283
  }
2226
2284
  const oldRoot = this.root;
2227
2285
  oldRoot.element.remove();
2228
- this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this._locked);
2286
+ this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this.locked, this.margin);
2229
2287
  if (oldRoot.children.length === 0) ;
2230
2288
  else if (oldRoot.children.length === 1) {
2231
2289
  // can remove one level of redundant branching if there is only a single child
@@ -2290,19 +2348,24 @@
2290
2348
  }
2291
2349
  return findLeaf(this.root, reverse);
2292
2350
  }
2293
- constructor(proportionalLayout, styles, orientation) {
2351
+ constructor(proportionalLayout, styles, orientation, locked, margin) {
2294
2352
  this.proportionalLayout = proportionalLayout;
2295
2353
  this.styles = styles;
2296
2354
  this._locked = false;
2355
+ this._margin = 0;
2297
2356
  this._maximizedNode = undefined;
2298
2357
  this.disposable = new MutableDisposable();
2299
2358
  this._onDidChange = new Emitter();
2300
2359
  this.onDidChange = this._onDidChange.event;
2360
+ this._onDidViewVisibilityChange = new Emitter();
2361
+ this.onDidViewVisibilityChange = this._onDidViewVisibilityChange.event;
2301
2362
  this._onDidMaximizedNodeChange = new Emitter();
2302
2363
  this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
2303
2364
  this.element = document.createElement('div');
2304
2365
  this.element.className = 'grid-view';
2305
- this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this._locked);
2366
+ this._locked = locked !== null && locked !== void 0 ? locked : false;
2367
+ this._margin = margin !== null && margin !== void 0 ? margin : 0;
2368
+ this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this.locked, this.margin);
2306
2369
  }
2307
2370
  isViewVisible(location) {
2308
2371
  const [rest, index] = tail(location);
@@ -2321,6 +2384,7 @@
2321
2384
  if (!(parent instanceof BranchNode)) {
2322
2385
  throw new Error('Invalid from location');
2323
2386
  }
2387
+ this._onDidViewVisibilityChange.fire();
2324
2388
  parent.setChildVisible(index, visible);
2325
2389
  }
2326
2390
  moveView(parentLocation, from, to) {
@@ -2353,7 +2417,7 @@
2353
2417
  }
2354
2418
  const child = grandParent.removeChild(parentIndex);
2355
2419
  child.dispose();
2356
- const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this._locked);
2420
+ const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this.locked, this.margin);
2357
2421
  grandParent.addChild(newParent, parent.size, parentIndex);
2358
2422
  const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
2359
2423
  newParent.addChild(newSibling, newSiblingSize, 0);
@@ -2592,14 +2656,18 @@
2592
2656
  this.onDidActiveChange = this._onDidActiveChange.event;
2593
2657
  this._bufferOnDidLayoutChange = new AsapEvent();
2594
2658
  this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
2659
+ this._onDidViewVisibilityChangeMicroTaskQueue = new AsapEvent();
2660
+ this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
2595
2661
  this.element.style.height = '100%';
2596
2662
  this.element.style.width = '100%';
2597
2663
  options.parentElement.appendChild(this.element);
2598
- this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
2664
+ this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
2599
2665
  this.gridview.locked = !!options.locked;
2600
2666
  this.element.appendChild(this.gridview.element);
2601
2667
  this.layout(0, 0, true); // set some elements height/widths
2602
- this.addDisposables(exports.DockviewDisposable.from(() => {
2668
+ this.addDisposables(this.gridview.onDidViewVisibilityChange(() => this._onDidViewVisibilityChangeMicroTaskQueue.fire()), this.onDidViewVisibilityChangeMicroTaskQueue(() => {
2669
+ this.layout(this.width, this.height, true);
2670
+ }), exports.DockviewDisposable.from(() => {
2603
2671
  var _a;
2604
2672
  (_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
2605
2673
  }), this.gridview.onDidChange(() => {
@@ -3213,6 +3281,9 @@
3213
3281
  get onDidRemovePanel() {
3214
3282
  return this.component.onDidRemovePanel;
3215
3283
  }
3284
+ get onDidMovePanel() {
3285
+ return this.component.onDidMovePanel;
3286
+ }
3216
3287
  /**
3217
3288
  * Invoked after a layout is deserialzied using the `fromJSON` method.
3218
3289
  */
@@ -3353,8 +3424,8 @@
3353
3424
  /**
3354
3425
  * Add a floating group
3355
3426
  */
3356
- addFloatingGroup(item, coord) {
3357
- return this.component.addFloatingGroup(item, coord);
3427
+ addFloatingGroup(item, options) {
3428
+ return this.component.addFloatingGroup(item, options);
3358
3429
  }
3359
3430
  /**
3360
3431
  * Create a component from a serialized object.
@@ -3404,6 +3475,9 @@
3404
3475
  addPopoutGroup(item, options) {
3405
3476
  return this.component.addPopoutGroup(item, options);
3406
3477
  }
3478
+ setGap(gap) {
3479
+ this.component.updateOptions({ gap });
3480
+ }
3407
3481
  }
3408
3482
 
3409
3483
  class DragHandler extends CompositeDisposable {
@@ -4773,7 +4847,8 @@
4773
4847
  this.accessor.addFloatingGroup(this.group, {
4774
4848
  x: left - rootLeft + 20,
4775
4849
  y: top - rootTop + 20,
4776
- }, { inDragMode: true });
4850
+ inDragMode: true,
4851
+ });
4777
4852
  }
4778
4853
  }), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
4779
4854
  if (event.defaultPrevented) {
@@ -4842,7 +4917,8 @@
4842
4917
  this.accessor.addFloatingGroup(panel, {
4843
4918
  x: left - rootLeft,
4844
4919
  y: top - rootTop,
4845
- }, { inDragMode: true });
4920
+ inDragMode: true,
4921
+ });
4846
4922
  return;
4847
4923
  }
4848
4924
  const isLeftClick = event.button === 0;
@@ -4915,6 +4991,7 @@
4915
4991
  rootOverlayModel: undefined,
4916
4992
  locked: undefined,
4917
4993
  disableDnd: undefined,
4994
+ gap: undefined,
4918
4995
  };
4919
4996
  return Object.keys(properties);
4920
4997
  })();
@@ -5645,6 +5722,9 @@
5645
5722
  get isActive() {
5646
5723
  return this.api.isActive;
5647
5724
  }
5725
+ get isVisible() {
5726
+ return this.api.isVisible;
5727
+ }
5648
5728
  constructor(id, component, options, api) {
5649
5729
  super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id, component));
5650
5730
  this._evaluatedMinimumWidth = 0;
@@ -6407,12 +6487,7 @@
6407
6487
  this._element.appendChild(this.options.content);
6408
6488
  this.options.container.appendChild(this._element);
6409
6489
  // if input bad resize within acceptable boundaries
6410
- this.setBounds({
6411
- height: this.options.height,
6412
- width: this.options.width,
6413
- top: this.options.top,
6414
- left: this.options.left,
6415
- });
6490
+ this.setBounds(Object.assign(Object.assign(Object.assign(Object.assign({ height: this.options.height, width: this.options.width }, ('top' in this.options && { top: this.options.top })), ('bottom' in this.options && { bottom: this.options.bottom })), ('left' in this.options && { left: this.options.left })), ('right' in this.options && { right: this.options.right })));
6416
6491
  }
6417
6492
  setBounds(bounds = {}) {
6418
6493
  if (typeof bounds.height === 'number') {
@@ -6421,11 +6496,25 @@
6421
6496
  if (typeof bounds.width === 'number') {
6422
6497
  this._element.style.width = `${bounds.width}px`;
6423
6498
  }
6424
- if (typeof bounds.top === 'number') {
6499
+ if ('top' in bounds && typeof bounds.top === 'number') {
6425
6500
  this._element.style.top = `${bounds.top}px`;
6501
+ this._element.style.bottom = 'auto';
6502
+ this.verticalAlignment = 'top';
6503
+ }
6504
+ if ('bottom' in bounds && typeof bounds.bottom === 'number') {
6505
+ this._element.style.bottom = `${bounds.bottom}px`;
6506
+ this._element.style.top = 'auto';
6507
+ this.verticalAlignment = 'bottom';
6426
6508
  }
6427
- if (typeof bounds.left === 'number') {
6509
+ if ('left' in bounds && typeof bounds.left === 'number') {
6428
6510
  this._element.style.left = `${bounds.left}px`;
6511
+ this._element.style.right = 'auto';
6512
+ this.horiziontalAlignment = 'left';
6513
+ }
6514
+ if ('right' in bounds && typeof bounds.right === 'number') {
6515
+ this._element.style.right = `${bounds.right}px`;
6516
+ this._element.style.left = 'auto';
6517
+ this.horiziontalAlignment = 'right';
6429
6518
  }
6430
6519
  const containerRect = this.options.container.getBoundingClientRect();
6431
6520
  const overlayRect = this._element.getBoundingClientRect();
@@ -6433,24 +6522,54 @@
6433
6522
  // a minimum width of minimumViewportWidth must be inside the viewport
6434
6523
  const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
6435
6524
  // a minimum height of minimumViewportHeight must be inside the viewport
6436
- const yOffset = typeof this.options.minimumInViewportHeight === 'number'
6437
- ? Math.max(0, this.getMinimumHeight(overlayRect.height))
6438
- : 0;
6439
- const left = clamp(overlayRect.left - containerRect.left, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
6440
- const top = clamp(overlayRect.top - containerRect.top, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
6441
- this._element.style.left = `${left}px`;
6442
- this._element.style.top = `${top}px`;
6525
+ const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));
6526
+ if (this.verticalAlignment === 'top') {
6527
+ const top = clamp(overlayRect.top - containerRect.top, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
6528
+ this._element.style.top = `${top}px`;
6529
+ this._element.style.bottom = 'auto';
6530
+ }
6531
+ if (this.verticalAlignment === 'bottom') {
6532
+ const bottom = clamp(containerRect.bottom - overlayRect.bottom, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
6533
+ this._element.style.bottom = `${bottom}px`;
6534
+ this._element.style.top = 'auto';
6535
+ }
6536
+ if (this.horiziontalAlignment === 'left') {
6537
+ const left = clamp(overlayRect.left - containerRect.left, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
6538
+ this._element.style.left = `${left}px`;
6539
+ this._element.style.right = 'auto';
6540
+ }
6541
+ if (this.horiziontalAlignment === 'right') {
6542
+ const right = clamp(containerRect.right - overlayRect.right, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
6543
+ this._element.style.right = `${right}px`;
6544
+ this._element.style.left = 'auto';
6545
+ }
6443
6546
  this._onDidChange.fire();
6444
6547
  }
6445
6548
  toJSON() {
6446
6549
  const container = this.options.container.getBoundingClientRect();
6447
6550
  const element = this._element.getBoundingClientRect();
6448
- return {
6449
- top: element.top - container.top,
6450
- left: element.left - container.left,
6451
- width: element.width,
6452
- height: element.height,
6453
- };
6551
+ const result = {};
6552
+ if (this.verticalAlignment === 'top') {
6553
+ result.top = parseFloat(this._element.style.top);
6554
+ }
6555
+ else if (this.verticalAlignment === 'bottom') {
6556
+ result.bottom = parseFloat(this._element.style.bottom);
6557
+ }
6558
+ else {
6559
+ result.top = element.top - container.top;
6560
+ }
6561
+ if (this.horiziontalAlignment === 'left') {
6562
+ result.left = parseFloat(this._element.style.left);
6563
+ }
6564
+ else if (this.horiziontalAlignment === 'right') {
6565
+ result.right = parseFloat(this._element.style.right);
6566
+ }
6567
+ else {
6568
+ result.left = element.left - container.left;
6569
+ }
6570
+ result.width = element.width;
6571
+ result.height = element.height;
6572
+ return result;
6454
6573
  }
6455
6574
  setupDrag(dragTarget, options = { inDragMode: false }) {
6456
6575
  const move = new MutableDisposable();
@@ -6482,12 +6601,30 @@
6482
6601
  };
6483
6602
  }
6484
6603
  const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
6485
- const yOffset = Math.max(0, this.options.minimumInViewportHeight
6486
- ? this.getMinimumHeight(overlayRect.height)
6487
- : 0);
6488
- const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
6604
+ const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));
6489
6605
  const top = clamp(y - offset.y, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
6490
- this.setBounds({ top, left });
6606
+ const bottom = clamp(offset.y -
6607
+ y +
6608
+ containerRect.height -
6609
+ overlayRect.height, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
6610
+ const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
6611
+ const right = clamp(offset.x - x + containerRect.width - overlayRect.width, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
6612
+ const bounds = {};
6613
+ // Anchor to top or to bottom depending on which one is closer
6614
+ if (top <= bottom) {
6615
+ bounds.top = top;
6616
+ }
6617
+ else {
6618
+ bounds.bottom = bottom;
6619
+ }
6620
+ // Anchor to left or to right depending on which one is closer
6621
+ if (left <= right) {
6622
+ bounds.left = left;
6623
+ }
6624
+ else {
6625
+ bounds.right = right;
6626
+ }
6627
+ this.setBounds(bounds);
6491
6628
  }), addDisposableWindowListener(window, 'mouseup', () => {
6492
6629
  toggleClass(this._element, 'dv-resize-container-dragging', false);
6493
6630
  move.dispose();
@@ -6555,8 +6692,10 @@
6555
6692
  };
6556
6693
  }
6557
6694
  let top = undefined;
6695
+ let bottom = undefined;
6558
6696
  let height = undefined;
6559
6697
  let left = undefined;
6698
+ let right = undefined;
6560
6699
  let width = undefined;
6561
6700
  const moveTop = () => {
6562
6701
  top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
@@ -6570,6 +6709,7 @@
6570
6709
  startPosition.originalY +
6571
6710
  startPosition.originalHeight -
6572
6711
  top;
6712
+ bottom = containerRect.height - top - height;
6573
6713
  };
6574
6714
  const moveBottom = () => {
6575
6715
  top =
@@ -6581,6 +6721,7 @@
6581
6721
  ? -top +
6582
6722
  this.options.minimumInViewportHeight
6583
6723
  : Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
6724
+ bottom = containerRect.height - top - height;
6584
6725
  };
6585
6726
  const moveLeft = () => {
6586
6727
  left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
@@ -6594,6 +6735,7 @@
6594
6735
  startPosition.originalX +
6595
6736
  startPosition.originalWidth -
6596
6737
  left;
6738
+ right = containerRect.width - left - width;
6597
6739
  };
6598
6740
  const moveRight = () => {
6599
6741
  left =
@@ -6605,6 +6747,7 @@
6605
6747
  ? -left +
6606
6748
  this.options.minimumInViewportWidth
6607
6749
  : Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
6750
+ right = containerRect.width - left - width;
6608
6751
  };
6609
6752
  switch (direction) {
6610
6753
  case 'top':
@@ -6636,7 +6779,24 @@
6636
6779
  moveRight();
6637
6780
  break;
6638
6781
  }
6639
- this.setBounds({ height, width, top, left });
6782
+ const bounds = {};
6783
+ // Anchor to top or to bottom depending on which one is closer
6784
+ if (top <= bottom) {
6785
+ bounds.top = top;
6786
+ }
6787
+ else {
6788
+ bounds.bottom = bottom;
6789
+ }
6790
+ // Anchor to left or to right depending on which one is closer
6791
+ if (left <= right) {
6792
+ bounds.left = left;
6793
+ }
6794
+ else {
6795
+ bounds.right = right;
6796
+ }
6797
+ bounds.height = height;
6798
+ bounds.width = width;
6799
+ this.setBounds(bounds);
6640
6800
  }), {
6641
6801
  dispose: () => {
6642
6802
  for (const iframe of iframes) {
@@ -6659,7 +6819,7 @@
6659
6819
  if (typeof this.options.minimumInViewportHeight === 'number') {
6660
6820
  return height - this.options.minimumInViewportHeight;
6661
6821
  }
6662
- return height;
6822
+ return 0;
6663
6823
  }
6664
6824
  dispose() {
6665
6825
  this._element.remove();
@@ -6682,7 +6842,7 @@
6682
6842
  }
6683
6843
 
6684
6844
  const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
6685
- const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
6845
+ const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100, width: 300, height: 300 };
6686
6846
 
6687
6847
  function createFocusableElement() {
6688
6848
  const element = document.createElement('div');
@@ -7048,6 +7208,7 @@
7048
7208
  parentElement: options.parentElement,
7049
7209
  disableAutoResizing: options.disableAutoResizing,
7050
7210
  locked: options.locked,
7211
+ margin: options.gap,
7051
7212
  });
7052
7213
  this.nextGroupId = sequentialNumberGenerator();
7053
7214
  this._deserializer = new DefaultDockviewDeserialzier(this);
@@ -7073,9 +7234,9 @@
7073
7234
  this._onDidActivePanelChange = new Emitter();
7074
7235
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
7075
7236
  this._onDidMovePanel = new Emitter();
7237
+ this.onDidMovePanel = this._onDidMovePanel.event;
7076
7238
  this._floatingGroups = [];
7077
7239
  this._popoutGroups = [];
7078
- this._ignoreEvents = 0;
7079
7240
  this._onDidRemoveGroup = new Emitter();
7080
7241
  this.onDidRemoveGroup = this._onDidRemoveGroup.event;
7081
7242
  this._onDidAddGroup = new Emitter();
@@ -7089,7 +7250,9 @@
7089
7250
  this.overlayRenderContainer = new OverlayRenderContainer(gready);
7090
7251
  toggleClass(this.gridview.element, 'dv-dockview', true);
7091
7252
  toggleClass(this.element, 'dv-debug', !!options.debug);
7092
- this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this.onDidAdd((event) => {
7253
+ this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
7254
+ this.updateWatermark();
7255
+ }), this.onDidAdd((event) => {
7093
7256
  if (!this._moving) {
7094
7257
  this._onDidAddGroup.fire(event);
7095
7258
  }
@@ -7103,7 +7266,7 @@
7103
7266
  }
7104
7267
  }), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove)(() => {
7105
7268
  this.updateWatermark();
7106
- }), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
7269
+ }), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidMovePanel, this.onDidActivePanelChange)(() => {
7107
7270
  this._bufferOnDidLayoutChange.fire();
7108
7271
  }), exports.DockviewDisposable.from(() => {
7109
7272
  // iterate over a copy of the array since .dispose() mutates the original array
@@ -7354,8 +7517,8 @@
7354
7517
  console.error('dockview: failed to create popout window', err);
7355
7518
  });
7356
7519
  }
7357
- addFloatingGroup(item, coord, options) {
7358
- var _a, _b, _c, _d, _e, _f, _g;
7520
+ addFloatingGroup(item, options) {
7521
+ var _a, _b, _c, _d, _e;
7359
7522
  let group;
7360
7523
  if (item instanceof DockviewPanel) {
7361
7524
  group = this.createGroup();
@@ -7400,26 +7563,62 @@
7400
7563
  }
7401
7564
  }
7402
7565
  group.model.location = { type: 'floating' };
7403
- const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number'
7404
- ? Math.max(coord.x, 0)
7405
- : DEFAULT_FLOATING_GROUP_POSITION.left;
7406
- const overlayTop = typeof (coord === null || coord === void 0 ? void 0 : coord.y) === 'number'
7407
- ? Math.max(coord.y, 0)
7408
- : DEFAULT_FLOATING_GROUP_POSITION.top;
7409
- const overlay = new Overlay({
7410
- container: this.gridview.element,
7411
- content: group.element,
7412
- height: (_b = coord === null || coord === void 0 ? void 0 : coord.height) !== null && _b !== void 0 ? _b : 300,
7413
- width: (_c = coord === null || coord === void 0 ? void 0 : coord.width) !== null && _c !== void 0 ? _c : 300,
7414
- left: overlayLeft,
7415
- top: overlayTop,
7416
- minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
7566
+ function getAnchoredBox() {
7567
+ if (options === null || options === void 0 ? void 0 : options.position) {
7568
+ const result = {};
7569
+ if ('left' in options.position) {
7570
+ result.left = Math.max(options.position.left, 0);
7571
+ }
7572
+ else if ('right' in options.position) {
7573
+ result.right = Math.max(options.position.right, 0);
7574
+ }
7575
+ else {
7576
+ result.left = DEFAULT_FLOATING_GROUP_POSITION.left;
7577
+ }
7578
+ if ('top' in options.position) {
7579
+ result.top = Math.max(options.position.top, 0);
7580
+ }
7581
+ else if ('bottom' in options.position) {
7582
+ result.bottom = Math.max(options.position.bottom, 0);
7583
+ }
7584
+ else {
7585
+ result.top = DEFAULT_FLOATING_GROUP_POSITION.top;
7586
+ }
7587
+ if ('width' in options.position) {
7588
+ result.width = Math.max(options.position.width, 0);
7589
+ }
7590
+ else {
7591
+ result.width = DEFAULT_FLOATING_GROUP_POSITION.width;
7592
+ }
7593
+ if ('height' in options.position) {
7594
+ result.height = Math.max(options.position.height, 0);
7595
+ }
7596
+ else {
7597
+ result.height = DEFAULT_FLOATING_GROUP_POSITION.height;
7598
+ }
7599
+ return result;
7600
+ }
7601
+ return {
7602
+ left: typeof (options === null || options === void 0 ? void 0 : options.x) === 'number'
7603
+ ? Math.max(options.x, 0)
7604
+ : DEFAULT_FLOATING_GROUP_POSITION.left,
7605
+ top: typeof (options === null || options === void 0 ? void 0 : options.y) === 'number'
7606
+ ? Math.max(options.y, 0)
7607
+ : DEFAULT_FLOATING_GROUP_POSITION.top,
7608
+ width: typeof (options === null || options === void 0 ? void 0 : options.width) === 'number'
7609
+ ? Math.max(options.width, 0)
7610
+ : DEFAULT_FLOATING_GROUP_POSITION.width,
7611
+ height: typeof (options === null || options === void 0 ? void 0 : options.height) === 'number'
7612
+ ? Math.max(options.height, 0)
7613
+ : DEFAULT_FLOATING_GROUP_POSITION.height,
7614
+ };
7615
+ }
7616
+ const anchoredBox = getAnchoredBox();
7617
+ const overlay = new Overlay(Object.assign(Object.assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
7417
7618
  ? undefined
7418
- : (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumWidthWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
7419
- minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
7619
+ : (_c = (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport) !== null && _c !== void 0 ? _c : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE, minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
7420
7620
  ? undefined
7421
- : (_g = (_f = this.options.floatingGroupBounds) === null || _f === void 0 ? void 0 : _f.minimumHeightWithinViewport) !== null && _g !== void 0 ? _g : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
7422
- });
7621
+ : (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
7423
7622
  const el = group.element.querySelector('.void-container');
7424
7623
  if (!el) {
7425
7624
  throw new Error('failed to find drag handle');
@@ -7517,12 +7716,18 @@
7517
7716
  group.overlay.minimumInViewportWidth =
7518
7717
  (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7519
7718
  }
7520
- group.overlay.setBounds({});
7719
+ group.overlay.setBounds();
7521
7720
  }
7522
7721
  }
7523
7722
  if (changed_rootOverlayOptions) {
7524
7723
  this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
7525
7724
  }
7725
+ if (this.gridview.margin !== 0 && options.gap === undefined) {
7726
+ this.gridview.margin = 0;
7727
+ }
7728
+ if (typeof options.gap === 'number') {
7729
+ this.gridview.margin = options.gap;
7730
+ }
7526
7731
  this.layout(this.gridview.width, this.gridview.height, true);
7527
7732
  }
7528
7733
  layout(width, height, forceResize) {
@@ -7684,11 +7889,10 @@
7684
7889
  const { data, position } = serializedFloatingGroup;
7685
7890
  const group = createGroupFromSerializedState(data);
7686
7891
  this.addFloatingGroup(group, {
7687
- x: position.left,
7688
- y: position.top,
7689
- height: position.height,
7690
- width: position.width,
7691
- }, { skipRemoveGroup: true, inDragMode: false });
7892
+ position: position,
7893
+ skipRemoveGroup: true,
7894
+ inDragMode: false,
7895
+ });
7692
7896
  }
7693
7897
  const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
7694
7898
  for (const serializedPopoutGroup of serializedPopoutGroups) {
@@ -7823,11 +8027,7 @@
7823
8027
  options.floating !== null
7824
8028
  ? options.floating
7825
8029
  : {};
7826
- this.addFloatingGroup(group, o, {
7827
- inDragMode: false,
7828
- skipRemoveGroup: true,
7829
- skipActiveGroup: true,
7830
- });
8030
+ this.addFloatingGroup(group, Object.assign(Object.assign({}, o), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
7831
8031
  panel = this.createPanel(options, group);
7832
8032
  group.model.openPanel(panel, {
7833
8033
  skipSetActive: options.inactive,
@@ -7866,11 +8066,7 @@
7866
8066
  options.floating !== null
7867
8067
  ? options.floating
7868
8068
  : {};
7869
- this.addFloatingGroup(group, coordinates, {
7870
- inDragMode: false,
7871
- skipRemoveGroup: true,
7872
- skipActiveGroup: true,
7873
- });
8069
+ this.addFloatingGroup(group, Object.assign(Object.assign({}, coordinates), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
7874
8070
  panel = this.createPanel(options, group);
7875
8071
  group.model.openPanel(panel, {
7876
8072
  skipSetActive: options.inactive,
@@ -7925,6 +8121,7 @@
7925
8121
  });
7926
8122
  const watermarkContainer = document.createElement('div');
7927
8123
  watermarkContainer.className = 'dv-watermark-container';
8124
+ addTestId(watermarkContainer, 'watermark-component');
7928
8125
  watermarkContainer.appendChild(this.watermark.element);
7929
8126
  this.gridview.element.appendChild(watermarkContainer);
7930
8127
  }
@@ -8113,6 +8310,7 @@
8113
8310
  this.doSetGroupAndPanelActive(destinationGroup);
8114
8311
  this._onDidMovePanel.fire({
8115
8312
  panel: removedPanel,
8313
+ from: sourceGroup,
8116
8314
  });
8117
8315
  }
8118
8316
  else {
@@ -8136,6 +8334,10 @@
8136
8334
  // if a group has one tab - we are essentially moving the 'group'
8137
8335
  // which is equivalent to swapping two views in this case
8138
8336
  this.gridview.moveView(sourceParentLocation, from, to);
8337
+ this._onDidMovePanel.fire({
8338
+ panel: this.getGroupPanel(sourceItemId),
8339
+ from: sourceGroup,
8340
+ });
8139
8341
  return;
8140
8342
  }
8141
8343
  }
@@ -8149,6 +8351,10 @@
8149
8351
  const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
8150
8352
  this.movingLock(() => this.doAddGroup(targetGroup, location));
8151
8353
  this.doSetGroupAndPanelActive(targetGroup);
8354
+ this._onDidMovePanel.fire({
8355
+ panel: this.getGroupPanel(sourceItemId),
8356
+ from: sourceGroup,
8357
+ });
8152
8358
  }
8153
8359
  else {
8154
8360
  /**
@@ -8168,6 +8374,10 @@
8168
8374
  skipSetGroupActive: true,
8169
8375
  }));
8170
8376
  this.doSetGroupAndPanelActive(group);
8377
+ this._onDidMovePanel.fire({
8378
+ panel: removedPanel,
8379
+ from: sourceGroup,
8380
+ });
8171
8381
  }
8172
8382
  }
8173
8383
  }
@@ -8192,9 +8402,6 @@
8192
8402
  }
8193
8403
  });
8194
8404
  this.doSetGroupAndPanelActive(to);
8195
- panels.forEach((panel) => {
8196
- this._onDidMovePanel.fire({ panel });
8197
- });
8198
8405
  }
8199
8406
  else {
8200
8407
  switch (from.api.location.type) {
@@ -8220,10 +8427,10 @@
8220
8427
  const referenceLocation = getGridLocation(to.element);
8221
8428
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
8222
8429
  this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
8223
- from.panels.forEach((panel) => {
8224
- this._onDidMovePanel.fire({ panel });
8225
- });
8226
8430
  }
8431
+ from.panels.forEach((panel) => {
8432
+ this._onDidMovePanel.fire({ panel, from });
8433
+ });
8227
8434
  }
8228
8435
  doSetGroupActive(group) {
8229
8436
  super.doSetGroupActive(group);