dockview-core 5.1.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 +8 -1
  17. package/dist/cjs/dockview/components/tab/tab.js +94 -6
  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 +67 -0
  26. package/dist/cjs/dockview/components/titlebar/tabs.js +1464 -34
  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 +97 -2
  40. package/dist/cjs/dockview/options.js +10 -5
  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 +5188 -729
  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 +5186 -727
  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 +8 -1
  75. package/dist/esm/dockview/components/tab/tab.js +96 -6
  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 +67 -0
  83. package/dist/esm/dockview/components/titlebar/tabs.js +1212 -25
  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 +97 -2
  97. package/dist/esm/dockview/options.js +5 -0
  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 +5182 -753
  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 +5168 -753
  116. package/dist/styles/dockview.css +1968 -195
  117. package/package.json +5 -1
@@ -0,0 +1,471 @@
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
+ var __values = (this && this.__values) || function(o) {
18
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
19
+ if (m) return m.call(o);
20
+ if (o && typeof o.length === "number") return {
21
+ next: function () {
22
+ if (o && i >= o.length) o = void 0;
23
+ return { value: o && o[i++], done: !o };
24
+ }
25
+ };
26
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
27
+ };
28
+ var __read = (this && this.__read) || function (o, n) {
29
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
30
+ if (!m) return o;
31
+ var i = m.call(o), r, ar = [], e;
32
+ try {
33
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
34
+ }
35
+ catch (error) { e = { error: error }; }
36
+ finally {
37
+ try {
38
+ if (r && !r.done && (m = i["return"])) m.call(i);
39
+ }
40
+ finally { if (e) throw e.error; }
41
+ }
42
+ return ar;
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.NoneTabGroupIndicator = exports.WrapTabGroupIndicator = void 0;
46
+ var tabGroupAccent_1 = require("../../tabGroupAccent");
47
+ /**
48
+ * Shared positioning logic for tab group indicators.
49
+ * Subclasses implement `applyShape` to control the visual output.
50
+ */
51
+ var BaseTabGroupIndicator = /** @class */ (function () {
52
+ function BaseTabGroupIndicator(_ctx) {
53
+ this._ctx = _ctx;
54
+ this._underlines = new Map();
55
+ this._rafId = null;
56
+ }
57
+ Object.defineProperty(BaseTabGroupIndicator.prototype, "underlines", {
58
+ get: function () {
59
+ return this._underlines;
60
+ },
61
+ enumerable: false,
62
+ configurable: true
63
+ });
64
+ BaseTabGroupIndicator.prototype.positionUnderlines = function () {
65
+ var _this = this;
66
+ requestAnimationFrame(function () {
67
+ _this._positionUnderlinesSync();
68
+ });
69
+ };
70
+ /**
71
+ * Continuously reposition underlines every frame for the duration
72
+ * of a tab transition (~200ms), so the underline tracks tab sizes.
73
+ */
74
+ BaseTabGroupIndicator.prototype.trackUnderlines = function () {
75
+ var _this = this;
76
+ if (this._rafId !== null) {
77
+ cancelAnimationFrame(this._rafId);
78
+ }
79
+ var start = performance.now();
80
+ var duration = 250; // slightly longer than transition to ensure we catch the end
81
+ var tick = function () {
82
+ _this._positionUnderlinesSync();
83
+ if (performance.now() - start < duration) {
84
+ _this._rafId = requestAnimationFrame(tick);
85
+ }
86
+ else {
87
+ _this._rafId = null;
88
+ }
89
+ };
90
+ this._rafId = requestAnimationFrame(tick);
91
+ };
92
+ BaseTabGroupIndicator.prototype.syncUnderlineElements = function (activeGroupIds) {
93
+ var e_1, _a, e_2, _b;
94
+ try {
95
+ // Ensure underline elements exist for active groups
96
+ for (var activeGroupIds_1 = __values(activeGroupIds), activeGroupIds_1_1 = activeGroupIds_1.next(); !activeGroupIds_1_1.done; activeGroupIds_1_1 = activeGroupIds_1.next()) {
97
+ var groupId = activeGroupIds_1_1.value;
98
+ if (!this._underlines.has(groupId)) {
99
+ var underline = document.createElement('div');
100
+ underline.className = 'dv-tab-group-underline';
101
+ this._ctx.tabsList.appendChild(underline);
102
+ this._underlines.set(groupId, underline);
103
+ }
104
+ }
105
+ }
106
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
107
+ finally {
108
+ try {
109
+ if (activeGroupIds_1_1 && !activeGroupIds_1_1.done && (_a = activeGroupIds_1.return)) _a.call(activeGroupIds_1);
110
+ }
111
+ finally { if (e_1) throw e_1.error; }
112
+ }
113
+ try {
114
+ // Remove underlines for dissolved groups
115
+ for (var _c = __values(this._underlines), _d = _c.next(); !_d.done; _d = _c.next()) {
116
+ var _e = __read(_d.value, 2), groupId = _e[0], el = _e[1];
117
+ if (!activeGroupIds.has(groupId)) {
118
+ el.remove();
119
+ this._underlines.delete(groupId);
120
+ }
121
+ }
122
+ }
123
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
124
+ finally {
125
+ try {
126
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
127
+ }
128
+ finally { if (e_2) throw e_2.error; }
129
+ }
130
+ };
131
+ BaseTabGroupIndicator.prototype.getUnderline = function (groupId) {
132
+ return this._underlines.get(groupId);
133
+ };
134
+ BaseTabGroupIndicator.prototype.dispose = function () {
135
+ var e_3, _a;
136
+ if (this._rafId !== null) {
137
+ cancelAnimationFrame(this._rafId);
138
+ this._rafId = null;
139
+ }
140
+ try {
141
+ for (var _b = __values(this._underlines), _c = _b.next(); !_c.done; _c = _b.next()) {
142
+ var _d = __read(_c.value, 2), el = _d[1];
143
+ el.remove();
144
+ }
145
+ }
146
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
147
+ finally {
148
+ try {
149
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
150
+ }
151
+ finally { if (e_3) throw e_3.error; }
152
+ }
153
+ this._underlines.clear();
154
+ };
155
+ BaseTabGroupIndicator.prototype._positionUnderlinesSync = function () {
156
+ var e_4, _a, e_5, _b;
157
+ var containerRect = this._ctx.tabsList.getBoundingClientRect();
158
+ var tabGroups = this._ctx.getTabGroups();
159
+ var isVertical = this._ctx.getDirection() === 'vertical';
160
+ var containerCrossSize = isVertical
161
+ ? containerRect.width
162
+ : containerRect.height;
163
+ var activePanelId = this._ctx.getActivePanelId();
164
+ var tabMap = this._ctx.getTabMap();
165
+ try {
166
+ for (var tabGroups_1 = __values(tabGroups), tabGroups_1_1 = tabGroups_1.next(); !tabGroups_1_1.done; tabGroups_1_1 = tabGroups_1.next()) {
167
+ var tg = tabGroups_1_1.value;
168
+ var underline = this._underlines.get(tg.id);
169
+ if (!underline) {
170
+ continue;
171
+ }
172
+ var panelIds = tg.panelIds;
173
+ if (panelIds.length === 0) {
174
+ underline.style.display = 'none';
175
+ continue;
176
+ }
177
+ underline.style.display = '';
178
+ var chipEl = this._ctx.getChipElement(tg.id);
179
+ // In vertical mode, compute top/bottom edges; in horizontal, left/right.
180
+ var startEdge = void 0;
181
+ if (chipEl) {
182
+ var chipRect = chipEl.getBoundingClientRect();
183
+ var chipStyle = getComputedStyle(chipEl);
184
+ var leadingMargin = isVertical
185
+ ? Number.parseFloat(chipStyle.marginTop) || 0
186
+ : Number.parseFloat(chipStyle.marginLeft) || 0;
187
+ startEdge = isVertical
188
+ ? chipRect.top - containerRect.top - leadingMargin
189
+ : chipRect.left - containerRect.left - leadingMargin;
190
+ }
191
+ else {
192
+ var firstPanelId = panelIds[0];
193
+ var firstTabEntry = tabMap.get(firstPanelId);
194
+ if (firstTabEntry) {
195
+ var firstRect = firstTabEntry.value.element.getBoundingClientRect();
196
+ startEdge = isVertical
197
+ ? firstRect.top - containerRect.top
198
+ : firstRect.left - containerRect.left;
199
+ }
200
+ else {
201
+ startEdge = 0;
202
+ }
203
+ }
204
+ // Measure the actual last tab position (follows CSS transitions in real-time)
205
+ var lastPanelId = panelIds[panelIds.length - 1];
206
+ var lastTabEntry = tabMap.get(lastPanelId);
207
+ if (!lastTabEntry) {
208
+ if (isVertical) {
209
+ underline.style.top = "".concat(startEdge, "px");
210
+ underline.style.height = '0px';
211
+ underline.style.left = '';
212
+ underline.style.width = '';
213
+ }
214
+ else {
215
+ underline.style.left = "".concat(startEdge, "px");
216
+ underline.style.width = '0px';
217
+ underline.style.top = '';
218
+ underline.style.height = '';
219
+ }
220
+ continue;
221
+ }
222
+ var lastTabRect = lastTabEntry.value.element.getBoundingClientRect();
223
+ var endEdge = isVertical
224
+ ? lastTabRect.bottom - containerRect.top
225
+ : lastTabRect.right - containerRect.left;
226
+ var span = endEdge - startEdge;
227
+ // During collapse or expand: converge both edges toward chip center
228
+ var isAnimating = tg.collapsed ||
229
+ tg.panelIds.some(function (pid) {
230
+ var te = tabMap.get(pid);
231
+ return (te &&
232
+ te.value.element.classList.contains('dv-tab--group-expanding'));
233
+ });
234
+ if (isAnimating && chipEl) {
235
+ var chipRect = chipEl.getBoundingClientRect();
236
+ var chipCenter = isVertical
237
+ ? chipRect.top + chipRect.height / 2 - containerRect.top
238
+ : chipRect.left + chipRect.width / 2 - containerRect.left;
239
+ // Sum of current visible tab sizes (shrinking or growing)
240
+ var currentTabSize = 0;
241
+ var fullTabSize = 0;
242
+ try {
243
+ for (var _c = (e_5 = void 0, __values(tg.panelIds)), _d = _c.next(); !_d.done; _d = _c.next()) {
244
+ var pid = _d.value;
245
+ var te = tabMap.get(pid);
246
+ if (!te)
247
+ continue;
248
+ var el = te.value.element;
249
+ if (isVertical) {
250
+ currentTabSize += el.getBoundingClientRect().height;
251
+ fullTabSize += el.scrollHeight;
252
+ }
253
+ else {
254
+ currentTabSize += el.getBoundingClientRect().width;
255
+ fullTabSize += el.scrollWidth;
256
+ }
257
+ }
258
+ }
259
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
260
+ finally {
261
+ try {
262
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
263
+ }
264
+ finally { if (e_5) throw e_5.error; }
265
+ }
266
+ // progress: 0 when tabs at 0 size, 1 when fully open
267
+ var progress = fullTabSize > 0
268
+ ? Math.min(1, currentTabSize / fullTabSize)
269
+ : 0;
270
+ // Interpolate start and end edges toward chip center
271
+ startEdge = chipCenter + (startEdge - chipCenter) * progress;
272
+ endEdge = chipCenter + (endEdge - chipCenter) * progress;
273
+ span = Math.max(0, endEdge - startEdge);
274
+ }
275
+ if (isVertical) {
276
+ underline.style.top = "".concat(startEdge, "px");
277
+ underline.style.height = "".concat(Math.max(0, span), "px");
278
+ // Clear horizontal properties
279
+ underline.style.left = '';
280
+ underline.style.width = '';
281
+ }
282
+ else {
283
+ underline.style.left = "".concat(startEdge, "px");
284
+ underline.style.width = "".concat(Math.max(0, span), "px");
285
+ // Clear vertical properties
286
+ underline.style.top = '';
287
+ underline.style.height = '';
288
+ }
289
+ this.applyShape(underline, tg, startEdge, span, containerCrossSize, activePanelId, containerRect, isVertical);
290
+ }
291
+ }
292
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
293
+ finally {
294
+ try {
295
+ if (tabGroups_1_1 && !tabGroups_1_1.done && (_a = tabGroups_1.return)) _a.call(tabGroups_1);
296
+ }
297
+ finally { if (e_4) throw e_4.error; }
298
+ }
299
+ };
300
+ return BaseTabGroupIndicator;
301
+ }());
302
+ /**
303
+ * Chrome-style wrap-around indicator using SVG paths.
304
+ */
305
+ var WrapTabGroupIndicator = /** @class */ (function (_super) {
306
+ __extends(WrapTabGroupIndicator, _super);
307
+ function WrapTabGroupIndicator() {
308
+ return _super !== null && _super.apply(this, arguments) || this;
309
+ }
310
+ WrapTabGroupIndicator.prototype._applyStraightLine = function (svg, path, underline, t, mainSize, isVertical) {
311
+ if (isVertical) {
312
+ svg.setAttribute('width', String(t));
313
+ svg.setAttribute('height', String(mainSize));
314
+ underline.style.width = "".concat(t, "px");
315
+ underline.style.height = "".concat(mainSize, "px");
316
+ path.setAttribute('d', "M ".concat(t / 2, ",0 L ").concat(t / 2, ",").concat(mainSize));
317
+ }
318
+ else {
319
+ svg.setAttribute('width', String(mainSize));
320
+ svg.setAttribute('height', String(t));
321
+ underline.style.width = "".concat(mainSize, "px");
322
+ underline.style.height = "".concat(t, "px");
323
+ path.setAttribute('d', "M 0,".concat(t / 2, " L ").concat(mainSize, ",").concat(t / 2));
324
+ }
325
+ };
326
+ /**
327
+ * Chrome-style wrap-around underline: a stroked SVG path that runs
328
+ * along the bottom (or left edge in vertical mode), curving up and
329
+ * over the active tab with rounded corners.
330
+ *
331
+ * The SVG and path elements are created once per underline and reused;
332
+ * only the `d`, `stroke`, and viewport attributes are updated each frame.
333
+ */
334
+ WrapTabGroupIndicator.prototype.applyShape = function (underline, tg, groupStart, groupSpan, containerCrossSize, activePanelId, containerRect, isVertical) {
335
+ var t = 2; // line thickness in px
336
+ var crossSize = containerCrossSize;
337
+ var mainSize = groupSpan;
338
+ var color = (0, tabGroupAccent_1.resolveTabGroupAccent)(tg.color, this._ctx.getColorPalette());
339
+ if (mainSize <= 0 || crossSize <= 0 || color === undefined) {
340
+ underline.style.display = 'none';
341
+ return;
342
+ }
343
+ underline.style.display = '';
344
+ // Find the active tab within this group
345
+ var activeTabEntry;
346
+ if (activePanelId && tg.panelIds.includes(activePanelId)) {
347
+ activeTabEntry = this._ctx.getTabMap().get(activePanelId);
348
+ }
349
+ // Ensure SVG + path child exists (created once, reused)
350
+ var svg = underline.firstElementChild;
351
+ var path;
352
+ if (!svg || svg.tagName !== 'svg') {
353
+ underline.innerHTML = '';
354
+ svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
355
+ svg.style.display = 'block';
356
+ path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
357
+ path.setAttribute('fill', 'none');
358
+ svg.appendChild(path);
359
+ underline.appendChild(svg);
360
+ }
361
+ else {
362
+ path = svg.firstElementChild;
363
+ }
364
+ path.setAttribute('stroke', color);
365
+ path.setAttribute('stroke-width', String(t));
366
+ if (!activeTabEntry) {
367
+ this._applyStraightLine(svg, path, underline, t, mainSize, isVertical);
368
+ return;
369
+ }
370
+ var activeRect = activeTabEntry.value.element.getBoundingClientRect();
371
+ // Compute active tab start/end relative to the group start
372
+ var aStart;
373
+ var aEnd;
374
+ if (isVertical) {
375
+ aStart = Math.max(0, activeRect.top - containerRect.top - groupStart);
376
+ aEnd = Math.min(mainSize, activeRect.bottom - containerRect.top - groupStart);
377
+ }
378
+ else {
379
+ aStart = Math.max(0, activeRect.left - containerRect.left - groupStart);
380
+ aEnd = Math.min(mainSize, activeRect.right - containerRect.left - groupStart);
381
+ }
382
+ if (aEnd <= aStart) {
383
+ this._applyStraightLine(svg, path, underline, t, mainSize, isVertical);
384
+ return;
385
+ }
386
+ var r = 6; // corner radius
387
+ var half = t / 2;
388
+ if (isVertical) {
389
+ var svgW = crossSize;
390
+ var svgH = mainSize;
391
+ svg.setAttribute('width', String(svgW));
392
+ svg.setAttribute('height', String(svgH));
393
+ underline.style.width = "".concat(svgW, "px");
394
+ underline.style.height = "".concat(svgH, "px");
395
+ var xLeft = half;
396
+ var xRight = svgW - half;
397
+ var d = [
398
+ "M ".concat(xLeft, ",0"),
399
+ "L ".concat(xLeft, ",").concat(aStart - r),
400
+ "Q ".concat(xLeft, ",").concat(aStart, " ").concat(xLeft + r, ",").concat(aStart),
401
+ "L ".concat(xRight - r, ",").concat(aStart),
402
+ "Q ".concat(xRight, ",").concat(aStart, " ").concat(xRight, ",").concat(aStart + r),
403
+ "L ".concat(xRight, ",").concat(aEnd - r),
404
+ "Q ".concat(xRight, ",").concat(aEnd, " ").concat(xRight - r, ",").concat(aEnd),
405
+ "L ".concat(xLeft + r, ",").concat(aEnd),
406
+ "Q ".concat(xLeft, ",").concat(aEnd, " ").concat(xLeft, ",").concat(aEnd + r),
407
+ "L ".concat(xLeft, ",").concat(svgH),
408
+ ].join(' ');
409
+ path.setAttribute('d', d);
410
+ }
411
+ else {
412
+ var svgW = mainSize;
413
+ var svgH = crossSize;
414
+ svg.setAttribute('width', String(svgW));
415
+ svg.setAttribute('height', String(svgH));
416
+ underline.style.width = "".concat(svgW, "px");
417
+ underline.style.height = "".concat(svgH, "px");
418
+ var yBot = svgH - half;
419
+ var yTop = half;
420
+ var d = [
421
+ "M 0,".concat(yBot),
422
+ "L ".concat(aStart - r, ",").concat(yBot),
423
+ "Q ".concat(aStart, ",").concat(yBot, " ").concat(aStart, ",").concat(yBot - r),
424
+ "L ".concat(aStart, ",").concat(yTop + r),
425
+ "Q ".concat(aStart, ",").concat(yTop, " ").concat(aStart + r, ",").concat(yTop),
426
+ "L ".concat(aEnd - r, ",").concat(yTop),
427
+ "Q ".concat(aEnd, ",").concat(yTop, " ").concat(aEnd, ",").concat(yTop + r),
428
+ "L ".concat(aEnd, ",").concat(yBot - r),
429
+ "Q ".concat(aEnd, ",").concat(yBot, " ").concat(aEnd + r, ",").concat(yBot),
430
+ "L ".concat(svgW, ",").concat(yBot),
431
+ ].join(' ');
432
+ path.setAttribute('d', d);
433
+ }
434
+ };
435
+ return WrapTabGroupIndicator;
436
+ }(BaseTabGroupIndicator));
437
+ exports.WrapTabGroupIndicator = WrapTabGroupIndicator;
438
+ /**
439
+ * Flat continuous bar indicator — no wrap-around, just a colored line
440
+ * spanning the full tab group width.
441
+ */
442
+ var NoneTabGroupIndicator = /** @class */ (function (_super) {
443
+ __extends(NoneTabGroupIndicator, _super);
444
+ function NoneTabGroupIndicator() {
445
+ return _super !== null && _super.apply(this, arguments) || this;
446
+ }
447
+ NoneTabGroupIndicator.prototype.applyShape = function (underline, tg, _startEdge, span, _containerCrossSize, _activePanelId, _containerRect, isVertical) {
448
+ var t = 2; // line thickness in px
449
+ var color = (0, tabGroupAccent_1.resolveTabGroupAccent)(tg.color, this._ctx.getColorPalette());
450
+ if (span <= 0 || color === undefined) {
451
+ underline.style.display = 'none';
452
+ return;
453
+ }
454
+ underline.style.display = '';
455
+ // Clear any SVG content left over from a mode switch
456
+ if (underline.firstElementChild) {
457
+ underline.innerHTML = '';
458
+ }
459
+ underline.style.backgroundColor = color;
460
+ if (isVertical) {
461
+ underline.style.width = "".concat(t, "px");
462
+ underline.style.height = "".concat(span, "px");
463
+ }
464
+ else {
465
+ underline.style.width = "".concat(span, "px");
466
+ underline.style.height = "".concat(t, "px");
467
+ }
468
+ };
469
+ return NoneTabGroupIndicator;
470
+ }(BaseTabGroupIndicator));
471
+ exports.NoneTabGroupIndicator = NoneTabGroupIndicator;
@@ -0,0 +1,57 @@
1
+ import { IDisposable, IValueDisposable } from '../../../lifecycle';
2
+ import { DockviewComponent } from '../../dockviewComponent';
3
+ import { DockviewGroupPanel } from '../../dockviewGroupPanel';
4
+ import { DockviewHeaderDirection } from '../../options';
5
+ import { Tab } from '../tab/tab';
6
+ import { ITabGroup } from '../../tabGroup';
7
+ import { ITabGroupChipRenderer } from '../../framework';
8
+ export interface TabGroupManagerContext {
9
+ readonly group: DockviewGroupPanel;
10
+ readonly accessor: DockviewComponent;
11
+ readonly tabsList: HTMLElement;
12
+ getTabs(): IValueDisposable<Tab>[];
13
+ getTabMap(): Map<string, IValueDisposable<Tab>>;
14
+ getDirection(): DockviewHeaderDirection;
15
+ }
16
+ export interface TabGroupManagerCallbacks {
17
+ onChipContextMenu(tabGroup: ITabGroup, event: MouseEvent): void;
18
+ onChipDragStart(tabGroup: ITabGroup, chip: ITabGroupChipRenderer, event: DragEvent): void;
19
+ }
20
+ export declare class TabGroupManager {
21
+ private readonly _ctx;
22
+ private readonly _callbacks;
23
+ private readonly _chipRenderers;
24
+ private _indicator;
25
+ private _skipNextCollapseAnimation;
26
+ private readonly _pendingTransitionCleanups;
27
+ get chipRenderers(): ReadonlyMap<string, {
28
+ chip: ITabGroupChipRenderer;
29
+ disposable: IDisposable;
30
+ }>;
31
+ get groupUnderlines(): ReadonlyMap<string, HTMLElement>;
32
+ get skipNextCollapseAnimation(): boolean;
33
+ set skipNextCollapseAnimation(value: boolean);
34
+ constructor(_ctx: TabGroupManagerContext, _callbacks: TabGroupManagerCallbacks);
35
+ /**
36
+ * Synchronize chip elements and CSS classes for all tab groups
37
+ * in the parent group model. Call after any tab group mutation.
38
+ */
39
+ update(): void;
40
+ /**
41
+ * Re-read the active palette and re-apply colors to chips, tabs and
42
+ * the indicator. Called when `tabGroupColors` / `tabGroupAccent`
43
+ * options change at runtime.
44
+ */
45
+ refreshAccents(): void;
46
+ positionAllChips(): void;
47
+ snapshotChipWidths(): Map<string, number>;
48
+ positionUnderlines(): void;
49
+ trackUnderlines(): void;
50
+ setGroupDragImage(event: DragEvent, tabGroup: ITabGroup, chipEl: HTMLElement): void;
51
+ cleanupTransition(panelId: string): void;
52
+ disposeAll(): void;
53
+ private _ensureIndicator;
54
+ private _ensureChipForGroup;
55
+ private _positionChipForGroup;
56
+ private _updateTabGroupClasses;
57
+ }