UNPKG

1.31 kBTypeScriptView Raw
1import { EventGroup } from './EventGroup';
2/**
3 * Placing this attribute on scrollable divs optimizes detection to know
4 * if the div is scrollable or not (given we can avoid expensive operations
5 * like getComputedStyle.)
6 *
7 * @public
8 */
9export declare const DATA_IS_SCROLLABLE_ATTRIBUTE = "data-is-scrollable";
10/**
11 * Allows the user to scroll within a element,
12 * while preventing the user from scrolling the body
13 */
14export declare const allowScrollOnElement: (element: HTMLElement | null, events: EventGroup) => void;
15/**
16 * Same as allowScrollOnElement but does not prevent overscrolling.
17 */
18export declare const allowOverscrollOnElement: (element: HTMLElement | null, events: EventGroup) => void;
19/**
20 * Disables the body scrolling.
21 *
22 * @public
23 */
24export declare function disableBodyScroll(): void;
25/**
26 * Enables the body scrolling.
27 *
28 * @public
29 */
30export declare function enableBodyScroll(): void;
31/**
32 * Calculates the width of a scrollbar for the browser/os.
33 *
34 * @public
35 */
36export declare function getScrollbarWidth(): number;
37/**
38 * Traverses up the DOM for the element with the data-is-scrollable=true attribute, or returns
39 * document.body.
40 *
41 * @public
42 */
43export declare function findScrollableParent(startingElement: HTMLElement | null): HTMLElement | Window | undefined | null;