dockview-react 1.15.3 → 1.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 1.15.3
3
+ * @version 1.16.1
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`;
@@ -2641,6 +2671,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2641
2671
  this.gridview.locked = value;
2642
2672
  }
2643
2673
  constructor(options) {
2674
+ var _a, _b;
2644
2675
  super(document.createElement('div'), options.disableAutoResizing);
2645
2676
  this._id = nextLayoutId$1.next();
2646
2677
  this._groups = new Map();
@@ -2654,8 +2685,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2654
2685
  this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
2655
2686
  this._onDidViewVisibilityChangeMicroTaskQueue = new AsapEvent();
2656
2687
  this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
2688
+ this.classNames = [];
2657
2689
  this.element.style.height = '100%';
2658
2690
  this.element.style.width = '100%';
2691
+ this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
2692
+ for (const className of this.classNames) {
2693
+ toggleClass(this.element, className, true);
2694
+ }
2659
2695
  options.parentElement.appendChild(this.element);
2660
2696
  this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
2661
2697
  this.gridview.locked = !!options.locked;
@@ -2679,6 +2715,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2679
2715
  isVisible(panel) {
2680
2716
  return this.gridview.isViewVisible(getGridLocation(panel.element));
2681
2717
  }
2718
+ updateOptions(options) {
2719
+ var _a, _b;
2720
+ if ('className' in options) {
2721
+ for (const className of this.classNames) {
2722
+ toggleClass(this.element, className, false);
2723
+ }
2724
+ this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
2725
+ for (const className of this.classNames) {
2726
+ toggleClass(this.element, className, true);
2727
+ }
2728
+ }
2729
+ }
2682
2730
  maximizeGroup(panel) {
2683
2731
  this.gridview.maximizeView(panel);
2684
2732
  this.doSetGroupActive(panel);
@@ -2859,12 +2907,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2859
2907
  constructor(component) {
2860
2908
  this.component = component;
2861
2909
  }
2862
- /**
2863
- * Update configuratable options.
2864
- */
2865
- updateOptions(options) {
2866
- this.component.updateOptions(options);
2867
- }
2868
2910
  /**
2869
2911
  * Removes an existing panel and optionally provide a `Sizing` method
2870
2912
  * for the subsequent resize.
@@ -2918,6 +2960,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2918
2960
  clear() {
2919
2961
  this.component.clear();
2920
2962
  }
2963
+ /**
2964
+ * Update configuratable options.
2965
+ */
2966
+ updateOptions(options) {
2967
+ this.component.updateOptions(options);
2968
+ }
2969
+ /**
2970
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
2971
+ */
2972
+ dispose() {
2973
+ this.component.dispose();
2974
+ }
2921
2975
  }
2922
2976
  class PaneviewApi {
2923
2977
  /**
@@ -3045,6 +3099,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3045
3099
  clear() {
3046
3100
  this.component.clear();
3047
3101
  }
3102
+ /**
3103
+ * Update configuratable options.
3104
+ */
3105
+ updateOptions(options) {
3106
+ this.component.updateOptions(options);
3107
+ }
3108
+ /**
3109
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
3110
+ */
3111
+ dispose() {
3112
+ this.component.dispose();
3113
+ }
3048
3114
  }
3049
3115
  class GridviewApi {
3050
3116
  /**
@@ -3185,6 +3251,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3185
3251
  clear() {
3186
3252
  this.component.clear();
3187
3253
  }
3254
+ updateOptions(options) {
3255
+ this.component.updateOptions(options);
3256
+ }
3257
+ /**
3258
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
3259
+ */
3260
+ dispose() {
3261
+ this.component.dispose();
3262
+ }
3188
3263
  }
3189
3264
  class DockviewApi {
3190
3265
  /**
@@ -3477,6 +3552,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3477
3552
  setGap(gap) {
3478
3553
  this.component.updateOptions({ gap });
3479
3554
  }
3555
+ updateOptions(options) {
3556
+ this.component.updateOptions(options);
3557
+ }
3558
+ /**
3559
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
3560
+ */
3561
+ dispose() {
3562
+ this.component.dispose();
3563
+ }
3480
3564
  }
3481
3565
 
3482
3566
  class DragHandler extends CompositeDisposable {
@@ -3499,20 +3583,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3499
3583
  event.preventDefault();
3500
3584
  return;
3501
3585
  }
3502
- const iframes = [
3503
- ...getElementsByTagName('iframe'),
3504
- ...getElementsByTagName('webview'),
3505
- ];
3586
+ const iframes = disableIframePointEvents();
3506
3587
  this.pointerEventsDisposable.value = {
3507
3588
  dispose: () => {
3508
- for (const iframe of iframes) {
3509
- iframe.style.pointerEvents = 'auto';
3510
- }
3589
+ iframes.release();
3511
3590
  },
3512
3591
  };
3513
- for (const iframe of iframes) {
3514
- iframe.style.pointerEvents = 'none';
3515
- }
3516
3592
  this.el.classList.add('dv-dragged');
3517
3593
  setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
3518
3594
  this.dataDisposable.value = this.getData(event);
@@ -4676,7 +4752,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4676
4752
  this._element.className = 'void-container';
4677
4753
  this._element.tabIndex = 0;
4678
4754
  this._element.draggable = true;
4679
- this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'click', () => {
4755
+ this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
4680
4756
  this.accessor.doSetGroupActive(this.group);
4681
4757
  }));
4682
4758
  const handler = new GroupDragHandler(this._element, accessor, group);
@@ -4991,6 +5067,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4991
5067
  locked: undefined,
4992
5068
  disableDnd: undefined,
4993
5069
  gap: undefined,
5070
+ className: undefined,
4994
5071
  };
4995
5072
  return Object.keys(properties);
4996
5073
  })();
@@ -5546,7 +5623,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5546
5623
  group: this.groupPanel,
5547
5624
  });
5548
5625
  this.watermark = watermark;
5549
- addDisposableListener(this.watermark.element, 'click', () => {
5626
+ addDisposableListener(this.watermark.element, 'pointerdown', () => {
5550
5627
  if (!this.isActive) {
5551
5628
  this.accessor.doSetGroupActive(this.groupPanel);
5552
5629
  }
@@ -6111,7 +6188,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6111
6188
  // forward the resize event to the group since if you want to resize a panel
6112
6189
  // you are actually just resizing the panels parent which is the group
6113
6190
  this.group.api.setSize(event);
6114
- }), this.api.onDidRendererChange((event) => {
6191
+ }), this.api.onDidRendererChange(() => {
6115
6192
  this.group.model.rerender(this);
6116
6193
  }));
6117
6194
  }
@@ -6447,17 +6524,30 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6447
6524
  }
6448
6525
  }
6449
6526
 
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);
6527
+ const DEFAULT_OVERLAY_Z_INDEX = 999;
6528
+ class AriaLevelTracker {
6529
+ constructor() {
6530
+ this._orderedList = [];
6531
+ }
6532
+ push(element) {
6533
+ this._orderedList = [
6534
+ ...this._orderedList.filter((item) => item !== element),
6535
+ element,
6536
+ ];
6537
+ this.update();
6538
+ }
6539
+ destroy(element) {
6540
+ this._orderedList = this._orderedList.filter((item) => item !== element);
6541
+ this.update();
6542
+ }
6543
+ update() {
6544
+ for (let i = 0; i < this._orderedList.length; i++) {
6545
+ this._orderedList[i].setAttribute('aria-level', `${i}`);
6546
+ this._orderedList[i].style.zIndex = `${DEFAULT_OVERLAY_Z_INDEX + i * 2}`;
6455
6547
  }
6456
- toggleClass(element, 'dv-bring-to-front', true);
6457
- previous = element;
6458
6548
  }
6459
- return pushToTop;
6460
- })();
6549
+ }
6550
+ const arialLevelTracker = new AriaLevelTracker();
6461
6551
  class Overlay extends CompositeDisposable {
6462
6552
  set minimumInViewportWidth(value) {
6463
6553
  this.options.minimumInViewportWidth = value;
@@ -6465,6 +6555,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6465
6555
  set minimumInViewportHeight(value) {
6466
6556
  this.options.minimumInViewportHeight = value;
6467
6557
  }
6558
+ get element() {
6559
+ return this._element;
6560
+ }
6468
6561
  constructor(options) {
6469
6562
  super();
6470
6563
  this.options = options;
@@ -6487,6 +6580,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6487
6580
  this.options.container.appendChild(this._element);
6488
6581
  // if input bad resize within acceptable boundaries
6489
6582
  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 })));
6583
+ arialLevelTracker.push(this._element);
6584
+ }
6585
+ bringToFront() {
6586
+ arialLevelTracker.push(this._element);
6490
6587
  }
6491
6588
  setBounds(bounds = {}) {
6492
6589
  if (typeof bounds.height === 'number') {
@@ -6574,18 +6671,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6574
6671
  const move = new MutableDisposable();
6575
6672
  const track = () => {
6576
6673
  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
- }
6674
+ const iframes = disableIframePointEvents();
6584
6675
  move.value = new CompositeDisposable({
6585
6676
  dispose: () => {
6586
- for (const iframe of iframes) {
6587
- iframe.style.pointerEvents = 'auto';
6588
- }
6677
+ iframes.release();
6589
6678
  },
6590
6679
  }, addDisposableWindowListener(window, 'mousemove', (e) => {
6591
6680
  const containerRect = this.options.container.getBoundingClientRect();
@@ -6654,9 +6743,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6654
6743
  track();
6655
6744
  }
6656
6745
  }), addDisposableListener(this.options.content, 'mousedown', () => {
6657
- bringElementToFront(this._element);
6746
+ arialLevelTracker.push(this._element);
6658
6747
  }, true));
6659
- bringElementToFront(this._element);
6660
6748
  if (options.inDragMode) {
6661
6749
  track();
6662
6750
  }
@@ -6669,13 +6757,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6669
6757
  this.addDisposables(move, addDisposableListener(resizeHandleElement, 'mousedown', (e) => {
6670
6758
  e.preventDefault();
6671
6759
  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
- }
6760
+ const iframes = disableIframePointEvents();
6679
6761
  move.value = new CompositeDisposable(addDisposableWindowListener(window, 'mousemove', (e) => {
6680
6762
  const containerRect = this.options.container.getBoundingClientRect();
6681
6763
  const overlayRect = this._element.getBoundingClientRect();
@@ -6798,9 +6880,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6798
6880
  this.setBounds(bounds);
6799
6881
  }), {
6800
6882
  dispose: () => {
6801
- for (const iframe of iframes) {
6802
- iframe.style.pointerEvents = 'auto';
6803
- }
6883
+ iframes.release();
6804
6884
  },
6805
6885
  }, addDisposableWindowListener(window, 'mouseup', () => {
6806
6886
  move.dispose();
@@ -6821,6 +6901,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6821
6901
  return 0;
6822
6902
  }
6823
6903
  dispose() {
6904
+ arialLevelTracker.destroy(this._element);
6824
6905
  this._element.remove();
6825
6906
  super.dispose();
6826
6907
  }
@@ -6849,9 +6930,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6849
6930
  return element;
6850
6931
  }
6851
6932
  class OverlayRenderContainer extends CompositeDisposable {
6852
- constructor(element) {
6933
+ constructor(element, accessor) {
6853
6934
  super();
6854
6935
  this.element = element;
6936
+ this.accessor = accessor;
6855
6937
  this.map = {};
6856
6938
  this._disposed = false;
6857
6939
  this.addDisposables(exports.DockviewDisposable.from(() => {
@@ -6907,7 +6989,35 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6907
6989
  }
6908
6990
  focusContainer.style.display = panel.api.isVisible ? '' : 'none';
6909
6991
  };
6910
- const disposable = new CompositeDisposable(
6992
+ const observerDisposable = new MutableDisposable();
6993
+ const correctLayerPosition = () => {
6994
+ if (panel.api.location.type === 'floating') {
6995
+ queueMicrotask(() => {
6996
+ const floatingGroup = this.accessor.floatingGroups.find((group) => group.group === panel.api.group);
6997
+ if (!floatingGroup) {
6998
+ return;
6999
+ }
7000
+ const element = floatingGroup.overlay.element;
7001
+ const update = () => {
7002
+ const level = Number(element.getAttribute('aria-level'));
7003
+ focusContainer.style.zIndex = `${DEFAULT_OVERLAY_Z_INDEX + level * 2 + 1}`;
7004
+ };
7005
+ const observer = new MutationObserver(() => {
7006
+ update();
7007
+ });
7008
+ observerDisposable.value = exports.DockviewDisposable.from(() => observer.disconnect());
7009
+ observer.observe(element, {
7010
+ attributeFilter: ['aria-level'],
7011
+ attributes: true,
7012
+ });
7013
+ update();
7014
+ });
7015
+ }
7016
+ else {
7017
+ focusContainer.style.zIndex = ''; // reset the z-index, perhaps CSS will take over here
7018
+ }
7019
+ };
7020
+ const disposable = new CompositeDisposable(observerDisposable,
6911
7021
  /**
6912
7022
  * since container is positioned absoutely we must explicitly forward
6913
7023
  * the dnd events for the expect behaviours to continue to occur in terms of dnd
@@ -6931,7 +7041,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6931
7041
  onDragOver: (e) => {
6932
7042
  referenceContainer.dropTarget.dnd.onDragOver(e);
6933
7043
  },
6934
- }), panel.api.onDidVisibilityChange((event) => {
7044
+ }), panel.api.onDidVisibilityChange(() => {
6935
7045
  /**
6936
7046
  * Control the visibility of the content, however even when not visible (display: none)
6937
7047
  * the content is still maintained within the DOM hence DOM specific attributes
@@ -6943,6 +7053,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6943
7053
  return;
6944
7054
  }
6945
7055
  resize();
7056
+ }), panel.api.onDidLocationChange(() => {
7057
+ correctLayerPosition();
6946
7058
  }));
6947
7059
  this.map[panel.api.id].destroy = exports.DockviewDisposable.from(() => {
6948
7060
  var _a;
@@ -6951,6 +7063,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6951
7063
  }
6952
7064
  (_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
6953
7065
  });
7066
+ correctLayerPosition();
6954
7067
  queueMicrotask(() => {
6955
7068
  if (this.isDisposed) {
6956
7069
  return;
@@ -7176,7 +7289,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7176
7289
  get gap() {
7177
7290
  return this.gridview.margin;
7178
7291
  }
7179
- constructor(options) {
7292
+ get floatingGroups() {
7293
+ return this._floatingGroups;
7294
+ }
7295
+ constructor(parentElement, options) {
7180
7296
  var _a;
7181
7297
  super({
7182
7298
  proportionalLayout: true,
@@ -7184,10 +7300,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7184
7300
  styles: options.hideBorders
7185
7301
  ? { separatorBorder: 'transparent' }
7186
7302
  : undefined,
7187
- parentElement: options.parentElement,
7303
+ parentElement: parentElement,
7188
7304
  disableAutoResizing: options.disableAutoResizing,
7189
7305
  locked: options.locked,
7190
7306
  margin: options.gap,
7307
+ className: options.className,
7191
7308
  });
7192
7309
  this.nextGroupId = sequentialNumberGenerator();
7193
7310
  this._deserializer = new DefaultDockviewDeserialzier(this);
@@ -7223,10 +7340,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7223
7340
  this._onDidActiveGroupChange = new Emitter();
7224
7341
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
7225
7342
  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);
7343
+ // const gready = document.createElement('div');
7344
+ // gready.className = 'dv-overlay-render-container';
7345
+ // this.gridview.element.appendChild(gready);
7346
+ this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
7230
7347
  toggleClass(this.gridview.element, 'dv-dockview', true);
7231
7348
  toggleClass(this.element, 'dv-debug', !!options.debug);
7232
7349
  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 +7509,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7392
7509
  }
7393
7510
  const gready = document.createElement('div');
7394
7511
  gready.className = 'dv-overlay-render-container';
7395
- const overlayRenderContainer = new OverlayRenderContainer(gready);
7512
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
7396
7513
  const referenceGroup = itemToPopout instanceof DockviewPanel
7397
7514
  ? itemToPopout.group
7398
7515
  : itemToPopout;
@@ -7541,7 +7658,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7541
7658
  }
7542
7659
  }
7543
7660
  }
7544
- group.model.location = { type: 'floating' };
7545
7661
  function getAnchoredBox() {
7546
7662
  if (options === null || options === void 0 ? void 0 : options.position) {
7547
7663
  const result = {};
@@ -7608,10 +7724,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7608
7724
  : false,
7609
7725
  });
7610
7726
  const floatingGroupPanel = new DockviewFloatingGroupPanel(group, overlay);
7611
- const disposable = watchElementResize(group.element, (entry) => {
7727
+ const disposable = new CompositeDisposable(group.api.onDidActiveChange((event) => {
7728
+ if (event.isActive) {
7729
+ overlay.bringToFront();
7730
+ }
7731
+ }), watchElementResize(group.element, (entry) => {
7612
7732
  const { width, height } = entry.contentRect;
7613
7733
  group.layout(width, height); // let the group know it's size is changing so it can fire events to the panel
7614
- });
7734
+ }));
7615
7735
  floatingGroupPanel.addDisposables(overlay.onDidChange(() => {
7616
7736
  // this is either a resize or a move
7617
7737
  // to inform the panels .layout(...) the group with it's current size
@@ -7627,12 +7747,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7627
7747
  }), {
7628
7748
  dispose: () => {
7629
7749
  disposable.dispose();
7630
- group.model.location = { type: 'grid' };
7631
7750
  remove(this._floatingGroups, floatingGroupPanel);
7751
+ group.model.location = { type: 'grid' };
7632
7752
  this.updateWatermark();
7633
7753
  },
7634
7754
  });
7635
7755
  this._floatingGroups.push(floatingGroupPanel);
7756
+ group.model.location = { type: 'floating' };
7636
7757
  if (!(options === null || options === void 0 ? void 0 : options.skipActiveGroup)) {
7637
7758
  this.doSetGroupAndPanelActive(group);
7638
7759
  }
@@ -7671,6 +7792,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7671
7792
  }
7672
7793
  updateOptions(options) {
7673
7794
  var _a, _b;
7795
+ super.updateOptions(options);
7674
7796
  const changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
7675
7797
  options.floatingGroupBounds !== this.options.floatingGroupBounds;
7676
7798
  const changed_rootOverlayOptions = 'rootOverlayModel' in options &&
@@ -8214,6 +8336,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8214
8336
  this._groups.delete(group.id);
8215
8337
  this._onDidRemoveGroup.fire(group);
8216
8338
  }
8339
+ remove(this._popoutGroups, selectedGroup);
8217
8340
  const removedGroup = selectedGroup.disposable.dispose();
8218
8341
  if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
8219
8342
  this.doAddGroup(removedGroup, [0]);
@@ -8325,6 +8448,31 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8325
8448
  return;
8326
8449
  }
8327
8450
  }
8451
+ if (sourceGroup.api.location.type === 'popout') {
8452
+ /**
8453
+ * the source group is a popout group with a single panel
8454
+ *
8455
+ * 1. remove the panel from the group without triggering any events
8456
+ * 2. remove the popout group
8457
+ * 3. create a new group at the requested location and add that panel
8458
+ */
8459
+ const popoutGroup = this._popoutGroups.find((group) => group.popoutGroup === sourceGroup);
8460
+ const removedPanel = this.movingLock(() => popoutGroup.popoutGroup.model.removePanel(popoutGroup.popoutGroup.panels[0], {
8461
+ skipSetActive: true,
8462
+ skipSetActiveGroup: true,
8463
+ }));
8464
+ this.doRemoveGroup(sourceGroup, { skipActive: true });
8465
+ const newGroup = this.createGroupAtLocation(targetLocation);
8466
+ this.movingLock(() => newGroup.model.openPanel(removedPanel, {
8467
+ skipSetActive: true,
8468
+ }));
8469
+ this.doSetGroupAndPanelActive(newGroup);
8470
+ this._onDidMovePanel.fire({
8471
+ panel: this.getGroupPanel(sourceItemId),
8472
+ from: sourceGroup,
8473
+ });
8474
+ return;
8475
+ }
8328
8476
  // source group will become empty so delete the group
8329
8477
  const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {
8330
8478
  skipActive: true,
@@ -8556,13 +8704,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8556
8704
  set deserializer(value) {
8557
8705
  this._deserializer = value;
8558
8706
  }
8559
- constructor(options) {
8707
+ constructor(parentElement, options) {
8560
8708
  super({
8561
- parentElement: options.parentElement,
8709
+ parentElement: parentElement,
8562
8710
  proportionalLayout: options.proportionalLayout,
8563
8711
  orientation: options.orientation,
8564
8712
  styles: options.styles,
8565
8713
  disableAutoResizing: options.disableAutoResizing,
8714
+ className: options.className,
8566
8715
  });
8567
8716
  this._onDidLayoutfromJSON = new Emitter();
8568
8717
  this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
@@ -8588,6 +8737,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8588
8737
  }
8589
8738
  }
8590
8739
  updateOptions(options) {
8740
+ super.updateOptions(options);
8591
8741
  const hasOrientationChanged = typeof options.orientation === 'string' &&
8592
8742
  this.gridview.orientation !== options.orientation;
8593
8743
  this._options = Object.assign(Object.assign({}, this.options), options);
@@ -8854,8 +9004,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8854
9004
  ? this.splitview.size
8855
9005
  : this.splitview.orthogonalSize;
8856
9006
  }
8857
- constructor(options) {
8858
- super(options.parentElement, options.disableAutoResizing);
9007
+ constructor(parentElement, options) {
9008
+ var _a, _b;
9009
+ super(parentElement, options.disableAutoResizing);
8859
9010
  this._splitviewChangeDisposable = new MutableDisposable();
8860
9011
  this._panels = new Map();
8861
9012
  this._onDidLayoutfromJSON = new Emitter();
@@ -8866,6 +9017,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8866
9017
  this.onDidRemoveView = this._onDidRemoveView.event;
8867
9018
  this._onDidLayoutChange = new Emitter();
8868
9019
  this.onDidLayoutChange = this._onDidLayoutChange.event;
9020
+ this.classNames = [];
9021
+ this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9022
+ for (const className of this.classNames) {
9023
+ toggleClass(this.element, className, true);
9024
+ }
8869
9025
  this._options = options;
8870
9026
  if (!options.components) {
8871
9027
  options.components = {};
@@ -8877,6 +9033,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8877
9033
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
8878
9034
  }
8879
9035
  updateOptions(options) {
9036
+ var _a, _b;
9037
+ if ('className' in options) {
9038
+ for (const className of this.classNames) {
9039
+ toggleClass(this.element, className, false);
9040
+ }
9041
+ this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9042
+ for (const className of this.classNames) {
9043
+ toggleClass(this.element, className, true);
9044
+ }
9045
+ }
8880
9046
  const hasOrientationChanged = typeof options.orientation === 'string' &&
8881
9047
  this.options.orientation !== options.orientation;
8882
9048
  this._options = Object.assign(Object.assign({}, this.options), options);
@@ -9178,8 +9344,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9178
9344
  get options() {
9179
9345
  return this._options;
9180
9346
  }
9181
- constructor(options) {
9182
- super(options.parentElement, options.disableAutoResizing);
9347
+ constructor(parentElement, options) {
9348
+ var _a, _b;
9349
+ super(parentElement, options.disableAutoResizing);
9183
9350
  this._id = nextLayoutId.next();
9184
9351
  this._disposable = new MutableDisposable();
9185
9352
  this._viewDisposables = new Map();
@@ -9193,7 +9360,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9193
9360
  this.onDidAddView = this._onDidAddView.event;
9194
9361
  this._onDidRemoveView = new Emitter();
9195
9362
  this.onDidRemoveView = this._onDidRemoveView.event;
9363
+ this.classNames = [];
9196
9364
  this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9365
+ this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9366
+ for (const className of this.classNames) {
9367
+ toggleClass(this.element, className, true);
9368
+ }
9197
9369
  this._options = options;
9198
9370
  if (!options.components) {
9199
9371
  options.components = {};
@@ -9215,6 +9387,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9215
9387
  //noop
9216
9388
  }
9217
9389
  updateOptions(options) {
9390
+ var _a, _b;
9391
+ if ('className' in options) {
9392
+ for (const className of this.classNames) {
9393
+ toggleClass(this.element, className, false);
9394
+ }
9395
+ this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9396
+ for (const className of this.classNames) {
9397
+ toggleClass(this.element, className, true);
9398
+ }
9399
+ }
9218
9400
  this._options = Object.assign(Object.assign({}, this.options), options);
9219
9401
  }
9220
9402
  addPanel(options) {
@@ -9508,6 +9690,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9508
9690
  }
9509
9691
  }
9510
9692
 
9693
+ function createDockview(element, options) {
9694
+ const component = new DockviewComponent(element, options);
9695
+ return component.api;
9696
+ }
9697
+ function createSplitview(element, options) {
9698
+ const component = new SplitviewComponent(element, options);
9699
+ return new SplitviewApi(component);
9700
+ }
9701
+ function createGridview(element, options) {
9702
+ const component = new GridviewComponent(element, options);
9703
+ return new GridviewApi(component);
9704
+ }
9705
+ function createPaneview(element, options) {
9706
+ const component = new PaneviewComponent(element, options);
9707
+ return new PaneviewApi(component);
9708
+ }
9709
+
9511
9710
  /**
9512
9711
  * This component is intended to interface between vanilla-js and React hence we need to be
9513
9712
  * creative in how we update props.
@@ -9887,20 +10086,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9887
10086
  });
9888
10087
  }
9889
10088
  : undefined,
9890
- parentElement: domRef.current,
9891
10089
  defaultTabComponent: props.defaultTabComponent
9892
10090
  ? DEFAULT_REACT_TAB
9893
10091
  : undefined,
9894
10092
  };
9895
- const dockview = new DockviewComponent(Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10093
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
9896
10094
  const { clientWidth, clientHeight } = domRef.current;
9897
- dockview.layout(clientWidth, clientHeight);
10095
+ api.layout(clientWidth, clientHeight);
9898
10096
  if (props.onReady) {
9899
- props.onReady({ api: new DockviewApi(dockview) });
10097
+ props.onReady({ api });
9900
10098
  }
9901
- dockviewRef.current = dockview;
10099
+ dockviewRef.current = api;
9902
10100
  return () => {
9903
- dockview.dispose();
10101
+ api.dispose();
9904
10102
  };
9905
10103
  }, []);
9906
10104
  React.useEffect(() => {
@@ -10103,8 +10301,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10103
10301
  React.useImperativeHandle(ref, () => domRef.current, []);
10104
10302
  React.useEffect(() => {
10105
10303
  var _a;
10106
- const splitview = new SplitviewComponent({
10107
- parentElement: domRef.current,
10304
+ const api = createSplitview(domRef.current, {
10108
10305
  disableAutoResizing: props.disableAutoResizing,
10109
10306
  orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10110
10307
  frameworkComponents: props.components,
@@ -10123,13 +10320,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10123
10320
  : undefined,
10124
10321
  });
10125
10322
  const { clientWidth, clientHeight } = domRef.current;
10126
- splitview.layout(clientWidth, clientHeight);
10323
+ api.layout(clientWidth, clientHeight);
10127
10324
  if (props.onReady) {
10128
- props.onReady({ api: new SplitviewApi(splitview) });
10325
+ props.onReady({ api });
10129
10326
  }
10130
- splitviewRef.current = splitview;
10327
+ splitviewRef.current = api;
10131
10328
  return () => {
10132
- splitview.dispose();
10329
+ api.dispose();
10133
10330
  };
10134
10331
  }, []);
10135
10332
  React.useEffect(() => {
@@ -10174,8 +10371,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10174
10371
  // noop
10175
10372
  };
10176
10373
  }
10177
- const gridview = new GridviewComponent({
10178
- parentElement: domRef.current,
10374
+ const api = createGridview(domRef.current, {
10179
10375
  disableAutoResizing: props.disableAutoResizing,
10180
10376
  proportionalLayout: typeof props.proportionalLayout === 'boolean'
10181
10377
  ? props.proportionalLayout
@@ -10194,13 +10390,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10194
10390
  : undefined,
10195
10391
  });
10196
10392
  const { clientWidth, clientHeight } = domRef.current;
10197
- gridview.layout(clientWidth, clientHeight);
10393
+ api.layout(clientWidth, clientHeight);
10198
10394
  if (props.onReady) {
10199
- props.onReady({ api: new GridviewApi(gridview) });
10395
+ props.onReady({ api });
10200
10396
  }
10201
- gridviewRef.current = gridview;
10397
+ gridviewRef.current = api;
10202
10398
  return () => {
10203
- gridview.dispose();
10399
+ api.dispose();
10204
10400
  };
10205
10401
  }, []);
10206
10402
  React.useEffect(() => {
@@ -10259,8 +10455,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10259
10455
  const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10260
10456
  addPortal,
10261
10457
  });
10262
- const paneview = new PaneviewComponent({
10263
- parentElement: domRef.current,
10458
+ const api = createPaneview(domRef.current, {
10264
10459
  disableAutoResizing: props.disableAutoResizing,
10265
10460
  frameworkComponents: props.components,
10266
10461
  components: {},
@@ -10277,15 +10472,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10277
10472
  },
10278
10473
  showDndOverlay: props.showDndOverlay,
10279
10474
  });
10280
- const api = new PaneviewApi(paneview);
10281
10475
  const { clientWidth, clientHeight } = domRef.current;
10282
- paneview.layout(clientWidth, clientHeight);
10476
+ api.layout(clientWidth, clientHeight);
10283
10477
  if (props.onReady) {
10284
10478
  props.onReady({ api });
10285
10479
  }
10286
- paneviewRef.current = paneview;
10480
+ paneviewRef.current = api;
10287
10481
  return () => {
10288
- paneview.dispose();
10482
+ api.dispose();
10289
10483
  };
10290
10484
  }, []);
10291
10485
  React.useEffect(() => {
@@ -10310,10 +10504,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10310
10504
  //
10311
10505
  };
10312
10506
  }
10313
- const paneview = paneviewRef.current;
10314
- const disposable = paneview.onDidDrop((event) => {
10507
+ const api = paneviewRef.current;
10508
+ const disposable = api.onDidDrop((event) => {
10315
10509
  if (props.onDidDrop) {
10316
- props.onDidDrop(Object.assign(Object.assign({}, event), { api: new PaneviewApi(paneview) }));
10510
+ props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10317
10511
  }
10318
10512
  });
10319
10513
  return () => {
@@ -10375,6 +10569,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10375
10569
  exports.Tab = Tab;
10376
10570
  exports.WillShowOverlayLocationEvent = WillShowOverlayLocationEvent;
10377
10571
  exports.createComponent = createComponent;
10572
+ exports.createDockview = createDockview;
10573
+ exports.createGridview = createGridview;
10574
+ exports.createPaneview = createPaneview;
10575
+ exports.createSplitview = createSplitview;
10378
10576
  exports.directionToPosition = directionToPosition;
10379
10577
  exports.getDirectionOrientation = getDirectionOrientation;
10380
10578
  exports.getGridLocation = getGridLocation;