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
  */
@@ -535,6 +535,26 @@
535
535
  function addTestId(element, id) {
536
536
  element.setAttribute('data-testid', id);
537
537
  }
538
+ function disableIframePointEvents() {
539
+ const iframes = [
540
+ ...getElementsByTagName('iframe'),
541
+ ...getElementsByTagName('webview'),
542
+ ];
543
+ const original = new WeakMap(); // don't hold onto HTMLElement references longer than required
544
+ for (const iframe of iframes) {
545
+ original.set(iframe, iframe.style.pointerEvents);
546
+ iframe.style.pointerEvents = 'none';
547
+ }
548
+ return {
549
+ release: () => {
550
+ var _a;
551
+ for (const iframe of iframes) {
552
+ iframe.style.pointerEvents = (_a = original.get(iframe)) !== null && _a !== void 0 ? _a : 'auto';
553
+ }
554
+ iframes.splice(0, iframes.length); // don't hold onto HTMLElement references longer than required
555
+ },
556
+ };
557
+ }
538
558
 
539
559
  function tail(arr) {
540
560
  if (arr.length === 0) {
@@ -1057,13 +1077,7 @@
1057
1077
  for (const item of this.viewItems) {
1058
1078
  item.enabled = false;
1059
1079
  }
1060
- const iframes = [
1061
- ...getElementsByTagName('iframe'),
1062
- ...getElementsByTagName('webview'),
1063
- ];
1064
- for (const iframe of iframes) {
1065
- iframe.style.pointerEvents = 'none';
1066
- }
1080
+ const iframes = disableIframePointEvents();
1067
1081
  const start = this._orientation === exports.Orientation.HORIZONTAL
1068
1082
  ? event.clientX
1069
1083
  : event.clientY;
@@ -1125,9 +1139,7 @@
1125
1139
  for (const item of this.viewItems) {
1126
1140
  item.enabled = true;
1127
1141
  }
1128
- for (const iframe of iframes) {
1129
- iframe.style.pointerEvents = 'auto';
1130
- }
1142
+ iframes.release();
1131
1143
  this.saveProportions();
1132
1144
  document.removeEventListener('pointermove', onPointerMove);
1133
1145
  document.removeEventListener('pointerup', end);
@@ -1294,29 +1306,47 @@
1294
1306
  if (this.viewItems.length === 0) {
1295
1307
  return;
1296
1308
  }
1297
- const sashCount = this.viewItems.length - 1;
1298
- const marginReducedSize = (this.margin * sashCount) / this.viewItems.length;
1309
+ const visibleViewItems = this.viewItems.filter((i) => i.visible);
1310
+ const sashCount = Math.max(0, visibleViewItems.length - 1);
1311
+ const marginReducedSize = (this.margin * sashCount) / Math.max(1, visibleViewItems.length);
1299
1312
  let totalLeftOffset = 0;
1300
1313
  const viewLeftOffsets = [];
1301
- for (let i = 0; i < this.viewItems.length - 1; i++) {
1302
- totalLeftOffset += this.viewItems[i].size;
1303
- viewLeftOffsets.push(totalLeftOffset);
1304
- const offset = Math.min(Math.max(0, totalLeftOffset - 2), this.size - this.margin);
1305
- if (this._orientation === exports.Orientation.HORIZONTAL) {
1306
- this.sashes[i].container.style.left = `${offset}px`;
1307
- this.sashes[i].container.style.top = `0px`;
1314
+ const sashWidth = 4; // hardcoded in css
1315
+ const runningVisiblePanelCount = this.viewItems.reduce((arr, viewItem, i) => {
1316
+ const flag = viewItem.visible ? 1 : 0;
1317
+ if (i === 0) {
1318
+ arr.push(flag);
1308
1319
  }
1309
- if (this._orientation === exports.Orientation.VERTICAL) {
1310
- this.sashes[i].container.style.left = `0px`;
1311
- this.sashes[i].container.style.top = `${offset}px`;
1320
+ else {
1321
+ arr.push(arr[i - 1] + flag);
1312
1322
  }
1313
- }
1323
+ return arr;
1324
+ }, []);
1325
+ // calculate both view and cash positions
1314
1326
  this.viewItems.forEach((view, i) => {
1315
- const size = view.size - marginReducedSize;
1316
- const offset = i === 0
1327
+ totalLeftOffset += this.viewItems[i].size;
1328
+ viewLeftOffsets.push(totalLeftOffset);
1329
+ const size = view.visible ? view.size - marginReducedSize : 0;
1330
+ const visiblePanelsBeforeThisView = Math.max(0, runningVisiblePanelCount[i] - 1);
1331
+ const offset = i === 0 || visiblePanelsBeforeThisView === 0
1317
1332
  ? 0
1318
1333
  : viewLeftOffsets[i - 1] +
1319
- (i / sashCount) * marginReducedSize;
1334
+ (visiblePanelsBeforeThisView / sashCount) * marginReducedSize;
1335
+ if (i < this.viewItems.length - 1) {
1336
+ // calculate sash position
1337
+ const newSize = view.visible
1338
+ ? offset + size - sashWidth / 2 + this.margin / 2
1339
+ : offset;
1340
+ if (this._orientation === exports.Orientation.HORIZONTAL) {
1341
+ this.sashes[i].container.style.left = `${newSize}px`;
1342
+ this.sashes[i].container.style.top = `0px`;
1343
+ }
1344
+ if (this._orientation === exports.Orientation.VERTICAL) {
1345
+ this.sashes[i].container.style.left = `0px`;
1346
+ this.sashes[i].container.style.top = `${newSize}px`;
1347
+ }
1348
+ }
1349
+ // calculate view position
1320
1350
  if (this._orientation === exports.Orientation.HORIZONTAL) {
1321
1351
  view.container.style.width = `${size}px`;
1322
1352
  view.container.style.left = `${offset}px`;
@@ -2660,6 +2690,9 @@
2660
2690
  this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
2661
2691
  this.element.style.height = '100%';
2662
2692
  this.element.style.width = '100%';
2693
+ if (typeof options.className === 'string') {
2694
+ this.element.classList.add(options.className);
2695
+ }
2663
2696
  options.parentElement.appendChild(this.element);
2664
2697
  this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
2665
2698
  this.gridview.locked = !!options.locked;
@@ -2863,12 +2896,6 @@
2863
2896
  constructor(component) {
2864
2897
  this.component = component;
2865
2898
  }
2866
- /**
2867
- * Update configuratable options.
2868
- */
2869
- updateOptions(options) {
2870
- this.component.updateOptions(options);
2871
- }
2872
2899
  /**
2873
2900
  * Removes an existing panel and optionally provide a `Sizing` method
2874
2901
  * for the subsequent resize.
@@ -2922,6 +2949,18 @@
2922
2949
  clear() {
2923
2950
  this.component.clear();
2924
2951
  }
2952
+ /**
2953
+ * Update configuratable options.
2954
+ */
2955
+ updateOptions(options) {
2956
+ this.component.updateOptions(options);
2957
+ }
2958
+ /**
2959
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
2960
+ */
2961
+ dispose() {
2962
+ this.component.dispose();
2963
+ }
2925
2964
  }
2926
2965
  class PaneviewApi {
2927
2966
  /**
@@ -3049,6 +3088,18 @@
3049
3088
  clear() {
3050
3089
  this.component.clear();
3051
3090
  }
3091
+ /**
3092
+ * Update configuratable options.
3093
+ */
3094
+ updateOptions(options) {
3095
+ this.component.updateOptions(options);
3096
+ }
3097
+ /**
3098
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
3099
+ */
3100
+ dispose() {
3101
+ this.component.dispose();
3102
+ }
3052
3103
  }
3053
3104
  class GridviewApi {
3054
3105
  /**
@@ -3189,6 +3240,15 @@
3189
3240
  clear() {
3190
3241
  this.component.clear();
3191
3242
  }
3243
+ updateOptions(options) {
3244
+ this.component.updateOptions(options);
3245
+ }
3246
+ /**
3247
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
3248
+ */
3249
+ dispose() {
3250
+ this.component.dispose();
3251
+ }
3192
3252
  }
3193
3253
  class DockviewApi {
3194
3254
  /**
@@ -3481,6 +3541,15 @@
3481
3541
  setGap(gap) {
3482
3542
  this.component.updateOptions({ gap });
3483
3543
  }
3544
+ updateOptions(options) {
3545
+ this.component.updateOptions(options);
3546
+ }
3547
+ /**
3548
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
3549
+ */
3550
+ dispose() {
3551
+ this.component.dispose();
3552
+ }
3484
3553
  }
3485
3554
 
3486
3555
  class DragHandler extends CompositeDisposable {
@@ -3503,20 +3572,12 @@
3503
3572
  event.preventDefault();
3504
3573
  return;
3505
3574
  }
3506
- const iframes = [
3507
- ...getElementsByTagName('iframe'),
3508
- ...getElementsByTagName('webview'),
3509
- ];
3575
+ const iframes = disableIframePointEvents();
3510
3576
  this.pointerEventsDisposable.value = {
3511
3577
  dispose: () => {
3512
- for (const iframe of iframes) {
3513
- iframe.style.pointerEvents = 'auto';
3514
- }
3578
+ iframes.release();
3515
3579
  },
3516
3580
  };
3517
- for (const iframe of iframes) {
3518
- iframe.style.pointerEvents = 'none';
3519
- }
3520
3581
  this.el.classList.add('dv-dragged');
3521
3582
  setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
3522
3583
  this.dataDisposable.value = this.getData(event);
@@ -4680,7 +4741,7 @@
4680
4741
  this._element.className = 'void-container';
4681
4742
  this._element.tabIndex = 0;
4682
4743
  this._element.draggable = true;
4683
- this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'click', () => {
4744
+ this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
4684
4745
  this.accessor.doSetGroupActive(this.group);
4685
4746
  }));
4686
4747
  const handler = new GroupDragHandler(this._element, accessor, group);
@@ -4995,6 +5056,7 @@
4995
5056
  locked: undefined,
4996
5057
  disableDnd: undefined,
4997
5058
  gap: undefined,
5059
+ className: undefined,
4998
5060
  };
4999
5061
  return Object.keys(properties);
5000
5062
  })();
@@ -5550,7 +5612,7 @@
5550
5612
  group: this.groupPanel,
5551
5613
  });
5552
5614
  this.watermark = watermark;
5553
- addDisposableListener(this.watermark.element, 'click', () => {
5615
+ addDisposableListener(this.watermark.element, 'pointerdown', () => {
5554
5616
  if (!this.isActive) {
5555
5617
  this.accessor.doSetGroupActive(this.groupPanel);
5556
5618
  }
@@ -6115,7 +6177,7 @@
6115
6177
  // forward the resize event to the group since if you want to resize a panel
6116
6178
  // you are actually just resizing the panels parent which is the group
6117
6179
  this.group.api.setSize(event);
6118
- }), this.api.onDidRendererChange((event) => {
6180
+ }), this.api.onDidRendererChange(() => {
6119
6181
  this.group.model.rerender(this);
6120
6182
  }));
6121
6183
  }
@@ -6451,17 +6513,30 @@
6451
6513
  }
6452
6514
  }
6453
6515
 
6454
- const bringElementToFront = (() => {
6455
- let previous = null;
6456
- function pushToTop(element) {
6457
- if (previous !== element && previous !== null) {
6458
- toggleClass(previous, 'dv-bring-to-front', false);
6516
+ const DEFAULT_OVERLAY_Z_INDEX = 999;
6517
+ class AriaLevelTracker {
6518
+ constructor() {
6519
+ this._orderedList = [];
6520
+ }
6521
+ push(element) {
6522
+ this._orderedList = [
6523
+ ...this._orderedList.filter((item) => item !== element),
6524
+ element,
6525
+ ];
6526
+ this.update();
6527
+ }
6528
+ destroy(element) {
6529
+ this._orderedList = this._orderedList.filter((item) => item !== element);
6530
+ this.update();
6531
+ }
6532
+ update() {
6533
+ for (let i = 0; i < this._orderedList.length; i++) {
6534
+ this._orderedList[i].setAttribute('aria-level', `${i}`);
6535
+ this._orderedList[i].style.zIndex = `${DEFAULT_OVERLAY_Z_INDEX + i * 2}`;
6459
6536
  }
6460
- toggleClass(element, 'dv-bring-to-front', true);
6461
- previous = element;
6462
6537
  }
6463
- return pushToTop;
6464
- })();
6538
+ }
6539
+ const arialLevelTracker = new AriaLevelTracker();
6465
6540
  class Overlay extends CompositeDisposable {
6466
6541
  set minimumInViewportWidth(value) {
6467
6542
  this.options.minimumInViewportWidth = value;
@@ -6469,6 +6544,9 @@
6469
6544
  set minimumInViewportHeight(value) {
6470
6545
  this.options.minimumInViewportHeight = value;
6471
6546
  }
6547
+ get element() {
6548
+ return this._element;
6549
+ }
6472
6550
  constructor(options) {
6473
6551
  super();
6474
6552
  this.options = options;
@@ -6491,6 +6569,10 @@
6491
6569
  this.options.container.appendChild(this._element);
6492
6570
  // if input bad resize within acceptable boundaries
6493
6571
  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 })));
6572
+ arialLevelTracker.push(this._element);
6573
+ }
6574
+ bringToFront() {
6575
+ arialLevelTracker.push(this._element);
6494
6576
  }
6495
6577
  setBounds(bounds = {}) {
6496
6578
  if (typeof bounds.height === 'number') {
@@ -6578,18 +6660,10 @@
6578
6660
  const move = new MutableDisposable();
6579
6661
  const track = () => {
6580
6662
  let offset = null;
6581
- const iframes = [
6582
- ...getElementsByTagName('iframe'),
6583
- ...getElementsByTagName('webview'),
6584
- ];
6585
- for (const iframe of iframes) {
6586
- iframe.style.pointerEvents = 'none';
6587
- }
6663
+ const iframes = disableIframePointEvents();
6588
6664
  move.value = new CompositeDisposable({
6589
6665
  dispose: () => {
6590
- for (const iframe of iframes) {
6591
- iframe.style.pointerEvents = 'auto';
6592
- }
6666
+ iframes.release();
6593
6667
  },
6594
6668
  }, addDisposableWindowListener(window, 'mousemove', (e) => {
6595
6669
  const containerRect = this.options.container.getBoundingClientRect();
@@ -6658,9 +6732,8 @@
6658
6732
  track();
6659
6733
  }
6660
6734
  }), addDisposableListener(this.options.content, 'mousedown', () => {
6661
- bringElementToFront(this._element);
6735
+ arialLevelTracker.push(this._element);
6662
6736
  }, true));
6663
- bringElementToFront(this._element);
6664
6737
  if (options.inDragMode) {
6665
6738
  track();
6666
6739
  }
@@ -6673,13 +6746,7 @@
6673
6746
  this.addDisposables(move, addDisposableListener(resizeHandleElement, 'mousedown', (e) => {
6674
6747
  e.preventDefault();
6675
6748
  let startPosition = null;
6676
- const iframes = [
6677
- ...getElementsByTagName('iframe'),
6678
- ...getElementsByTagName('webview'),
6679
- ];
6680
- for (const iframe of iframes) {
6681
- iframe.style.pointerEvents = 'none';
6682
- }
6749
+ const iframes = disableIframePointEvents();
6683
6750
  move.value = new CompositeDisposable(addDisposableWindowListener(window, 'mousemove', (e) => {
6684
6751
  const containerRect = this.options.container.getBoundingClientRect();
6685
6752
  const overlayRect = this._element.getBoundingClientRect();
@@ -6802,9 +6869,7 @@
6802
6869
  this.setBounds(bounds);
6803
6870
  }), {
6804
6871
  dispose: () => {
6805
- for (const iframe of iframes) {
6806
- iframe.style.pointerEvents = 'auto';
6807
- }
6872
+ iframes.release();
6808
6873
  },
6809
6874
  }, addDisposableWindowListener(window, 'mouseup', () => {
6810
6875
  move.dispose();
@@ -6825,6 +6890,7 @@
6825
6890
  return 0;
6826
6891
  }
6827
6892
  dispose() {
6893
+ arialLevelTracker.destroy(this._element);
6828
6894
  this._element.remove();
6829
6895
  super.dispose();
6830
6896
  }
@@ -6853,9 +6919,10 @@
6853
6919
  return element;
6854
6920
  }
6855
6921
  class OverlayRenderContainer extends CompositeDisposable {
6856
- constructor(element) {
6922
+ constructor(element, accessor) {
6857
6923
  super();
6858
6924
  this.element = element;
6925
+ this.accessor = accessor;
6859
6926
  this.map = {};
6860
6927
  this._disposed = false;
6861
6928
  this.addDisposables(exports.DockviewDisposable.from(() => {
@@ -6911,7 +6978,35 @@
6911
6978
  }
6912
6979
  focusContainer.style.display = panel.api.isVisible ? '' : 'none';
6913
6980
  };
6914
- const disposable = new CompositeDisposable(
6981
+ const observerDisposable = new MutableDisposable();
6982
+ const correctLayerPosition = () => {
6983
+ if (panel.api.location.type === 'floating') {
6984
+ queueMicrotask(() => {
6985
+ const floatingGroup = this.accessor.floatingGroups.find((group) => group.group === panel.api.group);
6986
+ if (!floatingGroup) {
6987
+ return;
6988
+ }
6989
+ const element = floatingGroup.overlay.element;
6990
+ const update = () => {
6991
+ const level = Number(element.getAttribute('aria-level'));
6992
+ focusContainer.style.zIndex = `${DEFAULT_OVERLAY_Z_INDEX + level * 2 + 1}`;
6993
+ };
6994
+ const observer = new MutationObserver(() => {
6995
+ update();
6996
+ });
6997
+ observerDisposable.value = exports.DockviewDisposable.from(() => observer.disconnect());
6998
+ observer.observe(element, {
6999
+ attributeFilter: ['aria-level'],
7000
+ attributes: true,
7001
+ });
7002
+ update();
7003
+ });
7004
+ }
7005
+ else {
7006
+ focusContainer.style.zIndex = ''; // reset the z-index, perhaps CSS will take over here
7007
+ }
7008
+ };
7009
+ const disposable = new CompositeDisposable(observerDisposable,
6915
7010
  /**
6916
7011
  * since container is positioned absoutely we must explicitly forward
6917
7012
  * the dnd events for the expect behaviours to continue to occur in terms of dnd
@@ -6935,7 +7030,7 @@
6935
7030
  onDragOver: (e) => {
6936
7031
  referenceContainer.dropTarget.dnd.onDragOver(e);
6937
7032
  },
6938
- }), panel.api.onDidVisibilityChange((event) => {
7033
+ }), panel.api.onDidVisibilityChange(() => {
6939
7034
  /**
6940
7035
  * Control the visibility of the content, however even when not visible (display: none)
6941
7036
  * the content is still maintained within the DOM hence DOM specific attributes
@@ -6947,6 +7042,8 @@
6947
7042
  return;
6948
7043
  }
6949
7044
  resize();
7045
+ }), panel.api.onDidLocationChange(() => {
7046
+ correctLayerPosition();
6950
7047
  }));
6951
7048
  this.map[panel.api.id].destroy = exports.DockviewDisposable.from(() => {
6952
7049
  var _a;
@@ -6955,6 +7052,7 @@
6955
7052
  }
6956
7053
  (_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
6957
7054
  });
7055
+ correctLayerPosition();
6958
7056
  queueMicrotask(() => {
6959
7057
  if (this.isDisposed) {
6960
7058
  return;
@@ -7180,7 +7278,10 @@
7180
7278
  get gap() {
7181
7279
  return this.gridview.margin;
7182
7280
  }
7183
- constructor(options) {
7281
+ get floatingGroups() {
7282
+ return this._floatingGroups;
7283
+ }
7284
+ constructor(parentElement, options) {
7184
7285
  var _a;
7185
7286
  super({
7186
7287
  proportionalLayout: true,
@@ -7188,10 +7289,11 @@
7188
7289
  styles: options.hideBorders
7189
7290
  ? { separatorBorder: 'transparent' }
7190
7291
  : undefined,
7191
- parentElement: options.parentElement,
7292
+ parentElement: parentElement,
7192
7293
  disableAutoResizing: options.disableAutoResizing,
7193
7294
  locked: options.locked,
7194
7295
  margin: options.gap,
7296
+ className: options.className,
7195
7297
  });
7196
7298
  this.nextGroupId = sequentialNumberGenerator();
7197
7299
  this._deserializer = new DefaultDockviewDeserialzier(this);
@@ -7227,10 +7329,10 @@
7227
7329
  this._onDidActiveGroupChange = new Emitter();
7228
7330
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
7229
7331
  this._moving = false;
7230
- const gready = document.createElement('div');
7231
- gready.className = 'dv-overlay-render-container';
7232
- this.gridview.element.appendChild(gready);
7233
- this.overlayRenderContainer = new OverlayRenderContainer(gready);
7332
+ // const gready = document.createElement('div');
7333
+ // gready.className = 'dv-overlay-render-container';
7334
+ // this.gridview.element.appendChild(gready);
7335
+ this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
7234
7336
  toggleClass(this.gridview.element, 'dv-dockview', true);
7235
7337
  toggleClass(this.element, 'dv-debug', !!options.debug);
7236
7338
  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(() => {
@@ -7396,7 +7498,7 @@
7396
7498
  }
7397
7499
  const gready = document.createElement('div');
7398
7500
  gready.className = 'dv-overlay-render-container';
7399
- const overlayRenderContainer = new OverlayRenderContainer(gready);
7501
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
7400
7502
  const referenceGroup = itemToPopout instanceof DockviewPanel
7401
7503
  ? itemToPopout.group
7402
7504
  : itemToPopout;
@@ -7545,7 +7647,6 @@
7545
7647
  }
7546
7648
  }
7547
7649
  }
7548
- group.model.location = { type: 'floating' };
7549
7650
  function getAnchoredBox() {
7550
7651
  if (options === null || options === void 0 ? void 0 : options.position) {
7551
7652
  const result = {};
@@ -7612,10 +7713,14 @@
7612
7713
  : false,
7613
7714
  });
7614
7715
  const floatingGroupPanel = new DockviewFloatingGroupPanel(group, overlay);
7615
- const disposable = watchElementResize(group.element, (entry) => {
7716
+ const disposable = new CompositeDisposable(group.api.onDidActiveChange((event) => {
7717
+ if (event.isActive) {
7718
+ overlay.bringToFront();
7719
+ }
7720
+ }), watchElementResize(group.element, (entry) => {
7616
7721
  const { width, height } = entry.contentRect;
7617
7722
  group.layout(width, height); // let the group know it's size is changing so it can fire events to the panel
7618
- });
7723
+ }));
7619
7724
  floatingGroupPanel.addDisposables(overlay.onDidChange(() => {
7620
7725
  // this is either a resize or a move
7621
7726
  // to inform the panels .layout(...) the group with it's current size
@@ -7631,12 +7736,13 @@
7631
7736
  }), {
7632
7737
  dispose: () => {
7633
7738
  disposable.dispose();
7634
- group.model.location = { type: 'grid' };
7635
7739
  remove(this._floatingGroups, floatingGroupPanel);
7740
+ group.model.location = { type: 'grid' };
7636
7741
  this.updateWatermark();
7637
7742
  },
7638
7743
  });
7639
7744
  this._floatingGroups.push(floatingGroupPanel);
7745
+ group.model.location = { type: 'floating' };
7640
7746
  if (!(options === null || options === void 0 ? void 0 : options.skipActiveGroup)) {
7641
7747
  this.doSetGroupAndPanelActive(group);
7642
7748
  }
@@ -7876,6 +7982,8 @@
7876
7982
  const group = createGroupFromSerializedState(data);
7877
7983
  this.addFloatingGroup(group, {
7878
7984
  position: position,
7985
+ width: position.width,
7986
+ height: position.height,
7879
7987
  skipRemoveGroup: true,
7880
7988
  inDragMode: false,
7881
7989
  });
@@ -8216,6 +8324,7 @@
8216
8324
  this._groups.delete(group.id);
8217
8325
  this._onDidRemoveGroup.fire(group);
8218
8326
  }
8327
+ remove(this._popoutGroups, selectedGroup);
8219
8328
  const removedGroup = selectedGroup.disposable.dispose();
8220
8329
  if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
8221
8330
  this.doAddGroup(removedGroup, [0]);
@@ -8327,6 +8436,31 @@
8327
8436
  return;
8328
8437
  }
8329
8438
  }
8439
+ if (sourceGroup.api.location.type === 'popout') {
8440
+ /**
8441
+ * the source group is a popout group with a single panel
8442
+ *
8443
+ * 1. remove the panel from the group without triggering any events
8444
+ * 2. remove the popout group
8445
+ * 3. create a new group at the requested location and add that panel
8446
+ */
8447
+ const popoutGroup = this._popoutGroups.find((group) => group.popoutGroup === sourceGroup);
8448
+ const removedPanel = this.movingLock(() => popoutGroup.popoutGroup.model.removePanel(popoutGroup.popoutGroup.panels[0], {
8449
+ skipSetActive: true,
8450
+ skipSetActiveGroup: true,
8451
+ }));
8452
+ this.doRemoveGroup(sourceGroup, { skipActive: true });
8453
+ const newGroup = this.createGroupAtLocation(targetLocation);
8454
+ this.movingLock(() => newGroup.model.openPanel(removedPanel, {
8455
+ skipSetActive: true,
8456
+ }));
8457
+ this.doSetGroupAndPanelActive(newGroup);
8458
+ this._onDidMovePanel.fire({
8459
+ panel: this.getGroupPanel(sourceItemId),
8460
+ from: sourceGroup,
8461
+ });
8462
+ return;
8463
+ }
8330
8464
  // source group will become empty so delete the group
8331
8465
  const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {
8332
8466
  skipActive: true,
@@ -8558,13 +8692,14 @@
8558
8692
  set deserializer(value) {
8559
8693
  this._deserializer = value;
8560
8694
  }
8561
- constructor(options) {
8695
+ constructor(parentElement, options) {
8562
8696
  super({
8563
- parentElement: options.parentElement,
8697
+ parentElement: parentElement,
8564
8698
  proportionalLayout: options.proportionalLayout,
8565
8699
  orientation: options.orientation,
8566
8700
  styles: options.styles,
8567
8701
  disableAutoResizing: options.disableAutoResizing,
8702
+ className: options.className,
8568
8703
  });
8569
8704
  this._onDidLayoutfromJSON = new Emitter();
8570
8705
  this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
@@ -8856,8 +8991,8 @@
8856
8991
  ? this.splitview.size
8857
8992
  : this.splitview.orthogonalSize;
8858
8993
  }
8859
- constructor(options) {
8860
- super(options.parentElement, options.disableAutoResizing);
8994
+ constructor(parentElement, options) {
8995
+ super(parentElement, options.disableAutoResizing);
8861
8996
  this._splitviewChangeDisposable = new MutableDisposable();
8862
8997
  this._panels = new Map();
8863
8998
  this._onDidLayoutfromJSON = new Emitter();
@@ -8868,6 +9003,9 @@
8868
9003
  this.onDidRemoveView = this._onDidRemoveView.event;
8869
9004
  this._onDidLayoutChange = new Emitter();
8870
9005
  this.onDidLayoutChange = this._onDidLayoutChange.event;
9006
+ if (typeof options.className === 'string') {
9007
+ this.element.classList.add(options.className);
9008
+ }
8871
9009
  this._options = options;
8872
9010
  if (!options.components) {
8873
9011
  options.components = {};
@@ -9180,8 +9318,8 @@
9180
9318
  get options() {
9181
9319
  return this._options;
9182
9320
  }
9183
- constructor(options) {
9184
- super(options.parentElement, options.disableAutoResizing);
9321
+ constructor(parentElement, options) {
9322
+ super(parentElement, options.disableAutoResizing);
9185
9323
  this._id = nextLayoutId.next();
9186
9324
  this._disposable = new MutableDisposable();
9187
9325
  this._viewDisposables = new Map();
@@ -9195,6 +9333,9 @@
9195
9333
  this.onDidAddView = this._onDidAddView.event;
9196
9334
  this._onDidRemoveView = new Emitter();
9197
9335
  this.onDidRemoveView = this._onDidRemoveView.event;
9336
+ if (typeof options.className === 'string') {
9337
+ this.element.classList.add(options.className);
9338
+ }
9198
9339
  this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9199
9340
  this._options = options;
9200
9341
  if (!options.components) {
@@ -9510,6 +9651,23 @@
9510
9651
  }
9511
9652
  }
9512
9653
 
9654
+ function createDockview(element, options) {
9655
+ const component = new DockviewComponent(element, options);
9656
+ return component.api;
9657
+ }
9658
+ function createSplitview(element, options) {
9659
+ const component = new SplitviewComponent(element, options);
9660
+ return new SplitviewApi(component);
9661
+ }
9662
+ function createGridview(element, options) {
9663
+ const component = new GridviewComponent(element, options);
9664
+ return new GridviewApi(component);
9665
+ }
9666
+ function createPaneview(element, options) {
9667
+ const component = new PaneviewComponent(element, options);
9668
+ return new PaneviewApi(component);
9669
+ }
9670
+
9513
9671
  /**
9514
9672
  * This component is intended to interface between vanilla-js and React hence we need to be
9515
9673
  * creative in how we update props.
@@ -9889,20 +10047,19 @@
9889
10047
  });
9890
10048
  }
9891
10049
  : undefined,
9892
- parentElement: domRef.current,
9893
10050
  defaultTabComponent: props.defaultTabComponent
9894
10051
  ? DEFAULT_REACT_TAB
9895
10052
  : undefined,
9896
10053
  };
9897
- const dockview = new DockviewComponent(Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10054
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
9898
10055
  const { clientWidth, clientHeight } = domRef.current;
9899
- dockview.layout(clientWidth, clientHeight);
10056
+ api.layout(clientWidth, clientHeight);
9900
10057
  if (props.onReady) {
9901
- props.onReady({ api: new DockviewApi(dockview) });
10058
+ props.onReady({ api });
9902
10059
  }
9903
- dockviewRef.current = dockview;
10060
+ dockviewRef.current = api;
9904
10061
  return () => {
9905
- dockview.dispose();
10062
+ api.dispose();
9906
10063
  };
9907
10064
  }, []);
9908
10065
  React.useEffect(() => {
@@ -10105,8 +10262,7 @@
10105
10262
  React.useImperativeHandle(ref, () => domRef.current, []);
10106
10263
  React.useEffect(() => {
10107
10264
  var _a;
10108
- const splitview = new SplitviewComponent({
10109
- parentElement: domRef.current,
10265
+ const api = createSplitview(domRef.current, {
10110
10266
  disableAutoResizing: props.disableAutoResizing,
10111
10267
  orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10112
10268
  frameworkComponents: props.components,
@@ -10125,13 +10281,13 @@
10125
10281
  : undefined,
10126
10282
  });
10127
10283
  const { clientWidth, clientHeight } = domRef.current;
10128
- splitview.layout(clientWidth, clientHeight);
10284
+ api.layout(clientWidth, clientHeight);
10129
10285
  if (props.onReady) {
10130
- props.onReady({ api: new SplitviewApi(splitview) });
10286
+ props.onReady({ api });
10131
10287
  }
10132
- splitviewRef.current = splitview;
10288
+ splitviewRef.current = api;
10133
10289
  return () => {
10134
- splitview.dispose();
10290
+ api.dispose();
10135
10291
  };
10136
10292
  }, []);
10137
10293
  React.useEffect(() => {
@@ -10176,8 +10332,7 @@
10176
10332
  // noop
10177
10333
  };
10178
10334
  }
10179
- const gridview = new GridviewComponent({
10180
- parentElement: domRef.current,
10335
+ const api = createGridview(domRef.current, {
10181
10336
  disableAutoResizing: props.disableAutoResizing,
10182
10337
  proportionalLayout: typeof props.proportionalLayout === 'boolean'
10183
10338
  ? props.proportionalLayout
@@ -10196,13 +10351,13 @@
10196
10351
  : undefined,
10197
10352
  });
10198
10353
  const { clientWidth, clientHeight } = domRef.current;
10199
- gridview.layout(clientWidth, clientHeight);
10354
+ api.layout(clientWidth, clientHeight);
10200
10355
  if (props.onReady) {
10201
- props.onReady({ api: new GridviewApi(gridview) });
10356
+ props.onReady({ api });
10202
10357
  }
10203
- gridviewRef.current = gridview;
10358
+ gridviewRef.current = api;
10204
10359
  return () => {
10205
- gridview.dispose();
10360
+ api.dispose();
10206
10361
  };
10207
10362
  }, []);
10208
10363
  React.useEffect(() => {
@@ -10261,8 +10416,7 @@
10261
10416
  const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10262
10417
  addPortal,
10263
10418
  });
10264
- const paneview = new PaneviewComponent({
10265
- parentElement: domRef.current,
10419
+ const api = createPaneview(domRef.current, {
10266
10420
  disableAutoResizing: props.disableAutoResizing,
10267
10421
  frameworkComponents: props.components,
10268
10422
  components: {},
@@ -10279,15 +10433,14 @@
10279
10433
  },
10280
10434
  showDndOverlay: props.showDndOverlay,
10281
10435
  });
10282
- const api = new PaneviewApi(paneview);
10283
10436
  const { clientWidth, clientHeight } = domRef.current;
10284
- paneview.layout(clientWidth, clientHeight);
10437
+ api.layout(clientWidth, clientHeight);
10285
10438
  if (props.onReady) {
10286
10439
  props.onReady({ api });
10287
10440
  }
10288
- paneviewRef.current = paneview;
10441
+ paneviewRef.current = api;
10289
10442
  return () => {
10290
- paneview.dispose();
10443
+ api.dispose();
10291
10444
  };
10292
10445
  }, []);
10293
10446
  React.useEffect(() => {
@@ -10312,10 +10465,10 @@
10312
10465
  //
10313
10466
  };
10314
10467
  }
10315
- const paneview = paneviewRef.current;
10316
- const disposable = paneview.onDidDrop((event) => {
10468
+ const api = paneviewRef.current;
10469
+ const disposable = api.onDidDrop((event) => {
10317
10470
  if (props.onDidDrop) {
10318
- props.onDidDrop(Object.assign(Object.assign({}, event), { api: new PaneviewApi(paneview) }));
10471
+ props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10319
10472
  }
10320
10473
  });
10321
10474
  return () => {
@@ -10377,6 +10530,10 @@
10377
10530
  exports.Tab = Tab;
10378
10531
  exports.WillShowOverlayLocationEvent = WillShowOverlayLocationEvent;
10379
10532
  exports.createComponent = createComponent;
10533
+ exports.createDockview = createDockview;
10534
+ exports.createGridview = createGridview;
10535
+ exports.createPaneview = createPaneview;
10536
+ exports.createSplitview = createSplitview;
10380
10537
  exports.directionToPosition = directionToPosition;
10381
10538
  exports.getDirectionOrientation = getDirectionOrientation;
10382
10539
  exports.getGridLocation = getGridLocation;