dockview-core 5.2.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -0,0 +1,621 @@
1
+ import { Emitter } from '../events';
2
+ import { CompositeDisposable } from '../lifecycle';
3
+ import { LayoutPriority, Orientation, Splitview, } from '../splitview/splitview';
4
+ import { watchElementResize } from '../dom';
5
+ export class EdgeGroupView {
6
+ get minimumSize() {
7
+ // When collapsed, lock size to collapsedSize so sash can't drag it open
8
+ return this._isCollapsed
9
+ ? this._collapsedSize
10
+ : this._expandedMinimumSize;
11
+ }
12
+ get maximumSize() {
13
+ // When collapsed, lock size to collapsedSize so sash can't drag it open
14
+ return this._isCollapsed
15
+ ? this._collapsedSize
16
+ : this._expandedMaximumSize;
17
+ }
18
+ get element() {
19
+ return this._group.element;
20
+ }
21
+ get isCollapsed() {
22
+ return this._isCollapsed;
23
+ }
24
+ get lastExpandedSize() {
25
+ return this._lastExpandedSize;
26
+ }
27
+ get collapsedSize() {
28
+ return this._collapsedSize;
29
+ }
30
+ constructor(options, group, orientation) {
31
+ var _a, _b, _c;
32
+ this._onDidChange = new Emitter();
33
+ this.onDidChange = this._onDidChange.event;
34
+ this.snap = false;
35
+ this.priority = LayoutPriority.Low;
36
+ this._isCollapsed = false;
37
+ this._group = group;
38
+ this._orientation = orientation;
39
+ group.element.classList.add('dv-edge-group');
40
+ group.element.dataset.testid = `dv-edge-group-${options.id}`;
41
+ this._collapsedSize = (_a = options.collapsedSize) !== null && _a !== void 0 ? _a : 35;
42
+ this._expandedMaximumSize =
43
+ (_b = options.maximumSize) !== null && _b !== void 0 ? _b : Number.POSITIVE_INFINITY;
44
+ // If the caller explicitly provides a minimumSize, respect it.
45
+ // Otherwise fall back to collapsedSize + 50 so the expanded state is
46
+ // visually distinguishable from the collapsed state.
47
+ this._expandedMinimumSize =
48
+ options.minimumSize !== undefined
49
+ ? options.minimumSize
50
+ : this._collapsedSize + 50;
51
+ this._lastExpandedSize = (_c = options.initialSize) !== null && _c !== void 0 ? _c : 200;
52
+ if (options.collapsed) {
53
+ this._isCollapsed = true;
54
+ group.element.classList.add('dv-edge-collapsed');
55
+ }
56
+ }
57
+ layout(size, orthogonalSize) {
58
+ // Track the last expanded size so we can restore it after collapsing
59
+ if (!this._isCollapsed) {
60
+ this._lastExpandedSize = size;
61
+ }
62
+ // horizontal (left/right): size=width, orthogonalSize=height → layout(width, height)
63
+ // vertical (top/bottom): size=height, orthogonalSize=width → layout(width, height)
64
+ if (this._orientation === 'horizontal') {
65
+ this._group.layout(size, orthogonalSize);
66
+ }
67
+ else {
68
+ this._group.layout(orthogonalSize, size);
69
+ }
70
+ }
71
+ setCollapsed(collapsed) {
72
+ if (this._isCollapsed === collapsed) {
73
+ return;
74
+ }
75
+ this._isCollapsed = collapsed;
76
+ this._group.element.classList.toggle('dv-edge-collapsed', collapsed);
77
+ // ShellManager calls resizeView directly after this; no _onDidChange needed
78
+ }
79
+ setVisible(_visible) {
80
+ // visibility is managed by the parent splitview
81
+ }
82
+ /**
83
+ * Restore the last-expanded size from serialized state without triggering
84
+ * a layout. Must be called before setCollapsed(true) during fromJSON so
85
+ * that expanding after deserialization restores the correct size.
86
+ */
87
+ restoreExpandedSize(size) {
88
+ this._lastExpandedSize = size;
89
+ }
90
+ /**
91
+ * Apply new effective collapsed and expanded-minimum sizes after a theme
92
+ * or gap change. The caller (ShellManager) is responsible for computing
93
+ * the correct values from the original config and the new gap.
94
+ */
95
+ updateCollapsedSize(newCollapsedSize, newExpandedMinimumSize) {
96
+ this._collapsedSize = newCollapsedSize;
97
+ this._expandedMinimumSize = newExpandedMinimumSize;
98
+ }
99
+ dispose() {
100
+ this._onDidChange.dispose();
101
+ }
102
+ }
103
+ class CenterView {
104
+ get element() {
105
+ return this._dockviewElement;
106
+ }
107
+ constructor(_dockviewElement, _layoutDockview) {
108
+ this._dockviewElement = _dockviewElement;
109
+ this._layoutDockview = _layoutDockview;
110
+ this.priority = LayoutPriority.High;
111
+ this.minimumSize = 100;
112
+ this.maximumSize = Number.POSITIVE_INFINITY;
113
+ this._onDidChange = new Emitter();
114
+ this.onDidChange = this._onDidChange.event;
115
+ }
116
+ layout(size, orthogonalSize) {
117
+ // Lives in a VERTICAL middle-column splitview:
118
+ // size = height alloc, orthogonalSize = width
119
+ this._layoutDockview(orthogonalSize, size);
120
+ }
121
+ setVisible(_visible) {
122
+ // center is always visible
123
+ }
124
+ dispose() {
125
+ this._onDidChange.dispose();
126
+ }
127
+ }
128
+ /**
129
+ * The vertical centre column: top (optional) | center | bottom (optional).
130
+ * This view sits between the left and right edge panels in the outer
131
+ * horizontal splitview, so its primary axis is width (horizontal).
132
+ */
133
+ class MiddleColumnView {
134
+ get element() {
135
+ return this._element;
136
+ }
137
+ constructor(centerView, gap = 0) {
138
+ this._onDidChange = new Emitter();
139
+ this.onDidChange = this._onDidChange.event;
140
+ this.minimumSize = 100;
141
+ this.maximumSize = Number.POSITIVE_INFINITY;
142
+ this.priority = LayoutPriority.High;
143
+ this._element = document.createElement('div');
144
+ this._element.className = 'dv-shell-middle-column';
145
+ this._element.style.height = '100%';
146
+ this._element.style.width = '100%';
147
+ this._splitview = new Splitview(this._element, {
148
+ orientation: Orientation.VERTICAL,
149
+ proportionalLayout: false,
150
+ margin: gap,
151
+ });
152
+ this._centerIndex = 0;
153
+ this._splitview.addView(centerView, { type: 'distribute' }, 0);
154
+ }
155
+ addTopView(view, initialSize) {
156
+ // Insert before center
157
+ this._splitview.addView(view, initialSize, 0);
158
+ this._topIndex = 0;
159
+ this._centerIndex += 1;
160
+ if (this._bottomIndex !== undefined) {
161
+ this._bottomIndex += 1;
162
+ }
163
+ }
164
+ addBottomView(view, initialSize) {
165
+ // Append after center (and any existing bottom — shouldn't happen but safe)
166
+ const newIndex = this._splitview.length;
167
+ this._splitview.addView(view, initialSize, newIndex);
168
+ this._bottomIndex = newIndex;
169
+ }
170
+ removeView(position) {
171
+ const index = position === 'top' ? this._topIndex : this._bottomIndex;
172
+ if (index === undefined) {
173
+ return;
174
+ }
175
+ this._splitview.removeView(index);
176
+ if (position === 'top') {
177
+ this._topIndex = undefined;
178
+ // center (and bottom if present) shift down by one
179
+ this._centerIndex -= 1;
180
+ if (this._bottomIndex !== undefined) {
181
+ this._bottomIndex -= 1;
182
+ }
183
+ }
184
+ else {
185
+ this._bottomIndex = undefined;
186
+ // center and top are unaffected
187
+ }
188
+ }
189
+ layout(size, orthogonalSize) {
190
+ // Outer horizontal splitview: size = width, orthogonalSize = height
191
+ // Inner vertical splitview: layout(height, width)
192
+ this._splitview.layout(orthogonalSize, size);
193
+ }
194
+ setVisible(_visible) {
195
+ // middle column is always visible
196
+ }
197
+ setViewVisible(position, visible) {
198
+ const index = position === 'top' ? this._topIndex : this._bottomIndex;
199
+ if (index !== undefined) {
200
+ this._splitview.setViewVisible(index, visible);
201
+ }
202
+ }
203
+ isViewVisible(position) {
204
+ const index = position === 'top' ? this._topIndex : this._bottomIndex;
205
+ if (index !== undefined) {
206
+ return this._splitview.isViewVisible(index);
207
+ }
208
+ return false;
209
+ }
210
+ getViewSize(position) {
211
+ const index = position === 'top' ? this._topIndex : this._bottomIndex;
212
+ if (index !== undefined) {
213
+ return this._splitview.getViewSize(index);
214
+ }
215
+ return 0;
216
+ }
217
+ resizeView(position, size) {
218
+ const index = position === 'top' ? this._topIndex : this._bottomIndex;
219
+ if (index !== undefined) {
220
+ this._splitview.resizeView(index, size);
221
+ }
222
+ }
223
+ updateMargin(gap) {
224
+ this._splitview.margin = gap;
225
+ }
226
+ dispose() {
227
+ this._onDidChange.dispose();
228
+ this._splitview.dispose();
229
+ }
230
+ }
231
+ function adjustedOpts(base, defaultCollapsed, gapAdd) {
232
+ var _a;
233
+ const effectiveCollapsed = ((_a = base.collapsedSize) !== null && _a !== void 0 ? _a : defaultCollapsed) + gapAdd;
234
+ const result = Object.assign(Object.assign({}, base), { collapsedSize: effectiveCollapsed });
235
+ if (base.minimumSize !== undefined) {
236
+ result.minimumSize = base.minimumSize + gapAdd;
237
+ }
238
+ return result;
239
+ }
240
+ export class ShellManager {
241
+ constructor(container, dockviewElement, layoutGrid, gap = 0, defaultCollapsedSize = 35) {
242
+ this._disposables = new CompositeDisposable();
243
+ // Retained for updateTheme() recalculations.
244
+ this._viewConfigs = new Map();
245
+ this._currentWidth = 0;
246
+ this._currentHeight = 0;
247
+ this._gap = gap;
248
+ this._defaultCollapsedSize = defaultCollapsedSize;
249
+ this._shellElement = document.createElement('div');
250
+ this._shellElement.className = 'dv-shell';
251
+ this._shellElement.style.height = '100%';
252
+ this._shellElement.style.width = '100%';
253
+ this._shellElement.style.position = 'relative';
254
+ container.appendChild(this._shellElement);
255
+ const centerView = new CenterView(dockviewElement, layoutGrid);
256
+ this._middleColumn = new MiddleColumnView(centerView, gap);
257
+ this._outerSplitview = new Splitview(this._shellElement, {
258
+ orientation: Orientation.HORIZONTAL,
259
+ proportionalLayout: false,
260
+ margin: gap,
261
+ });
262
+ this._middleIndex = 0;
263
+ this._outerSplitview.addView(this._middleColumn, { type: 'distribute' }, 0);
264
+ this._disposables.addDisposables(watchElementResize(this._shellElement, (entry) => {
265
+ const { width, height } = entry.contentRect;
266
+ this._currentWidth = width;
267
+ this._currentHeight = height;
268
+ this.layout(width, height);
269
+ }), this._outerSplitview, this._middleColumn, centerView);
270
+ }
271
+ get element() {
272
+ return this._shellElement;
273
+ }
274
+ /**
275
+ * Add an edge group view at the given position. The view wraps the
276
+ * provided group element inside the shell's splitview layout.
277
+ * Throws if a group at this position is already registered.
278
+ */
279
+ addEdgeView(position, options, group) {
280
+ if (this.hasEdgeGroup(position)) {
281
+ throw new Error(`dockview: edge group already registered at position '${position}'`);
282
+ }
283
+ this._viewConfigs.set(position, options);
284
+ // Recompute gap adjustments now that _viewConfigs has grown.
285
+ const outerN = 1 +
286
+ (this._viewConfigs.has('left') ? 1 : 0) +
287
+ (this._viewConfigs.has('right') ? 1 : 0);
288
+ const innerN = 1 +
289
+ (this._viewConfigs.has('top') ? 1 : 0) +
290
+ (this._viewConfigs.has('bottom') ? 1 : 0);
291
+ const outerGapAdd = outerN > 1 ? (this._gap * (outerN - 1)) / outerN : 0;
292
+ const innerGapAdd = innerN > 1 ? (this._gap * (innerN - 1)) / innerN : 0;
293
+ const isHorizontal = position === 'left' || position === 'right';
294
+ const gapAdd = isHorizontal ? outerGapAdd : innerGapAdd;
295
+ const orientation = isHorizontal ? 'horizontal' : 'vertical';
296
+ const view = new EdgeGroupView(adjustedOpts(Object.assign({ collapsedSize: this._defaultCollapsedSize }, options), this._defaultCollapsedSize, gapAdd), group, orientation);
297
+ const initialSize = view.isCollapsed
298
+ ? view.collapsedSize
299
+ : view.lastExpandedSize;
300
+ switch (position) {
301
+ case 'left':
302
+ // Insert before the middle column
303
+ this._outerSplitview.addView(view, initialSize, 0);
304
+ this._leftIndex = 0;
305
+ this._middleIndex += 1;
306
+ if (this._rightIndex !== undefined) {
307
+ this._rightIndex += 1;
308
+ }
309
+ this._leftView = view;
310
+ break;
311
+ case 'right':
312
+ // Append after the middle column
313
+ {
314
+ const idx = this._outerSplitview.length;
315
+ this._outerSplitview.addView(view, initialSize, idx);
316
+ this._rightIndex = idx;
317
+ this._rightView = view;
318
+ }
319
+ break;
320
+ case 'top':
321
+ this._middleColumn.addTopView(view, initialSize);
322
+ this._topView = view;
323
+ break;
324
+ case 'bottom':
325
+ this._middleColumn.addBottomView(view, initialSize);
326
+ this._bottomView = view;
327
+ break;
328
+ }
329
+ this._disposables.addDisposables(view);
330
+ // Recalculate gap adjustments for all views now that n has changed.
331
+ // updateTheme already guards the layout() call by _currentWidth/_currentHeight.
332
+ this.updateTheme(this._gap, this._defaultCollapsedSize);
333
+ return view;
334
+ }
335
+ layout(width, height) {
336
+ // Outer splitview is HORIZONTAL: layout(size=width, orthogonalSize=height)
337
+ this._outerSplitview.layout(width, height);
338
+ }
339
+ /**
340
+ * Called when the active theme changes. Updates splitview margins and
341
+ * edge-group collapsed sizes so the layout matches the new theme's gap
342
+ * and tab-strip dimensions.
343
+ */
344
+ updateTheme(gap, defaultCollapsedSize) {
345
+ var _a, _b, _c, _d;
346
+ this._gap = gap;
347
+ this._defaultCollapsedSize = defaultCollapsedSize;
348
+ const outerN = 1 +
349
+ (this._viewConfigs.has('left') ? 1 : 0) +
350
+ (this._viewConfigs.has('right') ? 1 : 0);
351
+ const innerN = 1 +
352
+ (this._viewConfigs.has('top') ? 1 : 0) +
353
+ (this._viewConfigs.has('bottom') ? 1 : 0);
354
+ const outerGapAdd = outerN > 1 ? (gap * (outerN - 1)) / outerN : 0;
355
+ const innerGapAdd = innerN > 1 ? (gap * (innerN - 1)) / innerN : 0;
356
+ // Update splitview margins.
357
+ this._outerSplitview.margin = gap;
358
+ this._middleColumn.updateMargin(gap);
359
+ // Recompute effective collapsed sizes from the original config values.
360
+ const updateView = (view, baseCfg, gapAdd) => {
361
+ var _a;
362
+ const baseCS = (_a = baseCfg.collapsedSize) !== null && _a !== void 0 ? _a : defaultCollapsedSize;
363
+ const newCS = baseCS + gapAdd;
364
+ const baseMS = baseCfg.minimumSize;
365
+ const newMS = baseMS !== undefined ? baseMS + gapAdd : newCS + 50;
366
+ view.updateCollapsedSize(newCS, newMS);
367
+ };
368
+ const topCfg = this._viewConfigs.get('top');
369
+ if (this._topView && topCfg) {
370
+ updateView(this._topView, topCfg, innerGapAdd);
371
+ }
372
+ const bottomCfg = this._viewConfigs.get('bottom');
373
+ if (this._bottomView && bottomCfg) {
374
+ updateView(this._bottomView, bottomCfg, innerGapAdd);
375
+ }
376
+ const leftCfg = this._viewConfigs.get('left');
377
+ if (this._leftView && leftCfg) {
378
+ updateView(this._leftView, leftCfg, outerGapAdd);
379
+ }
380
+ const rightCfg = this._viewConfigs.get('right');
381
+ if (this._rightView && rightCfg) {
382
+ updateView(this._rightView, rightCfg, outerGapAdd);
383
+ }
384
+ // Resize currently-collapsed groups to their new collapsed size so
385
+ // they immediately match the new theme's tab-strip dimensions.
386
+ if (((_a = this._leftView) === null || _a === void 0 ? void 0 : _a.isCollapsed) && this._leftIndex !== undefined) {
387
+ this._outerSplitview.resizeView(this._leftIndex, this._leftView.collapsedSize);
388
+ }
389
+ if (((_b = this._rightView) === null || _b === void 0 ? void 0 : _b.isCollapsed) && this._rightIndex !== undefined) {
390
+ this._outerSplitview.resizeView(this._rightIndex, this._rightView.collapsedSize);
391
+ }
392
+ if ((_c = this._topView) === null || _c === void 0 ? void 0 : _c.isCollapsed) {
393
+ this._middleColumn.resizeView('top', this._topView.collapsedSize);
394
+ }
395
+ if ((_d = this._bottomView) === null || _d === void 0 ? void 0 : _d.isCollapsed) {
396
+ this._middleColumn.resizeView('bottom', this._bottomView.collapsedSize);
397
+ }
398
+ // Re-run layout with the current shell dimensions.
399
+ if (this._currentWidth > 0 && this._currentHeight > 0) {
400
+ this.layout(this._currentWidth, this._currentHeight);
401
+ }
402
+ }
403
+ removeEdgeView(position) {
404
+ const view = this._getView(position);
405
+ if (!view) {
406
+ return;
407
+ }
408
+ switch (position) {
409
+ case 'left':
410
+ this._outerSplitview.removeView(this._leftIndex);
411
+ this._leftIndex = undefined;
412
+ this._leftView = undefined;
413
+ // middle and right shift left by one
414
+ this._middleIndex -= 1;
415
+ if (this._rightIndex !== undefined) {
416
+ this._rightIndex -= 1;
417
+ }
418
+ break;
419
+ case 'right':
420
+ this._outerSplitview.removeView(this._rightIndex);
421
+ this._rightIndex = undefined;
422
+ this._rightView = undefined;
423
+ break;
424
+ case 'top':
425
+ this._middleColumn.removeView('top');
426
+ this._topView = undefined;
427
+ break;
428
+ case 'bottom':
429
+ this._middleColumn.removeView('bottom');
430
+ this._bottomView = undefined;
431
+ break;
432
+ }
433
+ // Deregister before disposing to avoid double-dispose when ShellManager
434
+ // itself is eventually disposed.
435
+ this._disposables.removeDisposable(view);
436
+ view.dispose();
437
+ this._viewConfigs.delete(position);
438
+ // Recalculate gap adjustments for remaining views.
439
+ this.updateTheme(this._gap, this._defaultCollapsedSize);
440
+ }
441
+ hasEdgeGroup(position) {
442
+ switch (position) {
443
+ case 'top':
444
+ return this._topView !== undefined;
445
+ case 'bottom':
446
+ return this._bottomView !== undefined;
447
+ case 'left':
448
+ return this._leftView !== undefined;
449
+ case 'right':
450
+ return this._rightView !== undefined;
451
+ }
452
+ }
453
+ setEdgeGroupVisible(position, visible) {
454
+ switch (position) {
455
+ case 'left':
456
+ if (this._leftIndex !== undefined) {
457
+ this._outerSplitview.setViewVisible(this._leftIndex, visible);
458
+ }
459
+ break;
460
+ case 'right':
461
+ if (this._rightIndex !== undefined) {
462
+ this._outerSplitview.setViewVisible(this._rightIndex, visible);
463
+ }
464
+ break;
465
+ case 'top':
466
+ case 'bottom':
467
+ this._middleColumn.setViewVisible(position, visible);
468
+ break;
469
+ }
470
+ }
471
+ isEdgeGroupVisible(position) {
472
+ switch (position) {
473
+ case 'left':
474
+ if (this._leftIndex !== undefined) {
475
+ return this._outerSplitview.isViewVisible(this._leftIndex);
476
+ }
477
+ return false;
478
+ case 'right':
479
+ if (this._rightIndex !== undefined) {
480
+ return this._outerSplitview.isViewVisible(this._rightIndex);
481
+ }
482
+ return false;
483
+ case 'top':
484
+ case 'bottom':
485
+ return this._middleColumn.isViewVisible(position);
486
+ }
487
+ }
488
+ setEdgeGroupCollapsed(position, collapsed) {
489
+ const view = this._getView(position);
490
+ if (!view) {
491
+ return;
492
+ }
493
+ view.setCollapsed(collapsed);
494
+ const targetSize = collapsed
495
+ ? view.collapsedSize
496
+ : view.lastExpandedSize;
497
+ switch (position) {
498
+ case 'left':
499
+ if (this._leftIndex !== undefined) {
500
+ this._outerSplitview.resizeView(this._leftIndex, targetSize);
501
+ }
502
+ break;
503
+ case 'right':
504
+ if (this._rightIndex !== undefined) {
505
+ this._outerSplitview.resizeView(this._rightIndex, targetSize);
506
+ }
507
+ break;
508
+ case 'top':
509
+ case 'bottom':
510
+ this._middleColumn.resizeView(position, targetSize);
511
+ break;
512
+ }
513
+ }
514
+ isEdgeGroupCollapsed(position) {
515
+ var _a, _b;
516
+ return (_b = (_a = this._getView(position)) === null || _a === void 0 ? void 0 : _a.isCollapsed) !== null && _b !== void 0 ? _b : false;
517
+ }
518
+ _getView(position) {
519
+ switch (position) {
520
+ case 'top':
521
+ return this._topView;
522
+ case 'bottom':
523
+ return this._bottomView;
524
+ case 'left':
525
+ return this._leftView;
526
+ case 'right':
527
+ return this._rightView;
528
+ }
529
+ }
530
+ toJSON() {
531
+ const edgeGroups = {};
532
+ if (this._leftView && this._leftIndex !== undefined) {
533
+ edgeGroups.left = {
534
+ size: this._leftView.isCollapsed
535
+ ? this._leftView.lastExpandedSize
536
+ : this._outerSplitview.getViewSize(this._leftIndex),
537
+ visible: this._outerSplitview.isViewVisible(this._leftIndex),
538
+ collapsed: this._leftView.isCollapsed || undefined,
539
+ };
540
+ }
541
+ if (this._rightView && this._rightIndex !== undefined) {
542
+ edgeGroups.right = {
543
+ size: this._rightView.isCollapsed
544
+ ? this._rightView.lastExpandedSize
545
+ : this._outerSplitview.getViewSize(this._rightIndex),
546
+ visible: this._outerSplitview.isViewVisible(this._rightIndex),
547
+ collapsed: this._rightView.isCollapsed || undefined,
548
+ };
549
+ }
550
+ if (this._topView) {
551
+ edgeGroups.top = {
552
+ size: this._topView.isCollapsed
553
+ ? this._topView.lastExpandedSize
554
+ : this._middleColumn.getViewSize('top'),
555
+ visible: this._middleColumn.isViewVisible('top'),
556
+ collapsed: this._topView.isCollapsed || undefined,
557
+ };
558
+ }
559
+ if (this._bottomView) {
560
+ edgeGroups.bottom = {
561
+ size: this._bottomView.isCollapsed
562
+ ? this._bottomView.lastExpandedSize
563
+ : this._middleColumn.getViewSize('bottom'),
564
+ visible: this._middleColumn.isViewVisible('bottom'),
565
+ collapsed: this._bottomView.isCollapsed || undefined,
566
+ };
567
+ }
568
+ return edgeGroups;
569
+ }
570
+ fromJSON(data) {
571
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
572
+ if (data.left && this._leftIndex !== undefined) {
573
+ // Always restore the expanded size first. toJSON always records the
574
+ // expanded size (even when collapsed), so restoredExpandedSize must
575
+ // be applied before setCollapsed locks min/max to collapsedSize.
576
+ (_a = this._leftView) === null || _a === void 0 ? void 0 : _a.restoreExpandedSize(data.left.size);
577
+ (_b = this._leftView) === null || _b === void 0 ? void 0 : _b.setCollapsed((_c = data.left.collapsed) !== null && _c !== void 0 ? _c : false);
578
+ this._outerSplitview.resizeView(this._leftIndex, data.left.collapsed
579
+ ? ((_e = (_d = this._leftView) === null || _d === void 0 ? void 0 : _d.collapsedSize) !== null && _e !== void 0 ? _e : data.left.size)
580
+ : data.left.size);
581
+ if (!data.left.visible) {
582
+ this._outerSplitview.setViewVisible(this._leftIndex, false);
583
+ }
584
+ }
585
+ if (data.right && this._rightIndex !== undefined) {
586
+ (_f = this._rightView) === null || _f === void 0 ? void 0 : _f.restoreExpandedSize(data.right.size);
587
+ (_g = this._rightView) === null || _g === void 0 ? void 0 : _g.setCollapsed((_h = data.right.collapsed) !== null && _h !== void 0 ? _h : false);
588
+ this._outerSplitview.resizeView(this._rightIndex, data.right.collapsed
589
+ ? ((_k = (_j = this._rightView) === null || _j === void 0 ? void 0 : _j.collapsedSize) !== null && _k !== void 0 ? _k : data.right.size)
590
+ : data.right.size);
591
+ if (!data.right.visible) {
592
+ this._outerSplitview.setViewVisible(this._rightIndex, false);
593
+ }
594
+ }
595
+ if (data.top) {
596
+ (_l = this._topView) === null || _l === void 0 ? void 0 : _l.restoreExpandedSize(data.top.size);
597
+ (_m = this._topView) === null || _m === void 0 ? void 0 : _m.setCollapsed((_o = data.top.collapsed) !== null && _o !== void 0 ? _o : false);
598
+ this._middleColumn.resizeView('top', data.top.collapsed
599
+ ? ((_q = (_p = this._topView) === null || _p === void 0 ? void 0 : _p.collapsedSize) !== null && _q !== void 0 ? _q : data.top.size)
600
+ : data.top.size);
601
+ if (!data.top.visible) {
602
+ this._middleColumn.setViewVisible('top', false);
603
+ }
604
+ }
605
+ if (data.bottom) {
606
+ (_r = this._bottomView) === null || _r === void 0 ? void 0 : _r.restoreExpandedSize(data.bottom.size);
607
+ (_s = this._bottomView) === null || _s === void 0 ? void 0 : _s.setCollapsed((_t = data.bottom.collapsed) !== null && _t !== void 0 ? _t : false);
608
+ this._middleColumn.resizeView('bottom', data.bottom.collapsed
609
+ ? ((_v = (_u = this._bottomView) === null || _u === void 0 ? void 0 : _u.collapsedSize) !== null && _v !== void 0 ? _v : data.bottom.size)
610
+ : data.bottom.size);
611
+ if (!data.bottom.visible) {
612
+ this._middleColumn.setViewVisible('bottom', false);
613
+ }
614
+ }
615
+ }
616
+ dispose() {
617
+ var _a;
618
+ this._disposables.dispose();
619
+ (_a = this._shellElement.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this._shellElement);
620
+ }
621
+ }
@@ -4,6 +4,7 @@ import { DockviewApi } from '../api/component.api';
4
4
  import { IDockviewPanel } from './dockviewPanel';
5
5
  import { DockviewGroupPanel } from './dockviewGroupPanel';
6
6
  import { IDockviewEvent } from '../events';
7
+ import { ITabGroup } from './tabGroup';
7
8
  export type DockviewGroupDropLocation = 'tab' | 'header_space' | 'content' | 'edge';
8
9
  export interface DockviewWillShowOverlayLocationEventOptions {
9
10
  readonly kind: DockviewGroupDropLocation;
@@ -12,6 +13,14 @@ export interface DockviewWillShowOverlayLocationEventOptions {
12
13
  readonly group: DockviewGroupPanel | undefined;
13
14
  getData: () => PanelTransfer | undefined;
14
15
  }
16
+ export interface DockviewTabGroupChangeEvent {
17
+ readonly tabGroup: ITabGroup;
18
+ }
19
+ export interface DockviewTabGroupPanelChangeEvent {
20
+ readonly tabGroup: ITabGroup;
21
+ readonly panelId: string;
22
+ }
23
+ export type DockviewTabGroupCollapsedChangeEvent = DockviewTabGroupChangeEvent;
15
24
  export declare class DockviewWillShowOverlayLocationEvent implements IDockviewEvent {
16
25
  private readonly event;
17
26
  readonly options: DockviewWillShowOverlayLocationEventOptions;
@@ -3,8 +3,10 @@ import { DockviewGroupPanelApi } from '../api/dockviewGroupPanelApi';
3
3
  import { DockviewPanelApi } from '../api/dockviewPanelApi';
4
4
  import { PanelParameters } from '../framwork';
5
5
  import { DockviewGroupPanel, IDockviewGroupPanel } from './dockviewGroupPanel';
6
+ import { DockviewGroupLocation } from './dockviewGroupPanelModel';
6
7
  import { IDockviewPanel } from './dockviewPanel';
7
8
  import { DockviewHeaderPosition } from './options';
9
+ import { ITabGroup } from './tabGroup';
8
10
  export interface IGroupPanelBaseProps<T extends {
9
11
  [index: string]: any;
10
12
  } = any> extends PanelParameters<T> {
@@ -28,6 +30,7 @@ export interface IDockviewHeaderActionsProps {
28
30
  isGroupActive: boolean;
29
31
  group: DockviewGroupPanel;
30
32
  headerPosition: DockviewHeaderPosition;
33
+ location?: DockviewGroupLocation;
31
34
  }
32
35
  export interface IGroupHeaderProps {
33
36
  api: DockviewGroupPanelApi;
@@ -41,3 +44,14 @@ export interface IWatermarkPanelProps {
41
44
  export interface DockviewReadyEvent {
42
45
  api: DockviewApi;
43
46
  }
47
+ export interface ITabGroupChipRenderer {
48
+ readonly element: HTMLElement;
49
+ init(params: {
50
+ tabGroup: ITabGroup;
51
+ api: DockviewApi;
52
+ }): void;
53
+ update?(params: {
54
+ tabGroup: ITabGroup;
55
+ }): void;
56
+ dispose(): void;
57
+ }