dockview-core 4.13.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +56 -8
  2. package/dist/cjs/api/dockviewGroupPanelApi.d.ts +5 -0
  3. package/dist/cjs/api/dockviewGroupPanelApi.js +13 -1
  4. package/dist/cjs/api/dockviewPanelApi.js +1 -1
  5. package/dist/cjs/constants.js +6 -1
  6. package/dist/cjs/dnd/abstractDragHandler.js +3 -1
  7. package/dist/cjs/dnd/droptarget.js +2 -2
  8. package/dist/cjs/dockview/components/popupService.js +2 -0
  9. package/dist/cjs/dockview/components/titlebar/tabs.d.ts +5 -0
  10. package/dist/cjs/dockview/components/titlebar/tabs.js +31 -4
  11. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +5 -0
  12. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +21 -0
  13. package/dist/cjs/dockview/deserializer.js +1 -1
  14. package/dist/cjs/dockview/dockviewComponent.d.ts +2 -1
  15. package/dist/cjs/dockview/dockviewComponent.js +73 -47
  16. package/dist/cjs/dockview/dockviewGroupPanel.js +16 -13
  17. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +11 -1
  18. package/dist/cjs/dockview/dockviewGroupPanelModel.js +62 -5
  19. package/dist/cjs/dockview/framework.d.ts +2 -0
  20. package/dist/cjs/dockview/options.d.ts +3 -0
  21. package/dist/cjs/dockview/options.js +1 -0
  22. package/dist/cjs/dom.js +9 -1
  23. package/dist/cjs/framwork.d.ts +1 -1
  24. package/dist/cjs/lifecycle.d.ts +2 -1
  25. package/dist/cjs/lifecycle.js +6 -3
  26. package/dist/cjs/overlay/overlay.js +2 -1
  27. package/dist/cjs/scrollbar.d.ts +5 -2
  28. package/dist/cjs/scrollbar.js +88 -26
  29. package/dist/dockview-core.js +265 -66
  30. package/dist/dockview-core.min.js +2 -2
  31. package/dist/dockview-core.min.js.map +1 -1
  32. package/dist/dockview-core.min.noStyle.js +2 -2
  33. package/dist/dockview-core.min.noStyle.js.map +1 -1
  34. package/dist/dockview-core.noStyle.js +264 -65
  35. package/dist/esm/api/dockviewGroupPanelApi.d.ts +5 -0
  36. package/dist/esm/api/dockviewGroupPanelApi.js +14 -2
  37. package/dist/esm/api/dockviewPanelApi.js +1 -1
  38. package/dist/esm/constants.js +6 -1
  39. package/dist/esm/dnd/abstractDragHandler.js +3 -1
  40. package/dist/esm/dnd/droptarget.js +2 -2
  41. package/dist/esm/dockview/components/popupService.js +2 -0
  42. package/dist/esm/dockview/components/titlebar/tabs.d.ts +5 -0
  43. package/dist/esm/dockview/components/titlebar/tabs.js +28 -5
  44. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +5 -0
  45. package/dist/esm/dockview/components/titlebar/tabsContainer.js +18 -1
  46. package/dist/esm/dockview/deserializer.js +1 -1
  47. package/dist/esm/dockview/dockviewComponent.d.ts +2 -1
  48. package/dist/esm/dockview/dockviewComponent.js +15 -3
  49. package/dist/esm/dockview/dockviewGroupPanel.js +17 -14
  50. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +11 -1
  51. package/dist/esm/dockview/dockviewGroupPanelModel.js +61 -8
  52. package/dist/esm/dockview/framework.d.ts +2 -0
  53. package/dist/esm/dockview/options.d.ts +3 -0
  54. package/dist/esm/dockview/options.js +1 -0
  55. package/dist/esm/dom.js +9 -1
  56. package/dist/esm/framwork.d.ts +1 -1
  57. package/dist/esm/lifecycle.d.ts +2 -1
  58. package/dist/esm/lifecycle.js +6 -3
  59. package/dist/esm/overlay/overlay.js +2 -1
  60. package/dist/esm/scrollbar.d.ts +5 -2
  61. package/dist/esm/scrollbar.js +85 -27
  62. package/dist/{dockview-core.cjs.js → package/main.cjs.js} +265 -66
  63. package/dist/package/main.cjs.min.js +7 -0
  64. package/dist/package/main.esm.min.mjs +7 -0
  65. package/dist/{dockview-core.esm.js → package/main.esm.mjs} +265 -66
  66. package/dist/styles/dockview.css +63 -7
  67. package/package.json +63 -53
  68. package/dist/dockview-core.amd.js +0 -11373
  69. package/dist/dockview-core.amd.js.map +0 -1
  70. package/dist/dockview-core.amd.min.js +0 -8
  71. package/dist/dockview-core.amd.min.js.map +0 -1
  72. package/dist/dockview-core.amd.min.noStyle.js +0 -8
  73. package/dist/dockview-core.amd.min.noStyle.js.map +0 -1
  74. package/dist/dockview-core.amd.noStyle.js +0 -11343
  75. package/dist/dockview-core.amd.noStyle.js.map +0 -1
  76. package/dist/dockview-core.cjs.js.map +0 -1
  77. package/dist/dockview-core.esm.js.map +0 -1
  78. package/dist/dockview-core.esm.min.js +0 -8
  79. package/dist/dockview-core.esm.min.js.map +0 -1
  80. package/dist/dockview-core.js.map +0 -1
  81. package/dist/dockview-core.noStyle.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 4.13.1
3
+ * @version 5.0.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -302,10 +302,13 @@
302
302
  }
303
303
  constructor(...args) {
304
304
  this._isDisposed = false;
305
- this._disposables = args;
305
+ this._disposables = new Set(args);
306
306
  }
307
307
  addDisposables(...args) {
308
- args.forEach((arg) => this._disposables.push(arg));
308
+ args.forEach((arg) => this._disposables.add(arg));
309
+ }
310
+ removeDisposable(disposable) {
311
+ this._disposables.delete(disposable);
309
312
  }
310
313
  dispose() {
311
314
  if (this._isDisposed) {
@@ -313,7 +316,7 @@
313
316
  }
314
317
  this._isDisposed = true;
315
318
  this._disposables.forEach((arg) => arg.dispose());
316
- this._disposables = [];
319
+ this._disposables.clear();
317
320
  }
318
321
  }
319
322
  class MutableDisposable {
@@ -598,9 +601,9 @@
598
601
  }
599
602
  const DEBOUCE_DELAY = 100;
600
603
  function isChildEntirelyVisibleWithinParent(child, parent) {
601
- //
602
604
  const childPosition = getDomNodePagePosition(child);
603
605
  const parentPosition = getDomNodePagePosition(parent);
606
+ // Check horizontal visibility
604
607
  if (childPosition.left < parentPosition.left) {
605
608
  return false;
606
609
  }
@@ -608,6 +611,14 @@
608
611
  parentPosition.left + parentPosition.width) {
609
612
  return false;
610
613
  }
614
+ // Check vertical visibility
615
+ if (childPosition.top < parentPosition.top) {
616
+ return false;
617
+ }
618
+ if (childPosition.top + childPosition.height >
619
+ parentPosition.top + parentPosition.height) {
620
+ return false;
621
+ }
611
622
  return true;
612
623
  }
613
624
  function onDidWindowMoveEnd(window) {
@@ -3833,7 +3844,9 @@
3833
3844
  }
3834
3845
  configure() {
3835
3846
  this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
3836
- if (event.defaultPrevented || this.isCancelled(event) || this.disabled) {
3847
+ if (event.defaultPrevented ||
3848
+ this.isCancelled(event) ||
3849
+ this.disabled) {
3837
3850
  event.preventDefault();
3838
3851
  return;
3839
3852
  }
@@ -3959,10 +3972,10 @@
3959
3972
  const widthPx = `${Math.round(width)}px`;
3960
3973
  const heightPx = `${Math.round(height)}px`;
3961
3974
  // Check if position or size changed (back to traditional method)
3962
- return element.style.top !== topPx ||
3975
+ return (element.style.top !== topPx ||
3963
3976
  element.style.left !== leftPx ||
3964
3977
  element.style.width !== widthPx ||
3965
- element.style.height !== heightPx;
3978
+ element.style.height !== heightPx);
3966
3979
  }
3967
3980
  class WillShowOverlayEvent extends DockviewEvent {
3968
3981
  get nativeEvent() {
@@ -5271,30 +5284,56 @@
5271
5284
  get element() {
5272
5285
  return this._element;
5273
5286
  }
5287
+ get orientation() {
5288
+ return this._orientation;
5289
+ }
5290
+ set orientation(value) {
5291
+ if (this._orientation === value) {
5292
+ return;
5293
+ }
5294
+ this._scrollOffset = 0;
5295
+ this._orientation = value;
5296
+ removeClasses(this._scrollbar, 'dv-scrollbar-vertical', 'dv-scrollbar-horizontal');
5297
+ if (value === 'vertical') {
5298
+ addClasses(this._scrollbar, 'dv-scrollbar-vertical');
5299
+ }
5300
+ else {
5301
+ addClasses(this._scrollbar, 'dv-scrollbar-horizontal');
5302
+ }
5303
+ }
5274
5304
  constructor(scrollableElement) {
5275
5305
  super();
5276
5306
  this.scrollableElement = scrollableElement;
5277
- this._scrollLeft = 0;
5307
+ this._scrollOffset = 0;
5308
+ this._orientation = 'horizontal';
5278
5309
  this._element = document.createElement('div');
5279
5310
  this._element.className = 'dv-scrollable';
5280
- this._horizontalScrollbar = document.createElement('div');
5281
- this._horizontalScrollbar.className = 'dv-scrollbar-horizontal';
5311
+ this._scrollbar = document.createElement('div');
5312
+ this._scrollbar.className = 'dv-scrollbar dv-scrollbar-horizontal';
5282
5313
  this.element.appendChild(scrollableElement);
5283
- this.element.appendChild(this._horizontalScrollbar);
5314
+ this.element.appendChild(this._scrollbar);
5284
5315
  this.addDisposables(addDisposableListener(this.element, 'wheel', (event) => {
5285
- this._scrollLeft += event.deltaY * Scrollbar.MouseWheelSpeed;
5316
+ this._scrollOffset += event.deltaY * Scrollbar.MouseWheelSpeed;
5286
5317
  this.calculateScrollbarStyles();
5287
- }), addDisposableListener(this._horizontalScrollbar, 'pointerdown', (event) => {
5318
+ }), addDisposableListener(this._scrollbar, 'pointerdown', (event) => {
5288
5319
  event.preventDefault();
5289
5320
  toggleClass(this.element, 'dv-scrollable-scrolling', true);
5290
- const originalClientX = event.clientX;
5291
- const originalScrollLeft = this._scrollLeft;
5321
+ const originalClient = this._orientation === 'horizontal'
5322
+ ? event.clientX
5323
+ : event.clientY;
5324
+ const originalScrollOffset = this._scrollOffset;
5292
5325
  const onPointerMove = (event) => {
5293
- const deltaX = event.clientX - originalClientX;
5294
- const { clientWidth } = this.element;
5295
- const { scrollWidth } = this.scrollableElement;
5296
- const p = clientWidth / scrollWidth;
5297
- this._scrollLeft = originalScrollLeft + deltaX / p;
5326
+ const delta = this._orientation === 'horizontal'
5327
+ ? event.clientX - originalClient
5328
+ : event.clientY - originalClient;
5329
+ const clientSize = this._orientation === 'horizontal'
5330
+ ? this.element.clientWidth
5331
+ : this.element.clientHeight;
5332
+ const scrollSize = this._orientation === 'horizontal'
5333
+ ? this.scrollableElement.scrollWidth
5334
+ : this.scrollableElement.scrollHeight;
5335
+ const p = clientSize / scrollSize;
5336
+ this._scrollOffset = originalScrollOffset + delta / p;
5298
5337
  this.calculateScrollbarStyles();
5299
5338
  };
5300
5339
  const onEnd = () => {
@@ -5309,7 +5348,10 @@
5309
5348
  }), addDisposableListener(this.element, 'scroll', () => {
5310
5349
  this.calculateScrollbarStyles();
5311
5350
  }), addDisposableListener(this.scrollableElement, 'scroll', () => {
5312
- this._scrollLeft = this.scrollableElement.scrollLeft;
5351
+ this._scrollOffset =
5352
+ this._orientation === 'horizontal'
5353
+ ? this.scrollableElement.scrollLeft
5354
+ : this.scrollableElement.scrollTop;
5313
5355
  this.calculateScrollbarStyles();
5314
5356
  }), watchElementResize(this.element, () => {
5315
5357
  toggleClass(this.element, 'dv-scrollable-resizing', true);
@@ -5324,21 +5366,50 @@
5324
5366
  }));
5325
5367
  }
5326
5368
  calculateScrollbarStyles() {
5327
- const { clientWidth } = this.element;
5328
- const { scrollWidth } = this.scrollableElement;
5329
- const hasScrollbar = scrollWidth > clientWidth;
5369
+ const clientSize = this._orientation === 'horizontal'
5370
+ ? this.element.clientWidth
5371
+ : this.element.clientHeight;
5372
+ const scrollSize = this._orientation === 'horizontal'
5373
+ ? this.scrollableElement.scrollWidth
5374
+ : this.scrollableElement.scrollHeight;
5375
+ const hasScrollbar = scrollSize > clientSize;
5330
5376
  if (hasScrollbar) {
5331
- const px = clientWidth * (clientWidth / scrollWidth);
5332
- this._horizontalScrollbar.style.width = `${px}px`;
5333
- this._scrollLeft = clamp(this._scrollLeft, 0, this.scrollableElement.scrollWidth - clientWidth);
5334
- this.scrollableElement.scrollLeft = this._scrollLeft;
5335
- const percentageComplete = this._scrollLeft / (scrollWidth - clientWidth);
5336
- this._horizontalScrollbar.style.left = `${(clientWidth - px) * percentageComplete}px`;
5377
+ const px = clientSize * (clientSize / scrollSize);
5378
+ if (this._orientation === 'horizontal') {
5379
+ this._scrollbar.style.width = `${px}px`;
5380
+ this._scrollbar.style.height = '';
5381
+ }
5382
+ else {
5383
+ this._scrollbar.style.height = `${px}px`;
5384
+ this._scrollbar.style.width = '';
5385
+ }
5386
+ this._scrollOffset = clamp(this._scrollOffset, 0, scrollSize - clientSize);
5387
+ if (this._orientation === 'horizontal') {
5388
+ this.scrollableElement.scrollLeft = this._scrollOffset;
5389
+ }
5390
+ else {
5391
+ this.scrollableElement.scrollTop = this._scrollOffset;
5392
+ }
5393
+ const percentageComplete = this._scrollOffset / (scrollSize - clientSize);
5394
+ if (this._orientation === 'horizontal') {
5395
+ this._scrollbar.style.left = `${(clientSize - px) * percentageComplete}px`;
5396
+ this._scrollbar.style.top = '';
5397
+ }
5398
+ else {
5399
+ this._scrollbar.style.top = `${(clientSize - px) * percentageComplete}px`;
5400
+ this._scrollbar.style.left = '';
5401
+ }
5337
5402
  }
5338
5403
  else {
5339
- this._horizontalScrollbar.style.width = `0px`;
5340
- this._horizontalScrollbar.style.left = `0px`;
5341
- this._scrollLeft = 0;
5404
+ if (this._orientation === 'horizontal') {
5405
+ this._scrollbar.style.width = '0px';
5406
+ this._scrollbar.style.left = '0px';
5407
+ }
5408
+ else {
5409
+ this._scrollbar.style.height = '0px';
5410
+ this._scrollbar.style.top = '0px';
5411
+ }
5412
+ this._scrollOffset = 0;
5342
5413
  }
5343
5414
  }
5344
5415
  }
@@ -5375,14 +5446,36 @@
5375
5446
  get tabs() {
5376
5447
  return this._tabs.map((_) => _.value);
5377
5448
  }
5449
+ get direction() {
5450
+ return this._direction;
5451
+ }
5452
+ set direction(value) {
5453
+ if (this._direction === value) {
5454
+ return;
5455
+ }
5456
+ this._direction = value;
5457
+ if (this._scrollbar) {
5458
+ this._scrollbar.orientation = value;
5459
+ }
5460
+ removeClasses(this._tabsList, 'dv-horizontal', 'dv-vertical');
5461
+ if (value === 'vertical') {
5462
+ addClasses(this._tabsList, 'dv-tabs-container-vertical', 'dv-vertical');
5463
+ }
5464
+ else {
5465
+ removeClasses(this._tabsList, 'dv-tabs-container-vertical');
5466
+ addClasses(this._tabsList, 'dv-horizontal');
5467
+ }
5468
+ }
5378
5469
  constructor(group, accessor, options) {
5379
5470
  super();
5380
5471
  this.group = group;
5381
5472
  this.accessor = accessor;
5382
5473
  this._observerDisposable = new MutableDisposable();
5474
+ this._scrollbar = null;
5383
5475
  this._tabs = [];
5384
5476
  this.selectedIndex = -1;
5385
5477
  this._showTabsOverflowControl = false;
5478
+ this._direction = 'horizontal';
5386
5479
  this._onTabDragStart = new Emitter();
5387
5480
  this.onTabDragStart = this._onTabDragStart.event;
5388
5481
  this._onDrop = new Emitter();
@@ -5392,15 +5485,16 @@
5392
5485
  this._onOverflowTabsChange = new Emitter();
5393
5486
  this.onOverflowTabsChange = this._onOverflowTabsChange.event;
5394
5487
  this._tabsList = document.createElement('div');
5395
- this._tabsList.className = 'dv-tabs-container dv-horizontal';
5488
+ this._tabsList.className = 'dv-tabs-container';
5396
5489
  this.showTabsOverflowControl = options.showTabsOverflowControl;
5397
5490
  if (accessor.options.scrollbars === 'native') {
5398
5491
  this._element = this._tabsList;
5399
5492
  }
5400
5493
  else {
5401
- const scrollbar = new Scrollbar(this._tabsList);
5402
- this._element = scrollbar.element;
5403
- this.addDisposables(scrollbar);
5494
+ this._scrollbar = new Scrollbar(this._tabsList);
5495
+ this._scrollbar.orientation = this.direction;
5496
+ this._element = this._scrollbar.element;
5497
+ this.addDisposables(this._scrollbar);
5404
5498
  }
5405
5499
  this.addDisposables(this._onOverflowTabsChange, this._observerDisposable, this._onWillShowOverlay, this._onDrop, this._onTabDragStart, addDisposableListener(this.element, 'pointerdown', (event) => {
5406
5500
  if (event.defaultPrevented) {
@@ -5597,6 +5691,22 @@
5597
5691
  this._hidden = value;
5598
5692
  this.element.style.display = value ? 'none' : '';
5599
5693
  }
5694
+ get direction() {
5695
+ return this._direction;
5696
+ }
5697
+ set direction(value) {
5698
+ this._direction = value;
5699
+ if (value === 'vertical') {
5700
+ addClasses(this._element, 'dv-groupview-header-vertical');
5701
+ addClasses(this.rightActionsContainer, 'dv-right-actions-container-vertical');
5702
+ this.tabs.direction = value;
5703
+ }
5704
+ else {
5705
+ removeClasses(this._element, 'dv-groupview-header-vertical');
5706
+ removeClasses(this.rightActionsContainer, 'dv-right-actions-container-vertical');
5707
+ this.tabs.direction = value;
5708
+ }
5709
+ }
5600
5710
  get element() {
5601
5711
  return this._element;
5602
5712
  }
@@ -5605,6 +5715,7 @@
5605
5715
  this.accessor = accessor;
5606
5716
  this.group = group;
5607
5717
  this._hidden = false;
5718
+ this._direction = 'horizontal';
5608
5719
  this.dropdownPart = null;
5609
5720
  this._overflowTabs = [];
5610
5721
  this._dropdownDisposable = new MutableDisposable();
@@ -5834,6 +5945,7 @@
5834
5945
  floatingGroupBounds: undefined,
5835
5946
  popoutUrl: undefined,
5836
5947
  defaultRenderer: undefined,
5948
+ defaultHeaderPosition: undefined,
5837
5949
  debug: undefined,
5838
5950
  rootOverlayModel: undefined,
5839
5951
  locked: undefined,
@@ -5943,6 +6055,29 @@
5943
6055
  }
5944
6056
  return isAncestor(document.activeElement, this.contentContainer.element);
5945
6057
  }
6058
+ get headerPosition() {
6059
+ var _a;
6060
+ return (_a = this._headerPosition) !== null && _a !== void 0 ? _a : 'top';
6061
+ }
6062
+ set headerPosition(value) {
6063
+ var _a;
6064
+ this._headerPosition = value;
6065
+ removeClasses(this.container, 'dv-groupview-header-top', 'dv-groupview-header-bottom', 'dv-groupview-header-left', 'dv-groupview-header-right');
6066
+ addClasses(this.container, `dv-groupview-header-${value}`);
6067
+ const direction = value === 'top' || value === 'bottom' ? 'horizontal' : 'vertical';
6068
+ this.tabsContainer.direction = direction;
6069
+ this.header.direction = direction;
6070
+ // resize the active panel to fit the new header direction
6071
+ // if not, the panel will overflow the tabs container
6072
+ if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {
6073
+ this._activePanel.layout(this._width, this._height);
6074
+ }
6075
+ if (this._leftHeaderActions ||
6076
+ this._rightHeaderActions ||
6077
+ this._prefixHeaderActions) {
6078
+ this.updateHeaderActions();
6079
+ }
6080
+ }
5946
6081
  get location() {
5947
6082
  return this._location;
5948
6083
  }
@@ -5977,7 +6112,7 @@
5977
6112
  });
5978
6113
  }
5979
6114
  constructor(container, accessor, id, options, groupPanel) {
5980
- var _a;
6115
+ var _a, _b;
5981
6116
  super();
5982
6117
  this.container = container;
5983
6118
  this.accessor = accessor;
@@ -5986,6 +6121,9 @@
5986
6121
  this.groupPanel = groupPanel;
5987
6122
  this._isGroupActive = false;
5988
6123
  this._locked = false;
6124
+ this._rightHeaderActionsDisposable = new MutableDisposable();
6125
+ this._leftHeaderActionsDisposable = new MutableDisposable();
6126
+ this._prefixHeaderActionsDisposable = new MutableDisposable();
5989
6127
  this._location = { type: 'grid' };
5990
6128
  this.mostRecentlyUsed = [];
5991
6129
  this._overwriteRenderContainer = null;
@@ -6027,7 +6165,9 @@
6027
6165
  container.append(this.tabsContainer.element, this.contentContainer.element);
6028
6166
  this.header.hidden = !!options.hideHeader;
6029
6167
  this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
6030
- this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
6168
+ this.headerPosition =
6169
+ (_b = options.headerPosition) !== null && _b !== void 0 ? _b : accessor.defaultHeaderPosition;
6170
+ this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this._rightHeaderActionsDisposable, this._leftHeaderActionsDisposable, this._prefixHeaderActionsDisposable, this.tabsContainer.onTabDragStart((event) => {
6031
6171
  this._onTabDragStart.fire(event);
6032
6172
  }), this.tabsContainer.onGroupDragStart((event) => {
6033
6173
  this._onGroupDragStart.fire(event);
@@ -6087,10 +6227,13 @@
6087
6227
  // correctly initialized
6088
6228
  this.setActive(this.isActive, true);
6089
6229
  this.updateContainer();
6230
+ this.updateHeaderActions();
6231
+ }
6232
+ updateHeaderActions() {
6090
6233
  if (this.accessor.options.createRightHeaderActionComponent) {
6091
6234
  this._rightHeaderActions =
6092
6235
  this.accessor.options.createRightHeaderActionComponent(this.groupPanel);
6093
- this.addDisposables(this._rightHeaderActions);
6236
+ this._rightHeaderActionsDisposable.value = this._rightHeaderActions;
6094
6237
  this._rightHeaderActions.init({
6095
6238
  containerApi: this._api,
6096
6239
  api: this.groupPanel.api,
@@ -6098,10 +6241,15 @@
6098
6241
  });
6099
6242
  this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
6100
6243
  }
6244
+ else {
6245
+ this._rightHeaderActions = undefined;
6246
+ this._rightHeaderActionsDisposable.dispose();
6247
+ this.tabsContainer.setRightActionsElement(undefined);
6248
+ }
6101
6249
  if (this.accessor.options.createLeftHeaderActionComponent) {
6102
6250
  this._leftHeaderActions =
6103
6251
  this.accessor.options.createLeftHeaderActionComponent(this.groupPanel);
6104
- this.addDisposables(this._leftHeaderActions);
6252
+ this._leftHeaderActionsDisposable.value = this._leftHeaderActions;
6105
6253
  this._leftHeaderActions.init({
6106
6254
  containerApi: this._api,
6107
6255
  api: this.groupPanel.api,
@@ -6109,10 +6257,16 @@
6109
6257
  });
6110
6258
  this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
6111
6259
  }
6260
+ else {
6261
+ this._leftHeaderActions = undefined;
6262
+ this._leftHeaderActionsDisposable.dispose();
6263
+ this.tabsContainer.setLeftActionsElement(undefined);
6264
+ }
6112
6265
  if (this.accessor.options.createPrefixHeaderActionComponent) {
6113
6266
  this._prefixHeaderActions =
6114
6267
  this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel);
6115
- this.addDisposables(this._prefixHeaderActions);
6268
+ this._prefixHeaderActionsDisposable.value =
6269
+ this._prefixHeaderActions;
6116
6270
  this._prefixHeaderActions.init({
6117
6271
  containerApi: this._api,
6118
6272
  api: this.groupPanel.api,
@@ -6120,6 +6274,11 @@
6120
6274
  });
6121
6275
  this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
6122
6276
  }
6277
+ else {
6278
+ this._prefixHeaderActions = undefined;
6279
+ this._prefixHeaderActionsDisposable.dispose();
6280
+ this.tabsContainer.setPrefixActionsElement(undefined);
6281
+ }
6123
6282
  }
6124
6283
  rerender(panel) {
6125
6284
  this.contentContainer.renderPanel(panel, { asActive: false });
@@ -6140,6 +6299,9 @@
6140
6299
  if (this.header.hidden) {
6141
6300
  result.hideHeader = true;
6142
6301
  }
6302
+ if (this.headerPosition !== 'top') {
6303
+ result.headerPosition = this.headerPosition;
6304
+ }
6143
6305
  return result;
6144
6306
  }
6145
6307
  moveToNext(options) {
@@ -6337,6 +6499,9 @@
6337
6499
  if (!options.skipSetActive) {
6338
6500
  this.contentContainer.openPanel(panel);
6339
6501
  }
6502
+ else if (panel.api.renderer === 'always') {
6503
+ this.contentContainer.renderPanel(panel, { asActive: false });
6504
+ }
6340
6505
  if (hasExistingPanel) {
6341
6506
  // TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
6342
6507
  return;
@@ -6743,6 +6908,18 @@
6743
6908
  ? this.location.getWindow()
6744
6909
  : window;
6745
6910
  }
6911
+ setHeaderPosition(position) {
6912
+ if (!this._group) {
6913
+ throw new Error(NOT_INITIALIZED_MESSAGE);
6914
+ }
6915
+ this._group.model.headerPosition = position;
6916
+ }
6917
+ getHeaderPosition() {
6918
+ if (!this._group) {
6919
+ throw new Error(NOT_INITIALIZED_MESSAGE);
6920
+ }
6921
+ return this._group.model.headerPosition;
6922
+ }
6746
6923
  moveTo(options) {
6747
6924
  var _a, _b, _c, _d;
6748
6925
  if (!this._group) {
@@ -6757,7 +6934,7 @@
6757
6934
  to: {
6758
6935
  group,
6759
6936
  position: options.group
6760
- ? (_d = options.position) !== null && _d !== void 0 ? _d : 'center'
6937
+ ? ((_d = options.position) !== null && _d !== void 0 ? _d : 'center')
6761
6938
  : 'center',
6762
6939
  index: options.index,
6763
6940
  },
@@ -6793,7 +6970,6 @@
6793
6970
  }
6794
6971
  }
6795
6972
 
6796
- // GridConstraintChangeEvent2 is not exported, so we'll type it manually
6797
6973
  const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
6798
6974
  const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
6799
6975
  class DockviewGroupPanel extends GridviewPanel {
@@ -6884,24 +7060,28 @@
6884
7060
  // Track explicitly set constraints to override panel constraints
6885
7061
  // Extract numeric values from functions or values
6886
7062
  if (event.minimumWidth !== undefined) {
6887
- this._explicitConstraints.minimumWidth = typeof event.minimumWidth === 'function'
6888
- ? event.minimumWidth()
6889
- : event.minimumWidth;
7063
+ this._explicitConstraints.minimumWidth =
7064
+ typeof event.minimumWidth === 'function'
7065
+ ? event.minimumWidth()
7066
+ : event.minimumWidth;
6890
7067
  }
6891
7068
  if (event.minimumHeight !== undefined) {
6892
- this._explicitConstraints.minimumHeight = typeof event.minimumHeight === 'function'
6893
- ? event.minimumHeight()
6894
- : event.minimumHeight;
7069
+ this._explicitConstraints.minimumHeight =
7070
+ typeof event.minimumHeight === 'function'
7071
+ ? event.minimumHeight()
7072
+ : event.minimumHeight;
6895
7073
  }
6896
7074
  if (event.maximumWidth !== undefined) {
6897
- this._explicitConstraints.maximumWidth = typeof event.maximumWidth === 'function'
6898
- ? event.maximumWidth()
6899
- : event.maximumWidth;
7075
+ this._explicitConstraints.maximumWidth =
7076
+ typeof event.maximumWidth === 'function'
7077
+ ? event.maximumWidth()
7078
+ : event.maximumWidth;
6900
7079
  }
6901
7080
  if (event.maximumHeight !== undefined) {
6902
- this._explicitConstraints.maximumHeight = typeof event.maximumHeight === 'function'
6903
- ? event.maximumHeight()
6904
- : event.maximumHeight;
7081
+ this._explicitConstraints.maximumHeight =
7082
+ typeof event.maximumHeight === 'function'
7083
+ ? event.maximumHeight()
7084
+ : event.maximumHeight;
6905
7085
  }
6906
7086
  }));
6907
7087
  }
@@ -7031,7 +7211,7 @@
7031
7211
  to: {
7032
7212
  group: (_a = options.group) !== null && _a !== void 0 ? _a : this._group,
7033
7213
  position: options.group
7034
- ? (_b = options.position) !== null && _b !== void 0 ? _b : 'center'
7214
+ ? ((_b = options.position) !== null && _b !== void 0 ? _b : 'center')
7035
7215
  : 'center',
7036
7216
  index: options.index,
7037
7217
  },
@@ -7383,7 +7563,7 @@
7383
7563
  const viewData = panelData.view;
7384
7564
  const contentComponent = viewData
7385
7565
  ? viewData.content.id
7386
- : (_a = panelData.contentComponent) !== null && _a !== void 0 ? _a : 'unknown';
7566
+ : ((_a = panelData.contentComponent) !== null && _a !== void 0 ? _a : 'unknown');
7387
7567
  const tabComponent = viewData
7388
7568
  ? (_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id
7389
7569
  : panelData.tabComponent;
@@ -7435,7 +7615,8 @@
7435
7615
  update() {
7436
7616
  for (let i = 0; i < this._orderedList.length; i++) {
7437
7617
  this._orderedList[i].setAttribute('aria-level', `${i}`);
7438
- this._orderedList[i].style.zIndex = `calc(var(--dv-overlay-z-index, 999) + ${i * 2})`;
7618
+ this._orderedList[i].style.zIndex =
7619
+ `calc(var(--dv-overlay-z-index, 999) + ${i * 2})`;
7439
7620
  }
7440
7621
  }
7441
7622
  }
@@ -7836,7 +8017,12 @@
7836
8017
  }
7837
8018
 
7838
8019
  const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
7839
- const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100, width: 300, height: 300 };
8020
+ const DEFAULT_FLOATING_GROUP_POSITION = {
8021
+ left: 100,
8022
+ top: 100,
8023
+ width: 300,
8024
+ height: 300,
8025
+ };
7840
8026
  const DESERIALIZATION_POPOUT_DELAY_MS = 100;
7841
8027
 
7842
8028
  class PositionCache {
@@ -8311,6 +8497,8 @@
8311
8497
  return; // clicked within popover
8312
8498
  }
8313
8499
  this.close();
8500
+ }), addDisposableListener(window, 'resize', () => {
8501
+ this.close();
8314
8502
  }));
8315
8503
  requestAnimationFrame(() => {
8316
8504
  shiftAbsoluteElementIntoView(wrapper, this.root);
@@ -8441,6 +8629,10 @@
8441
8629
  var _a;
8442
8630
  return (_a = this.options.defaultRenderer) !== null && _a !== void 0 ? _a : 'onlyWhenVisible';
8443
8631
  }
8632
+ get defaultHeaderPosition() {
8633
+ var _a;
8634
+ return (_a = this.options.defaultHeaderPosition) !== null && _a !== void 0 ? _a : 'top';
8635
+ }
8444
8636
  get api() {
8445
8637
  return this._api;
8446
8638
  }
@@ -9010,9 +9202,9 @@
9010
9202
  const anchoredBox = getAnchoredBox();
9011
9203
  const overlay = new Overlay(Object.assign(Object.assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
9012
9204
  ? undefined
9013
- : (_c = (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport) !== null && _c !== void 0 ? _c : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE, minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
9205
+ : ((_c = (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport) !== null && _c !== void 0 ? _c : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE), minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
9014
9206
  ? undefined
9015
- : (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
9207
+ : ((_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE) }));
9016
9208
  const el = group.element.querySelector('.dv-void-container');
9017
9209
  if (!el) {
9018
9210
  throw new Error('dockview: failed to find drag handle');
@@ -9125,6 +9317,13 @@
9125
9317
  if ('theme' in options) {
9126
9318
  this.updateTheme();
9127
9319
  }
9320
+ if ('createRightHeaderActionComponent' in options ||
9321
+ 'createLeftHeaderActionComponent' in options ||
9322
+ 'createPrefixHeaderActionComponent' in options) {
9323
+ for (const group of this.groups) {
9324
+ group.model.updateHeaderActions();
9325
+ }
9326
+ }
9128
9327
  this.layout(this.gridview.width, this.gridview.height, true);
9129
9328
  }
9130
9329
  layout(width, height, forceResize) {
@@ -9281,7 +9480,7 @@
9281
9480
  const width = this.width;
9282
9481
  const height = this.height;
9283
9482
  const createGroupFromSerializedState = (data) => {
9284
- const { id, locked, hideHeader, views, activeView } = data;
9483
+ const { id, locked, hideHeader, headerPosition, views, activeView, } = data;
9285
9484
  if (typeof id !== 'string') {
9286
9485
  throw new Error('dockview: group id must be of type string');
9287
9486
  }
@@ -9289,6 +9488,7 @@
9289
9488
  id,
9290
9489
  locked: !!locked,
9291
9490
  hideHeader: !!hideHeader,
9491
+ headerPosition,
9292
9492
  });
9293
9493
  this._onDidAddGroup.fire(group);
9294
9494
  const createdPanels = [];
@@ -11344,4 +11544,3 @@
11344
11544
  exports.toTarget = toTarget;
11345
11545
 
11346
11546
  }));
11347
- //# sourceMappingURL=dockview-core.noStyle.js.map
@@ -2,6 +2,7 @@ import { Position } from '../dnd/droptarget';
2
2
  import { DockviewComponent } from '../dockview/dockviewComponent';
3
3
  import { DockviewGroupPanel } from '../dockview/dockviewGroupPanel';
4
4
  import { DockviewGroupChangeEvent, DockviewGroupLocation } from '../dockview/dockviewGroupPanelModel';
5
+ import { DockviewHeaderPosition } from '../dockview/options';
5
6
  import { Emitter, Event } from '../events';
6
7
  import { GridviewPanelApi, GridviewPanelApiImpl, SizeEvent } from './gridviewPanelApi';
7
8
  export interface DockviewGroupMoveParams {
@@ -25,6 +26,8 @@ export interface DockviewGroupPanelApi extends GridviewPanelApi {
25
26
  */
26
27
  getWindow(): Window;
27
28
  moveTo(options: DockviewGroupMoveParams): void;
29
+ setHeaderPosition(position: DockviewHeaderPosition): void;
30
+ getHeaderPosition(): DockviewHeaderPosition;
28
31
  maximize(): void;
29
32
  isMaximized(): boolean;
30
33
  exitMaximized(): void;
@@ -46,6 +49,8 @@ export declare class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
46
49
  setSize(event: SizeEvent): void;
47
50
  close(): void;
48
51
  getWindow(): Window;
52
+ setHeaderPosition(position: DockviewHeaderPosition): void;
53
+ getHeaderPosition(): DockviewHeaderPosition;
49
54
  moveTo(options: DockviewGroupMoveParams): void;
50
55
  maximize(): void;
51
56
  isMaximized(): boolean;