dockview-core 5.2.0 → 6.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 (117) hide show
  1. package/README.md +3 -1
  2. package/dist/cjs/api/component.api.d.ts +93 -1
  3. package/dist/cjs/api/component.api.js +146 -0
  4. package/dist/cjs/api/dockviewGroupPanelApi.d.ts +26 -0
  5. package/dist/cjs/api/dockviewGroupPanelApi.js +21 -1
  6. package/dist/cjs/api/entryPoints.js +4 -5
  7. package/dist/cjs/array.js +7 -8
  8. package/dist/cjs/dnd/dataTransfer.d.ts +2 -1
  9. package/dist/cjs/dnd/dataTransfer.js +5 -4
  10. package/dist/cjs/dnd/droptarget.d.ts +12 -0
  11. package/dist/cjs/dnd/droptarget.js +38 -10
  12. package/dist/cjs/dnd/ghost.js +1 -2
  13. package/dist/cjs/dockview/components/panel/content.js +5 -1
  14. package/dist/cjs/dockview/components/popupService.d.ts +9 -2
  15. package/dist/cjs/dockview/components/popupService.js +24 -9
  16. package/dist/cjs/dockview/components/tab/tab.d.ts +6 -1
  17. package/dist/cjs/dockview/components/tab/tab.js +81 -9
  18. package/dist/cjs/dockview/components/titlebar/tabGroupChip.d.ts +30 -0
  19. package/dist/cjs/dockview/components/titlebar/tabGroupChip.js +95 -0
  20. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.d.ts +71 -0
  21. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +471 -0
  22. package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +57 -0
  23. package/dist/cjs/dockview/components/titlebar/tabGroups.js +612 -0
  24. package/dist/cjs/dockview/components/titlebar/tabOverflowControl.js +1 -2
  25. package/dist/cjs/dockview/components/titlebar/tabs.d.ts +59 -0
  26. package/dist/cjs/dockview/components/titlebar/tabs.js +1227 -144
  27. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +6 -0
  28. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +132 -14
  29. package/dist/cjs/dockview/contextMenu.d.ts +10 -0
  30. package/dist/cjs/dockview/contextMenu.js +298 -0
  31. package/dist/cjs/dockview/dockviewComponent.d.ts +60 -3
  32. package/dist/cjs/dockview/dockviewComponent.js +712 -126
  33. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +83 -0
  34. package/dist/cjs/dockview/dockviewGroupPanelModel.js +619 -27
  35. package/dist/cjs/dockview/dockviewShell.d.ts +128 -0
  36. package/dist/cjs/dockview/dockviewShell.js +681 -0
  37. package/dist/cjs/dockview/events.d.ts +9 -0
  38. package/dist/cjs/dockview/framework.d.ts +14 -0
  39. package/dist/cjs/dockview/options.d.ts +92 -10
  40. package/dist/cjs/dockview/options.js +10 -7
  41. package/dist/cjs/dockview/tabGroup.d.ts +99 -0
  42. package/dist/cjs/dockview/tabGroup.js +219 -0
  43. package/dist/cjs/dockview/tabGroupAccent.d.ts +65 -0
  44. package/dist/cjs/dockview/tabGroupAccent.js +128 -0
  45. package/dist/cjs/dockview/theme.d.ts +56 -1
  46. package/dist/cjs/dockview/theme.js +103 -6
  47. package/dist/cjs/dockview/types.d.ts +2 -0
  48. package/dist/cjs/dom.js +19 -19
  49. package/dist/cjs/events.js +2 -2
  50. package/dist/cjs/gridview/baseComponentGridview.d.ts +1 -0
  51. package/dist/cjs/gridview/baseComponentGridview.js +6 -3
  52. package/dist/cjs/gridview/gridview.js +7 -7
  53. package/dist/cjs/index.d.ts +8 -5
  54. package/dist/cjs/index.js +6 -1
  55. package/dist/cjs/popoutWindow.js +3 -3
  56. package/dist/cjs/splitview/splitviewPanel.d.ts +1 -1
  57. package/dist/dockview-core.js +6942 -2777
  58. package/dist/dockview-core.min.js +2 -2
  59. package/dist/dockview-core.min.js.map +1 -1
  60. package/dist/dockview-core.min.noStyle.js +2 -2
  61. package/dist/dockview-core.min.noStyle.js.map +1 -1
  62. package/dist/dockview-core.noStyle.js +6940 -2775
  63. package/dist/esm/api/component.api.d.ts +93 -1
  64. package/dist/esm/api/component.api.js +118 -0
  65. package/dist/esm/api/dockviewGroupPanelApi.d.ts +26 -0
  66. package/dist/esm/api/dockviewGroupPanelApi.js +21 -1
  67. package/dist/esm/dnd/dataTransfer.d.ts +2 -1
  68. package/dist/esm/dnd/dataTransfer.js +2 -1
  69. package/dist/esm/dnd/droptarget.d.ts +12 -0
  70. package/dist/esm/dnd/droptarget.js +33 -5
  71. package/dist/esm/dockview/components/panel/content.js +5 -1
  72. package/dist/esm/dockview/components/popupService.d.ts +9 -2
  73. package/dist/esm/dockview/components/popupService.js +23 -9
  74. package/dist/esm/dockview/components/tab/tab.d.ts +6 -1
  75. package/dist/esm/dockview/components/tab/tab.js +83 -9
  76. package/dist/esm/dockview/components/titlebar/tabGroupChip.d.ts +30 -0
  77. package/dist/esm/dockview/components/titlebar/tabGroupChip.js +68 -0
  78. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.d.ts +71 -0
  79. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +354 -0
  80. package/dist/esm/dockview/components/titlebar/tabGroups.d.ts +57 -0
  81. package/dist/esm/dockview/components/titlebar/tabGroups.js +406 -0
  82. package/dist/esm/dockview/components/titlebar/tabs.d.ts +59 -0
  83. package/dist/esm/dockview/components/titlebar/tabs.js +1011 -99
  84. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +6 -0
  85. package/dist/esm/dockview/components/titlebar/tabsContainer.js +105 -7
  86. package/dist/esm/dockview/contextMenu.d.ts +10 -0
  87. package/dist/esm/dockview/contextMenu.js +213 -0
  88. package/dist/esm/dockview/dockviewComponent.d.ts +60 -3
  89. package/dist/esm/dockview/dockviewComponent.js +460 -35
  90. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +83 -0
  91. package/dist/esm/dockview/dockviewGroupPanelModel.js +460 -4
  92. package/dist/esm/dockview/dockviewShell.d.ts +128 -0
  93. package/dist/esm/dockview/dockviewShell.js +621 -0
  94. package/dist/esm/dockview/events.d.ts +9 -0
  95. package/dist/esm/dockview/framework.d.ts +14 -0
  96. package/dist/esm/dockview/options.d.ts +92 -10
  97. package/dist/esm/dockview/options.js +5 -2
  98. package/dist/esm/dockview/tabGroup.d.ts +99 -0
  99. package/dist/esm/dockview/tabGroup.js +144 -0
  100. package/dist/esm/dockview/tabGroupAccent.d.ts +65 -0
  101. package/dist/esm/dockview/tabGroupAccent.js +116 -0
  102. package/dist/esm/dockview/theme.d.ts +56 -1
  103. package/dist/esm/dockview/theme.js +102 -5
  104. package/dist/esm/dockview/types.d.ts +2 -0
  105. package/dist/esm/dom.js +1 -1
  106. package/dist/esm/gridview/baseComponentGridview.d.ts +1 -0
  107. package/dist/esm/gridview/baseComponentGridview.js +4 -1
  108. package/dist/esm/index.d.ts +8 -5
  109. package/dist/esm/index.js +2 -1
  110. package/dist/esm/popoutWindow.js +1 -1
  111. package/dist/esm/splitview/splitviewPanel.d.ts +1 -1
  112. package/dist/package/main.cjs.js +6936 -2801
  113. package/dist/package/main.cjs.min.js +2 -2
  114. package/dist/package/main.esm.min.mjs +2 -2
  115. package/dist/package/main.esm.mjs +6922 -2800
  116. package/dist/styles/dockview.css +1945 -196
  117. package/package.json +5 -1
@@ -15,7 +15,11 @@ var __extends = (this && this.__extends) || (function () {
15
15
  };
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.calculateQuadrantAsPixels = exports.calculateQuadrantAsPercentage = exports.Droptarget = exports.positionToDirection = exports.directionToPosition = exports.WillShowOverlayEvent = void 0;
18
+ exports.Droptarget = exports.WillShowOverlayEvent = void 0;
19
+ exports.directionToPosition = directionToPosition;
20
+ exports.positionToDirection = positionToDirection;
21
+ exports.calculateQuadrantAsPercentage = calculateQuadrantAsPercentage;
22
+ exports.calculateQuadrantAsPixels = calculateQuadrantAsPixels;
19
23
  var dom_1 = require("../dom");
20
24
  var events_1 = require("../events");
21
25
  var lifecycle_1 = require("../lifecycle");
@@ -103,7 +107,6 @@ function directionToPosition(direction) {
103
107
  throw new Error("invalid direction '".concat(direction, "'"));
104
108
  }
105
109
  }
106
- exports.directionToPosition = directionToPosition;
107
110
  function positionToDirection(position) {
108
111
  switch (position) {
109
112
  case 'top':
@@ -120,7 +123,6 @@ function positionToDirection(position) {
120
123
  throw new Error("invalid position '".concat(position, "'"));
121
124
  }
122
125
  }
123
- exports.positionToDirection = positionToDirection;
124
126
  var DEFAULT_ACTIVATION_SIZE = {
125
127
  value: 20,
126
128
  type: 'percentage',
@@ -306,13 +308,15 @@ var Droptarget = /** @class */ (function (_super) {
306
308
  return typeof value === 'boolean' && value;
307
309
  };
308
310
  Droptarget.prototype.toggleClasses = function (quadrant, width, height) {
309
- var _a, _b, _c, _d, _e, _f, _g;
311
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
310
312
  var target = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);
311
313
  if (!target && !this.overlayElement) {
312
314
  return;
313
315
  }
314
- var isSmallX = width < SMALL_WIDTH_BOUNDARY;
315
- var isSmallY = height < SMALL_HEIGHT_BOUNDARY;
316
+ var smallWidthBoundary = (_d = (_c = this.options.overlayModel) === null || _c === void 0 ? void 0 : _c.smallWidthBoundary) !== null && _d !== void 0 ? _d : SMALL_WIDTH_BOUNDARY;
317
+ var smallHeightBoundary = (_f = (_e = this.options.overlayModel) === null || _e === void 0 ? void 0 : _e.smallHeightBoundary) !== null && _f !== void 0 ? _f : SMALL_HEIGHT_BOUNDARY;
318
+ var isSmallX = width < smallWidthBoundary;
319
+ var isSmallY = height < smallHeightBoundary;
316
320
  var isLeft = quadrant === 'left';
317
321
  var isRight = quadrant === 'right';
318
322
  var isTop = quadrant === 'top';
@@ -322,7 +326,7 @@ var Droptarget = /** @class */ (function (_super) {
322
326
  var topClass = !isSmallY && isTop;
323
327
  var bottomClass = !isSmallY && isBottom;
324
328
  var size = 1;
325
- var sizeOptions = (_d = (_c = this.options.overlayModel) === null || _c === void 0 ? void 0 : _c.size) !== null && _d !== void 0 ? _d : DEFAULT_SIZE;
329
+ var sizeOptions = (_h = (_g = this.options.overlayModel) === null || _g === void 0 ? void 0 : _g.size) !== null && _h !== void 0 ? _h : DEFAULT_SIZE;
326
330
  if (sizeOptions.type === 'percentage') {
327
331
  size = (0, math_1.clamp)(sizeOptions.value, 0, 100) / 100;
328
332
  }
@@ -335,7 +339,7 @@ var Droptarget = /** @class */ (function (_super) {
335
339
  }
336
340
  }
337
341
  if (target) {
338
- var outlineEl = (_g = (_f = (_e = this.options).getOverlayOutline) === null || _f === void 0 ? void 0 : _f.call(_e)) !== null && _g !== void 0 ? _g : this.element;
342
+ var outlineEl = (_l = (_k = (_j = this.options).getOverlayOutline) === null || _k === void 0 ? void 0 : _k.call(_j)) !== null && _l !== void 0 ? _l : this.element;
339
343
  var elBox = outlineEl.getBoundingClientRect();
340
344
  var ta = target.getElements(undefined, outlineEl);
341
345
  var el = ta.root;
@@ -370,6 +374,13 @@ var Droptarget = /** @class */ (function (_super) {
370
374
  box_1.left = rootLeft + width - 4;
371
375
  box_1.width = 4;
372
376
  }
377
+ if (isSmallY && isTop) {
378
+ box_1.height = 4;
379
+ }
380
+ if (isSmallY && isBottom) {
381
+ box_1.top = rootTop + height - 4;
382
+ box_1.height = 4;
383
+ }
373
384
  // Use GPU-optimized bounds checking and setting
374
385
  if (!checkBoundsChanged(overlay_1, box_1)) {
375
386
  return;
@@ -380,6 +391,8 @@ var Droptarget = /** @class */ (function (_super) {
380
391
  (0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-right', isRight);
381
392
  (0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-top', isTop);
382
393
  (0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-bottom', isBottom);
394
+ (0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-anchor-line', (isSmallX && (isLeft || isRight)) ||
395
+ (isSmallY && (isTop || isBottom)));
383
396
  (0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-center', quadrant === 'center');
384
397
  if (ta.changed) {
385
398
  (0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-anchor-container-changed', true);
@@ -426,9 +439,26 @@ var Droptarget = /** @class */ (function (_super) {
426
439
  box.top = "".concat(100 * (1 - size), "%");
427
440
  box.height = "".concat(100 * size, "%");
428
441
  }
442
+ if (isSmallX && isLeft) {
443
+ box.width = '4px';
444
+ }
445
+ if (isSmallX && isRight) {
446
+ box.left = "".concat(width - 4, "px");
447
+ box.width = '4px';
448
+ }
449
+ if (isSmallY && isTop) {
450
+ box.height = '4px';
451
+ }
452
+ if (isSmallY && isBottom) {
453
+ box.top = "".concat(height - 4, "px");
454
+ box.height = '4px';
455
+ }
429
456
  setGPUOptimizedBoundsFromStrings(this.overlayElement, box);
457
+ var isLine = (isSmallX && (isLeft || isRight)) ||
458
+ (isSmallY && (isTop || isBottom));
430
459
  (0, dom_1.toggleClass)(this.overlayElement, 'dv-drop-target-small-vertical', isSmallY);
431
460
  (0, dom_1.toggleClass)(this.overlayElement, 'dv-drop-target-small-horizontal', isSmallX);
461
+ (0, dom_1.toggleClass)(this.overlayElement, 'dv-drop-target-selection-line', isLine);
432
462
  (0, dom_1.toggleClass)(this.overlayElement, 'dv-drop-target-left', isLeft);
433
463
  (0, dom_1.toggleClass)(this.overlayElement, 'dv-drop-target-right', isRight);
434
464
  (0, dom_1.toggleClass)(this.overlayElement, 'dv-drop-target-top', isTop);
@@ -478,7 +508,6 @@ function calculateQuadrantAsPercentage(overlayType, x, y, width, height, thresho
478
508
  }
479
509
  return 'center';
480
510
  }
481
- exports.calculateQuadrantAsPercentage = calculateQuadrantAsPercentage;
482
511
  function calculateQuadrantAsPixels(overlayType, x, y, width, height, threshold) {
483
512
  if (overlayType.has('left') && x < threshold) {
484
513
  return 'left';
@@ -497,4 +526,3 @@ function calculateQuadrantAsPixels(overlayType, x, y, width, height, threshold)
497
526
  }
498
527
  return 'center';
499
528
  }
500
- exports.calculateQuadrantAsPixels = calculateQuadrantAsPixels;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addGhostImage = void 0;
3
+ exports.addGhostImage = addGhostImage;
4
4
  var dom_1 = require("../dom");
5
5
  function addGhostImage(dataTransfer, ghostElement, options) {
6
6
  var _a, _b;
@@ -15,4 +15,3 @@ function addGhostImage(dataTransfer, ghostElement, options) {
15
15
  ghostElement.remove();
16
16
  }, 0);
17
17
  }
18
- exports.addGhostImage = addGhostImage;
@@ -82,6 +82,7 @@ var ContentContainer = /** @class */ (function (_super) {
82
82
  };
83
83
  ContentContainer.prototype.renderPanel = function (panel, options) {
84
84
  var _this = this;
85
+ var _a, _b, _c, _d;
85
86
  if (options === void 0) { options = { asActive: true }; }
86
87
  var doRender = options.asActive ||
87
88
  (this.panel && this.group.isPanelActive(this.panel));
@@ -91,6 +92,7 @@ var ContentContainer = /** @class */ (function (_super) {
91
92
  * If the currently attached panel is mounted directly to the content then remove it
92
93
  */
93
94
  this._element.removeChild(this.panel.view.content.element);
95
+ (_b = (_a = this.panel.view.content).onHide) === null || _b === void 0 ? void 0 : _b.call(_a);
94
96
  }
95
97
  this.panel = panel;
96
98
  var container;
@@ -100,6 +102,7 @@ var ContentContainer = /** @class */ (function (_super) {
100
102
  if (this.panel) {
101
103
  if (doRender) {
102
104
  this._element.appendChild(this.panel.view.content.element);
105
+ (_d = (_c = this.panel.view.content).onShow) === null || _d === void 0 ? void 0 : _d.call(_c);
103
106
  }
104
107
  }
105
108
  container = this._element;
@@ -134,10 +137,11 @@ var ContentContainer = /** @class */ (function (_super) {
134
137
  // noop
135
138
  };
136
139
  ContentContainer.prototype.closePanel = function () {
137
- var _a;
140
+ var _a, _b, _c;
138
141
  if (this.panel) {
139
142
  if (this.panel.api.renderer === 'onlyWhenVisible') {
140
143
  (_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
144
+ (_c = (_b = this.panel.view.content).onHide) === null || _c === void 0 ? void 0 : _c.call(_b);
141
145
  }
142
146
  }
143
147
  this.panel = undefined;
@@ -1,10 +1,17 @@
1
1
  import { CompositeDisposable } from '../../lifecycle';
2
2
  export declare class PopupService extends CompositeDisposable {
3
- private readonly root;
4
3
  private readonly _element;
5
4
  private _active;
6
5
  private readonly _activeDisposable;
7
- constructor(root: HTMLElement);
6
+ private _root;
7
+ private readonly _window;
8
+ constructor(root: HTMLElement, win?: Window);
9
+ /**
10
+ * Move the popup anchor into a new root element. Call this when a shell
11
+ * wraps the dockview component so that edge-group overflow dropdowns
12
+ * position correctly relative to the full layout area.
13
+ */
14
+ updateRoot(newRoot: HTMLElement): void;
8
15
  openPopover(element: HTMLElement, position: {
9
16
  x: number;
10
17
  y: number;
@@ -21,25 +21,36 @@ var events_1 = require("../../events");
21
21
  var lifecycle_1 = require("../../lifecycle");
22
22
  var PopupService = /** @class */ (function (_super) {
23
23
  __extends(PopupService, _super);
24
- function PopupService(root) {
24
+ function PopupService(root, win) {
25
+ if (win === void 0) { win = window; }
25
26
  var _this = _super.call(this) || this;
26
- _this.root = root;
27
27
  _this._active = null;
28
28
  _this._activeDisposable = new lifecycle_1.MutableDisposable();
29
- _this._element = document.createElement('div');
29
+ _this._root = root;
30
+ _this._window = win;
31
+ _this._element = win.document.createElement('div');
30
32
  _this._element.className = 'dv-popover-anchor';
31
33
  _this._element.style.position = 'relative';
32
- _this.root.prepend(_this._element);
34
+ _this._root.prepend(_this._element);
33
35
  _this.addDisposables(lifecycle_1.Disposable.from(function () {
34
36
  _this.close();
35
37
  }), _this._activeDisposable);
36
38
  return _this;
37
39
  }
40
+ /**
41
+ * Move the popup anchor into a new root element. Call this when a shell
42
+ * wraps the dockview component so that edge-group overflow dropdowns
43
+ * position correctly relative to the full layout area.
44
+ */
45
+ PopupService.prototype.updateRoot = function (newRoot) {
46
+ newRoot.prepend(this._element);
47
+ this._root = newRoot;
48
+ };
38
49
  PopupService.prototype.openPopover = function (element, position) {
39
50
  var _this = this;
40
51
  var _a;
41
52
  this.close();
42
- var wrapper = document.createElement('div');
53
+ var wrapper = this._window.document.createElement('div');
43
54
  wrapper.style.position = 'absolute';
44
55
  wrapper.style.zIndex = (_a = position.zIndex) !== null && _a !== void 0 ? _a : 'var(--dv-overlay-z-index)';
45
56
  wrapper.appendChild(element);
@@ -50,7 +61,7 @@ var PopupService = /** @class */ (function (_super) {
50
61
  wrapper.style.left = "".concat(position.x - offsetX, "px");
51
62
  this._element.appendChild(wrapper);
52
63
  this._active = wrapper;
53
- this._activeDisposable.value = new lifecycle_1.CompositeDisposable((0, events_1.addDisposableListener)(window, 'pointerdown', function (event) {
64
+ this._activeDisposable.value = new lifecycle_1.CompositeDisposable((0, events_1.addDisposableListener)(this._window, 'pointerdown', function (event) {
54
65
  var _a;
55
66
  var target = event.target;
56
67
  if (!(target instanceof HTMLElement)) {
@@ -64,11 +75,15 @@ var PopupService = /** @class */ (function (_super) {
64
75
  return; // clicked within popover
65
76
  }
66
77
  _this.close();
67
- }), (0, events_1.addDisposableListener)(window, 'resize', function () {
78
+ }), (0, events_1.addDisposableListener)(this._window, 'keydown', function (event) {
79
+ if (event.key === 'Escape' || event.key === 'Enter') {
80
+ _this.close();
81
+ }
82
+ }), (0, events_1.addDisposableListener)(this._window, 'resize', function () {
68
83
  _this.close();
69
84
  }));
70
- requestAnimationFrame(function () {
71
- (0, dom_1.shiftAbsoluteElementIntoView)(wrapper, _this.root);
85
+ this._window.requestAnimationFrame(function () {
86
+ (0, dom_1.shiftAbsoluteElementIntoView)(wrapper, _this._root);
72
87
  });
73
88
  };
74
89
  PopupService.prototype.close = function () {
@@ -5,6 +5,7 @@ import { ITabRenderer } from '../../types';
5
5
  import { DockviewGroupPanel } from '../../dockviewGroupPanel';
6
6
  import { DroptargetEvent, WillShowOverlayEvent } from '../../../dnd/droptarget';
7
7
  import { IDockviewPanel } from '../../dockviewPanel';
8
+ import { DockviewHeaderDirection } from '../../options';
8
9
  export declare class Tab extends CompositeDisposable {
9
10
  readonly panel: IDockviewPanel;
10
11
  private readonly accessor;
@@ -13,8 +14,11 @@ export declare class Tab extends CompositeDisposable {
13
14
  private readonly dropTarget;
14
15
  private content;
15
16
  private readonly dragHandler;
17
+ private _direction;
16
18
  private readonly _onPointDown;
17
19
  readonly onPointerDown: Event<MouseEvent>;
20
+ private readonly _onTabClick;
21
+ readonly onTabClick: Event<MouseEvent>;
18
22
  private readonly _onDropped;
19
23
  readonly onDrop: Event<DroptargetEvent>;
20
24
  private readonly _onDragStart;
@@ -26,6 +30,7 @@ export declare class Tab extends CompositeDisposable {
26
30
  constructor(panel: IDockviewPanel, accessor: DockviewComponent, group: DockviewGroupPanel);
27
31
  setActive(isActive: boolean): void;
28
32
  setContent(part: ITabRenderer): void;
33
+ private _buildOverlayModel;
34
+ setDirection(direction: DockviewHeaderDirection): void;
29
35
  updateDragAndDropState(): void;
30
- dispose(): void;
31
36
  }
@@ -52,8 +52,11 @@ var Tab = /** @class */ (function (_super) {
52
52
  _this.accessor = accessor;
53
53
  _this.group = group;
54
54
  _this.content = undefined;
55
+ _this._direction = 'horizontal';
55
56
  _this._onPointDown = new events_1.Emitter();
56
57
  _this.onPointerDown = _this._onPointDown.event;
58
+ _this._onTabClick = new events_1.Emitter();
59
+ _this.onTabClick = _this._onTabClick.event;
57
60
  _this._onDropped = new events_1.Emitter();
58
61
  _this.onDrop = _this._onDropped.event;
59
62
  _this._onDragStart = new events_1.Emitter();
@@ -68,15 +71,20 @@ var Tab = /** @class */ (function (_super) {
68
71
  _this.dragHandler = new TabDragHandler(_this._element, _this.accessor, _this.group, _this.panel, !!_this.accessor.options.disableDnd);
69
72
  _this.dropTarget = new droptarget_1.Droptarget(_this._element, {
70
73
  acceptedTargetZones: ['left', 'right'],
71
- overlayModel: { activationSize: { value: 50, type: 'percentage' } },
74
+ overlayModel: _this._buildOverlayModel(),
72
75
  canDisplayOverlay: function (event, position) {
76
+ var _a;
73
77
  if (_this.group.locked) {
74
78
  return false;
75
79
  }
76
80
  var data = (0, dataTransfer_1.getPanelData)();
77
81
  if (data && _this.accessor.id === data.viewId) {
78
- if (_this.accessor.options.tabAnimation === 'smooth' &&
79
- data.groupId === _this.group.id) {
82
+ if (((_a = _this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'smooth') {
83
+ // When smooth reorder is enabled, the Tabs
84
+ // container handles all intra-accessor drops
85
+ // (both same-group and cross-group) via
86
+ // animation. Suppress the per-tab overlay so
87
+ // the tab is dropped *beside* rather than *on*.
80
88
  return false;
81
89
  }
82
90
  return true;
@@ -86,21 +94,65 @@ var Tab = /** @class */ (function (_super) {
86
94
  getOverrideTarget: function () { var _a; return (_a = group.model.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; },
87
95
  });
88
96
  _this.onWillShowOverlay = _this.dropTarget.onWillShowOverlay;
89
- _this.addDisposables(_this._onPointDown, _this._onDropped, _this._onDragStart, _this._onDragEnd, _this.dragHandler.onDragStart(function (event) {
97
+ _this.addDisposables(_this._onPointDown, _this._onTabClick, _this._onDropped, _this._onDragStart, _this._onDragEnd, _this.accessor.onDidOptionsChange(function () {
98
+ _this.dropTarget.setOverlayModel(_this._buildOverlayModel());
99
+ }), _this.dragHandler.onDragStart(function (event) {
100
+ var _a;
90
101
  if (event.dataTransfer) {
91
102
  var style_1 = getComputedStyle(_this.element);
92
103
  var newNode_1 = _this.element.cloneNode(true);
104
+ var isVertical_1 = _this._direction === 'vertical';
105
+ /**
106
+ * Properties to skip when copying computed styles for a
107
+ * vertical tab ghost. `writing-mode` is excluded so we
108
+ * can force `horizontal-tb`. Size and margin logical
109
+ * properties are excluded because their physical meaning
110
+ * flips when writing-mode changes, which would produce
111
+ * incorrect dimensions.
112
+ */
113
+ var verticalSkip_1 = new Set([
114
+ 'writing-mode',
115
+ 'inline-size',
116
+ 'block-size',
117
+ 'min-inline-size',
118
+ 'min-block-size',
119
+ 'max-inline-size',
120
+ 'max-block-size',
121
+ 'margin-inline',
122
+ 'margin-inline-start',
123
+ 'margin-inline-end',
124
+ 'margin-block',
125
+ 'margin-block-start',
126
+ 'margin-block-end',
127
+ 'padding-inline',
128
+ 'padding-inline-start',
129
+ 'padding-inline-end',
130
+ 'padding-block',
131
+ 'padding-block-start',
132
+ 'padding-block-end',
133
+ ]);
93
134
  Array.from(style_1).forEach(function (key) {
94
- return newNode_1.style.setProperty(key, style_1.getPropertyValue(key), style_1.getPropertyPriority(key));
135
+ if (isVertical_1 && verticalSkip_1.has(key)) {
136
+ return;
137
+ }
138
+ newNode_1.style.setProperty(key, style_1.getPropertyValue(key), style_1.getPropertyPriority(key));
95
139
  });
140
+ if (isVertical_1) {
141
+ // Force horizontal text flow and swap the physical
142
+ // dimensions so the ghost appears as a horizontal tab.
143
+ newNode_1.style.setProperty('writing-mode', 'horizontal-tb');
144
+ newNode_1.style.setProperty('width', style_1.height);
145
+ newNode_1.style.setProperty('height', style_1.width);
146
+ }
96
147
  newNode_1.style.position = 'absolute';
148
+ newNode_1.classList.add('dv-tab-ghost-drag');
97
149
  (0, ghost_1.addGhostImage)(event.dataTransfer, newNode_1, {
98
150
  y: -10,
99
151
  x: 30,
100
152
  });
101
153
  }
102
154
  _this._onDragStart.fire(event);
103
- if (_this.accessor.options.tabAnimation === 'smooth') {
155
+ if (((_a = _this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'smooth') {
104
156
  // Delay collapse to next frame so the browser
105
157
  // captures the full drag image first
106
158
  requestAnimationFrame(function () {
@@ -112,6 +164,10 @@ var Tab = /** @class */ (function (_super) {
112
164
  _this._onDragEnd.fire(event);
113
165
  }), _this.dragHandler, (0, events_1.addDisposableListener)(_this._element, 'pointerdown', function (event) {
114
166
  _this._onPointDown.fire(event);
167
+ }), (0, events_1.addDisposableListener)(_this._element, 'click', function (event) {
168
+ _this._onTabClick.fire(event);
169
+ }), (0, events_1.addDisposableListener)(_this._element, 'contextmenu', function (event) {
170
+ _this.accessor.contextMenuController.show(_this.panel, _this.group, event);
115
171
  }), _this.dropTarget.onDrop(function (event) {
116
172
  _this._onDropped.fire(event);
117
173
  }), _this.dropTarget);
@@ -135,13 +191,29 @@ var Tab = /** @class */ (function (_super) {
135
191
  this.content = part;
136
192
  this._element.appendChild(this.content.element);
137
193
  };
194
+ Tab.prototype._buildOverlayModel = function () {
195
+ var _a;
196
+ // 'line' themes render a 4px insertion strip at the tab edge via the
197
+ // anchor container's small-boundary path. 'fill' themes render a
198
+ // half-width highlighted area, so we disable the small-boundary path
199
+ // entirely (boundary = 0 ⟹ isSmall always false).
200
+ var smallBoundary = ((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.dndTabIndicator) === 'line'
201
+ ? Number.POSITIVE_INFINITY
202
+ : 0;
203
+ return {
204
+ activationSize: { value: 50, type: 'percentage' },
205
+ smallWidthBoundary: smallBoundary,
206
+ smallHeightBoundary: smallBoundary,
207
+ };
208
+ };
209
+ Tab.prototype.setDirection = function (direction) {
210
+ this._direction = direction;
211
+ this.dropTarget.setTargetZones(direction === 'vertical' ? ['top', 'bottom'] : ['left', 'right']);
212
+ };
138
213
  Tab.prototype.updateDragAndDropState = function () {
139
214
  this._element.draggable = !this.accessor.options.disableDnd;
140
215
  this.dragHandler.setDisabled(!!this.accessor.options.disableDnd);
141
216
  };
142
- Tab.prototype.dispose = function () {
143
- _super.prototype.dispose.call(this);
144
- };
145
217
  return Tab;
146
218
  }(lifecycle_1.CompositeDisposable));
147
219
  exports.Tab = Tab;
@@ -0,0 +1,30 @@
1
+ import { Event } from '../../../events';
2
+ import { CompositeDisposable } from '../../../lifecycle';
3
+ import { ITabGroup } from '../../tabGroup';
4
+ import { TabGroupColorPalette } from '../../tabGroupAccent';
5
+ import { ITabGroupChipRenderer } from '../../framework';
6
+ import { DockviewApi } from '../../../api/component.api';
7
+ export declare class TabGroupChip extends CompositeDisposable implements ITabGroupChipRenderer {
8
+ private readonly _palette?;
9
+ private readonly _element;
10
+ private readonly _label;
11
+ private _tabGroup;
12
+ private readonly _onClick;
13
+ readonly onClick: Event<MouseEvent>;
14
+ private readonly _onContextMenu;
15
+ readonly onContextMenu: Event<MouseEvent>;
16
+ private readonly _onDragStart;
17
+ readonly onDragStart: Event<DragEvent>;
18
+ get element(): HTMLElement;
19
+ constructor(_palette?: TabGroupColorPalette | undefined);
20
+ init(params: {
21
+ tabGroup: ITabGroup;
22
+ api: DockviewApi;
23
+ }): void;
24
+ update(params: {
25
+ tabGroup: ITabGroup;
26
+ }): void;
27
+ private updateColor;
28
+ private updateLabel;
29
+ private updateCollapsed;
30
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.TabGroupChip = void 0;
19
+ var events_1 = require("../../../events");
20
+ var lifecycle_1 = require("../../../lifecycle");
21
+ var dom_1 = require("../../../dom");
22
+ var tabGroupAccent_1 = require("../../tabGroupAccent");
23
+ var TabGroupChip = /** @class */ (function (_super) {
24
+ __extends(TabGroupChip, _super);
25
+ function TabGroupChip(_palette) {
26
+ var _this = _super.call(this) || this;
27
+ _this._palette = _palette;
28
+ _this._onClick = new events_1.Emitter();
29
+ _this.onClick = _this._onClick.event;
30
+ _this._onContextMenu = new events_1.Emitter();
31
+ _this.onContextMenu = _this._onContextMenu.event;
32
+ _this._onDragStart = new events_1.Emitter();
33
+ _this.onDragStart = _this._onDragStart.event;
34
+ _this._element = document.createElement('div');
35
+ _this._element.className = 'dv-tab-group-chip';
36
+ _this._element.tabIndex = 0;
37
+ _this._element.draggable = true;
38
+ _this._label = document.createElement('span');
39
+ _this._label.className = 'dv-tab-group-chip-label';
40
+ _this._element.appendChild(_this._label);
41
+ _this.addDisposables(_this._onClick, _this._onContextMenu, _this._onDragStart, (0, events_1.addDisposableListener)(_this._element, 'click', function (event) {
42
+ _this._onClick.fire(event);
43
+ }), (0, events_1.addDisposableListener)(_this._element, 'contextmenu', function (event) {
44
+ _this._onContextMenu.fire(event);
45
+ }), (0, events_1.addDisposableListener)(_this._element, 'dragstart', function (event) {
46
+ _this._onDragStart.fire(event);
47
+ }));
48
+ return _this;
49
+ }
50
+ Object.defineProperty(TabGroupChip.prototype, "element", {
51
+ get: function () {
52
+ return this._element;
53
+ },
54
+ enumerable: false,
55
+ configurable: true
56
+ });
57
+ TabGroupChip.prototype.init = function (params) {
58
+ var _this = this;
59
+ this._tabGroup = params.tabGroup;
60
+ this.updateColor(params.tabGroup.color);
61
+ this.updateLabel(params.tabGroup.label);
62
+ this.updateCollapsed(params.tabGroup.collapsed);
63
+ this.addDisposables(params.tabGroup.onDidChange(function () {
64
+ if (_this._tabGroup) {
65
+ _this.updateColor(_this._tabGroup.color);
66
+ _this.updateLabel(_this._tabGroup.label);
67
+ }
68
+ }), params.tabGroup.onDidCollapseChange(function (collapsed) {
69
+ _this.updateCollapsed(collapsed);
70
+ }), this._onClick.event(function () {
71
+ var _a;
72
+ (_a = _this._tabGroup) === null || _a === void 0 ? void 0 : _a.toggle();
73
+ }));
74
+ };
75
+ TabGroupChip.prototype.update = function (params) {
76
+ this._tabGroup = params.tabGroup;
77
+ this.updateColor(params.tabGroup.color);
78
+ this.updateLabel(params.tabGroup.label);
79
+ this.updateCollapsed(params.tabGroup.collapsed);
80
+ };
81
+ TabGroupChip.prototype.updateColor = function (color) {
82
+ var _a;
83
+ (0, tabGroupAccent_1.applyTabGroupAccent)(this._element, color, this._palette);
84
+ (0, dom_1.toggleClass)(this._element, 'dv-tab-group-chip--accent-off', ((_a = this._palette) === null || _a === void 0 ? void 0 : _a.enabled) === false);
85
+ };
86
+ TabGroupChip.prototype.updateLabel = function (label) {
87
+ this._label.textContent = label;
88
+ (0, dom_1.toggleClass)(this._label, 'dv-tab-group-chip-label--empty', !label);
89
+ };
90
+ TabGroupChip.prototype.updateCollapsed = function (collapsed) {
91
+ (0, dom_1.toggleClass)(this._element, 'dv-tab-group-chip--collapsed', collapsed);
92
+ };
93
+ return TabGroupChip;
94
+ }(lifecycle_1.CompositeDisposable));
95
+ exports.TabGroupChip = TabGroupChip;
@@ -0,0 +1,71 @@
1
+ import { IValueDisposable } from '../../../lifecycle';
2
+ import { DockviewHeaderDirection } from '../../options';
3
+ import { Tab } from '../tab/tab';
4
+ import { ITabGroup } from '../../tabGroup';
5
+ import { TabGroupColorPalette } from '../../tabGroupAccent';
6
+ export interface TabGroupIndicatorContext {
7
+ readonly tabsList: HTMLElement;
8
+ getTabGroups(): readonly ITabGroup[];
9
+ getActivePanelId(): string | undefined;
10
+ getTabMap(): Map<string, IValueDisposable<Tab>>;
11
+ getChipElement(groupId: string): HTMLElement | undefined;
12
+ getDirection(): DockviewHeaderDirection;
13
+ getColorPalette(): TabGroupColorPalette | undefined;
14
+ }
15
+ export interface ITabGroupIndicator {
16
+ readonly underlines: ReadonlyMap<string, HTMLElement>;
17
+ positionUnderlines(): void;
18
+ trackUnderlines(): void;
19
+ syncUnderlineElements(activeGroupIds: Set<string>): void;
20
+ getUnderline(groupId: string): HTMLElement | undefined;
21
+ dispose(): void;
22
+ }
23
+ /**
24
+ * Shared positioning logic for tab group indicators.
25
+ * Subclasses implement `applyShape` to control the visual output.
26
+ */
27
+ declare abstract class BaseTabGroupIndicator implements ITabGroupIndicator {
28
+ protected readonly _ctx: TabGroupIndicatorContext;
29
+ protected readonly _underlines: Map<string, HTMLElement>;
30
+ private _rafId;
31
+ get underlines(): ReadonlyMap<string, HTMLElement>;
32
+ constructor(_ctx: TabGroupIndicatorContext);
33
+ positionUnderlines(): void;
34
+ /**
35
+ * Continuously reposition underlines every frame for the duration
36
+ * of a tab transition (~200ms), so the underline tracks tab sizes.
37
+ */
38
+ trackUnderlines(): void;
39
+ syncUnderlineElements(activeGroupIds: Set<string>): void;
40
+ getUnderline(groupId: string): HTMLElement | undefined;
41
+ dispose(): void;
42
+ /**
43
+ * Apply the visual shape to the underline element.
44
+ * Called once per tab group per frame with the computed geometry.
45
+ */
46
+ protected abstract applyShape(underline: HTMLElement, tg: ITabGroup, startEdge: number, span: number, containerCrossSize: number, activePanelId: string | undefined, containerRect: DOMRect, isVertical: boolean): void;
47
+ private _positionUnderlinesSync;
48
+ }
49
+ /**
50
+ * Chrome-style wrap-around indicator using SVG paths.
51
+ */
52
+ export declare class WrapTabGroupIndicator extends BaseTabGroupIndicator {
53
+ private _applyStraightLine;
54
+ /**
55
+ * Chrome-style wrap-around underline: a stroked SVG path that runs
56
+ * along the bottom (or left edge in vertical mode), curving up and
57
+ * over the active tab with rounded corners.
58
+ *
59
+ * The SVG and path elements are created once per underline and reused;
60
+ * only the `d`, `stroke`, and viewport attributes are updated each frame.
61
+ */
62
+ protected applyShape(underline: HTMLElement, tg: ITabGroup, groupStart: number, groupSpan: number, containerCrossSize: number, activePanelId: string | undefined, containerRect: DOMRect, isVertical: boolean): void;
63
+ }
64
+ /**
65
+ * Flat continuous bar indicator — no wrap-around, just a colored line
66
+ * spanning the full tab group width.
67
+ */
68
+ export declare class NoneTabGroupIndicator extends BaseTabGroupIndicator {
69
+ protected applyShape(underline: HTMLElement, tg: ITabGroup, _startEdge: number, span: number, _containerCrossSize: number, _activePanelId: string | undefined, _containerRect: DOMRect, isVertical: boolean): void;
70
+ }
71
+ export {};