UNPKG

3.32 kBTypeScriptView Raw
1/**
2 * The namespace for element related utilities.
3 */
4export declare namespace ElementExt {
5 /**
6 * An object which holds the border and padding data for an element.
7 */
8 interface IBoxSizing {
9 /**
10 * The top border width, in pixels.
11 */
12 borderTop: number;
13 /**
14 * The left border width, in pixels.
15 */
16 borderLeft: number;
17 /**
18 * The right border width, in pixels.
19 */
20 borderRight: number;
21 /**
22 * The bottom border width, in pixels.
23 */
24 borderBottom: number;
25 /**
26 * The top padding width, in pixels.
27 */
28 paddingTop: number;
29 /**
30 * The left padding width, in pixels.
31 */
32 paddingLeft: number;
33 /**
34 * The right padding width, in pixels.
35 */
36 paddingRight: number;
37 /**
38 * The bottom padding width, in pixels.
39 */
40 paddingBottom: number;
41 /**
42 * The sum of horizontal border and padding.
43 */
44 horizontalSum: number;
45 /**
46 * The sum of vertical border and padding.
47 */
48 verticalSum: number;
49 }
50 /**
51 * Compute the box sizing for an element.
52 *
53 * @param element - The element of interest.
54 *
55 * @returns The box sizing data for the specified element.
56 */
57 function boxSizing(element: Element): IBoxSizing;
58 /**
59 * An object which holds the min and max size data for an element.
60 */
61 interface ISizeLimits {
62 /**
63 * The minimum width, in pixels.
64 */
65 minWidth: number;
66 /**
67 * The minimum height, in pixels.
68 */
69 minHeight: number;
70 /**
71 * The maximum width, in pixels.
72 */
73 maxWidth: number;
74 /**
75 * The maximum height, in pixels.
76 */
77 maxHeight: number;
78 }
79 /**
80 * Compute the size limits for an element.
81 *
82 * @param element - The element of interest.
83 *
84 * @returns The size limit data for the specified element.
85 */
86 function sizeLimits(element: Element): ISizeLimits;
87 /**
88 * Test whether a client position lies within an element.
89 *
90 * @param element - The DOM element of interest.
91 *
92 * @param clientX - The client X coordinate of interest.
93 *
94 * @param clientY - The client Y coordinate of interest.
95 *
96 * @returns Whether the point is within the given element.
97 */
98 function hitTest(element: Element, clientX: number, clientY: number): boolean;
99 /**
100 * Vertically scroll an element into view if needed.
101 *
102 * @param area - The scroll area element.
103 *
104 * @param element - The element of interest.
105 *
106 * #### Notes
107 * This follows the "nearest" behavior of the native `scrollIntoView`
108 * method, which is not supported by all browsers.
109 * https://drafts.csswg.org/cssom-view/#element-scrolling-members
110 *
111 * If the element fully covers the visible area or is fully contained
112 * within the visible area, no scrolling will take place. Otherwise,
113 * the nearest edges of the area and element are aligned.
114 */
115 function scrollIntoViewIfNeeded(area: Element, element: Element): void;
116}