dockview-core 8.2.0 → 8.3.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.
@@ -77,6 +77,13 @@ export interface DockviewGroupPanelApi extends GridviewPanelApi {
77
77
  isMaximized(): boolean;
78
78
  exitMaximized(): void;
79
79
  close(): void;
80
+ /**
81
+ * Resize this group, clamped by its constraints and the space available.
82
+ * An edge group is sized along its own axis only - `width` for
83
+ * `left`/`right`, `height` for `top`/`bottom` - and that size is the one
84
+ * it expands to, so a collapsed group keeps its strip until expanded.
85
+ */
86
+ setSize(event: SizeEvent): void;
80
87
  /**
81
88
  * Collapse this group (edge groups only). No-op for non-edge groups.
82
89
  */
@@ -15,6 +15,12 @@ export declare class DropTargetAnchorContainer extends CompositeDisposable {
15
15
  * drag genuinely leaves to somewhere that doesn't re-render here.
16
16
  */
17
17
  private _pendingClear;
18
+ /**
19
+ * The element the live overlay was rendered for, `undefined` when nothing
20
+ * is showing. The container is shared by every drop target, so a caller
21
+ * tearing down only its own overlay must check this before `clear()`.
22
+ */
23
+ get renderedOutline(): HTMLElement | undefined;
18
24
  get disabled(): boolean;
19
25
  set disabled(value: boolean);
20
26
  private _cancelPendingClear;
@@ -123,6 +123,13 @@ export interface DroptargetOptions {
123
123
  * `undefined` (the default) uses the built-in cursor-quadrant logic.
124
124
  */
125
125
  getPositionResolver?: () => PositionResolver | undefined;
126
+ /**
127
+ * Pointer backend only: skip this target during hit-testing so the ancestor
128
+ * walk continues past it, making an element a hit-test stop for some
129
+ * payloads and transparent for the rest. The HTML5 backend ignores it —
130
+ * propagation there is the DOM event flow's job.
131
+ */
132
+ isHitTestTransparent?: () => boolean;
126
133
  }
127
134
  /**
128
135
  * Backend-agnostic drop target. Both the HTML5 `Droptarget` and the pointer
@@ -136,6 +143,10 @@ export interface IDropTarget extends IDisposable {
136
143
  disabled: boolean;
137
144
  setTargetZones(zones: Position[]): void;
138
145
  setOverlayModel(model: DroptargetOverlayModel): void;
146
+ /** Drop whatever this target is showing, for a consumer that commits a
147
+ * drop this target never sees (a capturing listener that stops the
148
+ * event, say) and so has to tear the overlay down itself. */
149
+ clearOverlay(): void;
139
150
  }
140
151
  export declare class Droptarget extends CompositeDisposable implements IDropTarget {
141
152
  private readonly element;
@@ -16,6 +16,8 @@ export interface PointerDropTargetOptions {
16
16
  * change at runtime; `undefined` (default) uses the cursor-quadrant logic.
17
17
  */
18
18
  getPositionResolver?: () => PositionResolver | undefined;
19
+ /** See `DroptargetOptions.isHitTestTransparent`. */
20
+ isHitTestTransparent?: () => boolean;
19
21
  }
20
22
  /** Pointer-driven counterpart to `Droptarget` with identical visual output. */
21
23
  export declare class PointerDropTarget extends CompositeDisposable implements IDropTarget {
@@ -35,6 +37,7 @@ export declare class PointerDropTarget extends CompositeDisposable implements ID
35
37
  set disabled(value: boolean);
36
38
  get state(): Position | undefined;
37
39
  constructor(element: HTMLElement, options: PointerDropTargetOptions);
40
+ clearOverlay(): void;
38
41
  setTargetZones(zones: Position[]): void;
39
42
  setOverlayModel(model: DroptargetOverlayModel): void;
40
43
  dispose(): void;
@@ -13,4 +13,9 @@ export interface IPointerDropTargetHandle {
13
13
  handleDragOver(event: PointerDragEvent): void;
14
14
  handleDragLeave(): void;
15
15
  handleDrop(event: PointerDragEvent): void;
16
+ /**
17
+ * Skip this target during hit-testing so the ancestor walk continues past
18
+ * it. A target that merely declines on drop still shadows its ancestors.
19
+ */
20
+ isHitTestTransparent?(): boolean;
16
21
  }
@@ -6,7 +6,7 @@ import { DockviewHeaderDirection } from '../../options';
6
6
  import { Tab } from '../tab/tab';
7
7
  import { ITabGroup } from '../../tabGroup';
8
8
  import { ITabGroupChipRenderer } from '../../framework';
9
- import { Droptarget, DroptargetEvent } from '../../../dnd/droptarget';
9
+ import { DroptargetEvent, IDropTarget } from '../../../dnd/droptarget';
10
10
  export interface TabGroupManagerContext {
11
11
  readonly group: DockviewGroupPanel;
12
12
  readonly accessor: DockviewComponent;
@@ -39,7 +39,8 @@ interface ChipRendererEntry {
39
39
  /** Disposes the two drag sources + their shared dragend listener. */
40
40
  dragSourcesDisposable: IDisposable | undefined;
41
41
  disposable: IDisposable;
42
- dropTarget: Droptarget;
42
+ dropTarget: IDropTarget;
43
+ pointerDropTarget: IDropTarget;
43
44
  }
44
45
  export declare class TabGroupManager {
45
46
  private readonly _ctx;
@@ -66,6 +67,12 @@ export declare class TabGroupManager {
66
67
  refreshAccents(): void;
67
68
  positionAllChips(): void;
68
69
  updateDirection(): void;
70
+ /**
71
+ * Drop any overlay the chips are showing. A group move is committed by a
72
+ * capturing listener on the tabs list that stops the event, so the chip
73
+ * target under the cursor never sees the drop that would clear its own.
74
+ */
75
+ clearChipDropOverlays(): void;
69
76
  snapshotChipWidths(): Map<string, number>;
70
77
  positionUnderlines(): void;
71
78
  trackUnderlines(): void;
@@ -142,6 +142,14 @@ export declare class TabReorderController extends CompositeDisposable {
142
142
  * zone, or into the void container; tears it down otherwise.
143
143
  */
144
144
  processDragLeave(related: Element | null): void;
145
+ /**
146
+ * Clear the anchored overlay only when this header is what rendered it.
147
+ * The container is shared with the group's content drop target, which
148
+ * renders into it on the same frame the cursor leaves the strip: the
149
+ * pointer backend calls `handleDragOver` on the new target before the
150
+ * global `onDragMove` that reaches us (#1612).
151
+ */
152
+ private clearHeaderAnchorOverlay;
145
153
  handleDragOver(event: {
146
154
  clientX: number;
147
155
  clientY?: number;
@@ -207,6 +207,10 @@ export declare class Tabs extends CompositeDisposable implements ITabReorderHost
207
207
  * (when the source tab is currently to the left of the target slot, its
208
208
  * removal shifts the insertion index down by one). Always clears
209
209
  * `targetTabGroupId` so the dropped tab lands outside the group.
210
+ *
211
+ * A chip dropped on a chip is a group move: the panel path would route it
212
+ * through the cross-group machinery, which rebuilds the tab group under a
213
+ * new id.
210
214
  */
211
215
  private _handleChipDrop;
212
216
  /**
@@ -0,0 +1,62 @@
1
+ import { DockviewGroupPanel } from './dockviewGroupPanel';
2
+ import { IDockviewPanel } from './dockviewPanel';
3
+ import { ITabGroup } from './tabGroup';
4
+ import { IContextMenuHost, IContextMenuService } from './moduleContracts';
5
+ export declare class ContextMenuController implements IContextMenuService {
6
+ private readonly accessor;
7
+ constructor(accessor: IContextMenuHost);
8
+ /**
9
+ * A single maximize/restore toggle whose label and behaviour track the
10
+ * group's live state: it reads *Restore* + calls `exitMaximized` when the
11
+ * group is maximized, otherwise *Maximize* + `maximize`. Only grid groups
12
+ * can be maximized, so the item is disabled for floating / popout panels
13
+ * that are not already maximized.
14
+ */
15
+ private buildMaximizeItem;
16
+ /**
17
+ * A single collapse/expand toggle whose label tracks the tab group's live
18
+ * state: *Expand* when the group is already collapsed, otherwise *Collapse*.
19
+ */
20
+ private buildCollapseItem;
21
+ /**
22
+ * Whether to auto-inject the built-in Pin/Unpin item at the top of the tab
23
+ * menu. True only when the PinnedTabs module is registered, pinning is
24
+ * enabled, and the app has not opted out via `pinnedTabs.contextMenuItem:
25
+ * false` (the item is on by default). This keeps pinning reachable from the
26
+ * menu without the app having to return `'pin'` from
27
+ * `getTabContextMenuItems` itself.
28
+ */
29
+ private _shouldInjectPin;
30
+ /**
31
+ * The tab menu items: the app's own items (if any) with the built-in
32
+ * `'pin'` item prepended when {@link _shouldInjectPin} applies, so the app
33
+ * keeps full control of its list, and pinning is added without disturbing
34
+ * it. Reuses the existing `'pin'` token rendering below.
35
+ */
36
+ private _resolveTabItems;
37
+ /**
38
+ * Render a custom `component` menu item and append it to `menuEl`. Builds
39
+ * the framework renderer via the host's `createContextMenuItemComponent`
40
+ * factory and initialises it. Shared by the tab menu and the chip menu,
41
+ * which differ only in `identity`: the tab menu passes the `panel`, the chip
42
+ * menu passes the `tabGroup`. No-op when no renderer could be created (no
43
+ * factory configured, or the factory declined the component).
44
+ */
45
+ private appendComponentItem;
46
+ /**
47
+ * The element for one built-in tab item, or `undefined` for a token this
48
+ * version doesn't know (an app on a newer typings version, or plain JS):
49
+ * an unrecognised token renders nothing rather than throwing.
50
+ */
51
+ private buildBuiltInTabItem;
52
+ /**
53
+ * Append one app-supplied item. A raw `element` is used as-is, a
54
+ * `component` goes through the framework renderer, and a `label` builds the
55
+ * default row; an item carrying none of the three renders nothing. Shared
56
+ * by both menus, which differ only in `identity`.
57
+ */
58
+ private appendConfigItem;
59
+ show(panel: IDockviewPanel, group: DockviewGroupPanel, event: MouseEvent): void;
60
+ showForChip(tabGroup: ITabGroup, group: DockviewGroupPanel, event: MouseEvent): void;
61
+ }
62
+ export declare const ContextMenuModule: import("./modules").DockviewModule<IContextMenuHost>;
@@ -671,6 +671,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
671
671
  private disposePopoutWindow;
672
672
  addFloatingGroup(item: DockviewPanel | DockviewGroupPanel, options?: FloatingGroupOptionsInternal): void;
673
673
  private _doAddFloatingGroup;
674
+ private removeGroupIfEmpty;
674
675
  /**
675
676
  * Build an empty gridview configured to match the main grid's styling, for
676
677
  * hosting a nested layout inside a floating or popout window.
@@ -951,6 +952,14 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
951
952
  private getNextGroupId;
952
953
  createGroup(options?: GroupOptions): DockviewGroupPanel;
953
954
  private createPanel;
955
+ /**
956
+ * Sizing for a group created by a drop next to `referenceLocation`: half
957
+ * of the group the overlay was drawn over, leaving its siblings alone, so
958
+ * the panel lands in the region the overlay indicated (#1612). Gridview
959
+ * rewrites the index to 0 when a cross-axis drop wraps the reference in a
960
+ * new branch, so one value serves both paths.
961
+ */
962
+ private dropSizing;
954
963
  private createGroupAtLocation;
955
964
  /**
956
965
  * Tag a group with the location and render / drop-target containers
@@ -139,6 +139,7 @@ export declare class ShellManager implements IDisposable {
139
139
  private _rightIndex;
140
140
  private readonly _disposables;
141
141
  private readonly _viewConfigs;
142
+ private readonly _pendingSizes;
142
143
  private _currentWidth;
143
144
  private _currentHeight;
144
145
  private _gap;
@@ -163,6 +164,20 @@ export declare class ShellManager implements IDisposable {
163
164
  setEdgeGroupVisible(position: EdgeGroupPosition, visible: boolean): void;
164
165
  isEdgeGroupVisible(position: EdgeGroupPosition): boolean;
165
166
  setEdgeGroupCollapsed(position: EdgeGroupPosition, collapsed: boolean): void;
167
+ /**
168
+ * Resize the edge group at `position` along its primary axis (width for
169
+ * `left`/`right`, height for `top`/`bottom`), clamped by the group's
170
+ * constraints and the space available. Where `groupApi.setSize` lands.
171
+ *
172
+ * The size becomes the group's expanded size, so a collapsed group keeps
173
+ * its strip and takes it on expand, and it survives a `toJSON` round-trip.
174
+ */
175
+ resizeEdgeGroup(position: EdgeGroupPosition, size: number): void;
176
+ /** A resize lands only on a visible view (a hidden one is pinned to zero)
177
+ * whose splitview has extent to distribute. */
178
+ private _canResize;
179
+ private _resizeView;
180
+ private _flushPendingSizes;
166
181
  isEdgeGroupCollapsed(position: EdgeGroupPosition): boolean;
167
182
  /** The size an edge group expands to (its pre-collapse size), used to size
168
183
  * the auto-hide peek overlay. */
@@ -156,8 +156,8 @@ export declare function logMissingModule(moduleName: string, reason?: string | s
156
156
  * case: calling `undo()` having never set the option at all.
157
157
  *
158
158
  * Interaction handlers are queries in this sense too: a right-click reaching an
159
- * absent ContextMenu module means the app never asked for one, so it stays
160
- * silent (`?.`) and the browser's own menu shows. Options are where intent is
159
+ * absent module means the app never asked for that feature, so it stays silent
160
+ * (`?.`) and the browser's own behaviour applies. Options are where intent is
161
161
  * declared; see `optionsModules.ts`.
162
162
  */
163
163
  export declare function assertModule<T>(service: T | undefined, moduleName: string, context?: string): T | undefined;
@@ -5,10 +5,9 @@
5
5
  *
6
6
  * This is the "declared intent" diagnostic. It fires when the user asks for a
7
7
  * feature via options, at construction and on every `updateOptions`. It
8
- * deliberately does *not* fire on user interaction: right-clicking without the
9
- * ContextMenu module stays silent (the browser's own menu shows), because the
10
- * `?.` service-slot call sites can't tell a missing module from a feature the
11
- * app never wanted.
8
+ * deliberately does *not* fire on user interaction: an interaction reaching an
9
+ * absent module stays silent, because the `?.` service-slot call sites can't
10
+ * tell a missing module from a feature the app never wanted.
12
11
  *
13
12
  * Rules are a flat list rather than a `Record<keyof DockviewOptions, ...>`
14
13
  * because dockview's options are nested and value-gated: `overflow.mode:
@@ -2,7 +2,7 @@ import { Event, AsapEvent } from '../events';
2
2
  import { Gridview, IGridView } from './gridview';
3
3
  import { Position } from '../dnd/droptarget';
4
4
  import { IDisposable, IValueDisposable } from '../lifecycle';
5
- import { ISplitviewStyles, Orientation } from '../splitview/splitview';
5
+ import { ISplitviewStyles, Orientation, Sizing } from '../splitview/splitview';
6
6
  import { IPanel } from '../panel/types';
7
7
  import { MovementOptions2 } from '../dockview/options';
8
8
  import { Resizable } from '../resizable';
@@ -95,7 +95,7 @@ export declare abstract class BaseGrid<T extends IGridPanelView> extends Resizab
95
95
  isMaximizedGroup(panel: T): boolean;
96
96
  exitMaximizedGroup(): void;
97
97
  hasMaximizedGroup(): boolean;
98
- protected doAddGroup(group: T, location?: number[], size?: number, gridview?: Gridview): void;
98
+ protected doAddGroup(group: T, location?: number[], size?: number | Sizing, gridview?: Gridview): void;
99
99
  protected doRemoveGroup(group: T, options?: {
100
100
  skipActive?: boolean;
101
101
  skipDispose?: boolean;
@@ -59,6 +59,7 @@ export { type IDragGhostSpec } from './dnd/backend';
59
59
  export { LiveRegionModule } from './dockview/liveRegionService';
60
60
  export { AdvancedDnDModule, AdvancedDnDService, } from './dockview/advancedDnDService';
61
61
  export { TabGroupChipsModule, TabGroupChipsService, } from './dockview/tabGroupChipsService';
62
+ export { ContextMenuController, ContextMenuModule, } from './dockview/contextMenuService';
62
63
  export { FloatingGroupModule } from './dockview/floatingGroupService';
63
64
  export { EdgeGroupModule } from './dockview/edgeGroupService';
64
65
  export { createCloseButton, createPinButton } from './svg';