dockview-core
Version:
Zero dependency layout manager supporting tabs, groups, grids and splitviews for vanilla TypeScript
627 lines (626 loc) • 29.3 kB
TypeScript
import { SerializedGridObject, Gridview, SerializedGridview } from '../gridview/gridview';
import { DroptargetOverlayModel, Position } from '../dnd/droptarget';
import { DockviewPanel, IDockviewPanel } from './dockviewPanel';
import { IDisposable } from '../lifecycle';
import { Event, Emitter } from '../events';
import { IWatermarkRenderer, GroupviewPanelState } from './types';
import { AddGroupOptions, AddPanelOptions, DockviewComponentOptions, DockviewDndOverlayEvent, DockviewOptions, MovementOptions, DockviewHeaderPosition } from './options';
import { BaseGrid, IBaseGrid } from '../gridview/baseComponentGridview';
import { DockviewApi } from '../api/component.api';
import { Orientation } from '../splitview/splitview';
import { GroupOptions, GroupPanelViewState, DockviewDidDropEvent, DockviewWillDropEvent } from './dockviewGroupPanelModel';
import { DockviewWillShowOverlayLocationEvent, DockviewTabGroupChangeEvent, DockviewTabGroupCollapsedChangeEvent, DockviewTabGroupPanelChangeEvent, DockviewGroupDropLocation } from './events';
import { DockviewGroupPanel } from './dockviewGroupPanel';
import { Parameters } from '../panel/types';
import { DockviewFloatingGroupPanel } from './dockviewFloatingGroupPanel';
import { GroupDragEvent, TabDragEvent } from './components/titlebar/tabsContainer';
import { IFloatingGroupHost } from './floatingGroupService';
import { IPopoutWindowHost } from './popoutWindowService';
import { IWatermarkHost } from './watermarkService';
import { IEdgeGroupServiceHost } from './edgeGroupService';
import { IAccessibilityHost, IAdvancedDnDHost, IContextMenuHost, IContextMenuService, ITabGroupChipsHost } from './moduleContracts';
import { IHeaderActionsHost } from './headerActionsService';
import { AnchoredBox, AnchorPosition, Box } from '../types';
import { DockviewPanelRenderer, OverlayRenderContainer } from '../overlay/overlayRenderContainer';
import { PopupService } from './components/popupService';
import { IRootDropTargetHost } from './rootDropTargetService';
import { ILiveRegionHost } from './liveRegionService';
import { IDragGhostSpec } from '../dnd/backend';
import { DropTargetAnchorContainer } from '../dnd/dropTargetAnchorContainer';
import { EdgeGroupPosition, EdgeGroupOptions, SerializedEdgeGroups } from './dockviewShell';
import { DockviewGroupPanelApi } from '../api/dockviewGroupPanelApi';
import { TabGroupColorPalette } from './tabGroupAccent';
export interface DockviewPopoutGroupOptions {
/**
* The position of the popout group
*/
position?: Box;
/**
* The same-origin path at which the popout window will be created
*
* Defaults to `/popout.html` if not provided
*/
popoutUrl?: string;
onDidOpen?: (event: {
id: string;
window: Window;
}) => void;
onWillClose?: (event: {
id: string;
window: Window;
}) => void;
}
interface DockviewPopoutGroupOptionsInternal extends DockviewPopoutGroupOptions {
referenceGroup?: DockviewGroupPanel;
overridePopoutGroup?: DockviewGroupPanel;
/**
* Restore into a pre-built nested gridview (multi-group popout window)
* rather than creating one around a single group.
*/
overridePopoutGridview?: Gridview;
}
export interface PanelReference {
update: (event: {
params: {
[key: string]: any;
};
}) => void;
remove: () => void;
}
export interface SerializedFloatingGroup {
/**
* Legacy single-group form. Still written when a floating window hosts a
* single group (for stable round-trips) and always accepted on read.
*/
data?: GroupPanelViewState;
/**
* Nested layout of the floating window. Written when the window hosts more
* than one group; mutually exclusive with `data`.
*/
grid?: SerializedGridview<GroupPanelViewState>;
position: AnchoredBox;
}
export interface SerializedPopoutGroup {
/**
* Legacy single-group form. Still written when a popout window hosts a
* single group (for stable round-trips) and always accepted on read.
*/
data?: GroupPanelViewState;
/**
* Nested layout of the popout window. Written when the window hosts more
* than one group; mutually exclusive with `data`.
*/
grid?: SerializedGridview<GroupPanelViewState>;
url?: string;
gridReferenceGroup?: string;
position: Box | null;
}
export interface SerializedDockview {
grid: {
root: SerializedGridObject<GroupPanelViewState>;
height: number;
width: number;
orientation: Orientation;
};
panels: Record<string, GroupviewPanelState>;
activeGroup?: string;
floatingGroups?: SerializedFloatingGroup[];
popoutGroups?: SerializedPopoutGroup[];
edgeGroups?: SerializedEdgeGroups;
}
export interface MovePanelEvent {
panel: IDockviewPanel;
from: DockviewGroupPanel;
}
type MoveGroupOptions = {
from: {
group: DockviewGroupPanel;
};
to: {
group: DockviewGroupPanel;
position: Position;
};
skipSetActive?: boolean;
};
type MoveGroupOrPanelOptions = {
from: {
groupId: string;
panelId?: string;
tabGroupId?: string;
};
to: {
group: DockviewGroupPanel;
position: Position;
index?: number;
};
skipSetActive?: boolean;
keepEmptyGroups?: boolean;
};
export interface FloatingGroupOptions {
x?: number;
y?: number;
height?: number;
width?: number;
position?: AnchorPosition;
/**
* Override the component-level `floatingGroupDragHandle` option for this
* group only. See {@link DockviewOptions.floatingGroupDragHandle}.
*/
dragHandle?: 'titlebar' | 'tabbar';
}
interface FloatingGroupOptionsInternal extends FloatingGroupOptions {
skipRemoveGroup?: boolean;
inDragMode?: boolean;
skipActiveGroup?: boolean;
}
export interface DockviewMaximizedGroupChangeEvent {
group: DockviewGroupPanel;
isMaximized: boolean;
}
/** The coarse kind of a structural layout mutation (see `onWillMutateLayout`). */
export type DockviewLayoutMutationKind = 'add' | 'remove' | 'move' | 'float' | 'popout' | 'maximize' | 'tab-group' | 'load' | 'clear';
/**
* Who caused an operation: `'user'` for changes driven by direct interaction
* (drag-and-drop, tab UI, keyboard docking) and `'api'` for those entered
* through a {@link DockviewApi} method called by application code. Lets
* consumers (e.g. an undo stack, or a context-sync listener) treat the app's
* own programmatic changes differently from end-user gestures.
*/
export type DockviewOrigin = 'user' | 'api';
export interface DockviewLayoutMutationEvent {
readonly kind: DockviewLayoutMutationKind;
readonly origin: DockviewOrigin;
}
/**
* Fired by `onDidActivePanelChange` when the active panel changes. Carries the
* {@link DockviewOrigin} so consumers can distinguish a user clicking a tab
* from a programmatic `setActive` call (e.g. to avoid feedback loops when
* syncing context off the active panel).
*/
export interface DockviewActivePanelChangeEvent {
readonly panel: IDockviewPanel | undefined;
readonly origin: DockviewOrigin;
}
export interface PopoutGroupChangeSizeEvent {
width: number;
height: number;
group: DockviewGroupPanel;
}
export interface PopoutGroupChangePositionEvent {
screenX: number;
screenY: number;
group: DockviewGroupPanel;
}
/** A spatial (visual) direction for group-to-group navigation. */
export type GroupNavigationDirection = 'left' | 'right' | 'up' | 'down';
/**
* A popout group currently open in its own window. `window` is the live
* `Window` handle of the popout, so consumers can route focus, attach
* per-document listeners, or place the window.
*/
export interface PopoutGroup {
readonly id: string;
readonly group: DockviewGroupPanel;
readonly window: Window;
}
export interface IDockviewComponent extends IBaseGrid<DockviewGroupPanel> {
readonly activePanel: IDockviewPanel | undefined;
readonly totalPanels: number;
readonly panels: IDockviewPanel[];
readonly orientation: Orientation;
readonly onDidDrop: Event<DockviewDidDropEvent>;
readonly onWillDrop: Event<DockviewWillDropEvent>;
readonly onWillMutateLayout: Event<DockviewLayoutMutationEvent>;
readonly onDidMutateLayout: Event<DockviewLayoutMutationEvent>;
currentOrigin(): DockviewOrigin;
withOrigin<T>(origin: DockviewOrigin, func: () => T): T;
readonly onWillShowOverlay: Event<DockviewWillShowOverlayLocationEvent>;
readonly onDidRemovePanel: Event<IDockviewPanel>;
readonly onDidAddPanel: Event<IDockviewPanel>;
readonly onDidLayoutFromJSON: Event<void>;
readonly onDidActivePanelChange: Event<DockviewActivePanelChangeEvent>;
readonly onWillDragPanel: Event<TabDragEvent>;
readonly onWillDragGroup: Event<GroupDragEvent>;
readonly onDidRemoveGroup: Event<DockviewGroupPanel>;
readonly onDidAddGroup: Event<DockviewGroupPanel>;
readonly onDidActiveGroupChange: Event<DockviewGroupPanel | undefined>;
readonly onUnhandledDragOver: Event<DockviewDndOverlayEvent>;
readonly onDidMovePanel: Event<MovePanelEvent>;
readonly onDidMaximizedGroupChange: Event<DockviewMaximizedGroupChangeEvent>;
readonly onDidPopoutGroupSizeChange: Event<PopoutGroupChangeSizeEvent>;
readonly onDidPopoutGroupPositionChange: Event<PopoutGroupChangePositionEvent>;
readonly onDidAddPopoutGroup: Event<PopoutGroup>;
readonly onDidRemovePopoutGroup: Event<PopoutGroup>;
readonly onDidOpenPopoutWindowFail: Event<void>;
getPopouts(): PopoutGroup[];
readonly onDidCreateTabGroup: Event<DockviewTabGroupChangeEvent>;
readonly onDidDestroyTabGroup: Event<DockviewTabGroupChangeEvent>;
readonly onDidAddPanelToTabGroup: Event<DockviewTabGroupPanelChangeEvent>;
readonly onDidRemovePanelFromTabGroup: Event<DockviewTabGroupPanelChangeEvent>;
readonly onDidTabGroupChange: Event<DockviewTabGroupChangeEvent>;
readonly onDidTabGroupCollapsedChange: Event<DockviewTabGroupCollapsedChangeEvent>;
readonly options: DockviewComponentOptions;
readonly tabGroupColorPalette: TabGroupColorPalette;
updateOptions(options: DockviewOptions): void;
moveGroupOrPanel(options: MoveGroupOrPanelOptions): void;
moveGroup(options: MoveGroupOptions): void;
doSetGroupActive: (group: DockviewGroupPanel, skipFocus?: boolean) => void;
removeGroup: (group: DockviewGroupPanel) => void;
addPanel<T extends object = Parameters>(options: AddPanelOptions<T>): IDockviewPanel;
removePanel(panel: IDockviewPanel): void;
getGroupPanel: (id: string) => IDockviewPanel | undefined;
createWatermarkComponent(): IWatermarkRenderer;
addGroup(options?: AddGroupOptions): DockviewGroupPanel;
closeAllGroups(): void;
adjacentGroupInDirection(group: DockviewGroupPanel, direction: GroupNavigationDirection): DockviewGroupPanel | undefined;
moveToNext(options?: MovementOptions): void;
moveToPrevious(options?: MovementOptions): void;
setActivePanel(panel: IDockviewPanel): void;
focus(): void;
toJSON(): SerializedDockview;
fromJSON(data: SerializedDockview): void;
addFloatingGroup(item: IDockviewPanel | DockviewGroupPanel, options?: FloatingGroupOptions): void;
addPopoutGroup(item: IDockviewPanel | DockviewGroupPanel, options?: DockviewPopoutGroupOptions): Promise<boolean>;
fromJSON(data: any, options?: {
reuseExistingPanels: boolean;
}): void;
addEdgeGroup(position: EdgeGroupPosition, options: EdgeGroupOptions): DockviewGroupPanelApi;
getEdgeGroup(position: EdgeGroupPosition): DockviewGroupPanelApi | undefined;
setEdgeGroupVisible(position: EdgeGroupPosition, visible: boolean): void;
isEdgeGroupVisible(position: EdgeGroupPosition): boolean;
removeEdgeGroup(position: EdgeGroupPosition): void;
}
export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> implements IDockviewComponent, IFloatingGroupHost, IPopoutWindowHost, IWatermarkHost, IEdgeGroupServiceHost, ITabGroupChipsHost, IContextMenuHost, IRootDropTargetHost, IHeaderActionsHost, IAdvancedDnDHost, ILiveRegionHost, IAccessibilityHost {
private readonly nextGroupId;
private readonly _deserializer;
private readonly _api;
private readonly _moduleRegistry;
private _options;
private _tabGroupColorPalette;
private _shellThemeClassnames;
readonly overlayRenderContainer: OverlayRenderContainer;
readonly popupService: PopupService;
readonly rootDropTargetContainer: DropTargetAnchorContainer;
private readonly _onWillDragPanel;
readonly onWillDragPanel: Event<TabDragEvent>;
private readonly _onWillDragGroup;
readonly onWillDragGroup: Event<GroupDragEvent>;
private readonly _onDidDrop;
readonly onDidDrop: Event<DockviewDidDropEvent>;
private readonly _onWillDrop;
readonly onWillDrop: Event<DockviewWillDropEvent>;
private _mutationDepth;
private _origin;
private _originDepth;
private readonly _onWillMutateLayout;
readonly onWillMutateLayout: Event<DockviewLayoutMutationEvent>;
private readonly _onDidMutateLayout;
readonly onDidMutateLayout: Event<DockviewLayoutMutationEvent>;
private readonly _onWillShowOverlay;
readonly onWillShowOverlay: Event<DockviewWillShowOverlayLocationEvent>;
private readonly _onUnhandledDragOver;
readonly onUnhandledDragOver: Event<DockviewDndOverlayEvent>;
private readonly _onDidRemovePanel;
readonly onDidRemovePanel: Event<IDockviewPanel>;
private readonly _onDidAddPanel;
readonly onDidAddPanel: Event<IDockviewPanel>;
private readonly _onDidPopoutGroupSizeChange;
readonly onDidPopoutGroupSizeChange: Event<PopoutGroupChangeSizeEvent>;
private readonly _onDidPopoutGroupPositionChange;
readonly onDidPopoutGroupPositionChange: Event<PopoutGroupChangePositionEvent>;
private readonly _onDidAddPopoutGroup;
readonly onDidAddPopoutGroup: Event<PopoutGroup>;
private readonly _onDidRemovePopoutGroup;
readonly onDidRemovePopoutGroup: Event<PopoutGroup>;
private readonly _onDidOpenPopoutWindowFail;
readonly onDidOpenPopoutWindowFail: Event<void>;
private readonly _onDidLayoutFromJSON;
readonly onDidLayoutFromJSON: Event<void>;
private readonly _onDidActivePanelChange;
readonly onDidActivePanelChange: Event<DockviewActivePanelChangeEvent>;
private readonly _onDidMovePanel;
readonly onDidMovePanel: Event<MovePanelEvent>;
private readonly _onDidCreateTabGroup;
readonly onDidCreateTabGroup: Event<DockviewTabGroupChangeEvent>;
private readonly _onDidDestroyTabGroup;
readonly onDidDestroyTabGroup: Event<DockviewTabGroupChangeEvent>;
private readonly _onDidAddPanelToTabGroup;
readonly onDidAddPanelToTabGroup: Event<DockviewTabGroupPanelChangeEvent>;
private readonly _onDidRemovePanelFromTabGroup;
readonly onDidRemovePanelFromTabGroup: Event<DockviewTabGroupPanelChangeEvent>;
private readonly _onDidTabGroupChange;
readonly onDidTabGroupChange: Event<DockviewTabGroupChangeEvent>;
private readonly _onDidTabGroupCollapsedChange;
readonly onDidTabGroupCollapsedChange: Event<DockviewTabGroupCollapsedChangeEvent>;
fireDidCreateTabGroup(event: DockviewTabGroupChangeEvent): void;
fireDidDestroyTabGroup(event: DockviewTabGroupChangeEvent): void;
fireDidAddPanelToTabGroup(event: DockviewTabGroupPanelChangeEvent): void;
fireDidRemovePanelFromTabGroup(event: DockviewTabGroupPanelChangeEvent): void;
fireDidTabGroupChange(event: DockviewTabGroupChangeEvent): void;
fireDidTabGroupCollapsedChange(event: DockviewTabGroupCollapsedChangeEvent): void;
private readonly _onDidMaximizedGroupChange;
readonly onDidMaximizedGroupChange: Event<DockviewMaximizedGroupChangeEvent>;
private _shellManager;
private _floatingOverlayHost;
private _inShellLayout;
private readonly _onDidRemoveGroup;
readonly onDidRemoveGroup: Event<DockviewGroupPanel>;
protected readonly _onDidAddGroup: Emitter<DockviewGroupPanel>;
readonly onDidAddGroup: Event<DockviewGroupPanel>;
private readonly _onDidOptionsChange;
readonly onDidOptionsChange: Event<void>;
private readonly _onDidActiveGroupChange;
readonly onDidActiveGroupChange: Event<DockviewGroupPanel | undefined>;
get orientation(): Orientation;
get totalPanels(): number;
get panels(): IDockviewPanel[];
get options(): DockviewComponentOptions;
get tabGroupColorPalette(): TabGroupColorPalette;
get activePanel(): IDockviewPanel | undefined;
get renderer(): DockviewPanelRenderer;
get defaultHeaderPosition(): DockviewHeaderPosition;
get api(): DockviewApi;
get floatingGroups(): readonly DockviewFloatingGroupPanel[];
/**
* Boxes of the floating groups other than `exclude`, in coordinates
* relative to the floating overlay container. Supplied to a
* `transformFloatingGroupDrag` callback as `context.others` so it can
* align the dragged float against its siblings.
*/
private _gatherFloatingGroupBoxes;
private get _floatingGroupService();
private get _popoutWindowService();
private get _watermarkService();
private get _edgeGroupService();
private get _rootDropTargetService();
private get _advancedDnDService();
get headerActionsService(): import("./headerActionsService").IHeaderActionsService | undefined;
isGridEmpty(): boolean;
rootDropTargetOverrideTarget(): import("../dnd/droptarget").DropTargetTargetModel | undefined;
dispatchUnhandledDragOver(nativeEvent: DragEvent | PointerEvent, position: Position): boolean;
fireWillDragPanel(event: TabDragEvent): void;
fireWillDragGroup(event: GroupDragEvent): void;
fireWillDrop(event: DockviewWillDropEvent): void;
fireWillShowOverlay(event: DockviewWillShowOverlayLocationEvent): void;
/**
* Resolve the custom group drag ghost (via the AdvancedDnD module), or
* `undefined` to fall back to the default chip. Returns `undefined` when
* the module is absent — the default ghost then renders.
*/
buildGroupDragGhost(group: DockviewGroupPanel): IDragGhostSpec | undefined;
/**
* Resolve the app-supplied drop overlay model (via the AdvancedDnD module)
* for a group drop target, or `undefined` to keep the target's default.
*/
resolveDropOverlayModel(location: DockviewGroupDropLocation, group?: DockviewGroupPanel): DroptargetOverlayModel | undefined;
/** Outermost element — the shell (incl. edge groups) once built, else the gridview. */
get rootElement(): HTMLElement;
/**
* The next / previous group in gridview (spatial) order, wrapping round.
* The keyboard accessibility module's focus navigation is built on this
* primitive — the only piece that needs the grid internals; the rest of
* the navigation logic lives in the AccessibilityService.
*/
adjacentGroup(group: DockviewGroupPanel, reverse: boolean): DockviewGroupPanel | undefined;
/**
* The nearest grid group in a spatial direction from `group`, by
* comparing group centre points. Floating and popout groups sit outside
* the grid's geometry and are ignored. Returns `undefined` when there is
* no group in that direction.
*/
adjacentGroupInDirection(group: DockviewGroupPanel, direction: GroupNavigationDirection): DockviewGroupPanel | undefined;
showDropPreview(group: DockviewGroupPanel, position: Position): IDisposable;
announce(message: string): void;
dockPanel(panel: IDockviewPanel, group: DockviewGroupPanel, position: Position): void;
get contextMenuService(): IContextMenuService | undefined;
get mountElement(): HTMLElement;
hasVisibleGridGroup(): boolean;
fireLayoutChange(): void;
/**
* Promise that resolves when all popout groups from the last fromJSON call are restored.
* Useful for tests that need to wait for delayed popout creation.
*/
get popoutRestorationPromise(): Promise<void>;
constructor(container: HTMLElement, options: DockviewComponentOptions);
setVisible(panel: DockviewGroupPanel, visible: boolean): void;
/**
* Returns the {@link PopupService} that should host popovers (context
* menus, tab overflow menus) for the given group. Popout groups have their
* own service rooted in their popout window so the popover renders there
* and dismisses on events from that window.
*/
getPopupServiceForGroup(group: DockviewGroupPanel): PopupService;
addPopoutGroup(itemToPopout: DockviewPanel | DockviewGroupPanel, options?: DockviewPopoutGroupOptionsInternal): Promise<boolean>;
/** Enumerate the popout groups currently open in their own windows. */
getPopouts(): PopoutGroup[];
private _doAddPopoutGroup;
/**
* The popout window was blocked (e.g. by the browser's popup blocker —
* common when restoring popouts on load). Fall back gracefully so the
* group(s) end up valid and visible in the main grid rather than as
* orphans that later crash clear()/remove().
*/
private handleBlockedPopout;
/**
* Wire a group that has been displaced from a floating / popout window back
* to the main grid's render & drop-target containers and dock it at the
* root. The caller is responsible for first detaching it from its old
* gridview — the detach strategy differs between the window-teardown path
* (`doRemoveGroup`) and the blocked-window path (`gridview.remove`).
*/
private redockGroupToMainGrid;
/**
* Teardown for a popout window's `popoutWindowDisposable`. Runs when the
* window closes (by user, by `removeGroup`, or by component disposal):
* relocates every member group back to the main grid (or to a floating
* window when the anchor came from one), then disposes the nested gridview.
* `closeResult.returnedGroup` is read by the entry's `dispose()` contract.
*/
private disposePopoutWindow;
addFloatingGroup(item: DockviewPanel | DockviewGroupPanel, options?: FloatingGroupOptionsInternal): void;
private _doAddFloatingGroup;
/**
* Build an empty gridview configured to match the main grid's styling, for
* hosting a nested layout inside a floating or popout window.
*/
private createNestedGridview;
/**
* Wrap a (populated) floating gridview in an overlay window: title bar /
* move handle, drag wiring, the floating-group service entry and the
* `floating` location tag for every member group.
*/
private mountFloatingWindow;
private orthogonalize;
updateOptions(options: Partial<DockviewComponentOptions>): void;
layout(width: number, height: number, forceResize?: boolean | undefined): void;
private _syncFloatingOverlayHost;
private _layoutFromShell;
protected forceRelayout(): void;
addEdgeGroup(position: EdgeGroupPosition, options: EdgeGroupOptions): DockviewGroupPanelApi;
getEdgeGroup(position: EdgeGroupPosition): DockviewGroupPanelApi | undefined;
setEdgeGroupVisible(position: EdgeGroupPosition, visible: boolean): void;
isEdgeGroupVisible(position: EdgeGroupPosition): boolean;
removeEdgeGroup(position: EdgeGroupPosition): void;
setEdgeGroupCollapsed(group: DockviewGroupPanel, collapsed: boolean): void;
isEdgeGroupCollapsed(group: DockviewGroupPanel): boolean;
private updateDragAndDropState;
focus(): void;
getGroupPanel(id: string): IDockviewPanel | undefined;
setActivePanel(panel: IDockviewPanel): void;
moveToNext(options?: MovementOptions): void;
moveToPrevious(options?: MovementOptions): void;
/**
* Serialize the current state of the layout
*
* @returns A JSON respresentation of the layout
*/
toJSON(): SerializedDockview;
fromJSON(data: SerializedDockview, options?: {
reuseExistingPanels: boolean;
}): void;
private _doFromJSON;
/**
* Rebuild a floating / popout window's nested gridview from its serialized
* tree, collecting the member groups (in deserialization order) so the
* caller can mount or restore the window.
*/
private deserializeNestedGridview;
private deserializeEdgeGroups;
private deserializeFloatingWindows;
private deserializePopoutWindows;
clear(): void;
private _doClear;
closeAllGroups(): void;
addPanel<T extends object = Parameters>(options: AddPanelOptions<T>): DockviewPanel;
private _doAddPanel;
removePanel(panel: IDockviewPanel, options?: {
removeEmptyGroup: boolean;
skipDispose?: boolean;
skipSetActiveGroup?: boolean;
}): void;
private _doRemovePanel;
createWatermarkComponent(): IWatermarkRenderer;
addGroup(options?: AddGroupOptions): DockviewGroupPanel;
private _doAddGroup;
private getLocationOrientation;
removeGroup(group: DockviewGroupPanel, options?: {
skipActive?: boolean;
skipDispose?: boolean;
skipPopoutAssociated?: boolean;
skipPopoutReturn?: boolean;
} | undefined): void;
/**
* Detach a single group from the nested gridview of its floating / popout
* window, keeping the window and its remaining members alive, and reassign
* the window's anchor if the detached group was it.
*
* @returns `true` if the group was detached from a multi-member window;
* `false` if `group` is not in a nested window, or is the window's only
* member — in which case the caller is responsible for disposing the whole
* window.
*/
private detachFromNestedWindow;
/**
* Dispose a group and forget it: remove it from `_groups` and fire the
* removed event.
*/
private disposeGroupRecord;
/**
* When `removed` was the active group, fall the active selection back to
* the first remaining group (or clear it when none remain).
*/
private activateFallbackGroupIfRemoved;
protected doRemoveGroup(group: DockviewGroupPanel, options?: {
skipActive?: boolean;
skipDispose?: boolean;
skipPopoutAssociated?: boolean;
skipPopoutReturn?: boolean;
} | undefined): DockviewGroupPanel;
private _moving;
private _updatePositionsFrameId;
private debouncedUpdateAllPositions;
movingLock<T>(func: () => T): T;
/**
* Bracket a structural mutation with `onWillMutateLayout` /
* `onDidMutateLayout`. Re-entrant: nested calls (a compound operation such
* as a drag that relocates a panel) join the outermost transaction, so the
* events fire exactly once around the whole operation. `kind` reflects the
* outermost mutation.
*/
mutation<T>(kind: DockviewLayoutMutationKind, func: () => T): T;
/**
* The origin of the operation currently in progress (`'user'` by default).
* Read inside a `mutation()` or active-panel change to learn whether the
* change was driven by application code (via the {@link DockviewApi}) or a
* user gesture.
*/
currentOrigin(): DockviewOrigin;
/**
* Run `func` with the operation origin set to `origin`, restoring the
* previous value afterwards. Used by the DockviewApi boundary to tag
* programmatic operations as `'api'`, and by user-gesture handlers to tag
* `'user'`. Only the outermost caller sets the origin — a nested call (or a
* call made while a mutation is already in flight) keeps whatever the
* enclosing operation established, so the trigger always wins.
*/
withOrigin<T>(origin: DockviewOrigin, func: () => T): T;
/**
* Fire `onDidActivePanelChange` with the panel and the current operation
* {@link DockviewOrigin}. Callers keep their own dedupe guards.
*/
private fireActivePanelChange;
moveGroupOrPanel(options: MoveGroupOrPanelOptions): void;
private _doMoveGroupOrPanel;
private moveTabGroupToGroup;
moveGroup(options: MoveGroupOptions): void;
maximizeGroup(panel: DockviewGroupPanel): void;
exitMaximizedGroup(): void;
private _doMoveGroup;
doSetGroupActive(group: DockviewGroupPanel | undefined): void;
doSetGroupAndPanelActive(group: DockviewGroupPanel | undefined): void;
private getNextGroupId;
createGroup(options?: GroupOptions): DockviewGroupPanel;
private createPanel;
private createGroupAtLocation;
/**
* Tag a group with the location and render / drop-target containers
* matching the gridview root it now lives in: the main grid, a floating
* window (shares the main containers), or a popout window (uses its own
* window-local containers).
*/
private setGroupLocationForRoot;
/**
* Resolve which gridview root currently owns a group: the main grid, or
* the nested gridview of the floating / popout window it lives in.
*/
getGridviewForGroup(group: DockviewGroupPanel): Gridview;
/**
* The groups that live within the same floating / popout window as `group`
* (including `group` itself). Empty when `group` is in the main grid.
*/
private nestedWindowMembers;
private findGroup;
private orientationAtLocation;
private updateTheme;
}
export {};