@bitfiber/utils 1.0.0
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/CODE_OF_CONDUCT.md +127 -0
- package/CONTRIBUTING.md +87 -0
- package/LICENSE.txt +201 -0
- package/README.md +2516 -0
- package/arr/at/at.d.ts +7 -0
- package/arr/at/at.js +11 -0
- package/arr/at/at.js.map +1 -0
- package/arr/cnd/cnd.d.ts +55 -0
- package/arr/cnd/cnd.js +136 -0
- package/arr/cnd/cnd.js.map +1 -0
- package/arr/diff-arr/diff-arr.d.ts +10 -0
- package/arr/diff-arr/diff-arr.js +37 -0
- package/arr/diff-arr/diff-arr.js.map +1 -0
- package/arr/fill/fill.d.ts +8 -0
- package/arr/fill/fill.js +11 -0
- package/arr/fill/fill.js.map +1 -0
- package/arr/for-each-arr/for-each-arr.d.ts +9 -0
- package/arr/for-each-arr/for-each-arr.js +25 -0
- package/arr/for-each-arr/for-each-arr.js.map +1 -0
- package/arr/index-by/index-by.d.ts +9 -0
- package/arr/index-by/index-by.js +19 -0
- package/arr/index-by/index-by.js.map +1 -0
- package/arr/index.d.ts +9 -0
- package/arr/index.js +10 -0
- package/arr/index.js.map +1 -0
- package/arr/pluck/pluck.d.ts +7 -0
- package/arr/pluck/pluck.js +13 -0
- package/arr/pluck/pluck.js.map +1 -0
- package/arr/types.d.ts +84 -0
- package/arr/types.js +2 -0
- package/arr/types.js.map +1 -0
- package/arr/within/within.d.ts +9 -0
- package/arr/within/within.js +14 -0
- package/arr/within/within.js.map +1 -0
- package/common/copy/copy.d.ts +6 -0
- package/common/copy/copy.js +86 -0
- package/common/copy/copy.js.map +1 -0
- package/common/equals/equals.d.ts +12 -0
- package/common/equals/equals.js +127 -0
- package/common/equals/equals.js.map +1 -0
- package/common/error.d.ts +19 -0
- package/common/error.js +16 -0
- package/common/error.js.map +1 -0
- package/common/for-each/for-each.d.ts +9 -0
- package/common/for-each/for-each.js +40 -0
- package/common/for-each/for-each.js.map +1 -0
- package/common/get-unique-num-id/get-unique-num-id.d.ts +4 -0
- package/common/get-unique-num-id/get-unique-num-id.js +8 -0
- package/common/get-unique-num-id/get-unique-num-id.js.map +1 -0
- package/common/get-unique-str-id/get-unique-str-id.d.ts +4 -0
- package/common/get-unique-str-id/get-unique-str-id.js +16 -0
- package/common/get-unique-str-id/get-unique-str-id.js.map +1 -0
- package/common/has-iterator/has-iterator.d.ts +5 -0
- package/common/has-iterator/has-iterator.js +8 -0
- package/common/has-iterator/has-iterator.js.map +1 -0
- package/common/index.d.ts +16 -0
- package/common/index.js +17 -0
- package/common/index.js.map +1 -0
- package/common/is/is.d.ts +136 -0
- package/common/is/is.js +214 -0
- package/common/is/is.js.map +1 -0
- package/common/is-empty/is-empty.d.ts +6 -0
- package/common/is-empty/is-empty.js +30 -0
- package/common/is-empty/is-empty.js.map +1 -0
- package/common/random/random.d.ts +5 -0
- package/common/random/random.js +9 -0
- package/common/random/random.js.map +1 -0
- package/common/same/same.d.ts +6 -0
- package/common/same/same.js +9 -0
- package/common/same/same.js.map +1 -0
- package/common/stub/stub.d.ts +4 -0
- package/common/stub/stub.js +8 -0
- package/common/stub/stub.js.map +1 -0
- package/common/to-float/to-float.d.ts +6 -0
- package/common/to-float/to-float.js +10 -0
- package/common/to-float/to-float.js.map +1 -0
- package/common/to-int/to-int.d.ts +6 -0
- package/common/to-int/to-int.js +10 -0
- package/common/to-int/to-int.js.map +1 -0
- package/common/to-sorted-string/to-sorted-string.d.ts +7 -0
- package/common/to-sorted-string/to-sorted-string.js +53 -0
- package/common/to-sorted-string/to-sorted-string.js.map +1 -0
- package/common/types.d.ts +63 -0
- package/common/types.js +5 -0
- package/common/types.js.map +1 -0
- package/dom/closest/closest.d.ts +6 -0
- package/dom/closest/closest.js +26 -0
- package/dom/closest/closest.js.map +1 -0
- package/dom/document/document.d.ts +12 -0
- package/dom/document/document.js +24 -0
- package/dom/document/document.js.map +1 -0
- package/dom/download-file/download-file.d.ts +6 -0
- package/dom/download-file/download-file.js +32 -0
- package/dom/download-file/download-file.js.map +1 -0
- package/dom/for-each-elements/for-each-elements.d.ts +8 -0
- package/dom/for-each-elements/for-each-elements.js +16 -0
- package/dom/for-each-elements/for-each-elements.js.map +1 -0
- package/dom/for-each-nodes/for-each-nodes.d.ts +7 -0
- package/dom/for-each-nodes/for-each-nodes.js +15 -0
- package/dom/for-each-nodes/for-each-nodes.js.map +1 -0
- package/dom/get-all-styles/get-all-styles.d.ts +5 -0
- package/dom/get-all-styles/get-all-styles.js +10 -0
- package/dom/get-all-styles/get-all-styles.js.map +1 -0
- package/dom/get-body/get-body.d.ts +4 -0
- package/dom/get-body/get-body.js +9 -0
- package/dom/get-body/get-body.js.map +1 -0
- package/dom/get-html/get-html.d.ts +4 -0
- package/dom/get-html/get-html.js +9 -0
- package/dom/get-html/get-html.js.map +1 -0
- package/dom/get-non-static-parent/get-non-static-parent.d.ts +5 -0
- package/dom/get-non-static-parent/get-non-static-parent.js +9 -0
- package/dom/get-non-static-parent/get-non-static-parent.js.map +1 -0
- package/dom/get-offset-from-doc/get-offset-from-doc.d.ts +6 -0
- package/dom/get-offset-from-doc/get-offset-from-doc.js +18 -0
- package/dom/get-offset-from-doc/get-offset-from-doc.js.map +1 -0
- package/dom/get-offset-from-parent/get-offset-from-parent.d.ts +7 -0
- package/dom/get-offset-from-parent/get-offset-from-parent.js +45 -0
- package/dom/get-offset-from-parent/get-offset-from-parent.js.map +1 -0
- package/dom/get-offset-from-win/get-offset-from-win.d.ts +6 -0
- package/dom/get-offset-from-win/get-offset-from-win.js +8 -0
- package/dom/get-offset-from-win/get-offset-from-win.js.map +1 -0
- package/dom/get-scroll-width/get-scroll-width.d.ts +8 -0
- package/dom/get-scroll-width/get-scroll-width.js +28 -0
- package/dom/get-scroll-width/get-scroll-width.js.map +1 -0
- package/dom/get-style/get-style.d.ts +6 -0
- package/dom/get-style/get-style.js +23 -0
- package/dom/get-style/get-style.js.map +1 -0
- package/dom/get-styles/get-styles.d.ts +9 -0
- package/dom/get-styles/get-styles.js +12 -0
- package/dom/get-styles/get-styles.js.map +1 -0
- package/dom/get-valid-style-name/get-valid-style-name.d.ts +6 -0
- package/dom/get-valid-style-name/get-valid-style-name.js +41 -0
- package/dom/get-valid-style-name/get-valid-style-name.js.map +1 -0
- package/dom/get-window/get-window.d.ts +4 -0
- package/dom/get-window/get-window.js +17 -0
- package/dom/get-window/get-window.js.map +1 -0
- package/dom/has-name/has-name.d.ts +6 -0
- package/dom/has-name/has-name.js +9 -0
- package/dom/has-name/has-name.js.map +1 -0
- package/dom/index.d.ts +25 -0
- package/dom/index.js +26 -0
- package/dom/index.js.map +1 -0
- package/dom/is-comment/is-comment.d.ts +5 -0
- package/dom/is-comment/is-comment.js +8 -0
- package/dom/is-comment/is-comment.js.map +1 -0
- package/dom/is-element/is-element.d.ts +5 -0
- package/dom/is-element/is-element.js +8 -0
- package/dom/is-element/is-element.js.map +1 -0
- package/dom/is-text/is-text.d.ts +5 -0
- package/dom/is-text/is-text.js +8 -0
- package/dom/is-text/is-text.js.map +1 -0
- package/dom/set-offset-from-parent/set-offset-from-parent.d.ts +8 -0
- package/dom/set-offset-from-parent/set-offset-from-parent.js +42 -0
- package/dom/set-offset-from-parent/set-offset-from-parent.js.map +1 -0
- package/dom/set-style/set-style.d.ts +8 -0
- package/dom/set-style/set-style.js +14 -0
- package/dom/set-style/set-style.js.map +1 -0
- package/dom/set-styles/set-styles.d.ts +8 -0
- package/dom/set-styles/set-styles.js +16 -0
- package/dom/set-styles/set-styles.js.map +1 -0
- package/dom/types.d.ts +19 -0
- package/dom/types.js +2 -0
- package/dom/types.js.map +1 -0
- package/env/get-browser/get-browser.d.ts +10 -0
- package/env/get-browser/get-browser.js +33 -0
- package/env/get-browser/get-browser.js.map +1 -0
- package/env/get-engine/get-engine.d.ts +7 -0
- package/env/get-engine/get-engine.js +22 -0
- package/env/get-engine/get-engine.js.map +1 -0
- package/env/get-os/get-os.d.ts +8 -0
- package/env/get-os/get-os.js +26 -0
- package/env/get-os/get-os.js.map +1 -0
- package/env/get-platform/get-platform.d.ts +7 -0
- package/env/get-platform/get-platform.js +30 -0
- package/env/get-platform/get-platform.js.map +1 -0
- package/env/index.d.ts +21 -0
- package/env/index.js +22 -0
- package/env/index.js.map +1 -0
- package/env/is-browser/is-browser.d.ts +11 -0
- package/env/is-browser/is-browser.js +15 -0
- package/env/is-browser/is-browser.js.map +1 -0
- package/env/is-chrome-like/is-chrome-like.d.ts +4 -0
- package/env/is-chrome-like/is-chrome-like.js +9 -0
- package/env/is-chrome-like/is-chrome-like.js.map +1 -0
- package/env/is-desktop/is-desktop.d.ts +4 -0
- package/env/is-desktop/is-desktop.js +9 -0
- package/env/is-desktop/is-desktop.js.map +1 -0
- package/env/is-engine/is-engine.d.ts +8 -0
- package/env/is-engine/is-engine.js +12 -0
- package/env/is-engine/is-engine.js.map +1 -0
- package/env/is-firefox-like/is-firefox-like.d.ts +4 -0
- package/env/is-firefox-like/is-firefox-like.js +9 -0
- package/env/is-firefox-like/is-firefox-like.js.map +1 -0
- package/env/is-mobile/is-mobile.d.ts +4 -0
- package/env/is-mobile/is-mobile.js +9 -0
- package/env/is-mobile/is-mobile.js.map +1 -0
- package/env/is-os/is-os.d.ts +9 -0
- package/env/is-os/is-os.js +13 -0
- package/env/is-os/is-os.js.map +1 -0
- package/env/is-portable/is-portable.d.ts +4 -0
- package/env/is-portable/is-portable.js +8 -0
- package/env/is-portable/is-portable.js.map +1 -0
- package/env/is-safari-like/is-safari-like.d.ts +4 -0
- package/env/is-safari-like/is-safari-like.js +9 -0
- package/env/is-safari-like/is-safari-like.js.map +1 -0
- package/env/is-stationary/is-stationary.d.ts +4 -0
- package/env/is-stationary/is-stationary.js +8 -0
- package/env/is-stationary/is-stationary.js.map +1 -0
- package/env/is-tablet/is-tablet.d.ts +4 -0
- package/env/is-tablet/is-tablet.js +9 -0
- package/env/is-tablet/is-tablet.js.map +1 -0
- package/env/is-tv/is-tv.d.ts +4 -0
- package/env/is-tv/is-tv.js +9 -0
- package/env/is-tv/is-tv.js.map +1 -0
- package/env/matches/matches.d.ts +34 -0
- package/env/matches/matches.js +52 -0
- package/env/matches/matches.js.map +1 -0
- package/env/matches-with-browsers/matches-with-browsers.d.ts +23 -0
- package/env/matches-with-browsers/matches-with-browsers.js +53 -0
- package/env/matches-with-browsers/matches-with-browsers.js.map +1 -0
- package/env/matches-with-version/matches-with-version.d.ts +6 -0
- package/env/matches-with-version/matches-with-version.js +41 -0
- package/env/matches-with-version/matches-with-version.js.map +1 -0
- package/env/private/private.d.ts +4 -0
- package/env/private/private.js +67 -0
- package/env/private/private.js.map +1 -0
- package/env/types.d.ts +106 -0
- package/env/types.js +2 -0
- package/env/types.js.map +1 -0
- package/env/user-agent/user-agent.d.ts +9 -0
- package/env/user-agent/user-agent.js +24 -0
- package/env/user-agent/user-agent.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/num/in-range/in-range.d.ts +8 -0
- package/num/in-range/in-range.js +23 -0
- package/num/in-range/in-range.js.map +1 -0
- package/num/index.d.ts +3 -0
- package/num/index.js +4 -0
- package/num/index.js.map +1 -0
- package/num/round/round.d.ts +7 -0
- package/num/round/round.js +11 -0
- package/num/round/round.js.map +1 -0
- package/num/types.d.ts +24 -0
- package/num/types.js +2 -0
- package/num/types.js.map +1 -0
- package/obj/constant/constant.d.ts +6 -0
- package/obj/constant/constant.js +8 -0
- package/obj/constant/constant.js.map +1 -0
- package/obj/deep-constant/deep-constant.d.ts +6 -0
- package/obj/deep-constant/deep-constant.js +18 -0
- package/obj/deep-constant/deep-constant.js.map +1 -0
- package/obj/diff-obj/diff-obj.d.ts +9 -0
- package/obj/diff-obj/diff-obj.js +48 -0
- package/obj/diff-obj/diff-obj.js.map +1 -0
- package/obj/exclude/exclude.d.ts +7 -0
- package/obj/exclude/exclude.js +18 -0
- package/obj/exclude/exclude.js.map +1 -0
- package/obj/extend/extend.d.ts +16 -0
- package/obj/extend/extend.js +49 -0
- package/obj/extend/extend.js.map +1 -0
- package/obj/for-each-obj/for-each-obj.d.ts +8 -0
- package/obj/for-each-obj/for-each-obj.js +16 -0
- package/obj/for-each-obj/for-each-obj.js.map +1 -0
- package/obj/has-own/has-own.d.ts +8 -0
- package/obj/has-own/has-own.js +11 -0
- package/obj/has-own/has-own.js.map +1 -0
- package/obj/include/include.d.ts +7 -0
- package/obj/include/include.js +17 -0
- package/obj/include/include.js.map +1 -0
- package/obj/index.d.ts +13 -0
- package/obj/index.js +14 -0
- package/obj/index.js.map +1 -0
- package/obj/keys/keys.d.ts +6 -0
- package/obj/keys/keys.js +8 -0
- package/obj/keys/keys.js.map +1 -0
- package/obj/map-obj/map-obj.d.ts +7 -0
- package/obj/map-obj/map-obj.js +12 -0
- package/obj/map-obj/map-obj.js.map +1 -0
- package/obj/map-obj-to-arr/map-obj-to-arr.d.ts +7 -0
- package/obj/map-obj-to-arr/map-obj-to-arr.js +12 -0
- package/obj/map-obj-to-arr/map-obj-to-arr.js.map +1 -0
- package/obj/types.d.ts +30 -0
- package/obj/types.js +2 -0
- package/obj/types.js.map +1 -0
- package/obj/values/values.d.ts +6 -0
- package/obj/values/values.js +11 -0
- package/obj/values/values.js.map +1 -0
- package/package.json +73 -0
- package/str/index.d.ts +3 -0
- package/str/index.js +4 -0
- package/str/index.js.map +1 -0
- package/str/to-camel-case/to-camel-case.d.ts +10 -0
- package/str/to-camel-case/to-camel-case.js +18 -0
- package/str/to-camel-case/to-camel-case.js.map +1 -0
- package/str/to-hash/to-hash.d.ts +7 -0
- package/str/to-hash/to-hash.js +21 -0
- package/str/to-hash/to-hash.js.map +1 -0
- package/str/with-capital/with-capital.d.ts +6 -0
- package/str/with-capital/with-capital.js +9 -0
- package/str/with-capital/with-capital.js.map +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { forEach, INTERRUPT } from '../../';
|
|
2
|
+
/**
|
|
3
|
+
* Iterates through all child elements of the parent element to the full depth of the tree
|
|
4
|
+
* and calls a handler for each element.
|
|
5
|
+
* If the handler returns INTERRUPT, the loop will be interrupted
|
|
6
|
+
* @param parent - a parent element
|
|
7
|
+
* @param handler - function called for each element
|
|
8
|
+
*/
|
|
9
|
+
export function forEachElements(parent, handler) {
|
|
10
|
+
forEach(parent.children, (child, i) => {
|
|
11
|
+
if (handler(child, i, parent) !== INTERRUPT) {
|
|
12
|
+
forEachElements(child, handler);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=for-each-elements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"for-each-elements.js","sourceRoot":"","sources":["../../../../package/src/dom/for-each-elements/for-each-elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,QAAQ,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,MAAe,EAC7C,OAAgE;IAChE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QACpC,IAAI,OAAO,CAAC,KAAK,EAAU,CAAC,EAAE,MAAM,CAAC,KAAK,SAAS,EAAE;YACnD,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;SACjC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Iterates through all child nodes of the parent node to the full depth of the tree and calls a handler for each node.
|
|
3
|
+
* If the handler returns INTERRUPT, the loop will be interrupted
|
|
4
|
+
* @param parent - a parent node
|
|
5
|
+
* @param handler - function called for each node (Text, Comment, Element)
|
|
6
|
+
*/
|
|
7
|
+
export declare function forEachNodes(parent: Node, handler: (child: Node, index: number, parent: Node) => any): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { INTERRUPT } from '../../';
|
|
2
|
+
/**
|
|
3
|
+
* Iterates through all child nodes of the parent node to the full depth of the tree and calls a handler for each node.
|
|
4
|
+
* If the handler returns INTERRUPT, the loop will be interrupted
|
|
5
|
+
* @param parent - a parent node
|
|
6
|
+
* @param handler - function called for each node (Text, Comment, Element)
|
|
7
|
+
*/
|
|
8
|
+
export function forEachNodes(parent, handler) {
|
|
9
|
+
parent.childNodes.forEach((child, i) => {
|
|
10
|
+
if (handler(child, i, parent) !== INTERRUPT) {
|
|
11
|
+
forEachNodes(child, handler);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=for-each-nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"for-each-nodes.js","sourceRoot":"","sources":["../../../../package/src/dom/for-each-nodes/for-each-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,MAAY,EAAE,OAA0D;IACnG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QACrC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,SAAS,EAAE;YAC3C,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;SAC9B;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getWindow } from '../';
|
|
2
|
+
/**
|
|
3
|
+
* Returns all computed styles of a given HTML element
|
|
4
|
+
* @param element - any HTML element
|
|
5
|
+
*/
|
|
6
|
+
export function getAllStyles(element) {
|
|
7
|
+
const win = getWindow();
|
|
8
|
+
return win.getComputedStyle(element);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=get-all-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-all-styles.js","sourceRoot":"","sources":["../../../../package/src/dom/get-all-styles/get-all-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,KAAK,CAAC;AAE9B;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAAoB;IAC/C,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IACxB,OAAO,GAAG,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-body.js","sourceRoot":"","sources":["../../../../package/src/dom/get-body/get-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,KAAK,CAAC;AAEhC;;GAEG;AACH,MAAM,UAAU,OAAO;IACrB,MAAM,GAAG,GAAG,WAAW,EAAE,CAAC;IAC1B,OAAO,GAAG,CAAC,IAAI,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-html.js","sourceRoot":"","sources":["../../../../package/src/dom/get-html/get-html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,KAAK,CAAC;AAEhC;;GAEG;AACH,MAAM,UAAU,OAAO;IACrB,MAAM,GAAG,GAAG,WAAW,EAAE,CAAC;IAC1B,OAAO,GAAG,CAAC,eAAe,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-non-static-parent.js","sourceRoot":"","sources":["../../../../package/src/dom/get-non-static-parent/get-non-static-parent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,KAAK,CAAC;AAE5B;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAoB;IACrD,OAAoB,OAAO,CAAC,YAAY,IAAI,OAAO,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getWindow } from '../';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the offset relative to the document
|
|
4
|
+
* @param element - any element
|
|
5
|
+
*/
|
|
6
|
+
export function getOffsetFromDoc(element) {
|
|
7
|
+
const win = getWindow();
|
|
8
|
+
const rect = element.getBoundingClientRect();
|
|
9
|
+
return {
|
|
10
|
+
top: rect.top + win.scrollY,
|
|
11
|
+
bottom: rect.bottom + win.scrollY,
|
|
12
|
+
left: rect.left + win.scrollX,
|
|
13
|
+
right: rect.right + win.scrollX,
|
|
14
|
+
width: rect.width,
|
|
15
|
+
height: rect.height,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=get-offset-from-doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-offset-from-doc.js","sourceRoot":"","sources":["../../../../package/src/dom/get-offset-from-doc/get-offset-from-doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAS,MAAM,KAAK,CAAC;AAEtC;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IACxB,MAAM,IAAI,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAC7C,OAAO;QACL,GAAG,EAAE,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,OAAO;QAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO;QACjC,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,OAAO;QAC7B,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,OAAO;QAC/B,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Offset } from '../';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the offset relative to the closest non-static parent element.
|
|
4
|
+
* For fixed elements returns the offset relative to the global window
|
|
5
|
+
* @param element - any HTML element
|
|
6
|
+
*/
|
|
7
|
+
export declare function getOffsetFromParent(element: HTMLElement): Offset;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BfError, toFloat } from '../../';
|
|
2
|
+
import { hasName, getNonStaticParent, getOffsetFromWin, getOffsetFromDoc, getStyle } from '../';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the offset relative to the closest non-static parent element.
|
|
5
|
+
* For fixed elements returns the offset relative to the global window
|
|
6
|
+
* @param element - any HTML element
|
|
7
|
+
*/
|
|
8
|
+
export function getOffsetFromParent(element) {
|
|
9
|
+
let offset;
|
|
10
|
+
let parentOffset;
|
|
11
|
+
if (hasName(element, 'html') || hasName(element, 'body')) {
|
|
12
|
+
throw new BfError('Element cannot be html or body', { code: 'bf_utils_dom_getOffsetFromParent_1' });
|
|
13
|
+
}
|
|
14
|
+
if (getStyle(element, 'position') === 'fixed') {
|
|
15
|
+
offset = getOffsetFromWin(element);
|
|
16
|
+
parentOffset = {
|
|
17
|
+
top: 0,
|
|
18
|
+
bottom: 0,
|
|
19
|
+
left: 0,
|
|
20
|
+
right: 0,
|
|
21
|
+
width: 0,
|
|
22
|
+
height: 0,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const parent = getNonStaticParent(element);
|
|
27
|
+
offset = getOffsetFromDoc(element);
|
|
28
|
+
parentOffset = getOffsetFromDoc(parent);
|
|
29
|
+
// The element cannot overlap its parent border, so the border width is added to the offset
|
|
30
|
+
parentOffset.top += toFloat(getStyle(parent, 'borderTopWidth'));
|
|
31
|
+
parentOffset.bottom -= toFloat(getStyle(parent, 'borderBottomWidth'));
|
|
32
|
+
parentOffset.left += toFloat(getStyle(parent, 'borderLeftWidth'));
|
|
33
|
+
parentOffset.right -= toFloat(getStyle(parent, 'borderRightWidth'));
|
|
34
|
+
}
|
|
35
|
+
// Subtract the element's margin so that the element is correctly placed relative to its parent
|
|
36
|
+
return {
|
|
37
|
+
top: offset.top - parentOffset.top - toFloat(getStyle(element, 'marginTop')),
|
|
38
|
+
bottom: offset.bottom - parentOffset.bottom - toFloat(getStyle(element, 'marginTop')),
|
|
39
|
+
left: offset.left - parentOffset.left - toFloat(getStyle(element, 'marginLeft')),
|
|
40
|
+
right: offset.right - parentOffset.right - toFloat(getStyle(element, 'marginLeft')),
|
|
41
|
+
width: offset.width,
|
|
42
|
+
height: offset.height,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=get-offset-from-parent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-offset-from-parent.js","sourceRoot":"","sources":["../../../../package/src/dom/get-offset-from-parent/get-offset-from-parent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAS,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,QAAQ,EAAC,MAAM,KAAK,CAAC;AAEtG;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAoB;IACtD,IAAI,MAAc,CAAC;IACnB,IAAI,YAAoB,CAAC;IAEzB,IAAI,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;QACxD,MAAM,IAAI,OAAO,CAAC,gCAAgC,EAAE,EAAC,IAAI,EAAE,oCAAoC,EAAC,CAAC,CAAC;KACnG;IAED,IAAI,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,OAAO,EAAE;QAC7C,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACnC,YAAY,GAAG;YACb,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;SACV,CAAC;KACH;SAAM;QACL,MAAM,MAAM,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACnC,YAAY,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAExC,2FAA2F;QAC3F,YAAY,CAAC,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;QAChE,YAAY,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;QACtE,YAAY,CAAC,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;QAClE,YAAY,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;KACrE;IAED,+FAA+F;IAC/F,OAAO;QACL,GAAG,EAAE,MAAM,CAAC,GAAG,GAAG,YAAY,CAAC,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC5E,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QACrF,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAChF,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACnF,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-offset-from-win.js","sourceRoot":"","sources":["../../../../package/src/dom/get-offset-from-win/get-offset-from-win.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,OAAO,OAAO,CAAC,qBAAqB,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getHtml, setStyle } from '../';
|
|
2
|
+
/**
|
|
3
|
+
* Returns width of vertical and horizontal scrollbars
|
|
4
|
+
* @param element - any HTML element, default the document's root element <html>
|
|
5
|
+
*/
|
|
6
|
+
export function getScrollWidth(element) {
|
|
7
|
+
element = element || getHtml();
|
|
8
|
+
const originalValue = setStyle(element, 'overflow', 'hidden');
|
|
9
|
+
const clientWidth1 = element.clientWidth;
|
|
10
|
+
const clientHeight1 = element.clientHeight;
|
|
11
|
+
setStyle(element, 'overflow', 'scroll');
|
|
12
|
+
const clientWidth2 = element.clientWidth;
|
|
13
|
+
const clientHeight2 = element.clientHeight;
|
|
14
|
+
setStyle(element, 'overflow', originalValue);
|
|
15
|
+
let y = clientWidth1 - clientWidth2;
|
|
16
|
+
let x = clientHeight1 - clientHeight2;
|
|
17
|
+
if (y > 0) {
|
|
18
|
+
y += 1;
|
|
19
|
+
}
|
|
20
|
+
if (x > 0) {
|
|
21
|
+
x += 1;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
y,
|
|
25
|
+
x,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=get-scroll-width.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-scroll-width.js","sourceRoot":"","sources":["../../../../package/src/dom/get-scroll-width/get-scroll-width.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,KAAK,CAAC;AAEtC;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAqB;IAClD,OAAO,GAAG,OAAO,IAAI,OAAO,EAAE,CAAC;IAC/B,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC9D,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IACzC,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAE3C,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IACzC,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAE3C,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IAC7C,IAAI,CAAC,GAAG,YAAY,GAAG,YAAY,CAAC;IACpC,IAAI,CAAC,GAAG,aAAa,GAAG,aAAa,CAAC;IAEtC,IAAI,CAAC,GAAG,CAAC,EAAE;QACT,CAAC,IAAI,CAAC,CAAC;KACR;IAED,IAAI,CAAC,GAAG,CAAC,EAAE;QACT,CAAC,IAAI,CAAC,CAAC;KACR;IAED,OAAO;QACL,CAAC;QACD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getValidStyleName, getAllStyles } from '../';
|
|
2
|
+
const validStyleValues = {
|
|
3
|
+
opacity: ['', '1'],
|
|
4
|
+
fontWeight: ['normal', '400'],
|
|
5
|
+
letterSpacing: ['normal', '0'],
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Returns certain computed style value of a given HTML element
|
|
9
|
+
* @param element - any HTML element
|
|
10
|
+
* @param styleName - any style name
|
|
11
|
+
*/
|
|
12
|
+
export function getStyle(element, styleName) {
|
|
13
|
+
const styles = getAllStyles(element);
|
|
14
|
+
const validName = getValidStyleName(styleName);
|
|
15
|
+
const value = styles.getPropertyValue(validName);
|
|
16
|
+
if (validStyleValues[validName] && value === validStyleValues[validName][0]) {
|
|
17
|
+
return validStyleValues[validName][1];
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=get-style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-style.js","sourceRoot":"","sources":["../../../../package/src/dom/get-style/get-style.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,KAAK,CAAC;AAEpD,MAAM,gBAAgB,GAA4B;IAChD,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC;IAClB,UAAU,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC;IAC7B,aAAa,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC;CAC/B,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAoB,EAAE,SAAiB;IAC9D,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAEjD,IAAI,gBAAgB,CAAC,SAAS,CAAC,IAAI,KAAK,KAAK,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;QAC3E,OAAO,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;KACvC;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ValueUnion } from '../../';
|
|
2
|
+
/**
|
|
3
|
+
* Returns an object with the specified computed styles for a given HTML element
|
|
4
|
+
* @param element - any HTML element
|
|
5
|
+
* @param styleNames - list of certain style names
|
|
6
|
+
*/
|
|
7
|
+
export declare function getStyles<A extends string[]>(element: HTMLElement, ...styleNames: A): {
|
|
8
|
+
[K in ValueUnion<A>]: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getStyle } from '../';
|
|
2
|
+
/**
|
|
3
|
+
* Returns an object with the specified computed styles for a given HTML element
|
|
4
|
+
* @param element - any HTML element
|
|
5
|
+
* @param styleNames - list of certain style names
|
|
6
|
+
*/
|
|
7
|
+
export function getStyles(element, ...styleNames) {
|
|
8
|
+
const styles = {};
|
|
9
|
+
styleNames.forEach(name => styles[name] = getStyle(element, name));
|
|
10
|
+
return styles;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=get-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-styles.js","sourceRoot":"","sources":["../../../../package/src/dom/get-styles/get-styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,KAAK,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAqB,OAAoB,EAChE,GAAG,UAAa;IAChB,MAAM,MAAM,GAAwC,EAAE,CAAC;IACvD,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAO,MAAO,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1E,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BfError } from '../../';
|
|
2
|
+
import { withCapital, toCamelCase } from '../../str';
|
|
3
|
+
import { getDocument } from '../';
|
|
4
|
+
let defaultStyles;
|
|
5
|
+
const vendorPrefixes = ['Webkit', 'Moz'];
|
|
6
|
+
const validStyleNames = { float: 'cssFloat' };
|
|
7
|
+
/**
|
|
8
|
+
* Attempts to convert the name to a valid style name.
|
|
9
|
+
* Returns a valid style name or throws an exception if a valid name is not found
|
|
10
|
+
* @param name - any name
|
|
11
|
+
*/
|
|
12
|
+
export function getValidStyleName(name) {
|
|
13
|
+
if (!defaultStyles) {
|
|
14
|
+
const doc = getDocument();
|
|
15
|
+
defaultStyles = doc.createElement('div').style;
|
|
16
|
+
}
|
|
17
|
+
if (name in validStyleNames) {
|
|
18
|
+
return validStyleNames[name];
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const camelName = toCamelCase(name);
|
|
22
|
+
if (camelName in defaultStyles) {
|
|
23
|
+
validStyleNames[name] = camelName;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const baseName = withCapital(camelName);
|
|
27
|
+
for (const prefix of vendorPrefixes) {
|
|
28
|
+
const fullName = prefix + baseName;
|
|
29
|
+
if (fullName in defaultStyles) {
|
|
30
|
+
validStyleNames[name] = fullName;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (!(name in validStyleNames)) {
|
|
35
|
+
throw new BfError('Incorrect style name', { code: 'bf_utils_dom_getValidStyleName_1' });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return validStyleNames[name];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=get-valid-style-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-valid-style-name.js","sourceRoot":"","sources":["../../../../package/src/dom/get-valid-style-name/get-valid-style-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAQ,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AACnD,OAAO,EAAC,WAAW,EAAC,MAAM,KAAK,CAAC;AAEhC,IAAI,aAAkC,CAAC;AACvC,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACzC,MAAM,eAAe,GAAkB,EAAC,KAAK,EAAE,UAAU,EAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,GAAG,GAAG,WAAW,EAAE,CAAC;QAC1B,aAAa,GAAG,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;KAChD;IAED,IAAI,IAAI,IAAI,eAAe,EAAE;QAC3B,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;KAC9B;SAAM;QACL,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAEpC,IAAI,SAAS,IAAI,aAAa,EAAE;YAC9B,eAAe,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;SACnC;aAAM;YACL,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;YAExC,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE;gBACnC,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;gBACnC,IAAI,QAAQ,IAAI,aAAa,EAAE;oBAC7B,eAAe,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;oBACjC,MAAM;iBACP;aACF;YAED,IAAI,CAAC,CAAC,IAAI,IAAI,eAAe,CAAC,EAAE;gBAC9B,MAAM,IAAI,OAAO,CAAC,sBAAsB,EAAE,EAAC,IAAI,EAAE,kCAAkC,EAAC,CAAC,CAAC;aACvF;SACF;QAED,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;KAC9B;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BfError } from '../../';
|
|
2
|
+
import { getDocument } from '../';
|
|
3
|
+
let win = typeof window === 'object' ? window : undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Returns the global window object in the current environment
|
|
6
|
+
*/
|
|
7
|
+
export function getWindow() {
|
|
8
|
+
const doc = getDocument();
|
|
9
|
+
win = doc.defaultView || win;
|
|
10
|
+
if (win) {
|
|
11
|
+
return win;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
throw new BfError('Window is absent', { code: 'bf_utils_dom_getWindow_1' });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=get-window.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-window.js","sourceRoot":"","sources":["../../../../package/src/dom/get-window/get-window.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAC,WAAW,EAAC,MAAM,KAAK,CAAC;AAEhC,IAAI,GAAG,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,GAAG,GAAG,WAAW,EAAE,CAAC;IAC1B,GAAG,GAAG,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC;IAC7B,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC;KACZ;SAAM;QACL,MAAM,IAAI,OAAO,CAAC,kBAAkB,EAAE,EAAC,IAAI,EAAE,0BAA0B,EAAC,CAAC,CAAC;KAC3E;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines if the name of the passed element matches a specific name
|
|
3
|
+
* @param element - any HTML element
|
|
4
|
+
* @param name - any node name
|
|
5
|
+
*/
|
|
6
|
+
export function hasName(element, name) {
|
|
7
|
+
return element.nodeName.toLowerCase() === name.toLowerCase();
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=has-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-name.js","sourceRoot":"","sources":["../../../../package/src/dom/has-name/has-name.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAgB,EAAE,IAAY;IACpD,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;AAC/D,CAAC"}
|
package/dom/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './is-text/is-text';
|
|
3
|
+
export * from './is-comment/is-comment';
|
|
4
|
+
export * from './is-element/is-element';
|
|
5
|
+
export * from './has-name/has-name';
|
|
6
|
+
export * from './document/document';
|
|
7
|
+
export * from './get-window/get-window';
|
|
8
|
+
export * from './get-html/get-html';
|
|
9
|
+
export * from './get-body/get-body';
|
|
10
|
+
export * from './closest/closest';
|
|
11
|
+
export * from './get-non-static-parent/get-non-static-parent';
|
|
12
|
+
export * from './get-offset-from-win/get-offset-from-win';
|
|
13
|
+
export * from './get-offset-from-doc/get-offset-from-doc';
|
|
14
|
+
export * from './get-offset-from-parent/get-offset-from-parent';
|
|
15
|
+
export * from './set-offset-from-parent/set-offset-from-parent';
|
|
16
|
+
export * from './get-valid-style-name/get-valid-style-name';
|
|
17
|
+
export * from './get-scroll-width/get-scroll-width';
|
|
18
|
+
export * from './download-file/download-file';
|
|
19
|
+
export * from './for-each-nodes/for-each-nodes';
|
|
20
|
+
export * from './for-each-elements/for-each-elements';
|
|
21
|
+
export * from './get-all-styles/get-all-styles';
|
|
22
|
+
export * from './get-style/get-style';
|
|
23
|
+
export * from './get-styles/get-styles';
|
|
24
|
+
export * from './set-style/set-style';
|
|
25
|
+
export * from './set-styles/set-styles';
|
package/dom/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './is-text/is-text';
|
|
3
|
+
export * from './is-comment/is-comment';
|
|
4
|
+
export * from './is-element/is-element';
|
|
5
|
+
export * from './has-name/has-name';
|
|
6
|
+
export * from './document/document';
|
|
7
|
+
export * from './get-window/get-window';
|
|
8
|
+
export * from './get-html/get-html';
|
|
9
|
+
export * from './get-body/get-body';
|
|
10
|
+
export * from './closest/closest';
|
|
11
|
+
export * from './get-non-static-parent/get-non-static-parent';
|
|
12
|
+
export * from './get-offset-from-win/get-offset-from-win';
|
|
13
|
+
export * from './get-offset-from-doc/get-offset-from-doc';
|
|
14
|
+
export * from './get-offset-from-parent/get-offset-from-parent';
|
|
15
|
+
export * from './set-offset-from-parent/set-offset-from-parent';
|
|
16
|
+
export * from './get-valid-style-name/get-valid-style-name';
|
|
17
|
+
export * from './get-scroll-width/get-scroll-width';
|
|
18
|
+
export * from './download-file/download-file';
|
|
19
|
+
export * from './for-each-nodes/for-each-nodes';
|
|
20
|
+
export * from './for-each-elements/for-each-elements';
|
|
21
|
+
export * from './get-all-styles/get-all-styles';
|
|
22
|
+
export * from './get-style/get-style';
|
|
23
|
+
export * from './get-styles/get-styles';
|
|
24
|
+
export * from './set-style/set-style';
|
|
25
|
+
export * from './set-styles/set-styles';
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
package/dom/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../package/src/dom/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iDAAiD,CAAC;AAChE,cAAc,iDAAiD,CAAC;AAChE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-comment.js","sourceRoot":"","sources":["../../../../package/src/dom/is-comment/is-comment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,KAAU;IAClC,OAAO,KAAK,YAAY,OAAO,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-element.js","sourceRoot":"","sources":["../../../../package/src/dom/is-element/is-element.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,KAAU;IAClC,OAAO,KAAK,YAAY,OAAO,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-text.js","sourceRoot":"","sources":["../../../../package/src/dom/is-text/is-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,KAAU;IAC/B,OAAO,KAAK,YAAY,IAAI,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TopLeft } from '../';
|
|
2
|
+
/**
|
|
3
|
+
* Sets the offset relative to the closest non-static parent element
|
|
4
|
+
* For fixed elements sets the offset relative to the global window
|
|
5
|
+
* @param element - any HTML element
|
|
6
|
+
* @param offset - top and left position relative to the parent HTML element
|
|
7
|
+
*/
|
|
8
|
+
export declare function setOffsetFromParent(element: HTMLElement, offset: Partial<TopLeft>): void;
|