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
  */
@@ -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`;
@@ -2645,6 +2675,7 @@
2645
2675
  this.gridview.locked = value;
2646
2676
  }
2647
2677
  constructor(options) {
2678
+ var _a, _b;
2648
2679
  super(document.createElement('div'), options.disableAutoResizing);
2649
2680
  this._id = nextLayoutId$1.next();
2650
2681
  this._groups = new Map();
@@ -2658,8 +2689,13 @@
2658
2689
  this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
2659
2690
  this._onDidViewVisibilityChangeMicroTaskQueue = new AsapEvent();
2660
2691
  this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
2692
+ this.classNames = [];
2661
2693
  this.element.style.height = '100%';
2662
2694
  this.element.style.width = '100%';
2695
+ this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
2696
+ for (const className of this.classNames) {
2697
+ toggleClass(this.element, className, true);
2698
+ }
2663
2699
  options.parentElement.appendChild(this.element);
2664
2700
  this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
2665
2701
  this.gridview.locked = !!options.locked;
@@ -2683,6 +2719,18 @@
2683
2719
  isVisible(panel) {
2684
2720
  return this.gridview.isViewVisible(getGridLocation(panel.element));
2685
2721
  }
2722
+ updateOptions(options) {
2723
+ var _a, _b;
2724
+ if ('className' in options) {
2725
+ for (const className of this.classNames) {
2726
+ toggleClass(this.element, className, false);
2727
+ }
2728
+ this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
2729
+ for (const className of this.classNames) {
2730
+ toggleClass(this.element, className, true);
2731
+ }
2732
+ }
2733
+ }
2686
2734
  maximizeGroup(panel) {
2687
2735
  this.gridview.maximizeView(panel);
2688
2736
  this.doSetGroupActive(panel);
@@ -2863,12 +2911,6 @@
2863
2911
  constructor(component) {
2864
2912
  this.component = component;
2865
2913
  }
2866
- /**
2867
- * Update configuratable options.
2868
- */
2869
- updateOptions(options) {
2870
- this.component.updateOptions(options);
2871
- }
2872
2914
  /**
2873
2915
  * Removes an existing panel and optionally provide a `Sizing` method
2874
2916
  * for the subsequent resize.
@@ -2922,6 +2964,18 @@
2922
2964
  clear() {
2923
2965
  this.component.clear();
2924
2966
  }
2967
+ /**
2968
+ * Update configuratable options.
2969
+ */
2970
+ updateOptions(options) {
2971
+ this.component.updateOptions(options);
2972
+ }
2973
+ /**
2974
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
2975
+ */
2976
+ dispose() {
2977
+ this.component.dispose();
2978
+ }
2925
2979
  }
2926
2980
  class PaneviewApi {
2927
2981
  /**
@@ -3049,6 +3103,18 @@
3049
3103
  clear() {
3050
3104
  this.component.clear();
3051
3105
  }
3106
+ /**
3107
+ * Update configuratable options.
3108
+ */
3109
+ updateOptions(options) {
3110
+ this.component.updateOptions(options);
3111
+ }
3112
+ /**
3113
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
3114
+ */
3115
+ dispose() {
3116
+ this.component.dispose();
3117
+ }
3052
3118
  }
3053
3119
  class GridviewApi {
3054
3120
  /**
@@ -3189,6 +3255,15 @@
3189
3255
  clear() {
3190
3256
  this.component.clear();
3191
3257
  }
3258
+ updateOptions(options) {
3259
+ this.component.updateOptions(options);
3260
+ }
3261
+ /**
3262
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
3263
+ */
3264
+ dispose() {
3265
+ this.component.dispose();
3266
+ }
3192
3267
  }
3193
3268
  class DockviewApi {
3194
3269
  /**
@@ -3481,6 +3556,15 @@
3481
3556
  setGap(gap) {
3482
3557
  this.component.updateOptions({ gap });
3483
3558
  }
3559
+ updateOptions(options) {
3560
+ this.component.updateOptions(options);
3561
+ }
3562
+ /**
3563
+ * Release resources and teardown component. Do not call when using framework versions of dockview.
3564
+ */
3565
+ dispose() {
3566
+ this.component.dispose();
3567
+ }
3484
3568
  }
3485
3569
 
3486
3570
  class DragHandler extends CompositeDisposable {
@@ -3503,20 +3587,12 @@
3503
3587
  event.preventDefault();
3504
3588
  return;
3505
3589
  }
3506
- const iframes = [
3507
- ...getElementsByTagName('iframe'),
3508
- ...getElementsByTagName('webview'),
3509
- ];
3590
+ const iframes = disableIframePointEvents();
3510
3591
  this.pointerEventsDisposable.value = {
3511
3592
  dispose: () => {
3512
- for (const iframe of iframes) {
3513
- iframe.style.pointerEvents = 'auto';
3514
- }
3593
+ iframes.release();
3515
3594
  },
3516
3595
  };
3517
- for (const iframe of iframes) {
3518
- iframe.style.pointerEvents = 'none';
3519
- }
3520
3596
  this.el.classList.add('dv-dragged');
3521
3597
  setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
3522
3598
  this.dataDisposable.value = this.getData(event);
@@ -4680,7 +4756,7 @@
4680
4756
  this._element.className = 'void-container';
4681
4757
  this._element.tabIndex = 0;
4682
4758
  this._element.draggable = true;
4683
- this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'click', () => {
4759
+ this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
4684
4760
  this.accessor.doSetGroupActive(this.group);
4685
4761
  }));
4686
4762
  const handler = new GroupDragHandler(this._element, accessor, group);
@@ -4995,6 +5071,7 @@
4995
5071
  locked: undefined,
4996
5072
  disableDnd: undefined,
4997
5073
  gap: undefined,
5074
+ className: undefined,
4998
5075
  };
4999
5076
  return Object.keys(properties);
5000
5077
  })();
@@ -5550,7 +5627,7 @@
5550
5627
  group: this.groupPanel,
5551
5628
  });
5552
5629
  this.watermark = watermark;
5553
- addDisposableListener(this.watermark.element, 'click', () => {
5630
+ addDisposableListener(this.watermark.element, 'pointerdown', () => {
5554
5631
  if (!this.isActive) {
5555
5632
  this.accessor.doSetGroupActive(this.groupPanel);
5556
5633
  }
@@ -6115,7 +6192,7 @@
6115
6192
  // forward the resize event to the group since if you want to resize a panel
6116
6193
  // you are actually just resizing the panels parent which is the group
6117
6194
  this.group.api.setSize(event);
6118
- }), this.api.onDidRendererChange((event) => {
6195
+ }), this.api.onDidRendererChange(() => {
6119
6196
  this.group.model.rerender(this);
6120
6197
  }));
6121
6198
  }
@@ -6451,17 +6528,30 @@
6451
6528
  }
6452
6529
  }
6453
6530
 
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);
6531
+ const DEFAULT_OVERLAY_Z_INDEX = 999;
6532
+ class AriaLevelTracker {
6533
+ constructor() {
6534
+ this._orderedList = [];
6535
+ }
6536
+ push(element) {
6537
+ this._orderedList = [
6538
+ ...this._orderedList.filter((item) => item !== element),
6539
+ element,
6540
+ ];
6541
+ this.update();
6542
+ }
6543
+ destroy(element) {
6544
+ this._orderedList = this._orderedList.filter((item) => item !== element);
6545
+ this.update();
6546
+ }
6547
+ update() {
6548
+ for (let i = 0; i < this._orderedList.length; i++) {
6549
+ this._orderedList[i].setAttribute('aria-level', `${i}`);
6550
+ this._orderedList[i].style.zIndex = `${DEFAULT_OVERLAY_Z_INDEX + i * 2}`;
6459
6551
  }
6460
- toggleClass(element, 'dv-bring-to-front', true);
6461
- previous = element;
6462
6552
  }
6463
- return pushToTop;
6464
- })();
6553
+ }
6554
+ const arialLevelTracker = new AriaLevelTracker();
6465
6555
  class Overlay extends CompositeDisposable {
6466
6556
  set minimumInViewportWidth(value) {
6467
6557
  this.options.minimumInViewportWidth = value;
@@ -6469,6 +6559,9 @@
6469
6559
  set minimumInViewportHeight(value) {
6470
6560
  this.options.minimumInViewportHeight = value;
6471
6561
  }
6562
+ get element() {
6563
+ return this._element;
6564
+ }
6472
6565
  constructor(options) {
6473
6566
  super();
6474
6567
  this.options = options;
@@ -6491,6 +6584,10 @@
6491
6584
  this.options.container.appendChild(this._element);
6492
6585
  // if input bad resize within acceptable boundaries
6493
6586
  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 })));
6587
+ arialLevelTracker.push(this._element);
6588
+ }
6589
+ bringToFront() {
6590
+ arialLevelTracker.push(this._element);
6494
6591
  }
6495
6592
  setBounds(bounds = {}) {
6496
6593
  if (typeof bounds.height === 'number') {
@@ -6578,18 +6675,10 @@
6578
6675
  const move = new MutableDisposable();
6579
6676
  const track = () => {
6580
6677
  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
- }
6678
+ const iframes = disableIframePointEvents();
6588
6679
  move.value = new CompositeDisposable({
6589
6680
  dispose: () => {
6590
- for (const iframe of iframes) {
6591
- iframe.style.pointerEvents = 'auto';
6592
- }
6681
+ iframes.release();
6593
6682
  },
6594
6683
  }, addDisposableWindowListener(window, 'mousemove', (e) => {
6595
6684
  const containerRect = this.options.container.getBoundingClientRect();
@@ -6658,9 +6747,8 @@
6658
6747
  track();
6659
6748
  }
6660
6749
  }), addDisposableListener(this.options.content, 'mousedown', () => {
6661
- bringElementToFront(this._element);
6750
+ arialLevelTracker.push(this._element);
6662
6751
  }, true));
6663
- bringElementToFront(this._element);
6664
6752
  if (options.inDragMode) {
6665
6753
  track();
6666
6754
  }
@@ -6673,13 +6761,7 @@
6673
6761
  this.addDisposables(move, addDisposableListener(resizeHandleElement, 'mousedown', (e) => {
6674
6762
  e.preventDefault();
6675
6763
  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
- }
6764
+ const iframes = disableIframePointEvents();
6683
6765
  move.value = new CompositeDisposable(addDisposableWindowListener(window, 'mousemove', (e) => {
6684
6766
  const containerRect = this.options.container.getBoundingClientRect();
6685
6767
  const overlayRect = this._element.getBoundingClientRect();
@@ -6802,9 +6884,7 @@
6802
6884
  this.setBounds(bounds);
6803
6885
  }), {
6804
6886
  dispose: () => {
6805
- for (const iframe of iframes) {
6806
- iframe.style.pointerEvents = 'auto';
6807
- }
6887
+ iframes.release();
6808
6888
  },
6809
6889
  }, addDisposableWindowListener(window, 'mouseup', () => {
6810
6890
  move.dispose();
@@ -6825,6 +6905,7 @@
6825
6905
  return 0;
6826
6906
  }
6827
6907
  dispose() {
6908
+ arialLevelTracker.destroy(this._element);
6828
6909
  this._element.remove();
6829
6910
  super.dispose();
6830
6911
  }
@@ -6853,9 +6934,10 @@
6853
6934
  return element;
6854
6935
  }
6855
6936
  class OverlayRenderContainer extends CompositeDisposable {
6856
- constructor(element) {
6937
+ constructor(element, accessor) {
6857
6938
  super();
6858
6939
  this.element = element;
6940
+ this.accessor = accessor;
6859
6941
  this.map = {};
6860
6942
  this._disposed = false;
6861
6943
  this.addDisposables(exports.DockviewDisposable.from(() => {
@@ -6911,7 +6993,35 @@
6911
6993
  }
6912
6994
  focusContainer.style.display = panel.api.isVisible ? '' : 'none';
6913
6995
  };
6914
- const disposable = new CompositeDisposable(
6996
+ const observerDisposable = new MutableDisposable();
6997
+ const correctLayerPosition = () => {
6998
+ if (panel.api.location.type === 'floating') {
6999
+ queueMicrotask(() => {
7000
+ const floatingGroup = this.accessor.floatingGroups.find((group) => group.group === panel.api.group);
7001
+ if (!floatingGroup) {
7002
+ return;
7003
+ }
7004
+ const element = floatingGroup.overlay.element;
7005
+ const update = () => {
7006
+ const level = Number(element.getAttribute('aria-level'));
7007
+ focusContainer.style.zIndex = `${DEFAULT_OVERLAY_Z_INDEX + level * 2 + 1}`;
7008
+ };
7009
+ const observer = new MutationObserver(() => {
7010
+ update();
7011
+ });
7012
+ observerDisposable.value = exports.DockviewDisposable.from(() => observer.disconnect());
7013
+ observer.observe(element, {
7014
+ attributeFilter: ['aria-level'],
7015
+ attributes: true,
7016
+ });
7017
+ update();
7018
+ });
7019
+ }
7020
+ else {
7021
+ focusContainer.style.zIndex = ''; // reset the z-index, perhaps CSS will take over here
7022
+ }
7023
+ };
7024
+ const disposable = new CompositeDisposable(observerDisposable,
6915
7025
  /**
6916
7026
  * since container is positioned absoutely we must explicitly forward
6917
7027
  * the dnd events for the expect behaviours to continue to occur in terms of dnd
@@ -6935,7 +7045,7 @@
6935
7045
  onDragOver: (e) => {
6936
7046
  referenceContainer.dropTarget.dnd.onDragOver(e);
6937
7047
  },
6938
- }), panel.api.onDidVisibilityChange((event) => {
7048
+ }), panel.api.onDidVisibilityChange(() => {
6939
7049
  /**
6940
7050
  * Control the visibility of the content, however even when not visible (display: none)
6941
7051
  * the content is still maintained within the DOM hence DOM specific attributes
@@ -6947,6 +7057,8 @@
6947
7057
  return;
6948
7058
  }
6949
7059
  resize();
7060
+ }), panel.api.onDidLocationChange(() => {
7061
+ correctLayerPosition();
6950
7062
  }));
6951
7063
  this.map[panel.api.id].destroy = exports.DockviewDisposable.from(() => {
6952
7064
  var _a;
@@ -6955,6 +7067,7 @@
6955
7067
  }
6956
7068
  (_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
6957
7069
  });
7070
+ correctLayerPosition();
6958
7071
  queueMicrotask(() => {
6959
7072
  if (this.isDisposed) {
6960
7073
  return;
@@ -7180,7 +7293,10 @@
7180
7293
  get gap() {
7181
7294
  return this.gridview.margin;
7182
7295
  }
7183
- constructor(options) {
7296
+ get floatingGroups() {
7297
+ return this._floatingGroups;
7298
+ }
7299
+ constructor(parentElement, options) {
7184
7300
  var _a;
7185
7301
  super({
7186
7302
  proportionalLayout: true,
@@ -7188,10 +7304,11 @@
7188
7304
  styles: options.hideBorders
7189
7305
  ? { separatorBorder: 'transparent' }
7190
7306
  : undefined,
7191
- parentElement: options.parentElement,
7307
+ parentElement: parentElement,
7192
7308
  disableAutoResizing: options.disableAutoResizing,
7193
7309
  locked: options.locked,
7194
7310
  margin: options.gap,
7311
+ className: options.className,
7195
7312
  });
7196
7313
  this.nextGroupId = sequentialNumberGenerator();
7197
7314
  this._deserializer = new DefaultDockviewDeserialzier(this);
@@ -7227,10 +7344,10 @@
7227
7344
  this._onDidActiveGroupChange = new Emitter();
7228
7345
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
7229
7346
  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);
7347
+ // const gready = document.createElement('div');
7348
+ // gready.className = 'dv-overlay-render-container';
7349
+ // this.gridview.element.appendChild(gready);
7350
+ this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
7234
7351
  toggleClass(this.gridview.element, 'dv-dockview', true);
7235
7352
  toggleClass(this.element, 'dv-debug', !!options.debug);
7236
7353
  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 +7513,7 @@
7396
7513
  }
7397
7514
  const gready = document.createElement('div');
7398
7515
  gready.className = 'dv-overlay-render-container';
7399
- const overlayRenderContainer = new OverlayRenderContainer(gready);
7516
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
7400
7517
  const referenceGroup = itemToPopout instanceof DockviewPanel
7401
7518
  ? itemToPopout.group
7402
7519
  : itemToPopout;
@@ -7545,7 +7662,6 @@
7545
7662
  }
7546
7663
  }
7547
7664
  }
7548
- group.model.location = { type: 'floating' };
7549
7665
  function getAnchoredBox() {
7550
7666
  if (options === null || options === void 0 ? void 0 : options.position) {
7551
7667
  const result = {};
@@ -7612,10 +7728,14 @@
7612
7728
  : false,
7613
7729
  });
7614
7730
  const floatingGroupPanel = new DockviewFloatingGroupPanel(group, overlay);
7615
- const disposable = watchElementResize(group.element, (entry) => {
7731
+ const disposable = new CompositeDisposable(group.api.onDidActiveChange((event) => {
7732
+ if (event.isActive) {
7733
+ overlay.bringToFront();
7734
+ }
7735
+ }), watchElementResize(group.element, (entry) => {
7616
7736
  const { width, height } = entry.contentRect;
7617
7737
  group.layout(width, height); // let the group know it's size is changing so it can fire events to the panel
7618
- });
7738
+ }));
7619
7739
  floatingGroupPanel.addDisposables(overlay.onDidChange(() => {
7620
7740
  // this is either a resize or a move
7621
7741
  // to inform the panels .layout(...) the group with it's current size
@@ -7631,12 +7751,13 @@
7631
7751
  }), {
7632
7752
  dispose: () => {
7633
7753
  disposable.dispose();
7634
- group.model.location = { type: 'grid' };
7635
7754
  remove(this._floatingGroups, floatingGroupPanel);
7755
+ group.model.location = { type: 'grid' };
7636
7756
  this.updateWatermark();
7637
7757
  },
7638
7758
  });
7639
7759
  this._floatingGroups.push(floatingGroupPanel);
7760
+ group.model.location = { type: 'floating' };
7640
7761
  if (!(options === null || options === void 0 ? void 0 : options.skipActiveGroup)) {
7641
7762
  this.doSetGroupAndPanelActive(group);
7642
7763
  }
@@ -7675,6 +7796,7 @@
7675
7796
  }
7676
7797
  updateOptions(options) {
7677
7798
  var _a, _b;
7799
+ super.updateOptions(options);
7678
7800
  const changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
7679
7801
  options.floatingGroupBounds !== this.options.floatingGroupBounds;
7680
7802
  const changed_rootOverlayOptions = 'rootOverlayModel' in options &&
@@ -8218,6 +8340,7 @@
8218
8340
  this._groups.delete(group.id);
8219
8341
  this._onDidRemoveGroup.fire(group);
8220
8342
  }
8343
+ remove(this._popoutGroups, selectedGroup);
8221
8344
  const removedGroup = selectedGroup.disposable.dispose();
8222
8345
  if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
8223
8346
  this.doAddGroup(removedGroup, [0]);
@@ -8329,6 +8452,31 @@
8329
8452
  return;
8330
8453
  }
8331
8454
  }
8455
+ if (sourceGroup.api.location.type === 'popout') {
8456
+ /**
8457
+ * the source group is a popout group with a single panel
8458
+ *
8459
+ * 1. remove the panel from the group without triggering any events
8460
+ * 2. remove the popout group
8461
+ * 3. create a new group at the requested location and add that panel
8462
+ */
8463
+ const popoutGroup = this._popoutGroups.find((group) => group.popoutGroup === sourceGroup);
8464
+ const removedPanel = this.movingLock(() => popoutGroup.popoutGroup.model.removePanel(popoutGroup.popoutGroup.panels[0], {
8465
+ skipSetActive: true,
8466
+ skipSetActiveGroup: true,
8467
+ }));
8468
+ this.doRemoveGroup(sourceGroup, { skipActive: true });
8469
+ const newGroup = this.createGroupAtLocation(targetLocation);
8470
+ this.movingLock(() => newGroup.model.openPanel(removedPanel, {
8471
+ skipSetActive: true,
8472
+ }));
8473
+ this.doSetGroupAndPanelActive(newGroup);
8474
+ this._onDidMovePanel.fire({
8475
+ panel: this.getGroupPanel(sourceItemId),
8476
+ from: sourceGroup,
8477
+ });
8478
+ return;
8479
+ }
8332
8480
  // source group will become empty so delete the group
8333
8481
  const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {
8334
8482
  skipActive: true,
@@ -8560,13 +8708,14 @@
8560
8708
  set deserializer(value) {
8561
8709
  this._deserializer = value;
8562
8710
  }
8563
- constructor(options) {
8711
+ constructor(parentElement, options) {
8564
8712
  super({
8565
- parentElement: options.parentElement,
8713
+ parentElement: parentElement,
8566
8714
  proportionalLayout: options.proportionalLayout,
8567
8715
  orientation: options.orientation,
8568
8716
  styles: options.styles,
8569
8717
  disableAutoResizing: options.disableAutoResizing,
8718
+ className: options.className,
8570
8719
  });
8571
8720
  this._onDidLayoutfromJSON = new Emitter();
8572
8721
  this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
@@ -8592,6 +8741,7 @@
8592
8741
  }
8593
8742
  }
8594
8743
  updateOptions(options) {
8744
+ super.updateOptions(options);
8595
8745
  const hasOrientationChanged = typeof options.orientation === 'string' &&
8596
8746
  this.gridview.orientation !== options.orientation;
8597
8747
  this._options = Object.assign(Object.assign({}, this.options), options);
@@ -8858,8 +9008,9 @@
8858
9008
  ? this.splitview.size
8859
9009
  : this.splitview.orthogonalSize;
8860
9010
  }
8861
- constructor(options) {
8862
- super(options.parentElement, options.disableAutoResizing);
9011
+ constructor(parentElement, options) {
9012
+ var _a, _b;
9013
+ super(parentElement, options.disableAutoResizing);
8863
9014
  this._splitviewChangeDisposable = new MutableDisposable();
8864
9015
  this._panels = new Map();
8865
9016
  this._onDidLayoutfromJSON = new Emitter();
@@ -8870,6 +9021,11 @@
8870
9021
  this.onDidRemoveView = this._onDidRemoveView.event;
8871
9022
  this._onDidLayoutChange = new Emitter();
8872
9023
  this.onDidLayoutChange = this._onDidLayoutChange.event;
9024
+ this.classNames = [];
9025
+ this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9026
+ for (const className of this.classNames) {
9027
+ toggleClass(this.element, className, true);
9028
+ }
8873
9029
  this._options = options;
8874
9030
  if (!options.components) {
8875
9031
  options.components = {};
@@ -8881,6 +9037,16 @@
8881
9037
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
8882
9038
  }
8883
9039
  updateOptions(options) {
9040
+ var _a, _b;
9041
+ if ('className' in options) {
9042
+ for (const className of this.classNames) {
9043
+ toggleClass(this.element, className, false);
9044
+ }
9045
+ this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9046
+ for (const className of this.classNames) {
9047
+ toggleClass(this.element, className, true);
9048
+ }
9049
+ }
8884
9050
  const hasOrientationChanged = typeof options.orientation === 'string' &&
8885
9051
  this.options.orientation !== options.orientation;
8886
9052
  this._options = Object.assign(Object.assign({}, this.options), options);
@@ -9182,8 +9348,9 @@
9182
9348
  get options() {
9183
9349
  return this._options;
9184
9350
  }
9185
- constructor(options) {
9186
- super(options.parentElement, options.disableAutoResizing);
9351
+ constructor(parentElement, options) {
9352
+ var _a, _b;
9353
+ super(parentElement, options.disableAutoResizing);
9187
9354
  this._id = nextLayoutId.next();
9188
9355
  this._disposable = new MutableDisposable();
9189
9356
  this._viewDisposables = new Map();
@@ -9197,7 +9364,12 @@
9197
9364
  this.onDidAddView = this._onDidAddView.event;
9198
9365
  this._onDidRemoveView = new Emitter();
9199
9366
  this.onDidRemoveView = this._onDidRemoveView.event;
9367
+ this.classNames = [];
9200
9368
  this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9369
+ this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9370
+ for (const className of this.classNames) {
9371
+ toggleClass(this.element, className, true);
9372
+ }
9201
9373
  this._options = options;
9202
9374
  if (!options.components) {
9203
9375
  options.components = {};
@@ -9219,6 +9391,16 @@
9219
9391
  //noop
9220
9392
  }
9221
9393
  updateOptions(options) {
9394
+ var _a, _b;
9395
+ if ('className' in options) {
9396
+ for (const className of this.classNames) {
9397
+ toggleClass(this.element, className, false);
9398
+ }
9399
+ this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9400
+ for (const className of this.classNames) {
9401
+ toggleClass(this.element, className, true);
9402
+ }
9403
+ }
9222
9404
  this._options = Object.assign(Object.assign({}, this.options), options);
9223
9405
  }
9224
9406
  addPanel(options) {
@@ -9512,6 +9694,23 @@
9512
9694
  }
9513
9695
  }
9514
9696
 
9697
+ function createDockview(element, options) {
9698
+ const component = new DockviewComponent(element, options);
9699
+ return component.api;
9700
+ }
9701
+ function createSplitview(element, options) {
9702
+ const component = new SplitviewComponent(element, options);
9703
+ return new SplitviewApi(component);
9704
+ }
9705
+ function createGridview(element, options) {
9706
+ const component = new GridviewComponent(element, options);
9707
+ return new GridviewApi(component);
9708
+ }
9709
+ function createPaneview(element, options) {
9710
+ const component = new PaneviewComponent(element, options);
9711
+ return new PaneviewApi(component);
9712
+ }
9713
+
9515
9714
  /**
9516
9715
  * This component is intended to interface between vanilla-js and React hence we need to be
9517
9716
  * creative in how we update props.
@@ -9891,20 +10090,19 @@
9891
10090
  });
9892
10091
  }
9893
10092
  : undefined,
9894
- parentElement: domRef.current,
9895
10093
  defaultTabComponent: props.defaultTabComponent
9896
10094
  ? DEFAULT_REACT_TAB
9897
10095
  : undefined,
9898
10096
  };
9899
- const dockview = new DockviewComponent(Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10097
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
9900
10098
  const { clientWidth, clientHeight } = domRef.current;
9901
- dockview.layout(clientWidth, clientHeight);
10099
+ api.layout(clientWidth, clientHeight);
9902
10100
  if (props.onReady) {
9903
- props.onReady({ api: new DockviewApi(dockview) });
10101
+ props.onReady({ api });
9904
10102
  }
9905
- dockviewRef.current = dockview;
10103
+ dockviewRef.current = api;
9906
10104
  return () => {
9907
- dockview.dispose();
10105
+ api.dispose();
9908
10106
  };
9909
10107
  }, []);
9910
10108
  React.useEffect(() => {
@@ -10107,8 +10305,7 @@
10107
10305
  React.useImperativeHandle(ref, () => domRef.current, []);
10108
10306
  React.useEffect(() => {
10109
10307
  var _a;
10110
- const splitview = new SplitviewComponent({
10111
- parentElement: domRef.current,
10308
+ const api = createSplitview(domRef.current, {
10112
10309
  disableAutoResizing: props.disableAutoResizing,
10113
10310
  orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10114
10311
  frameworkComponents: props.components,
@@ -10127,13 +10324,13 @@
10127
10324
  : undefined,
10128
10325
  });
10129
10326
  const { clientWidth, clientHeight } = domRef.current;
10130
- splitview.layout(clientWidth, clientHeight);
10327
+ api.layout(clientWidth, clientHeight);
10131
10328
  if (props.onReady) {
10132
- props.onReady({ api: new SplitviewApi(splitview) });
10329
+ props.onReady({ api });
10133
10330
  }
10134
- splitviewRef.current = splitview;
10331
+ splitviewRef.current = api;
10135
10332
  return () => {
10136
- splitview.dispose();
10333
+ api.dispose();
10137
10334
  };
10138
10335
  }, []);
10139
10336
  React.useEffect(() => {
@@ -10178,8 +10375,7 @@
10178
10375
  // noop
10179
10376
  };
10180
10377
  }
10181
- const gridview = new GridviewComponent({
10182
- parentElement: domRef.current,
10378
+ const api = createGridview(domRef.current, {
10183
10379
  disableAutoResizing: props.disableAutoResizing,
10184
10380
  proportionalLayout: typeof props.proportionalLayout === 'boolean'
10185
10381
  ? props.proportionalLayout
@@ -10198,13 +10394,13 @@
10198
10394
  : undefined,
10199
10395
  });
10200
10396
  const { clientWidth, clientHeight } = domRef.current;
10201
- gridview.layout(clientWidth, clientHeight);
10397
+ api.layout(clientWidth, clientHeight);
10202
10398
  if (props.onReady) {
10203
- props.onReady({ api: new GridviewApi(gridview) });
10399
+ props.onReady({ api });
10204
10400
  }
10205
- gridviewRef.current = gridview;
10401
+ gridviewRef.current = api;
10206
10402
  return () => {
10207
- gridview.dispose();
10403
+ api.dispose();
10208
10404
  };
10209
10405
  }, []);
10210
10406
  React.useEffect(() => {
@@ -10263,8 +10459,7 @@
10263
10459
  const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10264
10460
  addPortal,
10265
10461
  });
10266
- const paneview = new PaneviewComponent({
10267
- parentElement: domRef.current,
10462
+ const api = createPaneview(domRef.current, {
10268
10463
  disableAutoResizing: props.disableAutoResizing,
10269
10464
  frameworkComponents: props.components,
10270
10465
  components: {},
@@ -10281,15 +10476,14 @@
10281
10476
  },
10282
10477
  showDndOverlay: props.showDndOverlay,
10283
10478
  });
10284
- const api = new PaneviewApi(paneview);
10285
10479
  const { clientWidth, clientHeight } = domRef.current;
10286
- paneview.layout(clientWidth, clientHeight);
10480
+ api.layout(clientWidth, clientHeight);
10287
10481
  if (props.onReady) {
10288
10482
  props.onReady({ api });
10289
10483
  }
10290
- paneviewRef.current = paneview;
10484
+ paneviewRef.current = api;
10291
10485
  return () => {
10292
- paneview.dispose();
10486
+ api.dispose();
10293
10487
  };
10294
10488
  }, []);
10295
10489
  React.useEffect(() => {
@@ -10314,10 +10508,10 @@
10314
10508
  //
10315
10509
  };
10316
10510
  }
10317
- const paneview = paneviewRef.current;
10318
- const disposable = paneview.onDidDrop((event) => {
10511
+ const api = paneviewRef.current;
10512
+ const disposable = api.onDidDrop((event) => {
10319
10513
  if (props.onDidDrop) {
10320
- props.onDidDrop(Object.assign(Object.assign({}, event), { api: new PaneviewApi(paneview) }));
10514
+ props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10321
10515
  }
10322
10516
  });
10323
10517
  return () => {
@@ -10379,6 +10573,10 @@
10379
10573
  exports.Tab = Tab;
10380
10574
  exports.WillShowOverlayLocationEvent = WillShowOverlayLocationEvent;
10381
10575
  exports.createComponent = createComponent;
10576
+ exports.createDockview = createDockview;
10577
+ exports.createGridview = createGridview;
10578
+ exports.createPaneview = createPaneview;
10579
+ exports.createSplitview = createSplitview;
10382
10580
  exports.directionToPosition = directionToPosition;
10383
10581
  exports.getDirectionOrientation = getDirectionOrientation;
10384
10582
  exports.getGridLocation = getGridLocation;