UNPKG

2 kBTypeScriptView Raw
1import { Cell } from './widget';
2import * as nbformat from '@jupyterlab/nbformat';
3export declare namespace CellDragUtils {
4 type ICellTargetArea = 'input' | 'prompt' | 'cell' | 'unknown';
5 /**
6 * Find the cell index containing the target html element.
7 * This function traces up the DOM hierarchy to find the root cell
8 * node. Then find the corresponding child and select it.
9 *
10 * @param node - the cell node or a child of the cell node.
11 * @param cells - an iterable of Cells
12 * @param isCellNode - a function that takes in a node and checks if
13 * it is a cell node.
14 *
15 * @returns index of the cell we're looking for. Returns -1 if
16 * the cell is not founds
17 */
18 function findCell(node: HTMLElement, cells: Iterable<Cell>, isCellNode: (node: HTMLElement) => boolean): number;
19 /**
20 * Detect which part of the cell triggered the MouseEvent
21 *
22 * @param cell - The cell which contains the MouseEvent's target
23 * @param target - The DOM node which triggered the MouseEvent
24 */
25 function detectTargetArea(cell: Cell, target: HTMLElement): ICellTargetArea;
26 /**
27 * Detect if a drag event should be started. This is down if the
28 * mouse is moved beyond a certain distance (DRAG_THRESHOLD).
29 *
30 * @param prevX - X Coordinate of the mouse pointer during the mousedown event
31 * @param prevY - Y Coordinate of the mouse pointer during the mousedown event
32 * @param nextX - Current X Coordinate of the mouse pointer
33 * @param nextY - Current Y Coordinate of the mouse pointer
34 */
35 function shouldStartDrag(prevX: number, prevY: number, nextX: number, nextY: number): boolean;
36 /**
37 * Create an image for the cell(s) to be dragged
38 *
39 * @param activeCell - The cell from where the drag event is triggered
40 * @param selectedCells - The cells to be dragged
41 */
42 function createCellDragImage(activeCell: Cell, selectedCells: nbformat.ICell[]): HTMLElement;
43}