dockview-core
Version:
Zero dependency layout manager supporting tabs, groups, grids and splitviews for vanilla TypeScript
72 lines (71 loc) • 3.34 kB
TypeScript
import { IValueDisposable } from '../../../lifecycle';
import { DockviewHeaderDirection } from '../../options';
import { Tab } from '../tab/tab';
import { ITabGroup } from '../../tabGroup';
import { TabGroupColorPalette } from '../../tabGroupAccent';
export interface TabGroupIndicatorContext {
readonly tabsList: HTMLElement;
getTabGroups(): readonly ITabGroup[];
getActivePanelId(): string | undefined;
getTabMap(): Map<string, IValueDisposable<Tab>>;
getChipElement(groupId: string): HTMLElement | undefined;
getDirection(): DockviewHeaderDirection;
getColorPalette(): TabGroupColorPalette | undefined;
}
export interface ITabGroupIndicator {
readonly underlines: ReadonlyMap<string, HTMLElement>;
positionUnderlines(): void;
trackUnderlines(): void;
syncUnderlineElements(activeGroupIds: Set<string>): void;
getUnderline(groupId: string): HTMLElement | undefined;
dispose(): void;
}
/**
* Shared positioning logic for tab group indicators.
* Subclasses implement `applyShape` to control the visual output.
*/
declare abstract class BaseTabGroupIndicator implements ITabGroupIndicator {
protected readonly _ctx: TabGroupIndicatorContext;
protected readonly _underlines: Map<string, HTMLElement>;
private _rafId;
get underlines(): ReadonlyMap<string, HTMLElement>;
constructor(_ctx: TabGroupIndicatorContext);
positionUnderlines(): void;
/**
* Continuously reposition underlines every frame for the duration
* of a tab transition (~200ms), so the underline tracks tab sizes.
*/
trackUnderlines(): void;
syncUnderlineElements(activeGroupIds: Set<string>): void;
getUnderline(groupId: string): HTMLElement | undefined;
dispose(): void;
/**
* Apply the visual shape to the underline element.
* Called once per tab group per frame with the computed geometry.
*/
protected abstract applyShape(underline: HTMLElement, tg: ITabGroup, startEdge: number, span: number, containerCrossSize: number, activePanelId: string | undefined, containerRect: DOMRect, isVertical: boolean): void;
private _positionUnderlinesSync;
}
/**
* Chrome-style wrap-around indicator using SVG paths.
*/
export declare class WrapTabGroupIndicator extends BaseTabGroupIndicator {
private _applyStraightLine;
/**
* Chrome-style wrap-around underline: a stroked SVG path that runs
* along the bottom (or left edge in vertical mode), curving up and
* over the active tab with rounded corners.
*
* The SVG and path elements are created once per underline and reused;
* only the `d`, `stroke`, and viewport attributes are updated each frame.
*/
protected applyShape(underline: HTMLElement, tg: ITabGroup, groupStart: number, groupSpan: number, containerCrossSize: number, activePanelId: string | undefined, containerRect: DOMRect, isVertical: boolean): void;
}
/**
* Flat continuous bar indicator — no wrap-around, just a colored line
* spanning the full tab group width.
*/
export declare class NoneTabGroupIndicator extends BaseTabGroupIndicator {
protected applyShape(underline: HTMLElement, tg: ITabGroup, _startEdge: number, span: number, _containerCrossSize: number, _activePanelId: string | undefined, _containerRect: DOMRect, isVertical: boolean): void;
}
export {};