dockview-core 8.5.1 → 8.6.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.
@@ -564,8 +564,14 @@ export declare class DockviewApi implements CommonApi<SerializedDockview> {
564
564
  addPanel<T extends object = Parameters>(options: AddPanelOptions<T>): IDockviewPanel;
565
565
  /**
566
566
  * Remove a panel given the panel object.
567
+ *
568
+ * `removeEmptyGroup` overrides the `closeEmptyGroups` option for this
569
+ * call: `false` keeps the group if the panel was its last one, `true`
570
+ * removes it.
567
571
  */
568
- removePanel(panel: IDockviewPanel): void;
572
+ removePanel(panel: IDockviewPanel, options?: {
573
+ removeEmptyGroup?: boolean;
574
+ }): void;
569
575
  /**
570
576
  * Add a group and return the created object.
571
577
  */
@@ -120,6 +120,8 @@ export declare class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
120
120
  private readonly accessor;
121
121
  private _group;
122
122
  private _pendingSize;
123
+ private _isApplyingSize;
124
+ private _reportedSize;
123
125
  readonly _onDidLocationChange: Emitter<DockviewGroupPanelLocationChangeEvent>;
124
126
  readonly onDidLocationChange: Event<DockviewGroupPanelLocationChangeEvent>;
125
127
  readonly _onDidActivePanelChange: Emitter<DockviewGroupActivePanelChangeEvent>;
@@ -274,7 +274,9 @@ export interface IDockviewComponent extends IBaseGrid<DockviewGroupPanel> {
274
274
  doSetGroupActive: (group: DockviewGroupPanel, skipFocus?: boolean) => void;
275
275
  removeGroup: (group: DockviewGroupPanel) => void;
276
276
  addPanel<T extends object = Parameters>(options: AddPanelOptions<T>): IDockviewPanel;
277
- removePanel(panel: IDockviewPanel): void;
277
+ removePanel(panel: IDockviewPanel, options?: {
278
+ removeEmptyGroup?: boolean;
279
+ }): void;
278
280
  getGroupPanel: (id: string) => IDockviewPanel | undefined;
279
281
  createWatermarkComponent(): IWatermarkRenderer;
280
282
  addGroup(options?: AddGroupOptions): DockviewGroupPanel;
@@ -686,7 +688,20 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
686
688
  private disposePopoutWindow;
687
689
  addFloatingGroup(item: DockviewPanel | DockviewGroupPanel, options?: FloatingGroupOptionsInternal): void;
688
690
  private _doAddFloatingGroup;
691
+ /** The `closeEmptyGroups` option: remove a group once it empties. */
692
+ private get closeEmptyGroups();
693
+ /** Whether a move leaves its emptied source group in place. */
694
+ private keepEmptyGroups;
689
695
  private removeGroupIfEmpty;
696
+ /**
697
+ * Locks the main grid, the shell whose splitviews host the edge groups,
698
+ * and the nested gridviews of floating and popout windows. The base
699
+ * setter stops at the main grid; `updateOptions` reaches this override.
700
+ */
701
+ get locked(): boolean;
702
+ set locked(value: boolean);
703
+ /** The gridviews hosted by open floating and popout windows. */
704
+ private nestedGridviews;
690
705
  /**
691
706
  * Build an empty gridview configured to match the main grid's styling and
692
707
  * resize behaviour, for hosting a nested layout inside a floating or popout
@@ -2,6 +2,14 @@ import { Event } from '../events';
2
2
  import { IDisposable } from '../lifecycle';
3
3
  import { IView, LayoutPriority } from '../splitview/splitview';
4
4
  export type EdgeGroupPosition = 'top' | 'bottom' | 'left' | 'right';
5
+ export declare function isHorizontal(position: EdgeGroupPosition): boolean;
6
+ /** What an edge view reads live from the splitview it sits in. */
7
+ export interface IEdgeGroupAxis {
8
+ /** The size each visible view gives up to the margins between them. */
9
+ readonly marginShare: number;
10
+ /** The splitview's extent along the axis; zero until it is laid out. */
11
+ readonly size: number;
12
+ }
5
13
  export interface EdgeGroupOptions {
6
14
  id: string;
7
15
  initialSize?: number;
@@ -69,10 +77,11 @@ export declare class EdgeGroupView implements IView {
69
77
  readonly snap = false;
70
78
  readonly priority = LayoutPriority.Low;
71
79
  private _isCollapsed;
80
+ private _isVisible;
72
81
  private _lastExpandedSize;
73
82
  private _baseCollapsedSize;
74
83
  private _baseMinimumSize;
75
- private _gapAdd;
84
+ private readonly _axis;
76
85
  private readonly _expandedMaximumSize;
77
86
  private _measuredTabSize;
78
87
  private readonly _tabSizeDisposables;
@@ -97,7 +106,7 @@ export declare class EdgeGroupView implements IView {
97
106
  get configuredMinimumSize(): number | undefined;
98
107
  get configuredMaximumSize(): number;
99
108
  get configuredCollapsedSize(): number;
100
- constructor(options: EdgeGroupOptions, group: IEdgeGroupHost, orientation: 'horizontal' | 'vertical', gapAdd?: number);
109
+ constructor(options: EdgeGroupOptions, group: IEdgeGroupHost, orientation: 'horizontal' | 'vertical', axis?: IEdgeGroupAxis);
101
110
  /**
102
111
  * Watch the group's tab strip so the collapsed size follows the live tab
103
112
  * height. The strip's cross-axis size (height for top/bottom, width for
@@ -113,20 +122,19 @@ export declare class EdgeGroupView implements IView {
113
122
  private _applyMeasuredTabSize;
114
123
  layout(size: number, orthogonalSize: number): void;
115
124
  setCollapsed(collapsed: boolean): void;
116
- setVisible(_visible: boolean): void;
125
+ setVisible(visible: boolean): void;
117
126
  /**
118
- * Restore the last-expanded size from serialized state without triggering
119
- * a layout. Must be called before setCollapsed(true) during fromJSON so
120
- * that expanding after deserialization restores the correct size.
127
+ * Set the expanded size without triggering a layout: from serialized
128
+ * state (before setCollapsed(true) during fromJSON, so that expanding
129
+ * restores the right size) or from an explicit resize.
121
130
  */
122
131
  restoreExpandedSize(size: number): void;
123
132
  /**
124
- * Apply a new base (pre-gap) collapsed size, base minimum size and gap
125
- * contribution after a theme or gap change. Base values come from the
126
- * original config; the ShellManager owns the gap arithmetic. A live
127
- * measured tab size (if any) continues to win over the base collapsed size.
133
+ * Apply a new base (pre-gap) collapsed size and base minimum size after a
134
+ * theme change. Base values come from the original config. A live measured
135
+ * tab size (if any) continues to win over the base collapsed size.
128
136
  */
129
- updateSizing(baseCollapsedSize: number, baseMinimumSize: number | undefined, gapAdd: number): void;
137
+ updateSizing(baseCollapsedSize: number, baseMinimumSize: number | undefined): void;
130
138
  dispose(): void;
131
139
  }
132
140
  export declare class ShellManager implements IDisposable {
@@ -149,6 +157,13 @@ export declare class ShellManager implements IDisposable {
149
157
  private _defaultCollapsedSize;
150
158
  constructor(container: HTMLElement, dockviewElement: HTMLElement, layoutGrid: (width: number, height: number) => void, gap?: number, defaultCollapsedSize?: number);
151
159
  get element(): HTMLElement;
160
+ /**
161
+ * The dock's `locked` option. The edge groups are resized with the sashes
162
+ * of the shell's own splitviews (left/right in the outer one, top/bottom
163
+ * in the middle column), so locking disables both.
164
+ */
165
+ get locked(): boolean;
166
+ set locked(value: boolean);
152
167
  /**
153
168
  * Add an edge group view at the given position. The view wraps the
154
169
  * provided group element inside the shell's splitview layout.
@@ -174,6 +189,21 @@ export declare class ShellManager implements IDisposable {
174
189
  * and tab-strip dimensions.
175
190
  */
176
191
  updateTheme(gap: number, defaultCollapsedSize: number): void;
192
+ /** Whether the other edge of `position`'s axis holds a view. */
193
+ private _hasSiblingOn;
194
+ /** The splitview `position`'s view sits in, as its edge axis. */
195
+ private _axisFor;
196
+ /** Re-derive every edge view's base sizing from its original config and
197
+ * the current defaults. */
198
+ private _applyThemeSizing;
199
+ /**
200
+ * Lay the shell out again at its current size, once it has one. The
201
+ * splitviews clamp every view to its current constraints, which is how a
202
+ * collapsed strip or a group at its minimum follows a moved gap share.
203
+ */
204
+ private _relayout;
205
+ /** The view's slot in its splitview: its laid-out size plus the gap share. */
206
+ private _slotSize;
177
207
  removeEdgeView(position: EdgeGroupPosition): void;
178
208
  hasEdgeGroup(position: EdgeGroupPosition): boolean;
179
209
  setEdgeGroupVisible(position: EdgeGroupPosition, visible: boolean): void;
@@ -199,6 +229,12 @@ export declare class ShellManager implements IDisposable {
199
229
  getEdgeGroupExpandedSize(position: EdgeGroupPosition): number;
200
230
  private _getView;
201
231
  toJSON(): SerializedEdgeGroups;
232
+ /** The size to restore the group to. An expanded-but-hidden group has a
233
+ * slot of 0, so fall back to its cached visible size (then
234
+ * lastExpandedSize); otherwise re-showing snaps to minimumSize. */
235
+ private _expandedSize;
236
+ /** The slot a hidden view had when it was last visible. */
237
+ private _cachedVisibleSize;
202
238
  fromJSON(data: SerializedEdgeGroups): void;
203
239
  dispose(): void;
204
240
  }
@@ -392,6 +392,12 @@ export interface DockviewOptions {
392
392
  * Define the behaviour of the dock when there are no panels to display. Defaults to `watermark`.
393
393
  */
394
394
  noPanelsOverlay?: 'emptyGroup' | 'watermark';
395
+ /**
396
+ * Whether a group is removed once its last panel is closed or moved out.
397
+ * Defaults to `true`. When `false` the empty group stays in the layout
398
+ * (rendering the watermark) until it is closed explicitly.
399
+ */
400
+ closeEmptyGroups?: boolean;
395
401
  theme?: DockviewTheme;
396
402
  disableTabsOverflowList?: boolean;
397
403
  /**
@@ -108,6 +108,11 @@ export declare class Splitview {
108
108
  get disabled(): boolean;
109
109
  set disabled(value: boolean);
110
110
  get margin(): number;
111
+ /**
112
+ * The size each visible view gives up to the margins: `n` visible views
113
+ * are separated by `n - 1` margins, spread evenly over the `n`.
114
+ */
115
+ get marginShare(): number;
111
116
  set margin(value: number);
112
117
  constructor(container: HTMLElement, options: SplitViewOptions);
113
118
  style(styles?: ISplitviewStyles): void;
@@ -136,6 +141,7 @@ export declare class Splitview {
136
141
  * For each view `i` the offet must be adjusted by `m * i/(n - 1)`.
137
142
  */
138
143
  private layoutViews;
144
+ private marginShareFor;
139
145
  private findFirstSnapIndex;
140
146
  private updateSashEnablement;
141
147
  private updateSash;