UNPKG

2.01 kBTypeScriptView Raw
1import { SplitPanel, Widget } from '@phosphor/widgets';
2export interface SplitPositionOptions {
3 /** The side of the side panel that shall be resized. */
4 side?: 'left' | 'right' | 'top' | 'bottom';
5 /** The duration in milliseconds, or 0 for no animation. */
6 duration: number;
7 /** When this widget is hidden, the animation is canceled. */
8 referenceWidget?: Widget;
9}
10export interface MoveEntry extends SplitPositionOptions {
11 parent: SplitPanel;
12 index: number;
13 started: boolean;
14 ended: boolean;
15 targetSize?: number;
16 targetPosition?: number;
17 startPosition?: number;
18 startTime?: number;
19 resolve?: (position: number) => void;
20 reject?: (reason: string) => void;
21}
22export declare class SplitPositionHandler {
23 private readonly splitMoves;
24 private currentMoveIndex;
25 /**
26 * Set the position of a split handle asynchronously. This function makes sure that such movements
27 * are performed one after another in order to prevent the movements from overriding each other.
28 * When resolved, the returned promise yields the final position of the split handle.
29 */
30 setSplitHandlePosition(parent: SplitPanel, index: number, targetPosition: number, options: SplitPositionOptions): Promise<number>;
31 /**
32 * Resize a side panel asynchronously. This function makes sure that such movements are performed
33 * one after another in order to prevent the movements from overriding each other.
34 * When resolved, the returned promise yields the final position of the split handle.
35 */
36 setSidePanelSize(sidePanel: Widget, targetSize: number, options: SplitPositionOptions): Promise<number>;
37 protected moveSplitPos(move: MoveEntry): Promise<number>;
38 protected animationFrame(time: number): void;
39 protected startMove(move: MoveEntry, time: number): void;
40 protected endMove(move: MoveEntry): void;
41 protected getCurrentPosition(move: MoveEntry): number | undefined;
42}
43//# sourceMappingURL=split-panels.d.ts.map
\No newline at end of file