dockview-react 1.15.2 → 1.16.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 1.15.2
3
+ * @version 1.16.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -531,6 +531,26 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
531
531
  function addTestId(element, id) {
532
532
  element.setAttribute('data-testid', id);
533
533
  }
534
+ function disableIframePointEvents() {
535
+ const iframes = [
536
+ ...getElementsByTagName('iframe'),
537
+ ...getElementsByTagName('webview'),
538
+ ];
539
+ const original = new WeakMap(); // don't hold onto HTMLElement references longer than required
540
+ for (const iframe of iframes) {
541
+ original.set(iframe, iframe.style.pointerEvents);
542
+ iframe.style.pointerEvents = 'none';
543
+ }
544
+ return {
545
+ release: () => {
546
+ var _a;
547
+ for (const iframe of iframes) {
548
+ iframe.style.pointerEvents = (_a = original.get(iframe)) !== null && _a !== void 0 ? _a : 'auto';
549
+ }
550
+ iframes.splice(0, iframes.length); // don't hold onto HTMLElement references longer than required
551
+ },
552
+ };
553
+ }
534
554
 
535
555
  function tail(arr) {
536
556
  if (arr.length === 0) {
@@ -1053,13 +1073,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1053
1073
  for (const item of this.viewItems) {
1054
1074
  item.enabled = false;
1055
1075
  }
1056
- const iframes = [
1057
- ...getElementsByTagName('iframe'),
1058
- ...getElementsByTagName('webview'),
1059
- ];
1060
- for (const iframe of iframes) {
1061
- iframe.style.pointerEvents = 'none';
1062
- }
1076
+ const iframes = disableIframePointEvents();
1063
1077
  const start = this._orientation === exports.Orientation.HORIZONTAL
1064
1078
  ? event.clientX
1065
1079
  : event.clientY;
@@ -1121,9 +1135,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1121
1135
  for (const item of this.viewItems) {
1122
1136
  item.enabled = true;
1123
1137
  }
1124
- for (const iframe of iframes) {
1125
- iframe.style.pointerEvents = 'auto';
1126
- }
1138
+ iframes.release();
1127
1139
  this.saveProportions();
1128
1140
  document.removeEventListener('pointermove', onPointerMove);
1129
1141
  document.removeEventListener('pointerup', end);
@@ -1290,29 +1302,47 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1290
1302
  if (this.viewItems.length === 0) {
1291
1303
  return;
1292
1304
  }
1293
- const sashCount = this.viewItems.length - 1;
1294
- const marginReducedSize = (this.margin * sashCount) / this.viewItems.length;
1305
+ const visibleViewItems = this.viewItems.filter((i) => i.visible);
1306
+ const sashCount = Math.max(0, visibleViewItems.length - 1);
1307
+ const marginReducedSize = (this.margin * sashCount) / Math.max(1, visibleViewItems.length);
1295
1308
  let totalLeftOffset = 0;
1296
1309
  const viewLeftOffsets = [];
1297
- for (let i = 0; i < this.viewItems.length - 1; i++) {
1298
- totalLeftOffset += this.viewItems[i].size;
1299
- viewLeftOffsets.push(totalLeftOffset);
1300
- const offset = Math.min(Math.max(0, totalLeftOffset - 2), this.size - this.margin);
1301
- if (this._orientation === exports.Orientation.HORIZONTAL) {
1302
- this.sashes[i].container.style.left = `${offset}px`;
1303
- this.sashes[i].container.style.top = `0px`;
1310
+ const sashWidth = 4; // hardcoded in css
1311
+ const runningVisiblePanelCount = this.viewItems.reduce((arr, viewItem, i) => {
1312
+ const flag = viewItem.visible ? 1 : 0;
1313
+ if (i === 0) {
1314
+ arr.push(flag);
1304
1315
  }
1305
- if (this._orientation === exports.Orientation.VERTICAL) {
1306
- this.sashes[i].container.style.left = `0px`;
1307
- this.sashes[i].container.style.top = `${offset}px`;
1316
+ else {
1317
+ arr.push(arr[i - 1] + flag);
1308
1318
  }
1309
- }
1319
+ return arr;
1320
+ }, []);
1321
+ // calculate both view and cash positions
1310
1322
  this.viewItems.forEach((view, i) => {
1311
- const size = view.size - marginReducedSize;
1312
- const offset = i === 0
1323
+ totalLeftOffset += this.viewItems[i].size;
1324
+ viewLeftOffsets.push(totalLeftOffset);
1325
+ const size = view.visible ? view.size - marginReducedSize : 0;
1326
+ const visiblePanelsBeforeThisView = Math.max(0, runningVisiblePanelCount[i] - 1);
1327
+ const offset = i === 0 || visiblePanelsBeforeThisView === 0
1313
1328
  ? 0
1314
1329
  : viewLeftOffsets[i - 1] +
1315
- (i / sashCount) * marginReducedSize;
1330
+ (visiblePanelsBeforeThisView / sashCount) * marginReducedSize;
1331
+ if (i < this.viewItems.length - 1) {
1332
+ // calculate sash position
1333
+ const newSize = view.visible
1334
+ ? offset + size - sashWidth / 2 + this.margin / 2
1335
+ : offset;
1336
+ if (this._orientation === exports.Orientation.HORIZONTAL) {
1337
+ this.sashes[i].container.style.left = `${newSize}px`;
1338
+ this.sashes[i].container.style.top = `0px`;
1339
+ }
1340
+ if (this._orientation === exports.Orientation.VERTICAL) {
1341
+ this.sashes[i].container.style.left = `0px`;
1342
+ this.sashes[i].container.style.top = `${newSize}px`;
1343
+ }
1344
+ }
1345
+ // calculate view position
1316
1346
  if (this._orientation === exports.Orientation.HORIZONTAL) {
1317
1347
  view.container.style.width = `${size}px`;
1318
1348
  view.container.style.left = `${offset}px`;
@@ -2656,6 +2686,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2656
2686
  this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
2657
2687
  this.element.style.height = '100%';
2658
2688
  this.element.style.width = '100%';
2689
+ if (typeof options.className === 'string') {
2690
+ this.element.classList.add(options.className);
2691
+ }
2659
2692
  options.parentElement.appendChild(this.element);
2660
2693
  this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
2661
2694
  this.gridview.locked = !!options.locked;
@@ -2859,12 +2892,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2859
2892
  constructor(component) {
2860
2893
  this.component = component;
2861
2894
  }
2862
- /**
2863
- * Update configuratable options.
2864
- */
2865
- updateOptions(options) {
2866
- this.component.updateOptions(options);
2867
- }
2868
2895
  /**
2869
2896
  * Removes an existing panel and optionally provide a `Sizing` method
2870
2897
  * for the subsequent resize.
@@ -2918,6 +2945,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2918
2945
  clear() {
2919
2946
  this.component.clear();
2920
2947
  }
2948
+ /**
2949
+ * Update configuratable options.
2950
+ */
2951
+ updateOptions(options) {
2952
+ this.component.updateOptions(options);
2953
+ }
2954
+ /**
2955
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
2956
+ */
2957
+ dispose() {
2958
+ this.component.dispose();
2959
+ }
2921
2960
  }
2922
2961
  class PaneviewApi {
2923
2962
  /**
@@ -3045,6 +3084,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3045
3084
  clear() {
3046
3085
  this.component.clear();
3047
3086
  }
3087
+ /**
3088
+ * Update configuratable options.
3089
+ */
3090
+ updateOptions(options) {
3091
+ this.component.updateOptions(options);
3092
+ }
3093
+ /**
3094
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
3095
+ */
3096
+ dispose() {
3097
+ this.component.dispose();
3098
+ }
3048
3099
  }
3049
3100
  class GridviewApi {
3050
3101
  /**
@@ -3185,6 +3236,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3185
3236
  clear() {
3186
3237
  this.component.clear();
3187
3238
  }
3239
+ updateOptions(options) {
3240
+ this.component.updateOptions(options);
3241
+ }
3242
+ /**
3243
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
3244
+ */
3245
+ dispose() {
3246
+ this.component.dispose();
3247
+ }
3188
3248
  }
3189
3249
  class DockviewApi {
3190
3250
  /**
@@ -3477,6 +3537,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3477
3537
  setGap(gap) {
3478
3538
  this.component.updateOptions({ gap });
3479
3539
  }
3540
+ updateOptions(options) {
3541
+ this.component.updateOptions(options);
3542
+ }
3543
+ /**
3544
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
3545
+ */
3546
+ dispose() {
3547
+ this.component.dispose();
3548
+ }
3480
3549
  }
3481
3550
 
3482
3551
  class DragHandler extends CompositeDisposable {
@@ -3499,20 +3568,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3499
3568
  event.preventDefault();
3500
3569
  return;
3501
3570
  }
3502
- const iframes = [
3503
- ...getElementsByTagName('iframe'),
3504
- ...getElementsByTagName('webview'),
3505
- ];
3571
+ const iframes = disableIframePointEvents();
3506
3572
  this.pointerEventsDisposable.value = {
3507
3573
  dispose: () => {
3508
- for (const iframe of iframes) {
3509
- iframe.style.pointerEvents = 'auto';
3510
- }
3574
+ iframes.release();
3511
3575
  },
3512
3576
  };
3513
- for (const iframe of iframes) {
3514
- iframe.style.pointerEvents = 'none';
3515
- }
3516
3577
  this.el.classList.add('dv-dragged');
3517
3578
  setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
3518
3579
  this.dataDisposable.value = this.getData(event);
@@ -4676,7 +4737,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4676
4737
  this._element.className = 'void-container';
4677
4738
  this._element.tabIndex = 0;
4678
4739
  this._element.draggable = true;
4679
- this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'click', () => {
4740
+ this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
4680
4741
  this.accessor.doSetGroupActive(this.group);
4681
4742
  }));
4682
4743
  const handler = new GroupDragHandler(this._element, accessor, group);
@@ -4991,6 +5052,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4991
5052
  locked: undefined,
4992
5053
  disableDnd: undefined,
4993
5054
  gap: undefined,
5055
+ className: undefined,
4994
5056
  };
4995
5057
  return Object.keys(properties);
4996
5058
  })();
@@ -5546,7 +5608,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5546
5608
  group: this.groupPanel,
5547
5609
  });
5548
5610
  this.watermark = watermark;
5549
- addDisposableListener(this.watermark.element, 'click', () => {
5611
+ addDisposableListener(this.watermark.element, 'pointerdown', () => {
5550
5612
  if (!this.isActive) {
5551
5613
  this.accessor.doSetGroupActive(this.groupPanel);
5552
5614
  }
@@ -6111,7 +6173,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6111
6173
  // forward the resize event to the group since if you want to resize a panel
6112
6174
  // you are actually just resizing the panels parent which is the group
6113
6175
  this.group.api.setSize(event);
6114
- }), this.api.onDidRendererChange((event) => {
6176
+ }), this.api.onDidRendererChange(() => {
6115
6177
  this.group.model.rerender(this);
6116
6178
  }));
6117
6179
  }
@@ -6447,17 +6509,30 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6447
6509
  }
6448
6510
  }
6449
6511
 
6450
- const bringElementToFront = (() => {
6451
- let previous = null;
6452
- function pushToTop(element) {
6453
- if (previous !== element && previous !== null) {
6454
- toggleClass(previous, 'dv-bring-to-front', false);
6512
+ const DEFAULT_OVERLAY_Z_INDEX = 999;
6513
+ class AriaLevelTracker {
6514
+ constructor() {
6515
+ this._orderedList = [];
6516
+ }
6517
+ push(element) {
6518
+ this._orderedList = [
6519
+ ...this._orderedList.filter((item) => item !== element),
6520
+ element,
6521
+ ];
6522
+ this.update();
6523
+ }
6524
+ destroy(element) {
6525
+ this._orderedList = this._orderedList.filter((item) => item !== element);
6526
+ this.update();
6527
+ }
6528
+ update() {
6529
+ for (let i = 0; i < this._orderedList.length; i++) {
6530
+ this._orderedList[i].setAttribute('aria-level', `${i}`);
6531
+ this._orderedList[i].style.zIndex = `${DEFAULT_OVERLAY_Z_INDEX + i * 2}`;
6455
6532
  }
6456
- toggleClass(element, 'dv-bring-to-front', true);
6457
- previous = element;
6458
6533
  }
6459
- return pushToTop;
6460
- })();
6534
+ }
6535
+ const arialLevelTracker = new AriaLevelTracker();
6461
6536
  class Overlay extends CompositeDisposable {
6462
6537
  set minimumInViewportWidth(value) {
6463
6538
  this.options.minimumInViewportWidth = value;
@@ -6465,6 +6540,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6465
6540
  set minimumInViewportHeight(value) {
6466
6541
  this.options.minimumInViewportHeight = value;
6467
6542
  }
6543
+ get element() {
6544
+ return this._element;
6545
+ }
6468
6546
  constructor(options) {
6469
6547
  super();
6470
6548
  this.options = options;
@@ -6487,6 +6565,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6487
6565
  this.options.container.appendChild(this._element);
6488
6566
  // if input bad resize within acceptable boundaries
6489
6567
  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 })));
6568
+ arialLevelTracker.push(this._element);
6569
+ }
6570
+ bringToFront() {
6571
+ arialLevelTracker.push(this._element);
6490
6572
  }
6491
6573
  setBounds(bounds = {}) {
6492
6574
  if (typeof bounds.height === 'number') {
@@ -6574,18 +6656,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6574
6656
  const move = new MutableDisposable();
6575
6657
  const track = () => {
6576
6658
  let offset = null;
6577
- const iframes = [
6578
- ...getElementsByTagName('iframe'),
6579
- ...getElementsByTagName('webview'),
6580
- ];
6581
- for (const iframe of iframes) {
6582
- iframe.style.pointerEvents = 'none';
6583
- }
6659
+ const iframes = disableIframePointEvents();
6584
6660
  move.value = new CompositeDisposable({
6585
6661
  dispose: () => {
6586
- for (const iframe of iframes) {
6587
- iframe.style.pointerEvents = 'auto';
6588
- }
6662
+ iframes.release();
6589
6663
  },
6590
6664
  }, addDisposableWindowListener(window, 'mousemove', (e) => {
6591
6665
  const containerRect = this.options.container.getBoundingClientRect();
@@ -6654,9 +6728,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6654
6728
  track();
6655
6729
  }
6656
6730
  }), addDisposableListener(this.options.content, 'mousedown', () => {
6657
- bringElementToFront(this._element);
6731
+ arialLevelTracker.push(this._element);
6658
6732
  }, true));
6659
- bringElementToFront(this._element);
6660
6733
  if (options.inDragMode) {
6661
6734
  track();
6662
6735
  }
@@ -6669,13 +6742,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6669
6742
  this.addDisposables(move, addDisposableListener(resizeHandleElement, 'mousedown', (e) => {
6670
6743
  e.preventDefault();
6671
6744
  let startPosition = null;
6672
- const iframes = [
6673
- ...getElementsByTagName('iframe'),
6674
- ...getElementsByTagName('webview'),
6675
- ];
6676
- for (const iframe of iframes) {
6677
- iframe.style.pointerEvents = 'none';
6678
- }
6745
+ const iframes = disableIframePointEvents();
6679
6746
  move.value = new CompositeDisposable(addDisposableWindowListener(window, 'mousemove', (e) => {
6680
6747
  const containerRect = this.options.container.getBoundingClientRect();
6681
6748
  const overlayRect = this._element.getBoundingClientRect();
@@ -6798,9 +6865,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6798
6865
  this.setBounds(bounds);
6799
6866
  }), {
6800
6867
  dispose: () => {
6801
- for (const iframe of iframes) {
6802
- iframe.style.pointerEvents = 'auto';
6803
- }
6868
+ iframes.release();
6804
6869
  },
6805
6870
  }, addDisposableWindowListener(window, 'mouseup', () => {
6806
6871
  move.dispose();
@@ -6821,6 +6886,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6821
6886
  return 0;
6822
6887
  }
6823
6888
  dispose() {
6889
+ arialLevelTracker.destroy(this._element);
6824
6890
  this._element.remove();
6825
6891
  super.dispose();
6826
6892
  }
@@ -6849,9 +6915,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6849
6915
  return element;
6850
6916
  }
6851
6917
  class OverlayRenderContainer extends CompositeDisposable {
6852
- constructor(element) {
6918
+ constructor(element, accessor) {
6853
6919
  super();
6854
6920
  this.element = element;
6921
+ this.accessor = accessor;
6855
6922
  this.map = {};
6856
6923
  this._disposed = false;
6857
6924
  this.addDisposables(exports.DockviewDisposable.from(() => {
@@ -6907,7 +6974,35 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6907
6974
  }
6908
6975
  focusContainer.style.display = panel.api.isVisible ? '' : 'none';
6909
6976
  };
6910
- const disposable = new CompositeDisposable(
6977
+ const observerDisposable = new MutableDisposable();
6978
+ const correctLayerPosition = () => {
6979
+ if (panel.api.location.type === 'floating') {
6980
+ queueMicrotask(() => {
6981
+ const floatingGroup = this.accessor.floatingGroups.find((group) => group.group === panel.api.group);
6982
+ if (!floatingGroup) {
6983
+ return;
6984
+ }
6985
+ const element = floatingGroup.overlay.element;
6986
+ const update = () => {
6987
+ const level = Number(element.getAttribute('aria-level'));
6988
+ focusContainer.style.zIndex = `${DEFAULT_OVERLAY_Z_INDEX + level * 2 + 1}`;
6989
+ };
6990
+ const observer = new MutationObserver(() => {
6991
+ update();
6992
+ });
6993
+ observerDisposable.value = exports.DockviewDisposable.from(() => observer.disconnect());
6994
+ observer.observe(element, {
6995
+ attributeFilter: ['aria-level'],
6996
+ attributes: true,
6997
+ });
6998
+ update();
6999
+ });
7000
+ }
7001
+ else {
7002
+ focusContainer.style.zIndex = ''; // reset the z-index, perhaps CSS will take over here
7003
+ }
7004
+ };
7005
+ const disposable = new CompositeDisposable(observerDisposable,
6911
7006
  /**
6912
7007
  * since container is positioned absoutely we must explicitly forward
6913
7008
  * the dnd events for the expect behaviours to continue to occur in terms of dnd
@@ -6931,7 +7026,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6931
7026
  onDragOver: (e) => {
6932
7027
  referenceContainer.dropTarget.dnd.onDragOver(e);
6933
7028
  },
6934
- }), panel.api.onDidVisibilityChange((event) => {
7029
+ }), panel.api.onDidVisibilityChange(() => {
6935
7030
  /**
6936
7031
  * Control the visibility of the content, however even when not visible (display: none)
6937
7032
  * the content is still maintained within the DOM hence DOM specific attributes
@@ -6943,6 +7038,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6943
7038
  return;
6944
7039
  }
6945
7040
  resize();
7041
+ }), panel.api.onDidLocationChange(() => {
7042
+ correctLayerPosition();
6946
7043
  }));
6947
7044
  this.map[panel.api.id].destroy = exports.DockviewDisposable.from(() => {
6948
7045
  var _a;
@@ -6951,6 +7048,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6951
7048
  }
6952
7049
  (_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
6953
7050
  });
7051
+ correctLayerPosition();
6954
7052
  queueMicrotask(() => {
6955
7053
  if (this.isDisposed) {
6956
7054
  return;
@@ -7176,7 +7274,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7176
7274
  get gap() {
7177
7275
  return this.gridview.margin;
7178
7276
  }
7179
- constructor(options) {
7277
+ get floatingGroups() {
7278
+ return this._floatingGroups;
7279
+ }
7280
+ constructor(parentElement, options) {
7180
7281
  var _a;
7181
7282
  super({
7182
7283
  proportionalLayout: true,
@@ -7184,10 +7285,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7184
7285
  styles: options.hideBorders
7185
7286
  ? { separatorBorder: 'transparent' }
7186
7287
  : undefined,
7187
- parentElement: options.parentElement,
7288
+ parentElement: parentElement,
7188
7289
  disableAutoResizing: options.disableAutoResizing,
7189
7290
  locked: options.locked,
7190
7291
  margin: options.gap,
7292
+ className: options.className,
7191
7293
  });
7192
7294
  this.nextGroupId = sequentialNumberGenerator();
7193
7295
  this._deserializer = new DefaultDockviewDeserialzier(this);
@@ -7223,10 +7325,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7223
7325
  this._onDidActiveGroupChange = new Emitter();
7224
7326
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
7225
7327
  this._moving = false;
7226
- const gready = document.createElement('div');
7227
- gready.className = 'dv-overlay-render-container';
7228
- this.gridview.element.appendChild(gready);
7229
- this.overlayRenderContainer = new OverlayRenderContainer(gready);
7328
+ // const gready = document.createElement('div');
7329
+ // gready.className = 'dv-overlay-render-container';
7330
+ // this.gridview.element.appendChild(gready);
7331
+ this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
7230
7332
  toggleClass(this.gridview.element, 'dv-dockview', true);
7231
7333
  toggleClass(this.element, 'dv-debug', !!options.debug);
7232
7334
  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(() => {
@@ -7392,7 +7494,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7392
7494
  }
7393
7495
  const gready = document.createElement('div');
7394
7496
  gready.className = 'dv-overlay-render-container';
7395
- const overlayRenderContainer = new OverlayRenderContainer(gready);
7497
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
7396
7498
  const referenceGroup = itemToPopout instanceof DockviewPanel
7397
7499
  ? itemToPopout.group
7398
7500
  : itemToPopout;
@@ -7541,7 +7643,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7541
7643
  }
7542
7644
  }
7543
7645
  }
7544
- group.model.location = { type: 'floating' };
7545
7646
  function getAnchoredBox() {
7546
7647
  if (options === null || options === void 0 ? void 0 : options.position) {
7547
7648
  const result = {};
@@ -7608,10 +7709,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7608
7709
  : false,
7609
7710
  });
7610
7711
  const floatingGroupPanel = new DockviewFloatingGroupPanel(group, overlay);
7611
- const disposable = watchElementResize(group.element, (entry) => {
7712
+ const disposable = new CompositeDisposable(group.api.onDidActiveChange((event) => {
7713
+ if (event.isActive) {
7714
+ overlay.bringToFront();
7715
+ }
7716
+ }), watchElementResize(group.element, (entry) => {
7612
7717
  const { width, height } = entry.contentRect;
7613
7718
  group.layout(width, height); // let the group know it's size is changing so it can fire events to the panel
7614
- });
7719
+ }));
7615
7720
  floatingGroupPanel.addDisposables(overlay.onDidChange(() => {
7616
7721
  // this is either a resize or a move
7617
7722
  // to inform the panels .layout(...) the group with it's current size
@@ -7627,12 +7732,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7627
7732
  }), {
7628
7733
  dispose: () => {
7629
7734
  disposable.dispose();
7630
- group.model.location = { type: 'grid' };
7631
7735
  remove(this._floatingGroups, floatingGroupPanel);
7736
+ group.model.location = { type: 'grid' };
7632
7737
  this.updateWatermark();
7633
7738
  },
7634
7739
  });
7635
7740
  this._floatingGroups.push(floatingGroupPanel);
7741
+ group.model.location = { type: 'floating' };
7636
7742
  if (!(options === null || options === void 0 ? void 0 : options.skipActiveGroup)) {
7637
7743
  this.doSetGroupAndPanelActive(group);
7638
7744
  }
@@ -7872,6 +7978,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7872
7978
  const group = createGroupFromSerializedState(data);
7873
7979
  this.addFloatingGroup(group, {
7874
7980
  position: position,
7981
+ width: position.width,
7982
+ height: position.height,
7875
7983
  skipRemoveGroup: true,
7876
7984
  inDragMode: false,
7877
7985
  });
@@ -8212,6 +8320,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8212
8320
  this._groups.delete(group.id);
8213
8321
  this._onDidRemoveGroup.fire(group);
8214
8322
  }
8323
+ remove(this._popoutGroups, selectedGroup);
8215
8324
  const removedGroup = selectedGroup.disposable.dispose();
8216
8325
  if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
8217
8326
  this.doAddGroup(removedGroup, [0]);
@@ -8323,6 +8432,31 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8323
8432
  return;
8324
8433
  }
8325
8434
  }
8435
+ if (sourceGroup.api.location.type === 'popout') {
8436
+ /**
8437
+ * the source group is a popout group with a single panel
8438
+ *
8439
+ * 1. remove the panel from the group without triggering any events
8440
+ * 2. remove the popout group
8441
+ * 3. create a new group at the requested location and add that panel
8442
+ */
8443
+ const popoutGroup = this._popoutGroups.find((group) => group.popoutGroup === sourceGroup);
8444
+ const removedPanel = this.movingLock(() => popoutGroup.popoutGroup.model.removePanel(popoutGroup.popoutGroup.panels[0], {
8445
+ skipSetActive: true,
8446
+ skipSetActiveGroup: true,
8447
+ }));
8448
+ this.doRemoveGroup(sourceGroup, { skipActive: true });
8449
+ const newGroup = this.createGroupAtLocation(targetLocation);
8450
+ this.movingLock(() => newGroup.model.openPanel(removedPanel, {
8451
+ skipSetActive: true,
8452
+ }));
8453
+ this.doSetGroupAndPanelActive(newGroup);
8454
+ this._onDidMovePanel.fire({
8455
+ panel: this.getGroupPanel(sourceItemId),
8456
+ from: sourceGroup,
8457
+ });
8458
+ return;
8459
+ }
8326
8460
  // source group will become empty so delete the group
8327
8461
  const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {
8328
8462
  skipActive: true,
@@ -8554,13 +8688,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8554
8688
  set deserializer(value) {
8555
8689
  this._deserializer = value;
8556
8690
  }
8557
- constructor(options) {
8691
+ constructor(parentElement, options) {
8558
8692
  super({
8559
- parentElement: options.parentElement,
8693
+ parentElement: parentElement,
8560
8694
  proportionalLayout: options.proportionalLayout,
8561
8695
  orientation: options.orientation,
8562
8696
  styles: options.styles,
8563
8697
  disableAutoResizing: options.disableAutoResizing,
8698
+ className: options.className,
8564
8699
  });
8565
8700
  this._onDidLayoutfromJSON = new Emitter();
8566
8701
  this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
@@ -8852,8 +8987,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8852
8987
  ? this.splitview.size
8853
8988
  : this.splitview.orthogonalSize;
8854
8989
  }
8855
- constructor(options) {
8856
- super(options.parentElement, options.disableAutoResizing);
8990
+ constructor(parentElement, options) {
8991
+ super(parentElement, options.disableAutoResizing);
8857
8992
  this._splitviewChangeDisposable = new MutableDisposable();
8858
8993
  this._panels = new Map();
8859
8994
  this._onDidLayoutfromJSON = new Emitter();
@@ -8864,6 +8999,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8864
8999
  this.onDidRemoveView = this._onDidRemoveView.event;
8865
9000
  this._onDidLayoutChange = new Emitter();
8866
9001
  this.onDidLayoutChange = this._onDidLayoutChange.event;
9002
+ if (typeof options.className === 'string') {
9003
+ this.element.classList.add(options.className);
9004
+ }
8867
9005
  this._options = options;
8868
9006
  if (!options.components) {
8869
9007
  options.components = {};
@@ -9176,8 +9314,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9176
9314
  get options() {
9177
9315
  return this._options;
9178
9316
  }
9179
- constructor(options) {
9180
- super(options.parentElement, options.disableAutoResizing);
9317
+ constructor(parentElement, options) {
9318
+ super(parentElement, options.disableAutoResizing);
9181
9319
  this._id = nextLayoutId.next();
9182
9320
  this._disposable = new MutableDisposable();
9183
9321
  this._viewDisposables = new Map();
@@ -9191,6 +9329,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9191
9329
  this.onDidAddView = this._onDidAddView.event;
9192
9330
  this._onDidRemoveView = new Emitter();
9193
9331
  this.onDidRemoveView = this._onDidRemoveView.event;
9332
+ if (typeof options.className === 'string') {
9333
+ this.element.classList.add(options.className);
9334
+ }
9194
9335
  this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9195
9336
  this._options = options;
9196
9337
  if (!options.components) {
@@ -9506,6 +9647,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9506
9647
  }
9507
9648
  }
9508
9649
 
9650
+ function createDockview(element, options) {
9651
+ const component = new DockviewComponent(element, options);
9652
+ return component.api;
9653
+ }
9654
+ function createSplitview(element, options) {
9655
+ const component = new SplitviewComponent(element, options);
9656
+ return new SplitviewApi(component);
9657
+ }
9658
+ function createGridview(element, options) {
9659
+ const component = new GridviewComponent(element, options);
9660
+ return new GridviewApi(component);
9661
+ }
9662
+ function createPaneview(element, options) {
9663
+ const component = new PaneviewComponent(element, options);
9664
+ return new PaneviewApi(component);
9665
+ }
9666
+
9509
9667
  /**
9510
9668
  * This component is intended to interface between vanilla-js and React hence we need to be
9511
9669
  * creative in how we update props.
@@ -9885,20 +10043,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9885
10043
  });
9886
10044
  }
9887
10045
  : undefined,
9888
- parentElement: domRef.current,
9889
10046
  defaultTabComponent: props.defaultTabComponent
9890
10047
  ? DEFAULT_REACT_TAB
9891
10048
  : undefined,
9892
10049
  };
9893
- const dockview = new DockviewComponent(Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10050
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
9894
10051
  const { clientWidth, clientHeight } = domRef.current;
9895
- dockview.layout(clientWidth, clientHeight);
10052
+ api.layout(clientWidth, clientHeight);
9896
10053
  if (props.onReady) {
9897
- props.onReady({ api: new DockviewApi(dockview) });
10054
+ props.onReady({ api });
9898
10055
  }
9899
- dockviewRef.current = dockview;
10056
+ dockviewRef.current = api;
9900
10057
  return () => {
9901
- dockview.dispose();
10058
+ api.dispose();
9902
10059
  };
9903
10060
  }, []);
9904
10061
  React.useEffect(() => {
@@ -10101,8 +10258,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10101
10258
  React.useImperativeHandle(ref, () => domRef.current, []);
10102
10259
  React.useEffect(() => {
10103
10260
  var _a;
10104
- const splitview = new SplitviewComponent({
10105
- parentElement: domRef.current,
10261
+ const api = createSplitview(domRef.current, {
10106
10262
  disableAutoResizing: props.disableAutoResizing,
10107
10263
  orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10108
10264
  frameworkComponents: props.components,
@@ -10121,13 +10277,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10121
10277
  : undefined,
10122
10278
  });
10123
10279
  const { clientWidth, clientHeight } = domRef.current;
10124
- splitview.layout(clientWidth, clientHeight);
10280
+ api.layout(clientWidth, clientHeight);
10125
10281
  if (props.onReady) {
10126
- props.onReady({ api: new SplitviewApi(splitview) });
10282
+ props.onReady({ api });
10127
10283
  }
10128
- splitviewRef.current = splitview;
10284
+ splitviewRef.current = api;
10129
10285
  return () => {
10130
- splitview.dispose();
10286
+ api.dispose();
10131
10287
  };
10132
10288
  }, []);
10133
10289
  React.useEffect(() => {
@@ -10172,8 +10328,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10172
10328
  // noop
10173
10329
  };
10174
10330
  }
10175
- const gridview = new GridviewComponent({
10176
- parentElement: domRef.current,
10331
+ const api = createGridview(domRef.current, {
10177
10332
  disableAutoResizing: props.disableAutoResizing,
10178
10333
  proportionalLayout: typeof props.proportionalLayout === 'boolean'
10179
10334
  ? props.proportionalLayout
@@ -10192,13 +10347,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10192
10347
  : undefined,
10193
10348
  });
10194
10349
  const { clientWidth, clientHeight } = domRef.current;
10195
- gridview.layout(clientWidth, clientHeight);
10350
+ api.layout(clientWidth, clientHeight);
10196
10351
  if (props.onReady) {
10197
- props.onReady({ api: new GridviewApi(gridview) });
10352
+ props.onReady({ api });
10198
10353
  }
10199
- gridviewRef.current = gridview;
10354
+ gridviewRef.current = api;
10200
10355
  return () => {
10201
- gridview.dispose();
10356
+ api.dispose();
10202
10357
  };
10203
10358
  }, []);
10204
10359
  React.useEffect(() => {
@@ -10257,8 +10412,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10257
10412
  const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10258
10413
  addPortal,
10259
10414
  });
10260
- const paneview = new PaneviewComponent({
10261
- parentElement: domRef.current,
10415
+ const api = createPaneview(domRef.current, {
10262
10416
  disableAutoResizing: props.disableAutoResizing,
10263
10417
  frameworkComponents: props.components,
10264
10418
  components: {},
@@ -10275,15 +10429,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10275
10429
  },
10276
10430
  showDndOverlay: props.showDndOverlay,
10277
10431
  });
10278
- const api = new PaneviewApi(paneview);
10279
10432
  const { clientWidth, clientHeight } = domRef.current;
10280
- paneview.layout(clientWidth, clientHeight);
10433
+ api.layout(clientWidth, clientHeight);
10281
10434
  if (props.onReady) {
10282
10435
  props.onReady({ api });
10283
10436
  }
10284
- paneviewRef.current = paneview;
10437
+ paneviewRef.current = api;
10285
10438
  return () => {
10286
- paneview.dispose();
10439
+ api.dispose();
10287
10440
  };
10288
10441
  }, []);
10289
10442
  React.useEffect(() => {
@@ -10308,10 +10461,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10308
10461
  //
10309
10462
  };
10310
10463
  }
10311
- const paneview = paneviewRef.current;
10312
- const disposable = paneview.onDidDrop((event) => {
10464
+ const api = paneviewRef.current;
10465
+ const disposable = api.onDidDrop((event) => {
10313
10466
  if (props.onDidDrop) {
10314
- props.onDidDrop(Object.assign(Object.assign({}, event), { api: new PaneviewApi(paneview) }));
10467
+ props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10315
10468
  }
10316
10469
  });
10317
10470
  return () => {
@@ -10373,6 +10526,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10373
10526
  exports.Tab = Tab;
10374
10527
  exports.WillShowOverlayLocationEvent = WillShowOverlayLocationEvent;
10375
10528
  exports.createComponent = createComponent;
10529
+ exports.createDockview = createDockview;
10530
+ exports.createGridview = createGridview;
10531
+ exports.createPaneview = createPaneview;
10532
+ exports.createSplitview = createSplitview;
10376
10533
  exports.directionToPosition = directionToPosition;
10377
10534
  exports.getDirectionOrientation = getDirectionOrientation;
10378
10535
  exports.getGridLocation = getGridLocation;