dockview-core 4.2.3 → 4.2.5

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 (37) hide show
  1. package/dist/cjs/dnd/ghost.js +2 -0
  2. package/dist/cjs/dockview/components/popupService.d.ts +1 -0
  3. package/dist/cjs/dockview/components/popupService.js +6 -1
  4. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +5 -1
  5. package/dist/cjs/dockview/dockviewComponent.js +19 -17
  6. package/dist/cjs/dom.d.ts +4 -0
  7. package/dist/cjs/dom.js +40 -1
  8. package/dist/dockview-core.amd.js +68 -20
  9. package/dist/dockview-core.amd.js.map +1 -1
  10. package/dist/dockview-core.amd.min.js +2 -2
  11. package/dist/dockview-core.amd.min.js.map +1 -1
  12. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  13. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  14. package/dist/dockview-core.amd.noStyle.js +68 -20
  15. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  16. package/dist/dockview-core.cjs.js +68 -20
  17. package/dist/dockview-core.cjs.js.map +1 -1
  18. package/dist/dockview-core.esm.js +68 -20
  19. package/dist/dockview-core.esm.js.map +1 -1
  20. package/dist/dockview-core.esm.min.js +2 -2
  21. package/dist/dockview-core.esm.min.js.map +1 -1
  22. package/dist/dockview-core.js +68 -20
  23. package/dist/dockview-core.js.map +1 -1
  24. package/dist/dockview-core.min.js +2 -2
  25. package/dist/dockview-core.min.js.map +1 -1
  26. package/dist/dockview-core.min.noStyle.js +2 -2
  27. package/dist/dockview-core.min.noStyle.js.map +1 -1
  28. package/dist/dockview-core.noStyle.js +68 -20
  29. package/dist/dockview-core.noStyle.js.map +1 -1
  30. package/dist/esm/dnd/ghost.js +2 -0
  31. package/dist/esm/dockview/components/popupService.d.ts +1 -0
  32. package/dist/esm/dockview/components/popupService.js +6 -1
  33. package/dist/esm/dockview/components/titlebar/tabsContainer.js +6 -2
  34. package/dist/esm/dockview/dockviewComponent.js +19 -17
  35. package/dist/esm/dom.d.ts +4 -0
  36. package/dist/esm/dom.js +36 -0
  37. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 4.2.3
3
+ * @version 4.2.5
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -638,6 +638,42 @@ define(['exports'], (function (exports) { 'use strict';
638
638
  }));
639
639
  return disposable;
640
640
  }
641
+ function shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {
642
+ const buffer = options.buffer;
643
+ const rect = element.getBoundingClientRect();
644
+ const rootRect = root.getBoundingClientRect();
645
+ let translateX = 0;
646
+ let translateY = 0;
647
+ const left = rect.left - rootRect.left;
648
+ const top = rect.top - rootRect.top;
649
+ const bottom = rect.bottom - rootRect.bottom;
650
+ const right = rect.right - rootRect.right;
651
+ // Check horizontal overflow
652
+ if (left < buffer) {
653
+ translateX = buffer - left;
654
+ }
655
+ else if (right > buffer) {
656
+ translateX = -buffer - right;
657
+ }
658
+ // Check vertical overflow
659
+ if (top < buffer) {
660
+ translateY = buffer - top;
661
+ }
662
+ else if (bottom > buffer) {
663
+ translateY = -bottom - buffer;
664
+ }
665
+ // Apply the translation if needed
666
+ if (translateX !== 0 || translateY !== 0) {
667
+ element.style.transform = `translate(${translateX}px, ${translateY}px)`;
668
+ }
669
+ }
670
+ function findRelativeZIndexParent(el) {
671
+ let tmp = el;
672
+ while (tmp && (tmp.style.zIndex === 'auto' || tmp.style.zIndex === '')) {
673
+ tmp = tmp.parentElement;
674
+ }
675
+ return tmp;
676
+ }
641
677
 
642
678
  function tail(arr) {
643
679
  if (arr.length === 0) {
@@ -4905,6 +4941,8 @@ define(['exports'], (function (exports) { 'use strict';
4905
4941
  var _a, _b;
4906
4942
  // class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
4907
4943
  addClasses(ghostElement, 'dv-dragged');
4944
+ // move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily
4945
+ ghostElement.style.top = '-9999px';
4908
4946
  document.body.appendChild(ghostElement);
4909
4947
  dataTransfer.setDragImage(ghostElement, (_a = options === null || options === void 0 ? void 0 : options.x) !== null && _a !== void 0 ? _a : 0, (_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : 0);
4910
4948
  setTimeout(() => {
@@ -5605,7 +5643,7 @@ define(['exports'], (function (exports) { 'use strict';
5605
5643
  toggleClass(wrapper, 'dv-tab', true);
5606
5644
  toggleClass(wrapper, 'dv-active-tab', panelObject.api.isActive);
5607
5645
  toggleClass(wrapper, 'dv-inactive-tab', !panelObject.api.isActive);
5608
- wrapper.addEventListener('mousedown', () => {
5646
+ wrapper.addEventListener('pointerdown', () => {
5609
5647
  this.accessor.popupService.close();
5610
5648
  tab.element.scrollIntoView();
5611
5649
  tab.panel.api.setActive();
@@ -5613,9 +5651,13 @@ define(['exports'], (function (exports) { 'use strict';
5613
5651
  wrapper.appendChild(child);
5614
5652
  el.appendChild(wrapper);
5615
5653
  }
5654
+ const relativeParent = findRelativeZIndexParent(root);
5616
5655
  this.accessor.popupService.openPopover(el, {
5617
5656
  x: event.clientX,
5618
5657
  y: event.clientY,
5658
+ zIndex: (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex)
5659
+ ? `calc(${relativeParent.style.zIndex} * 2)`
5660
+ : undefined,
5619
5661
  });
5620
5662
  }));
5621
5663
  }
@@ -7980,10 +8022,11 @@ define(['exports'], (function (exports) { 'use strict';
7980
8022
  }), this._activeDisposable);
7981
8023
  }
7982
8024
  openPopover(element, position) {
8025
+ var _a;
7983
8026
  this.close();
7984
8027
  const wrapper = document.createElement('div');
7985
8028
  wrapper.style.position = 'absolute';
7986
- wrapper.style.zIndex = '99';
8029
+ wrapper.style.zIndex = (_a = position.zIndex) !== null && _a !== void 0 ? _a : 'var(--dv-overlay-z-index)';
7987
8030
  wrapper.appendChild(element);
7988
8031
  const anchorBox = this._element.getBoundingClientRect();
7989
8032
  const offsetX = anchorBox.left;
@@ -8007,6 +8050,9 @@ define(['exports'], (function (exports) { 'use strict';
8007
8050
  }
8008
8051
  this.close();
8009
8052
  }));
8053
+ requestAnimationFrame(() => {
8054
+ shiftAbsoluteElementIntoView(wrapper, this.root);
8055
+ });
8010
8056
  }
8011
8057
  close() {
8012
8058
  if (this._active) {
@@ -9540,24 +9586,26 @@ define(['exports'], (function (exports) { 'use strict';
9540
9586
  selectedPopoutGroup.disposable.dispose();
9541
9587
  }
9542
9588
  }
9543
- const referenceLocation = getGridLocation(to.element);
9544
- const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
9545
- let size;
9546
- switch (this.gridview.orientation) {
9547
- case exports.Orientation.VERTICAL:
9548
- size =
9549
- referenceLocation.length % 2 == 0
9550
- ? from.api.width
9551
- : from.api.height;
9552
- break;
9553
- case exports.Orientation.HORIZONTAL:
9554
- size =
9555
- referenceLocation.length % 2 == 0
9556
- ? from.api.height
9557
- : from.api.width;
9558
- break;
9589
+ if (from.api.location.type !== 'popout') {
9590
+ const referenceLocation = getGridLocation(to.element);
9591
+ const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
9592
+ let size;
9593
+ switch (this.gridview.orientation) {
9594
+ case exports.Orientation.VERTICAL:
9595
+ size =
9596
+ referenceLocation.length % 2 == 0
9597
+ ? from.api.width
9598
+ : from.api.height;
9599
+ break;
9600
+ case exports.Orientation.HORIZONTAL:
9601
+ size =
9602
+ referenceLocation.length % 2 == 0
9603
+ ? from.api.height
9604
+ : from.api.width;
9605
+ break;
9606
+ }
9607
+ this.gridview.addView(from, size, dropLocation);
9559
9608
  }
9560
- this.gridview.addView(from, size, dropLocation);
9561
9609
  }
9562
9610
  from.panels.forEach((panel) => {
9563
9611
  this._onDidMovePanel.fire({ panel, from });