@oscarpalmer/atoms 0.7.0 → 0.7.1
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/dist/js/atoms.js +2 -2
- package/package.json +1 -1
- package/src/js/element.ts +5 -3
- package/types/element.d.ts +2 -2
package/dist/js/atoms.js
CHANGED
|
@@ -18,10 +18,10 @@ function findParentElement(origin, selector) {
|
|
|
18
18
|
}
|
|
19
19
|
return parent ?? undefined;
|
|
20
20
|
}
|
|
21
|
-
function getElementUnderPointer(
|
|
21
|
+
function getElementUnderPointer(skipIgnore) {
|
|
22
22
|
const elements = Array.from(document.querySelectorAll(":hover")).filter((element) => {
|
|
23
23
|
const style = window.getComputedStyle(element);
|
|
24
|
-
return element.tagName !== "HEAD" && (typeof
|
|
24
|
+
return element.tagName !== "HEAD" && (typeof skipIgnore === "boolean" && skipIgnore ? true : style.pointerEvents !== "none" && style.visibility !== "hidden");
|
|
25
25
|
});
|
|
26
26
|
return elements[elements.length - 1];
|
|
27
27
|
}
|
package/package.json
CHANGED
package/src/js/element.ts
CHANGED
|
@@ -38,16 +38,18 @@ export function findParentElement(
|
|
|
38
38
|
/**
|
|
39
39
|
* - Get the most specific element under the pointer
|
|
40
40
|
* - Ignores elements with `pointer-events: none` and `visibility: hidden`
|
|
41
|
-
* - If `
|
|
41
|
+
* - If `skipIgnore` is `true`, no elements are ignored
|
|
42
42
|
*/
|
|
43
|
-
export function getElementUnderPointer(
|
|
43
|
+
export function getElementUnderPointer(
|
|
44
|
+
skipIgnore?: boolean,
|
|
45
|
+
): Element | undefined {
|
|
44
46
|
const elements = Array.from(document.querySelectorAll(':hover')).filter(
|
|
45
47
|
element => {
|
|
46
48
|
const style = window.getComputedStyle(element);
|
|
47
49
|
|
|
48
50
|
return (
|
|
49
51
|
element.tagName !== 'HEAD' &&
|
|
50
|
-
(typeof
|
|
52
|
+
(typeof skipIgnore === 'boolean' && skipIgnore
|
|
51
53
|
? true
|
|
52
54
|
: style.pointerEvents !== 'none' && style.visibility !== 'hidden')
|
|
53
55
|
);
|
package/types/element.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export declare function findParentElement(origin: Element, selector: string | ((
|
|
|
6
6
|
/**
|
|
7
7
|
* - Get the most specific element under the pointer
|
|
8
8
|
* - Ignores elements with `pointer-events: none` and `visibility: hidden`
|
|
9
|
-
* - If `
|
|
9
|
+
* - If `skipIgnore` is `true`, no elements are ignored
|
|
10
10
|
*/
|
|
11
|
-
export declare function getElementUnderPointer(
|
|
11
|
+
export declare function getElementUnderPointer(skipIgnore?: boolean): Element | undefined;
|