dockview-core 7.0.2 → 7.0.3

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 (98) hide show
  1. package/dist/cjs/api/dockviewGroupPanelApi.js +1 -1
  2. package/dist/cjs/dnd/dropTargetAnchorContainer.js +1 -2
  3. package/dist/cjs/dnd/pointer/longPress.js +1 -1
  4. package/dist/cjs/dnd/pointer/pointerDragController.js +9 -7
  5. package/dist/cjs/dnd/pointer/pointerDragSource.js +4 -2
  6. package/dist/cjs/dockview/components/panel/content.js +6 -6
  7. package/dist/cjs/dockview/components/popupService.js +1 -1
  8. package/dist/cjs/dockview/components/tab/tab.js +2 -2
  9. package/dist/cjs/dockview/components/titlebar/floatingTitleBar.d.ts +1 -2
  10. package/dist/cjs/dockview/components/titlebar/groupDragSource.d.ts +1 -2
  11. package/dist/cjs/dockview/components/titlebar/groupDragSource.js +1 -1
  12. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +5 -6
  13. package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +27 -5
  14. package/dist/cjs/dockview/components/titlebar/tabGroups.js +104 -54
  15. package/dist/cjs/dockview/components/titlebar/tabs.js +16 -23
  16. package/dist/cjs/dockview/components/titlebar/voidContainer.js +1 -1
  17. package/dist/cjs/dockview/dndCapabilities.js +3 -3
  18. package/dist/cjs/dockview/dockviewComponent.d.ts +5 -5
  19. package/dist/cjs/dockview/dockviewComponent.js +140 -122
  20. package/dist/cjs/dockview/dockviewGroupPanel.d.ts +1 -1
  21. package/dist/cjs/dockview/dockviewGroupPanelModel.js +19 -25
  22. package/dist/cjs/dockview/dockviewPanel.js +4 -5
  23. package/dist/cjs/dockview/dockviewShell.d.ts +29 -7
  24. package/dist/cjs/dockview/dockviewShell.js +94 -36
  25. package/dist/cjs/dockview/strictEventsSequencing.js +6 -6
  26. package/dist/cjs/dockview/tabGroup.js +3 -3
  27. package/dist/cjs/dockview/tabGroupAccent.js +1 -3
  28. package/dist/cjs/dom.js +1 -1
  29. package/dist/cjs/events.js +1 -1
  30. package/dist/cjs/gridview/baseComponentGridview.js +3 -8
  31. package/dist/cjs/gridview/branchNode.js +13 -17
  32. package/dist/cjs/gridview/gridview.js +8 -8
  33. package/dist/cjs/gridview/gridviewComponent.js +1 -6
  34. package/dist/cjs/overlay/overlay.js +25 -28
  35. package/dist/cjs/overlay/overlayRenderContainer.js +3 -4
  36. package/dist/cjs/paneview/draggablePaneviewPanel.js +1 -1
  37. package/dist/cjs/paneview/paneviewComponent.js +2 -6
  38. package/dist/cjs/popoutWindow.js +4 -4
  39. package/dist/cjs/scrollbar.d.ts +1 -1
  40. package/dist/cjs/scrollbar.js +7 -6
  41. package/dist/cjs/splitview/splitview.d.ts +1 -1
  42. package/dist/cjs/splitview/splitview.js +21 -20
  43. package/dist/cjs/splitview/viewItem.js +1 -1
  44. package/dist/dockview-core.js +413 -330
  45. package/dist/dockview-core.min.js +2 -2
  46. package/dist/dockview-core.min.js.map +1 -1
  47. package/dist/dockview-core.min.noStyle.js +2 -2
  48. package/dist/dockview-core.min.noStyle.js.map +1 -1
  49. package/dist/dockview-core.noStyle.js +412 -329
  50. package/dist/esm/api/dockviewGroupPanelApi.js +1 -1
  51. package/dist/esm/dnd/dropTargetAnchorContainer.js +1 -2
  52. package/dist/esm/dnd/pointer/longPress.js +1 -1
  53. package/dist/esm/dnd/pointer/pointerDragController.js +9 -7
  54. package/dist/esm/dnd/pointer/pointerDragSource.js +4 -2
  55. package/dist/esm/dockview/components/panel/content.js +6 -6
  56. package/dist/esm/dockview/components/popupService.js +1 -1
  57. package/dist/esm/dockview/components/tab/tab.js +2 -2
  58. package/dist/esm/dockview/components/titlebar/floatingTitleBar.d.ts +1 -2
  59. package/dist/esm/dockview/components/titlebar/groupDragSource.d.ts +1 -2
  60. package/dist/esm/dockview/components/titlebar/groupDragSource.js +1 -1
  61. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +5 -6
  62. package/dist/esm/dockview/components/titlebar/tabGroups.d.ts +27 -5
  63. package/dist/esm/dockview/components/titlebar/tabGroups.js +91 -42
  64. package/dist/esm/dockview/components/titlebar/tabs.js +17 -24
  65. package/dist/esm/dockview/components/titlebar/voidContainer.js +1 -1
  66. package/dist/esm/dockview/dndCapabilities.js +3 -3
  67. package/dist/esm/dockview/dockviewComponent.d.ts +5 -5
  68. package/dist/esm/dockview/dockviewComponent.js +61 -51
  69. package/dist/esm/dockview/dockviewGroupPanel.d.ts +1 -1
  70. package/dist/esm/dockview/dockviewGroupPanelModel.js +19 -25
  71. package/dist/esm/dockview/dockviewPanel.js +1 -2
  72. package/dist/esm/dockview/dockviewShell.d.ts +29 -7
  73. package/dist/esm/dockview/dockviewShell.js +89 -37
  74. package/dist/esm/dockview/strictEventsSequencing.js +6 -6
  75. package/dist/esm/dockview/tabGroup.js +3 -3
  76. package/dist/esm/dockview/tabGroupAccent.js +1 -3
  77. package/dist/esm/dom.js +1 -1
  78. package/dist/esm/events.js +1 -1
  79. package/dist/esm/gridview/baseComponentGridview.js +3 -8
  80. package/dist/esm/gridview/branchNode.js +13 -15
  81. package/dist/esm/gridview/gridview.js +8 -8
  82. package/dist/esm/gridview/gridviewComponent.js +1 -6
  83. package/dist/esm/overlay/overlay.js +25 -28
  84. package/dist/esm/overlay/overlayRenderContainer.js +3 -4
  85. package/dist/esm/paneview/draggablePaneviewPanel.js +1 -1
  86. package/dist/esm/paneview/paneviewComponent.js +2 -6
  87. package/dist/esm/popoutWindow.js +4 -4
  88. package/dist/esm/scrollbar.d.ts +1 -1
  89. package/dist/esm/scrollbar.js +7 -6
  90. package/dist/esm/splitview/splitview.d.ts +1 -1
  91. package/dist/esm/splitview/splitview.js +21 -20
  92. package/dist/esm/splitview/viewItem.js +1 -1
  93. package/dist/package/main.cjs.js +412 -329
  94. package/dist/package/main.cjs.min.js +2 -2
  95. package/dist/package/main.esm.min.mjs +2 -2
  96. package/dist/package/main.esm.mjs +412 -329
  97. package/dist/styles/dockview.css +8 -8
  98. package/package.json +1 -1
@@ -13,7 +13,7 @@ export interface IDockviewGroupPanel extends IGridviewPanel<DockviewGroupPanelAp
13
13
  }
14
14
  export declare class DockviewGroupPanel extends GridviewPanel<DockviewGroupPanelApiImpl> implements IDockviewGroupPanel {
15
15
  private readonly _model;
16
- private _explicitConstraints;
16
+ private readonly _explicitConstraints;
17
17
  get minimumWidth(): number;
18
18
  get minimumHeight(): number;
19
19
  get maximumWidth(): number;
@@ -572,7 +572,7 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
572
572
  }
573
573
  // Remove from any existing group first
574
574
  var existingGroup = this.getTabGroupForPanel(panelId);
575
- if (existingGroup && existingGroup.id === tabGroupId) {
575
+ if ((existingGroup === null || existingGroup === void 0 ? void 0 : existingGroup.id) === tabGroupId) {
576
576
  return; // already in this group — no mutation
577
577
  }
578
578
  this._bracketTabGroupMutation(function () {
@@ -593,7 +593,7 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
593
593
  */
594
594
  DockviewGroupPanelModel.prototype.movePanelWithinGroup = function (tabGroupId, panelId, newIndex) {
595
595
  var tabGroup = this._tabGroupMap.get(tabGroupId);
596
- if (!tabGroup || !tabGroup.containsPanel(panelId)) {
596
+ if (!(tabGroup === null || tabGroup === void 0 ? void 0 : tabGroup.containsPanel(panelId))) {
597
597
  return;
598
598
  }
599
599
  // Remove and re-add at new index within the group
@@ -846,7 +846,7 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
846
846
  for (var i = activePanelIndex + 1; i < this._panels.length; i++) {
847
847
  var candidate = this._panels[i];
848
848
  var candidateGroup = this._findTabGroupForPanel(candidate.id);
849
- if (!candidateGroup || !candidateGroup.collapsed) {
849
+ if (!(candidateGroup === null || candidateGroup === void 0 ? void 0 : candidateGroup.collapsed)) {
850
850
  this.doSetActivePanel(candidate);
851
851
  this.updateContainer();
852
852
  return;
@@ -855,7 +855,7 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
855
855
  for (var i = activePanelIndex - 1; i >= 0; i--) {
856
856
  var candidate = this._panels[i];
857
857
  var candidateGroup = this._findTabGroupForPanel(candidate.id);
858
- if (!candidateGroup || !candidateGroup.collapsed) {
858
+ if (!(candidateGroup === null || candidateGroup === void 0 ? void 0 : candidateGroup.collapsed)) {
859
859
  this.doSetActivePanel(candidate);
860
860
  this.updateContainer();
861
861
  return;
@@ -888,9 +888,9 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
888
888
  // Bump counter past any restored numeric suffixes to avoid ID collisions
889
889
  for (var serializedGroups_1 = __values(serializedGroups), serializedGroups_1_1 = serializedGroups_1.next(); !serializedGroups_1_1.done; serializedGroups_1_1 = serializedGroups_1.next()) {
890
890
  var data = serializedGroups_1_1.value;
891
- var match = data.id.match(/-(\d+)$/);
891
+ var match = /-(\d+)$/.exec(data.id);
892
892
  if (match) {
893
- var num = parseInt(match[1], 10) + 1;
893
+ var num = Number.parseInt(match[1], 10) + 1;
894
894
  if (num > this._tabGroupIdCounter) {
895
895
  this._tabGroupIdCounter = num;
896
896
  }
@@ -1049,32 +1049,26 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
1049
1049
  return result;
1050
1050
  };
1051
1051
  DockviewGroupPanelModel.prototype.moveToNext = function (options) {
1052
- if (!options) {
1053
- options = {};
1054
- }
1055
- if (!options.panel) {
1056
- options.panel = this.activePanel;
1057
- }
1052
+ var _a;
1053
+ options !== null && options !== void 0 ? options : (options = {});
1054
+ (_a = options.panel) !== null && _a !== void 0 ? _a : (options.panel = this.activePanel);
1058
1055
  var index = options.panel ? this.panels.indexOf(options.panel) : -1;
1059
1056
  var normalizedIndex;
1060
1057
  if (index < this.panels.length - 1) {
1061
1058
  normalizedIndex = index + 1;
1062
1059
  }
1063
- else if (!options.suppressRoll) {
1064
- normalizedIndex = 0;
1060
+ else if (options.suppressRoll) {
1061
+ return;
1065
1062
  }
1066
1063
  else {
1067
- return;
1064
+ normalizedIndex = 0;
1068
1065
  }
1069
1066
  this.openPanel(this.panels[normalizedIndex]);
1070
1067
  };
1071
1068
  DockviewGroupPanelModel.prototype.moveToPrevious = function (options) {
1072
- if (!options) {
1073
- options = {};
1074
- }
1075
- if (!options.panel) {
1076
- options.panel = this.activePanel;
1077
- }
1069
+ var _a;
1070
+ options !== null && options !== void 0 ? options : (options = {});
1071
+ (_a = options.panel) !== null && _a !== void 0 ? _a : (options.panel = this.activePanel);
1078
1072
  if (!options.panel) {
1079
1073
  return;
1080
1074
  }
@@ -1083,11 +1077,11 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
1083
1077
  if (index > 0) {
1084
1078
  normalizedIndex = index - 1;
1085
1079
  }
1086
- else if (!options.suppressRoll) {
1087
- normalizedIndex = this.panels.length - 1;
1080
+ else if (options.suppressRoll) {
1081
+ return;
1088
1082
  }
1089
1083
  else {
1090
- return;
1084
+ normalizedIndex = this.panels.length - 1;
1091
1085
  }
1092
1086
  this.openPanel(this.panels[normalizedIndex]);
1093
1087
  };
@@ -1202,7 +1196,7 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
1202
1196
  if (!this._activePanel && this.panels.length > 0) {
1203
1197
  var candidate = this._panels.find(function (p) {
1204
1198
  var tg = _this._findTabGroupForPanel(p.id);
1205
- return !tg || !tg.collapsed;
1199
+ return !(tg === null || tg === void 0 ? void 0 : tg.collapsed);
1206
1200
  });
1207
1201
  if (candidate) {
1208
1202
  this.doSetActivePanel(candidate);
@@ -178,16 +178,15 @@ var DockviewPanel = /** @class */ (function (_super) {
178
178
  };
179
179
  DockviewPanel.prototype.update = function (event) {
180
180
  var e_1, _a;
181
- var _b;
182
181
  // merge the new parameters with the existing parameters
183
- this._params = __assign(__assign({}, ((_b = this._params) !== null && _b !== void 0 ? _b : {})), event.params);
182
+ this._params = __assign(__assign({}, this._params), event.params);
184
183
  try {
185
184
  /**
186
185
  * delete new keys that have a value of undefined,
187
186
  * allow values of null
188
187
  */
189
- for (var _c = __values(Object.keys(event.params)), _d = _c.next(); !_d.done; _d = _c.next()) {
190
- var key = _d.value;
188
+ for (var _b = __values(Object.keys(event.params)), _c = _b.next(); !_c.done; _c = _b.next()) {
189
+ var key = _c.value;
191
190
  if (event.params[key] === undefined) {
192
191
  delete this._params[key];
193
192
  }
@@ -196,7 +195,7 @@ var DockviewPanel = /** @class */ (function (_super) {
196
195
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
197
196
  finally {
198
197
  try {
199
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
198
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
200
199
  }
201
200
  finally { if (e_1) throw e_1.error; }
202
201
  }
@@ -56,16 +56,37 @@ export declare class EdgeGroupView implements IView {
56
56
  readonly priority = LayoutPriority.Low;
57
57
  private _isCollapsed;
58
58
  private _lastExpandedSize;
59
- private _collapsedSize;
60
- private _expandedMinimumSize;
59
+ private _baseCollapsedSize;
60
+ private _baseMinimumSize;
61
+ private _gapAdd;
61
62
  private readonly _expandedMaximumSize;
63
+ private _measuredTabSize;
64
+ private readonly _tabSizeDisposables;
65
+ /**
66
+ * The effective (pre-gap) collapsed size: the measured tab-strip size when
67
+ * available, otherwise the configured/theme base.
68
+ */
69
+ private get _effectiveBaseCollapsed();
62
70
  get minimumSize(): number;
63
71
  get maximumSize(): number;
64
72
  get element(): HTMLElement;
65
73
  get isCollapsed(): boolean;
66
74
  get lastExpandedSize(): number;
67
75
  get collapsedSize(): number;
68
- constructor(options: EdgeGroupOptions, group: IEdgeGroupHost, orientation: 'horizontal' | 'vertical');
76
+ constructor(options: EdgeGroupOptions, group: IEdgeGroupHost, orientation: 'horizontal' | 'vertical', gapAdd?: number);
77
+ /**
78
+ * Watch the group's tab strip so the collapsed size follows the live tab
79
+ * height. The strip's cross-axis size (height for top/bottom, width for
80
+ * left/right) is exactly what a collapsed edge group should occupy; a
81
+ * ResizeObserver keeps them in sync when the tab height changes at runtime.
82
+ */
83
+ private _observeTabStrip;
84
+ /**
85
+ * Apply a freshly-measured tab-strip cross size. When the group is
86
+ * collapsed this resizes it in the parent splitview so the collapsed strip
87
+ * always shows the full tab height.
88
+ */
89
+ private _applyMeasuredTabSize;
69
90
  layout(size: number, orthogonalSize: number): void;
70
91
  setCollapsed(collapsed: boolean): void;
71
92
  setVisible(_visible: boolean): void;
@@ -76,11 +97,12 @@ export declare class EdgeGroupView implements IView {
76
97
  */
77
98
  restoreExpandedSize(size: number): void;
78
99
  /**
79
- * Apply new effective collapsed and expanded-minimum sizes after a theme
80
- * or gap change. The caller (ShellManager) is responsible for computing
81
- * the correct values from the original config and the new gap.
100
+ * Apply a new base (pre-gap) collapsed size, base minimum size and gap
101
+ * contribution after a theme or gap change. Base values come from the
102
+ * original config; the ShellManager owns the gap arithmetic. A live
103
+ * measured tab size (if any) continues to win over the base collapsed size.
82
104
  */
83
- updateCollapsedSize(newCollapsedSize: number, newExpandedMinimumSize: number): void;
105
+ updateSizing(baseCollapsedSize: number, baseMinimumSize: number | undefined, gapAdd: number): void;
84
106
  dispose(): void;
85
107
  }
86
108
  export declare class ShellManager implements IDisposable {
@@ -17,39 +17,55 @@ var lifecycle_1 = require("../lifecycle");
17
17
  var splitview_1 = require("../splitview/splitview");
18
18
  var dom_1 = require("../dom");
19
19
  var EdgeGroupView = /** @class */ (function () {
20
- function EdgeGroupView(options, group, orientation) {
20
+ function EdgeGroupView(options, group, orientation, gapAdd) {
21
+ if (gapAdd === void 0) { gapAdd = 0; }
21
22
  var _a, _b, _c;
22
23
  this._onDidChange = new events_1.Emitter();
23
24
  this.onDidChange = this._onDidChange.event;
24
25
  this.snap = false;
25
26
  this.priority = splitview_1.LayoutPriority.Low;
26
27
  this._isCollapsed = false;
28
+ this._tabSizeDisposables = new lifecycle_1.CompositeDisposable();
27
29
  this._group = group;
28
30
  this._orientation = orientation;
29
31
  group.element.classList.add('dv-edge-group');
30
32
  group.element.dataset.testid = "dv-edge-group-".concat(options.id);
31
- this._collapsedSize = (_a = options.collapsedSize) !== null && _a !== void 0 ? _a : 35;
33
+ this._baseCollapsedSize = (_a = options.collapsedSize) !== null && _a !== void 0 ? _a : 35;
34
+ this._baseMinimumSize = options.minimumSize;
35
+ this._gapAdd = gapAdd;
32
36
  this._expandedMaximumSize =
33
37
  (_b = options.maximumSize) !== null && _b !== void 0 ? _b : Number.POSITIVE_INFINITY;
34
- // If the caller explicitly provides a minimumSize, respect it.
35
- // Otherwise fall back to collapsedSize + 50 so the expanded state is
36
- // visually distinguishable from the collapsed state.
37
- this._expandedMinimumSize =
38
- options.minimumSize !== undefined
39
- ? options.minimumSize
40
- : this._collapsedSize + 50;
41
38
  this._lastExpandedSize = (_c = options.initialSize) !== null && _c !== void 0 ? _c : 200;
42
39
  if (options.collapsed) {
43
40
  this._isCollapsed = true;
44
41
  group.element.classList.add('dv-edge-collapsed');
45
42
  }
43
+ this._observeTabStrip();
46
44
  }
45
+ Object.defineProperty(EdgeGroupView.prototype, "_effectiveBaseCollapsed", {
46
+ /**
47
+ * The effective (pre-gap) collapsed size: the measured tab-strip size when
48
+ * available, otherwise the configured/theme base.
49
+ */
50
+ get: function () {
51
+ var _a;
52
+ return (_a = this._measuredTabSize) !== null && _a !== void 0 ? _a : this._baseCollapsedSize;
53
+ },
54
+ enumerable: false,
55
+ configurable: true
56
+ });
47
57
  Object.defineProperty(EdgeGroupView.prototype, "minimumSize", {
48
58
  get: function () {
49
59
  // When collapsed, lock size to collapsedSize so sash can't drag it open
50
- return this._isCollapsed
51
- ? this._collapsedSize
52
- : this._expandedMinimumSize;
60
+ if (this._isCollapsed) {
61
+ return this.collapsedSize;
62
+ }
63
+ // If the caller explicitly provides a minimumSize, respect it.
64
+ // Otherwise fall back to collapsedSize + 50 so the expanded state is
65
+ // visually distinguishable from the collapsed state.
66
+ return this._baseMinimumSize !== undefined
67
+ ? this._baseMinimumSize + this._gapAdd
68
+ : this._effectiveBaseCollapsed + 50 + this._gapAdd;
53
69
  },
54
70
  enumerable: false,
55
71
  configurable: true
@@ -58,7 +74,7 @@ var EdgeGroupView = /** @class */ (function () {
58
74
  get: function () {
59
75
  // When collapsed, lock size to collapsedSize so sash can't drag it open
60
76
  return this._isCollapsed
61
- ? this._collapsedSize
77
+ ? this.collapsedSize
62
78
  : this._expandedMaximumSize;
63
79
  },
64
80
  enumerable: false,
@@ -87,11 +103,43 @@ var EdgeGroupView = /** @class */ (function () {
87
103
  });
88
104
  Object.defineProperty(EdgeGroupView.prototype, "collapsedSize", {
89
105
  get: function () {
90
- return this._collapsedSize;
106
+ return this._effectiveBaseCollapsed + this._gapAdd;
91
107
  },
92
108
  enumerable: false,
93
109
  configurable: true
94
110
  });
111
+ /**
112
+ * Watch the group's tab strip so the collapsed size follows the live tab
113
+ * height. The strip's cross-axis size (height for top/bottom, width for
114
+ * left/right) is exactly what a collapsed edge group should occupy; a
115
+ * ResizeObserver keeps them in sync when the tab height changes at runtime.
116
+ */
117
+ EdgeGroupView.prototype._observeTabStrip = function () {
118
+ var _this = this;
119
+ var strip = this._group.element.querySelector('.dv-tabs-and-actions-container');
120
+ if (!strip) {
121
+ return;
122
+ }
123
+ this._tabSizeDisposables.addDisposables((0, dom_1.watchElementResize)(strip, function () {
124
+ _this._applyMeasuredTabSize(_this._orientation === 'vertical'
125
+ ? strip.offsetHeight
126
+ : strip.offsetWidth);
127
+ }));
128
+ };
129
+ /**
130
+ * Apply a freshly-measured tab-strip cross size. When the group is
131
+ * collapsed this resizes it in the parent splitview so the collapsed strip
132
+ * always shows the full tab height.
133
+ */
134
+ EdgeGroupView.prototype._applyMeasuredTabSize = function (size) {
135
+ if (size <= 0 || size === this._measuredTabSize) {
136
+ return;
137
+ }
138
+ this._measuredTabSize = size;
139
+ if (this._isCollapsed) {
140
+ this._onDidChange.fire({ size: this.collapsedSize });
141
+ }
142
+ };
95
143
  EdgeGroupView.prototype.layout = function (size, orthogonalSize) {
96
144
  // Track the last expanded size so we can restore it after collapsing
97
145
  if (!this._isCollapsed) {
@@ -126,15 +174,18 @@ var EdgeGroupView = /** @class */ (function () {
126
174
  this._lastExpandedSize = size;
127
175
  };
128
176
  /**
129
- * Apply new effective collapsed and expanded-minimum sizes after a theme
130
- * or gap change. The caller (ShellManager) is responsible for computing
131
- * the correct values from the original config and the new gap.
177
+ * Apply a new base (pre-gap) collapsed size, base minimum size and gap
178
+ * contribution after a theme or gap change. Base values come from the
179
+ * original config; the ShellManager owns the gap arithmetic. A live
180
+ * measured tab size (if any) continues to win over the base collapsed size.
132
181
  */
133
- EdgeGroupView.prototype.updateCollapsedSize = function (newCollapsedSize, newExpandedMinimumSize) {
134
- this._collapsedSize = newCollapsedSize;
135
- this._expandedMinimumSize = newExpandedMinimumSize;
182
+ EdgeGroupView.prototype.updateSizing = function (baseCollapsedSize, baseMinimumSize, gapAdd) {
183
+ this._baseCollapsedSize = baseCollapsedSize;
184
+ this._baseMinimumSize = baseMinimumSize;
185
+ this._gapAdd = gapAdd;
136
186
  };
137
187
  EdgeGroupView.prototype.dispose = function () {
188
+ this._tabSizeDisposables.dispose();
138
189
  this._onDidChange.dispose();
139
190
  };
140
191
  return EdgeGroupView;
@@ -279,15 +330,6 @@ var MiddleColumnView = /** @class */ (function () {
279
330
  };
280
331
  return MiddleColumnView;
281
332
  }());
282
- function adjustedOpts(base, defaultCollapsed, gapAdd) {
283
- var _a;
284
- var effectiveCollapsed = ((_a = base.collapsedSize) !== null && _a !== void 0 ? _a : defaultCollapsed) + gapAdd;
285
- var result = __assign(__assign({}, base), { collapsedSize: effectiveCollapsed });
286
- if (base.minimumSize !== undefined) {
287
- result.minimumSize = base.minimumSize + gapAdd;
288
- }
289
- return result;
290
- }
291
333
  var ShellManager = /** @class */ (function () {
292
334
  function ShellManager(container, dockviewElement, layoutGrid, gap, defaultCollapsedSize) {
293
335
  if (gap === void 0) { gap = 0; }
@@ -316,6 +358,26 @@ var ShellManager = /** @class */ (function () {
316
358
  this._middleIndex = 0;
317
359
  this._outerSplitview.addView(this._middleColumn, { type: 'distribute' }, 0);
318
360
  this._disposables.addDisposables((0, dom_1.watchElementResize)(this._shellElement, function (entry) {
361
+ /**
362
+ * When the shell (or an ancestor) becomes hidden — e.g. a
363
+ * nested dockview whose `onlyWhenVisible` host panel is
364
+ * deactivated — the element collapses to (0, 0) or is detached
365
+ * from the DOM. Propagating that zero size would relayout the
366
+ * edge-group splitview at 0, clamping the low-priority edge
367
+ * groups down to their minimum size and destroying the user's
368
+ * sizing. Skip these cases so sizes are preserved while hidden;
369
+ * mirrors the guard in the `Resizable` base class. See #1495.
370
+ *
371
+ * offsetParent === null is equivalent to display: none on the
372
+ * element or one of its ancestors.
373
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
374
+ */
375
+ if (!_this._shellElement.offsetParent) {
376
+ return;
377
+ }
378
+ if (!(0, dom_1.isInDocument)(_this._shellElement)) {
379
+ return;
380
+ }
319
381
  var width = Math.round(entry.contentRect.width);
320
382
  var height = Math.round(entry.contentRect.height);
321
383
  if (width === _this._currentWidth &&
@@ -356,7 +418,7 @@ var ShellManager = /** @class */ (function () {
356
418
  var isHorizontal = position === 'left' || position === 'right';
357
419
  var gapAdd = isHorizontal ? outerGapAdd : innerGapAdd;
358
420
  var orientation = isHorizontal ? 'horizontal' : 'vertical';
359
- var view = new EdgeGroupView(adjustedOpts(__assign({ collapsedSize: this._defaultCollapsedSize }, options), this._defaultCollapsedSize, gapAdd), group, orientation);
421
+ var view = new EdgeGroupView(__assign({ collapsedSize: this._defaultCollapsedSize }, options), group, orientation, gapAdd);
360
422
  var initialSize = view.isCollapsed
361
423
  ? view.collapsedSize
362
424
  : view.lastExpandedSize;
@@ -423,10 +485,7 @@ var ShellManager = /** @class */ (function () {
423
485
  var updateView = function (view, baseCfg, gapAdd) {
424
486
  var _a;
425
487
  var baseCS = (_a = baseCfg.collapsedSize) !== null && _a !== void 0 ? _a : defaultCollapsedSize;
426
- var newCS = baseCS + gapAdd;
427
- var baseMS = baseCfg.minimumSize;
428
- var newMS = baseMS !== undefined ? baseMS + gapAdd : newCS + 50;
429
- view.updateCollapsedSize(newCS, newMS);
488
+ view.updateSizing(baseCS, baseCfg.minimumSize, gapAdd);
430
489
  };
431
490
  var topCfg = this._viewConfigs.get('top');
432
491
  if (this._topView && topCfg) {
@@ -677,9 +736,8 @@ var ShellManager = /** @class */ (function () {
677
736
  }
678
737
  };
679
738
  ShellManager.prototype.dispose = function () {
680
- var _a;
681
739
  this._disposables.dispose();
682
- (_a = this._shellElement.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this._shellElement);
740
+ this._shellElement.remove();
683
741
  };
684
742
  return ShellManager;
685
743
  }());
@@ -36,11 +36,11 @@ var StrictEventsSequencing = /** @class */ (function (_super) {
36
36
  panels.add(panel.api.id);
37
37
  }
38
38
  }), this.accessor.onDidRemovePanel(function (panel) {
39
- if (!panels.has(panel.api.id)) {
40
- throw new Error("dockview: Invalid event sequence. [onDidRemovePanel] called for panel ".concat(panel.api.id, " but panel does not exists"));
39
+ if (panels.has(panel.api.id)) {
40
+ panels.delete(panel.api.id);
41
41
  }
42
42
  else {
43
- panels.delete(panel.api.id);
43
+ throw new Error("dockview: Invalid event sequence. [onDidRemovePanel] called for panel ".concat(panel.api.id, " but panel does not exists"));
44
44
  }
45
45
  }), this.accessor.onDidAddGroup(function (group) {
46
46
  if (groups.has(group.api.id)) {
@@ -50,11 +50,11 @@ var StrictEventsSequencing = /** @class */ (function (_super) {
50
50
  groups.add(group.api.id);
51
51
  }
52
52
  }), this.accessor.onDidRemoveGroup(function (group) {
53
- if (!groups.has(group.api.id)) {
54
- throw new Error("dockview: Invalid event sequence. [onDidRemoveGroup] called for group ".concat(group.api.id, " but group does not exists"));
53
+ if (groups.has(group.api.id)) {
54
+ groups.delete(group.api.id);
55
55
  }
56
56
  else {
57
- groups.delete(group.api.id);
57
+ throw new Error("dockview: Invalid event sequence. [onDidRemoveGroup] called for group ".concat(group.api.id, " but group does not exists"));
58
58
  }
59
59
  }));
60
60
  };
@@ -147,9 +147,9 @@ var TabGroup = /** @class */ (function (_super) {
147
147
  if (this._panelIds.includes(panelId)) {
148
148
  return;
149
149
  }
150
- var insertIndex = index !== undefined
151
- ? Math.max(0, Math.min(index, this._panelIds.length))
152
- : this._panelIds.length;
150
+ var insertIndex = index === undefined
151
+ ? this._panelIds.length
152
+ : Math.max(0, Math.min(index, this._panelIds.length));
153
153
  this._panelIds.splice(insertIndex, 0, panelId);
154
154
  this._onDidPanelChange.fire({ panelId: panelId, type: 'add' });
155
155
  };
@@ -99,9 +99,7 @@ var _fallbackPalette;
99
99
  * palette through.
100
100
  */
101
101
  function getFallbackPalette() {
102
- if (!_fallbackPalette) {
103
- _fallbackPalette = new TabGroupColorPalette(exports.DEFAULT_TAB_GROUP_COLORS, true);
104
- }
102
+ _fallbackPalette !== null && _fallbackPalette !== void 0 ? _fallbackPalette : (_fallbackPalette = new TabGroupColorPalette(exports.DEFAULT_TAB_GROUP_COLORS, true));
105
103
  return _fallbackPalette;
106
104
  }
107
105
  /**
package/dist/cjs/dom.js CHANGED
@@ -179,7 +179,7 @@ var FocusTracker = /** @class */ (function (_super) {
179
179
  var onBlur = function () {
180
180
  if (hasFocus) {
181
181
  loosingFocus = true;
182
- window.setTimeout(function () {
182
+ globalThis.setTimeout(function () {
183
183
  if (loosingFocus) {
184
184
  loosingFocus = false;
185
185
  hasFocus = false;
@@ -95,7 +95,7 @@ var Stacktrace = /** @class */ (function () {
95
95
  }
96
96
  Stacktrace.create = function () {
97
97
  var _a;
98
- return new Stacktrace((_a = new Error().stack) !== null && _a !== void 0 ? _a : '');
98
+ return new Stacktrace((_a = new Error('listener stacktrace').stack) !== null && _a !== void 0 ? _a : '');
99
99
  };
100
100
  Stacktrace.prototype.print = function () {
101
101
  console.warn('dockview: stacktrace', this.value);
@@ -90,8 +90,7 @@ var BaseGrid = /** @class */ (function (_super) {
90
90
  }), _this.onDidViewVisibilityChangeMicroTaskQueue(function () {
91
91
  _this.forceRelayout();
92
92
  }), lifecycle_1.Disposable.from(function () {
93
- var _a;
94
- (_a = _this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(_this.element);
93
+ _this.element.remove();
95
94
  }), _this.gridview.onDidChange(function () {
96
95
  _this._bufferOnDidLayoutChange.fire();
97
96
  }), events_1.Event.any(_this.onDidAdd, _this.onDidRemove, _this.onDidActiveChange)(function () {
@@ -269,9 +268,7 @@ var BaseGrid = /** @class */ (function (_super) {
269
268
  };
270
269
  BaseGrid.prototype.moveToNext = function (options) {
271
270
  var _a;
272
- if (!options) {
273
- options = {};
274
- }
271
+ options !== null && options !== void 0 ? options : (options = {});
275
272
  if (!options.group) {
276
273
  if (!this.activeGroup) {
277
274
  return;
@@ -284,9 +281,7 @@ var BaseGrid = /** @class */ (function (_super) {
284
281
  };
285
282
  BaseGrid.prototype.moveToPrevious = function (options) {
286
283
  var _a;
287
- if (!options) {
288
- options = {};
289
- }
284
+ options !== null && options !== void 0 ? options : (options = {});
290
285
  if (!options.group) {
291
286
  if (!this.activeGroup) {
292
287
  return;
@@ -66,16 +66,7 @@ var BranchNode = /** @class */ (function (_super) {
66
66
  _this._size = size;
67
67
  _this.element = document.createElement('div');
68
68
  _this.element.className = 'dv-branch-node';
69
- if (!childDescriptors) {
70
- _this.splitview = new splitview_1.Splitview(_this.element, {
71
- orientation: _this.orientation,
72
- proportionalLayout: proportionalLayout,
73
- styles: styles,
74
- margin: margin,
75
- });
76
- _this.splitview.layout(_this.size, _this.orthogonalSize);
77
- }
78
- else {
69
+ if (childDescriptors) {
79
70
  var descriptor = {
80
71
  views: childDescriptors.map(function (childDescriptor) {
81
72
  return {
@@ -98,6 +89,15 @@ var BranchNode = /** @class */ (function (_super) {
98
89
  margin: margin,
99
90
  });
100
91
  }
92
+ else {
93
+ _this.splitview = new splitview_1.Splitview(_this.element, {
94
+ orientation: _this.orientation,
95
+ proportionalLayout: proportionalLayout,
96
+ styles: styles,
97
+ margin: margin,
98
+ });
99
+ _this.splitview.layout(_this.size, _this.orthogonalSize);
100
+ }
101
101
  _this.disabled = disabled;
102
102
  _this.addDisposables(_this._onDidChange, _this._onDidVisibilityChange, _this.splitview.onDidSashEnd(function () {
103
103
  _this._onDidChange.fire({});
@@ -218,15 +218,11 @@ var BranchNode = /** @class */ (function (_super) {
218
218
  if (this.children.length === 0) {
219
219
  return splitview_1.LayoutPriority.Normal;
220
220
  }
221
- var priorities = this.children.map(function (c) {
222
- return typeof c.priority === 'undefined'
223
- ? splitview_1.LayoutPriority.Normal
224
- : c.priority;
225
- });
226
- if (priorities.some(function (p) { return p === splitview_1.LayoutPriority.High; })) {
221
+ var priorities = new Set(this.children.map(function (c) { var _a; return (_a = c.priority) !== null && _a !== void 0 ? _a : splitview_1.LayoutPriority.Normal; }));
222
+ if (priorities.has(splitview_1.LayoutPriority.High)) {
227
223
  return splitview_1.LayoutPriority.High;
228
224
  }
229
- else if (priorities.some(function (p) { return p === splitview_1.LayoutPriority.Low; })) {
225
+ else if (priorities.has(splitview_1.LayoutPriority.Low)) {
230
226
  return splitview_1.LayoutPriority.Low;
231
227
  }
232
228
  return splitview_1.LayoutPriority.Normal;