@koine/dom 2.0.0-beta.2 → 2.0.0-beta.4

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.
Files changed (109) hide show
  1. package/$$.d.ts +1 -1
  2. package/$$.js +19 -6
  3. package/$$.mjs +1 -2
  4. package/$.d.ts +1 -1
  5. package/$.js +19 -6
  6. package/$.mjs +1 -2
  7. package/$each.js +22 -17
  8. package/$each.mjs +3 -4
  9. package/_listen-delegation.d.ts +3 -2
  10. package/_listen-delegation.js +42 -49
  11. package/_listen-delegation.mjs +17 -23
  12. package/addClass.js +21 -10
  13. package/addClass.mjs +2 -5
  14. package/calculateFixedOffset.js +22 -9
  15. package/calculateFixedOffset.mjs +3 -4
  16. package/createElement.js +22 -15
  17. package/createElement.mjs +2 -3
  18. package/emitEvent.js +22 -12
  19. package/emitEvent.mjs +3 -7
  20. package/escapeSelector.js +19 -6
  21. package/escapeSelector.mjs +1 -2
  22. package/exists.js +19 -6
  23. package/exists.mjs +1 -2
  24. package/forEach.d.ts +4 -5
  25. package/forEach.js +22 -11
  26. package/forEach.mjs +4 -7
  27. package/getDataAttr.js +19 -6
  28. package/getDataAttr.mjs +1 -2
  29. package/getDocumentHeight.js +20 -7
  30. package/getDocumentHeight.mjs +2 -3
  31. package/getHeight.js +19 -6
  32. package/getHeight.mjs +1 -2
  33. package/getListeners.d.ts +1 -1
  34. package/getListeners.js +23 -16
  35. package/getListeners.mjs +4 -5
  36. package/getOffset.js +26 -10
  37. package/getOffset.mjs +8 -6
  38. package/getOffsetTop.js +21 -8
  39. package/getOffsetTop.mjs +3 -4
  40. package/getOffsetTopSlim.js +19 -6
  41. package/getOffsetTopSlim.mjs +1 -2
  42. package/getScrollbarWidth.js +19 -6
  43. package/getScrollbarWidth.mjs +1 -2
  44. package/getStyleValue.js +19 -6
  45. package/getStyleValue.mjs +1 -2
  46. package/getVisualBackgroundColor.js +26 -14
  47. package/getVisualBackgroundColor.mjs +8 -10
  48. package/index.js +191 -92
  49. package/injectCss.js +21 -10
  50. package/injectCss.mjs +2 -5
  51. package/isHidden.js +19 -6
  52. package/isHidden.mjs +1 -2
  53. package/isInViewport.js +21 -13
  54. package/isInViewport.mjs +3 -9
  55. package/isNodeList.js +21 -12
  56. package/isNodeList.mjs +3 -8
  57. package/isTotallyScrolled.js +19 -6
  58. package/isTotallyScrolled.mjs +1 -2
  59. package/listen.d.ts +2 -1
  60. package/listen.js +33 -25
  61. package/listen.mjs +11 -8
  62. package/listenLoaded.js +21 -12
  63. package/listenLoaded.mjs +2 -3
  64. package/listenOnce.js +24 -19
  65. package/listenOnce.mjs +2 -3
  66. package/listenResize.js +20 -11
  67. package/listenResize.mjs +1 -2
  68. package/listenResizeDebounced.js +48 -45
  69. package/listenResizeDebounced.mjs +28 -36
  70. package/listenResizeThrottled.js +21 -18
  71. package/listenResizeThrottled.mjs +1 -8
  72. package/listenScroll.js +21 -14
  73. package/listenScroll.mjs +2 -5
  74. package/listenScrollDebounced.js +21 -18
  75. package/listenScrollDebounced.mjs +1 -8
  76. package/listenScrollThrottled.js +21 -18
  77. package/listenScrollThrottled.mjs +1 -8
  78. package/off.d.ts +2 -2
  79. package/off.js +20 -11
  80. package/off.mjs +2 -5
  81. package/on.d.ts +2 -2
  82. package/on.js +25 -15
  83. package/on.mjs +5 -5
  84. package/onClickOutside.js +16 -12
  85. package/onClickOutside.mjs +5 -7
  86. package/once.js +25 -16
  87. package/once.mjs +3 -5
  88. package/package.json +12 -8
  89. package/removeClass.js +22 -11
  90. package/removeClass.mjs +3 -6
  91. package/scrollTo.js +31 -27
  92. package/scrollTo.mjs +13 -14
  93. package/setDataAttr.js +19 -6
  94. package/setDataAttr.mjs +1 -2
  95. package/setVendorCSS.js +20 -7
  96. package/setVendorCSS.mjs +2 -3
  97. package/siblings.js +22 -9
  98. package/siblings.mjs +4 -5
  99. package/toArray.js +19 -6
  100. package/toArray.mjs +1 -2
  101. package/types.d.ts +5 -0
  102. package/types.js +3 -1
  103. package/types.mjs +1 -1
  104. package/unlisten.d.ts +2 -1
  105. package/unlisten.js +34 -26
  106. package/unlisten.mjs +11 -9
  107. package/getVisualBackground.d.ts +0 -6
  108. package/getVisualBackground.js +0 -25
  109. package/getVisualBackground.mjs +0 -21
package/exists.js CHANGED
@@ -1,16 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.exists = void 0;
4
1
  /**
5
2
  * Checks if passed node exist and is a valid element.
6
3
  *
7
4
  * @borrows @glidejs/glide/src/utils/dom (source)
8
- */
5
+ */ "use strict";
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ function _export(target, all) {
10
+ for(var name in all)Object.defineProperty(target, name, {
11
+ enumerable: true,
12
+ get: all[name]
13
+ });
14
+ }
15
+ _export(exports, {
16
+ exists: function() {
17
+ return exists;
18
+ },
19
+ default: function() {
20
+ return _default;
21
+ }
22
+ });
9
23
  function exists(node) {
10
24
  if (node && node instanceof window.HTMLElement) {
11
25
  return true;
12
26
  }
13
27
  return false;
14
28
  }
15
- exports.exists = exists;
16
- exports.default = exists;
29
+ const _default = exists;
package/exists.mjs CHANGED
@@ -2,8 +2,7 @@
2
2
  * Checks if passed node exist and is a valid element.
3
3
  *
4
4
  * @borrows @glidejs/glide/src/utils/dom (source)
5
- */
6
- export function exists(node) {
5
+ */ export function exists(node) {
7
6
  if (node && node instanceof window.HTMLElement) {
8
7
  return true;
9
8
  }
package/forEach.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  /**
2
- * For each, iterate through a NodeList of HTMLElements
2
+ * For each, iterate through a `NodeList` or an `array` of `HTMLElement`s
3
3
  *
4
- * @param nodes DOM nodes collection
5
- * @param callback
6
- * @param scope
4
+ * @param scope The optional `this` of the callback function
7
5
  */
8
- export declare function forEach<T extends Element = HTMLElement, TScope = object>(nodes: NodeList, callback: (this: TScope, $element: T, index: number) => any, scope?: TScope): void;
6
+ export declare function forEach<TScope = object>(nodes: HTMLElement[], callback: (this: TScope, $element: HTMLElement, index: number) => any, scope?: TScope): void;
7
+ export declare function forEach<TScope = object>(nodes: NodeListOf<HTMLElement> | HTMLElement[], callback: (this: TScope, $element: HTMLElement, index: number) => any, scope?: TScope): void;
9
8
  export default forEach;
package/forEach.js CHANGED
@@ -1,17 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.forEach = void 0;
4
1
  /**
5
- * For each, iterate through a NodeList of HTMLElements
2
+ * For each, iterate through a `NodeList` or an `array` of `HTMLElement`s
6
3
  *
7
- * @param nodes DOM nodes collection
8
- * @param callback
9
- * @param scope
10
- */
4
+ * @param scope The optional `this` of the callback function
5
+ */ "use strict";
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ function _export(target, all) {
10
+ for(var name in all)Object.defineProperty(target, name, {
11
+ enumerable: true,
12
+ get: all[name]
13
+ });
14
+ }
15
+ _export(exports, {
16
+ forEach: function() {
17
+ return forEach;
18
+ },
19
+ default: function() {
20
+ return _default;
21
+ }
22
+ });
11
23
  function forEach(nodes, callback, scope) {
12
- for (var i = 0; i < nodes.length; i++) {
24
+ for(let i = 0; i < nodes.length; i++){
13
25
  callback.call(scope, nodes[i], i);
14
26
  }
15
27
  }
16
- exports.forEach = forEach;
17
- exports.default = forEach;
28
+ const _default = forEach;
package/forEach.mjs CHANGED
@@ -1,12 +1,9 @@
1
1
  /**
2
- * For each, iterate through a NodeList of HTMLElements
2
+ * For each, iterate through a `NodeList` or an `array` of `HTMLElement`s
3
3
  *
4
- * @param nodes DOM nodes collection
5
- * @param callback
6
- * @param scope
7
- */
8
- export function forEach(nodes, callback, scope) {
9
- for (var i = 0; i < nodes.length; i++) {
4
+ * @param scope The optional `this` of the callback function
5
+ */ export function forEach(nodes, callback, scope) {
6
+ for(let i = 0; i < nodes.length; i++){
10
7
  callback.call(scope, nodes[i], i);
11
8
  }
12
9
  }
package/getDataAttr.js CHANGED
@@ -1,17 +1,30 @@
1
- "use strict";
2
1
  // TODO: maybe move to `dataset` API but consider the comment about Safari here
3
2
  // https://stackoverflow.com/a/9201264/1938970
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.getDataAttr = void 0;
6
3
  /**
7
4
  * Get data attribute
8
5
  *
9
6
  * @param element
10
7
  * @param attribute The name of the `data-{attr}`
11
- */
8
+ */ "use strict";
9
+ Object.defineProperty(exports, "__esModule", {
10
+ value: true
11
+ });
12
+ function _export(target, all) {
13
+ for(var name in all)Object.defineProperty(target, name, {
14
+ enumerable: true,
15
+ get: all[name]
16
+ });
17
+ }
18
+ _export(exports, {
19
+ getDataAttr: function() {
20
+ return getDataAttr;
21
+ },
22
+ default: function() {
23
+ return _default;
24
+ }
25
+ });
12
26
  function getDataAttr(element, attribute) {
13
27
  // return element.dataset[attribute];
14
28
  return element.getAttribute("data-" + attribute);
15
29
  }
16
- exports.getDataAttr = getDataAttr;
17
- exports.default = getDataAttr;
30
+ const _default = getDataAttr;
package/getDataAttr.mjs CHANGED
@@ -5,8 +5,7 @@
5
5
  *
6
6
  * @param element
7
7
  * @param attribute The name of the `data-{attr}`
8
- */
9
- export function getDataAttr(element, attribute) {
8
+ */ export function getDataAttr(element, attribute) {
10
9
  // return element.dataset[attribute];
11
10
  return element.getAttribute("data-" + attribute);
12
11
  }
@@ -1,14 +1,27 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDocumentHeight = void 0;
4
1
  /**
5
2
  * Determine the document's height
6
3
  *
7
4
  * @see https://github.com/cferdinandi/smooth-scroll (credits)
8
- */
5
+ */ "use strict";
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ function _export(target, all) {
10
+ for(var name in all)Object.defineProperty(target, name, {
11
+ enumerable: true,
12
+ get: all[name]
13
+ });
14
+ }
15
+ _export(exports, {
16
+ getDocumentHeight: function() {
17
+ return getDocumentHeight;
18
+ },
19
+ default: function() {
20
+ return _default;
21
+ }
22
+ });
9
23
  function getDocumentHeight() {
10
- var body = document.body, documentElement = document.documentElement;
24
+ const { body, documentElement } = document;
11
25
  return Math.max(body.scrollHeight, documentElement.scrollHeight, body.offsetHeight, documentElement.offsetHeight, body.clientHeight, documentElement.clientHeight);
12
26
  }
13
- exports.getDocumentHeight = getDocumentHeight;
14
- exports.default = getDocumentHeight;
27
+ const _default = getDocumentHeight;
@@ -2,9 +2,8 @@
2
2
  * Determine the document's height
3
3
  *
4
4
  * @see https://github.com/cferdinandi/smooth-scroll (credits)
5
- */
6
- export function getDocumentHeight() {
7
- var body = document.body, documentElement = document.documentElement;
5
+ */ export function getDocumentHeight() {
6
+ const { body, documentElement } = document;
8
7
  return Math.max(body.scrollHeight, documentElement.scrollHeight, body.offsetHeight, documentElement.offsetHeight, body.clientHeight, documentElement.clientHeight);
9
8
  }
10
9
  export default getDocumentHeight;
package/getHeight.js CHANGED
@@ -1,11 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getHeight = void 0;
4
1
  /**
5
2
  * Get element height
6
- */
3
+ */ "use strict";
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ function _export(target, all) {
8
+ for(var name in all)Object.defineProperty(target, name, {
9
+ enumerable: true,
10
+ get: all[name]
11
+ });
12
+ }
13
+ _export(exports, {
14
+ getHeight: function() {
15
+ return getHeight;
16
+ },
17
+ default: function() {
18
+ return _default;
19
+ }
20
+ });
7
21
  function getHeight(element) {
8
22
  return parseInt(window.getComputedStyle(element).height, 10);
9
23
  }
10
- exports.getHeight = getHeight;
11
- exports.default = getHeight;
24
+ const _default = getHeight;
package/getHeight.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Get element height
3
- */
4
- export function getHeight(element) {
3
+ */ export function getHeight(element) {
5
4
  return parseInt(window.getComputedStyle(element).height, 10);
6
5
  }
7
6
  export default getHeight;
package/getListeners.d.ts CHANGED
@@ -5,5 +5,5 @@
5
5
  *
6
6
  * @return Active event listeners
7
7
  */
8
- export declare function getListeners(): Record<string, import("./_listen-delegation").ListenEvent[]>;
8
+ export declare function getListeners(): Partial<Record<import("./types").AnyDOMEventType, import("./_listen-delegation").ListenEvent[]>>;
9
9
  export default getListeners;
package/getListeners.js CHANGED
@@ -1,22 +1,29 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getListeners = void 0;
4
- var _listen_delegation_1 = require("./_listen-delegation");
5
- /**
6
- * Get an immutable copy of all active event listeners
7
- *
8
- * @category listen-delegation
9
- *
10
- * @return Active event listeners
11
- */
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ getListeners: function() {
13
+ return getListeners;
14
+ },
15
+ default: function() {
16
+ return _default;
17
+ }
18
+ });
19
+ const _listendelegation = require("./_listen-delegation");
12
20
  function getListeners() {
13
- var obj = {};
14
- for (var type in _listen_delegation_1.activeEvents) {
21
+ const obj = {};
22
+ for(const type in _listendelegation.activeEvents){
15
23
  // if (activeEvents.hasOwnProperty(type)) {
16
- obj[type] = _listen_delegation_1.activeEvents[type];
17
- // }
24
+ obj[type] = _listendelegation.activeEvents[type];
25
+ // }
18
26
  }
19
27
  return obj;
20
28
  }
21
- exports.getListeners = getListeners;
22
- exports.default = getListeners;
29
+ const _default = getListeners;
package/getListeners.mjs CHANGED
@@ -5,13 +5,12 @@ import { activeEvents } from "./_listen-delegation";
5
5
  * @category listen-delegation
6
6
  *
7
7
  * @return Active event listeners
8
- */
9
- export function getListeners() {
10
- var obj = {};
11
- for (var type in activeEvents) {
8
+ */ export function getListeners() {
9
+ const obj = {};
10
+ for(const type in activeEvents){
12
11
  // if (activeEvents.hasOwnProperty(type)) {
13
12
  obj[type] = activeEvents[type];
14
- // }
13
+ // }
15
14
  }
16
15
  return obj;
17
16
  }
package/getOffset.js CHANGED
@@ -1,22 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOffset = void 0;
4
1
  /**
5
2
  * Get an element's distance from the top and left of the Document.
6
3
  *
7
4
  * @param elem The HTML node element
8
5
  * @return Distance from the top and left in pixels
9
- */
6
+ */ "use strict";
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ function _export(target, all) {
11
+ for(var name in all)Object.defineProperty(target, name, {
12
+ enumerable: true,
13
+ get: all[name]
14
+ });
15
+ }
16
+ _export(exports, {
17
+ getOffset: function() {
18
+ return getOffset;
19
+ },
20
+ default: function() {
21
+ return _default;
22
+ }
23
+ });
10
24
  function getOffset(elem) {
11
- var left = 0;
12
- var top = 0;
13
- while (elem && !isNaN(elem.offsetLeft) && !isNaN(elem.offsetTop)) {
25
+ let left = 0;
26
+ let top = 0;
27
+ while(elem && !isNaN(elem.offsetLeft) && !isNaN(elem.offsetTop)){
14
28
  left += elem.offsetLeft - elem.scrollLeft;
15
29
  top += elem.offsetTop - elem.scrollTop;
16
30
  // @ts-expect-error nevermind?
17
31
  elem = elem.offsetParent;
18
32
  }
19
- return { top: top, left: left };
33
+ return {
34
+ top,
35
+ left
36
+ };
20
37
  }
21
- exports.getOffset = getOffset;
22
- exports.default = getOffset;
38
+ const _default = getOffset;
package/getOffset.mjs CHANGED
@@ -3,16 +3,18 @@
3
3
  *
4
4
  * @param elem The HTML node element
5
5
  * @return Distance from the top and left in pixels
6
- */
7
- export function getOffset(elem) {
8
- var left = 0;
9
- var top = 0;
10
- while (elem && !isNaN(elem.offsetLeft) && !isNaN(elem.offsetTop)) {
6
+ */ export function getOffset(elem) {
7
+ let left = 0;
8
+ let top = 0;
9
+ while(elem && !isNaN(elem.offsetLeft) && !isNaN(elem.offsetTop)){
11
10
  left += elem.offsetLeft - elem.scrollLeft;
12
11
  top += elem.offsetTop - elem.scrollTop;
13
12
  // @ts-expect-error nevermind?
14
13
  elem = elem.offsetParent;
15
14
  }
16
- return { top: top, left: left };
15
+ return {
16
+ top,
17
+ left
18
+ };
17
19
  }
18
20
  export default getOffset;
package/getOffsetTop.js CHANGED
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOffsetTop = void 0;
4
1
  /**
5
2
  * Get an element's distance from the top of the Document.
6
3
  *
@@ -8,11 +5,28 @@ exports.getOffsetTop = void 0;
8
5
  *
9
6
  * @param elem The HTML node element
10
7
  * @return Distance from the top in pixels
11
- */
8
+ */ "use strict";
9
+ Object.defineProperty(exports, "__esModule", {
10
+ value: true
11
+ });
12
+ function _export(target, all) {
13
+ for(var name in all)Object.defineProperty(target, name, {
14
+ enumerable: true,
15
+ get: all[name]
16
+ });
17
+ }
18
+ _export(exports, {
19
+ getOffsetTop: function() {
20
+ return getOffsetTop;
21
+ },
22
+ default: function() {
23
+ return _default;
24
+ }
25
+ });
12
26
  function getOffsetTop(elem) {
13
- var location = 0;
27
+ let location = 0;
14
28
  if (elem.offsetParent) {
15
- while (elem) {
29
+ while(elem){
16
30
  location += elem.offsetTop;
17
31
  // @ts-expect-error nevermind?
18
32
  elem = elem.offsetParent;
@@ -20,5 +34,4 @@ function getOffsetTop(elem) {
20
34
  }
21
35
  return location >= 0 ? location : 0;
22
36
  }
23
- exports.getOffsetTop = getOffsetTop;
24
- exports.default = getOffsetTop;
37
+ const _default = getOffsetTop;
package/getOffsetTop.mjs CHANGED
@@ -5,11 +5,10 @@
5
5
  *
6
6
  * @param elem The HTML node element
7
7
  * @return Distance from the top in pixels
8
- */
9
- export function getOffsetTop(elem) {
10
- var location = 0;
8
+ */ export function getOffsetTop(elem) {
9
+ let location = 0;
11
10
  if (elem.offsetParent) {
12
- while (elem) {
11
+ while(elem){
13
12
  location += elem.offsetTop;
14
13
  // @ts-expect-error nevermind?
15
14
  elem = elem.offsetParent;
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOffsetTopSlim = void 0;
4
1
  /**
5
2
  * Get an element's distance from the top of the Document (using more modern/performant
6
3
  * technique compared to {@link ./getOffsetTop})
@@ -9,9 +6,25 @@ exports.getOffsetTopSlim = void 0;
9
6
  *
10
7
  * @param elem The HTML node element
11
8
  * @return Distance from the top in pixels
12
- */
9
+ */ "use strict";
10
+ Object.defineProperty(exports, "__esModule", {
11
+ value: true
12
+ });
13
+ function _export(target, all) {
14
+ for(var name in all)Object.defineProperty(target, name, {
15
+ enumerable: true,
16
+ get: all[name]
17
+ });
18
+ }
19
+ _export(exports, {
20
+ getOffsetTopSlim: function() {
21
+ return getOffsetTopSlim;
22
+ },
23
+ default: function() {
24
+ return _default;
25
+ }
26
+ });
13
27
  function getOffsetTopSlim(elem) {
14
28
  return elem.getBoundingClientRect().top + window.scrollY;
15
29
  }
16
- exports.getOffsetTopSlim = getOffsetTopSlim;
17
- exports.default = getOffsetTopSlim;
30
+ const _default = getOffsetTopSlim;
@@ -6,8 +6,7 @@
6
6
  *
7
7
  * @param elem The HTML node element
8
8
  * @return Distance from the top in pixels
9
- */
10
- export function getOffsetTopSlim(elem) {
9
+ */ export function getOffsetTopSlim(elem) {
11
10
  return elem.getBoundingClientRect().top + window.scrollY;
12
11
  }
13
12
  export default getOffsetTopSlim;
@@ -1,11 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getScrollbarWidth = void 0;
4
1
  /**
5
2
  * Get scrollbar's current width
6
- */
3
+ */ "use strict";
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ function _export(target, all) {
8
+ for(var name in all)Object.defineProperty(target, name, {
9
+ enumerable: true,
10
+ get: all[name]
11
+ });
12
+ }
13
+ _export(exports, {
14
+ getScrollbarWidth: function() {
15
+ return getScrollbarWidth;
16
+ },
17
+ default: function() {
18
+ return _default;
19
+ }
20
+ });
7
21
  function getScrollbarWidth(element) {
8
22
  return window.innerWidth - (element || document.documentElement).clientWidth;
9
23
  }
10
- exports.getScrollbarWidth = getScrollbarWidth;
11
- exports.default = getScrollbarWidth;
24
+ const _default = getScrollbarWidth;
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Get scrollbar's current width
3
- */
4
- export function getScrollbarWidth(element) {
3
+ */ export function getScrollbarWidth(element) {
5
4
  return window.innerWidth - (element || document.documentElement).clientWidth;
6
5
  }
7
6
  export default getScrollbarWidth;
package/getStyleValue.js CHANGED
@@ -1,14 +1,27 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStyleValue = void 0;
4
1
  /**
5
2
  * Return the current style value for an element CSS property
6
3
  *
7
4
  * @param el The element to compute
8
5
  * @param prop The style property
9
- */
6
+ */ "use strict";
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ function _export(target, all) {
11
+ for(var name in all)Object.defineProperty(target, name, {
12
+ enumerable: true,
13
+ get: all[name]
14
+ });
15
+ }
16
+ _export(exports, {
17
+ getStyleValue: function() {
18
+ return getStyleValue;
19
+ },
20
+ default: function() {
21
+ return _default;
22
+ }
23
+ });
10
24
  function getStyleValue(el, prop) {
11
25
  return getComputedStyle(el, null).getPropertyValue(prop);
12
26
  }
13
- exports.getStyleValue = getStyleValue;
14
- exports.default = getStyleValue;
27
+ const _default = getStyleValue;
package/getStyleValue.mjs CHANGED
@@ -3,8 +3,7 @@
3
3
  *
4
4
  * @param el The element to compute
5
5
  * @param prop The style property
6
- */
7
- export function getStyleValue(el, prop) {
6
+ */ export function getStyleValue(el, prop) {
8
7
  return getComputedStyle(el, null).getPropertyValue(prop);
9
8
  }
10
9
  export default getStyleValue;
@@ -1,25 +1,37 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getVisualBackgroundColor = void 0;
4
1
  /**
5
2
  * Get the background color of an element eventually looking recursively into
6
3
  * its parents, if nothing is found it returns a `#fff` background
7
- */
4
+ */ "use strict";
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ function _export(target, all) {
9
+ for(var name in all)Object.defineProperty(target, name, {
10
+ enumerable: true,
11
+ get: all[name]
12
+ });
13
+ }
14
+ _export(exports, {
15
+ getVisualBackgroundColor: function() {
16
+ return getVisualBackgroundColor;
17
+ },
18
+ default: function() {
19
+ return _default;
20
+ }
21
+ });
8
22
  function getVisualBackgroundColor(elem) {
9
- if (!elem)
10
- return "#fff";
11
- var transparent = "rgba(0, 0, 0, 0)";
12
- var transparentIE11 = "transparent";
23
+ if (!elem) return "#fff";
24
+ const transparent = "rgba(0, 0, 0, 0)";
25
+ const transparentIE11 = "transparent";
13
26
  // if (!elem) return transparent;
14
- var bg = window.getComputedStyle(elem).backgroundColor;
27
+ const bg = window.getComputedStyle(elem).backgroundColor;
15
28
  if (bg === transparent || bg === transparentIE11) {
16
- var parent_1 = elem.parentElement;
17
- if (parent_1) {
18
- return getVisualBackgroundColor(parent_1);
29
+ const parent = elem.parentElement;
30
+ if (parent) {
31
+ return getVisualBackgroundColor(parent);
19
32
  }
20
33
  return "#fff";
21
34
  }
22
35
  return bg;
23
36
  }
24
- exports.getVisualBackgroundColor = getVisualBackgroundColor;
25
- exports.default = getVisualBackgroundColor;
37
+ const _default = getVisualBackgroundColor;