@ethlete/core 4.19.2 → 4.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -6
- package/esm2022/lib/utils/scrollable.utils.mjs +16 -19
- package/esm2022/lib/utils/signal.utils.mjs +14 -16
- package/fesm2022/ethlete-core.mjs +29 -34
- package/fesm2022/ethlete-core.mjs.map +1 -1
- package/lib/utils/scrollable.utils.d.ts +13 -12
- package/lib/utils/signal.utils.d.ts +1 -1
- package/package.json +1 -1
|
@@ -14,6 +14,11 @@ export interface IsElementVisibleOptions {
|
|
|
14
14
|
* @default container.getBoundingClientRect()
|
|
15
15
|
*/
|
|
16
16
|
containerRect?: DOMRect | null;
|
|
17
|
+
/**
|
|
18
|
+
* The element's rect. Can be supplied to reduce the amount of DOM reads.
|
|
19
|
+
* @default container.getBoundingClientRect()
|
|
20
|
+
*/
|
|
21
|
+
elementRect?: DOMRect | null;
|
|
17
22
|
}
|
|
18
23
|
export interface CurrentElementVisibility {
|
|
19
24
|
/**
|
|
@@ -32,6 +37,14 @@ export interface CurrentElementVisibility {
|
|
|
32
37
|
* The percentage of the element that is visible in the block direction.
|
|
33
38
|
*/
|
|
34
39
|
blockIntersection: number;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the element is intersecting the container.
|
|
42
|
+
*/
|
|
43
|
+
isIntersecting: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The ratio of the element that is intersecting the container.
|
|
46
|
+
*/
|
|
47
|
+
intersectionRatio: number;
|
|
35
48
|
/**
|
|
36
49
|
* The element that is being checked for visibility.
|
|
37
50
|
*/
|
|
@@ -76,15 +89,3 @@ export interface ScrollToElementOptions {
|
|
|
76
89
|
scrollBlockMargin?: number;
|
|
77
90
|
}
|
|
78
91
|
export declare const scrollToElement: (options: ScrollToElementOptions) => void;
|
|
79
|
-
export interface GetVisibleElementsOptions {
|
|
80
|
-
/**
|
|
81
|
-
* The container to check for visible elements.
|
|
82
|
-
* @default document.documentElement
|
|
83
|
-
*/
|
|
84
|
-
container?: HTMLElement | null;
|
|
85
|
-
/**
|
|
86
|
-
* The elements to check if they are visible inside a container.
|
|
87
|
-
*/
|
|
88
|
-
elements: HTMLElement[];
|
|
89
|
-
}
|
|
90
|
-
export declare const getElementVisibleStates: (options: GetVisibleElementsOptions) => CurrentElementVisibility[];
|
|
@@ -91,7 +91,7 @@ export type ElementSize = {
|
|
|
91
91
|
export declare const boundingClientRectToElementRect: (rect: DOMRectReadOnly) => ElementRect;
|
|
92
92
|
export declare const createElementDimensions: (el: HTMLElement | null, rect?: DOMRect) => NullableElementDimensions;
|
|
93
93
|
export type ElementDimensions = {
|
|
94
|
-
rect: ElementRect;
|
|
94
|
+
rect: () => ElementRect;
|
|
95
95
|
client: ElementSize;
|
|
96
96
|
scroll: ElementSize;
|
|
97
97
|
offset: ElementSize;
|