@koine/dom 1.1.10 → 1.1.11

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 (114) hide show
  1. package/$$.js +6 -2
  2. package/{node/$$.js → $$.mjs} +2 -6
  3. package/$.js +6 -2
  4. package/{node/$.js → $.mjs} +2 -6
  5. package/$each.js +9 -4
  6. package/{node/$each.js → $each.mjs} +4 -9
  7. package/_listen-delegation.js +17 -10
  8. package/{node/_listen-delegation.js → _listen-delegation.mjs} +10 -17
  9. package/addClass.js +6 -2
  10. package/{node/addClass.js → addClass.mjs} +2 -6
  11. package/calculateFixedOffset.js +8 -4
  12. package/calculateFixedOffset.mjs +10 -0
  13. package/createElement.js +9 -4
  14. package/createElement.mjs +16 -0
  15. package/emitEvent.js +6 -2
  16. package/{node/emitEvent.js → emitEvent.mjs} +2 -6
  17. package/escapeSelector.js +6 -2
  18. package/{node/escapeSelector.js → escapeSelector.mjs} +2 -6
  19. package/exists.js +6 -2
  20. package/{node/exists.js → exists.mjs} +2 -6
  21. package/forEach.js +6 -2
  22. package/{node/forEach.js → forEach.mjs} +2 -6
  23. package/getDataAttr.js +6 -2
  24. package/{node/getDataAttr.js → getDataAttr.mjs} +2 -6
  25. package/getDocumentHeight.js +6 -2
  26. package/{node/getDocumentHeight.js → getDocumentHeight.mjs} +2 -6
  27. package/getHeight.js +6 -2
  28. package/getHeight.mjs +7 -0
  29. package/getListeners.js +9 -5
  30. package/getListeners.mjs +18 -0
  31. package/getOffset.js +6 -2
  32. package/{node/getOffset.js → getOffset.mjs} +2 -6
  33. package/getOffsetTop.js +6 -2
  34. package/{node/getOffsetTop.js → getOffsetTop.mjs} +2 -6
  35. package/getOffsetTopSlim.js +6 -2
  36. package/{node/getOffsetTopSlim.js → getOffsetTopSlim.mjs} +2 -6
  37. package/getScrollbarWidth.js +6 -2
  38. package/getScrollbarWidth.mjs +7 -0
  39. package/getStyleValue.js +6 -2
  40. package/getStyleValue.mjs +10 -0
  41. package/index.js +48 -45
  42. package/index.mjs +45 -0
  43. package/injectCss.js +6 -2
  44. package/{node/injectCss.js → injectCss.mjs} +2 -6
  45. package/isHidden.js +6 -2
  46. package/isHidden.mjs +7 -0
  47. package/isInViewport.js +6 -2
  48. package/{node/isInViewport.js → isInViewport.mjs} +2 -6
  49. package/isNodeList.js +6 -2
  50. package/{node/isNodeList.js → isNodeList.mjs} +2 -6
  51. package/isTotallyScrolled.js +6 -2
  52. package/{node/isTotallyScrolled.js → isTotallyScrolled.mjs} +2 -6
  53. package/listen.js +12 -8
  54. package/{node/listen.js → listen.mjs} +8 -12
  55. package/listenLoaded.js +8 -4
  56. package/listenLoaded.mjs +11 -0
  57. package/listenOnce.js +12 -8
  58. package/listenOnce.mjs +20 -0
  59. package/listenResize.js +7 -3
  60. package/listenResize.mjs +8 -0
  61. package/listenResizeDebounced.js +10 -5
  62. package/{node/listenResizeDebounced.js → listenResizeDebounced.mjs} +5 -10
  63. package/listenResizeThrottled.js +10 -5
  64. package/listenResizeThrottled.mjs +15 -0
  65. package/listenScroll.js +8 -4
  66. package/listenScroll.mjs +13 -0
  67. package/listenScrollDebounced.js +10 -5
  68. package/listenScrollDebounced.mjs +15 -0
  69. package/listenScrollThrottled.js +10 -5
  70. package/listenScrollThrottled.mjs +15 -0
  71. package/off.js +6 -2
  72. package/{node/off.js → off.mjs} +2 -6
  73. package/on.js +9 -4
  74. package/{node/on.js → on.mjs} +4 -9
  75. package/onClickOutside.js +8 -4
  76. package/{node/onClickOutside.js → onClickOutside.mjs} +4 -8
  77. package/once.js +11 -6
  78. package/once.mjs +15 -0
  79. package/package.json +3 -3
  80. package/removeClass.js +6 -2
  81. package/{node/removeClass.js → removeClass.mjs} +2 -6
  82. package/scrollTo.js +11 -7
  83. package/{node/scrollTo.js → scrollTo.mjs} +7 -11
  84. package/setDataAttr.js +6 -2
  85. package/{node/setDataAttr.js → setDataAttr.mjs} +2 -6
  86. package/setVendorCSS.js +6 -2
  87. package/{node/setVendorCSS.js → setVendorCSS.mjs} +2 -6
  88. package/siblings.js +6 -2
  89. package/{node/siblings.js → siblings.mjs} +2 -6
  90. package/toArray.js +6 -2
  91. package/toArray.mjs +9 -0
  92. package/types.js +2 -1
  93. package/types.mjs +1 -0
  94. package/unlisten.js +14 -10
  95. package/unlisten.mjs +33 -0
  96. package/node/calculateFixedOffset.js +0 -14
  97. package/node/createElement.js +0 -21
  98. package/node/getHeight.js +0 -11
  99. package/node/getListeners.js +0 -22
  100. package/node/getScrollbarWidth.js +0 -11
  101. package/node/getStyleValue.js +0 -14
  102. package/node/index.js +0 -48
  103. package/node/isHidden.js +0 -11
  104. package/node/listenLoaded.js +0 -15
  105. package/node/listenOnce.js +0 -24
  106. package/node/listenResize.js +0 -12
  107. package/node/listenResizeThrottled.js +0 -20
  108. package/node/listenScroll.js +0 -17
  109. package/node/listenScrollDebounced.js +0 -20
  110. package/node/listenScrollThrottled.js +0 -20
  111. package/node/once.js +0 -20
  112. package/node/toArray.js +0 -13
  113. package/node/types.js +0 -2
  114. package/node/unlisten.js +0 -37
package/getListeners.js CHANGED
@@ -1,4 +1,7 @@
1
- import { activeEvents } from "./_listen-delegation";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getListeners = void 0;
4
+ var _listen_delegation_1 = require("./_listen-delegation");
2
5
  /**
3
6
  * Get an immutable copy of all active event listeners
4
7
  *
@@ -6,13 +9,14 @@ import { activeEvents } from "./_listen-delegation";
6
9
  *
7
10
  * @return Active event listeners
8
11
  */
9
- export function getListeners() {
12
+ function getListeners() {
10
13
  var obj = {};
11
- for (var type in activeEvents) {
14
+ for (var type in _listen_delegation_1.activeEvents) {
12
15
  // if (activeEvents.hasOwnProperty(type)) {
13
- obj[type] = activeEvents[type];
16
+ obj[type] = _listen_delegation_1.activeEvents[type];
14
17
  // }
15
18
  }
16
19
  return obj;
17
20
  }
18
- export default getListeners;
21
+ exports.getListeners = getListeners;
22
+ exports.default = getListeners;
@@ -0,0 +1,18 @@
1
+ import { activeEvents } from "./_listen-delegation";
2
+ /**
3
+ * Get an immutable copy of all active event listeners
4
+ *
5
+ * @category listen-delegation
6
+ *
7
+ * @return Active event listeners
8
+ */
9
+ export function getListeners() {
10
+ var obj = {};
11
+ for (var type in activeEvents) {
12
+ // if (activeEvents.hasOwnProperty(type)) {
13
+ obj[type] = activeEvents[type];
14
+ // }
15
+ }
16
+ return obj;
17
+ }
18
+ export default getListeners;
package/getOffset.js CHANGED
@@ -1,10 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOffset = void 0;
1
4
  /**
2
5
  * Get an element's distance from the top and left of the Document.
3
6
  *
4
7
  * @param elem The HTML node element
5
8
  * @return Distance from the top and left in pixels
6
9
  */
7
- export function getOffset(elem) {
10
+ function getOffset(elem) {
8
11
  var left = 0;
9
12
  var top = 0;
10
13
  while (elem && !isNaN(elem.offsetLeft) && !isNaN(elem.offsetTop)) {
@@ -15,4 +18,5 @@ export function getOffset(elem) {
15
18
  }
16
19
  return { top: top, left: left };
17
20
  }
18
- export default getOffset;
21
+ exports.getOffset = getOffset;
22
+ exports.default = getOffset;
@@ -1,13 +1,10 @@
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
  */
10
- function getOffset(elem) {
7
+ export function getOffset(elem) {
11
8
  var left = 0;
12
9
  var top = 0;
13
10
  while (elem && !isNaN(elem.offsetLeft) && !isNaN(elem.offsetTop)) {
@@ -18,5 +15,4 @@ function getOffset(elem) {
18
15
  }
19
16
  return { top: top, left: left };
20
17
  }
21
- exports.getOffset = getOffset;
22
- exports.default = getOffset;
18
+ export default getOffset;
package/getOffsetTop.js CHANGED
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOffsetTop = void 0;
1
4
  /**
2
5
  * Get an element's distance from the top of the Document.
3
6
  *
@@ -6,7 +9,7 @@
6
9
  * @param elem The HTML node element
7
10
  * @return Distance from the top in pixels
8
11
  */
9
- export function getOffsetTop(elem) {
12
+ function getOffsetTop(elem) {
10
13
  var location = 0;
11
14
  if (elem.offsetParent) {
12
15
  while (elem) {
@@ -17,4 +20,5 @@ export function getOffsetTop(elem) {
17
20
  }
18
21
  return location >= 0 ? location : 0;
19
22
  }
20
- export default getOffsetTop;
23
+ exports.getOffsetTop = getOffsetTop;
24
+ exports.default = getOffsetTop;
@@ -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
  *
@@ -9,7 +6,7 @@ exports.getOffsetTop = void 0;
9
6
  * @param elem The HTML node element
10
7
  * @return Distance from the top in pixels
11
8
  */
12
- function getOffsetTop(elem) {
9
+ export function getOffsetTop(elem) {
13
10
  var location = 0;
14
11
  if (elem.offsetParent) {
15
12
  while (elem) {
@@ -20,5 +17,4 @@ function getOffsetTop(elem) {
20
17
  }
21
18
  return location >= 0 ? location : 0;
22
19
  }
23
- exports.getOffsetTop = getOffsetTop;
24
- exports.default = getOffsetTop;
20
+ export default getOffsetTop;
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOffsetTopSlim = void 0;
1
4
  /**
2
5
  * Get an element's distance from the top of the Document (using more modern/performant
3
6
  * technique compared to {@link ./getOffsetTop})
@@ -7,7 +10,8 @@
7
10
  * @param elem The HTML node element
8
11
  * @return Distance from the top in pixels
9
12
  */
10
- export function getOffsetTopSlim(elem) {
13
+ function getOffsetTopSlim(elem) {
11
14
  return elem.getBoundingClientRect().top + window.scrollY;
12
15
  }
13
- export default getOffsetTopSlim;
16
+ exports.getOffsetTopSlim = getOffsetTopSlim;
17
+ exports.default = getOffsetTopSlim;
@@ -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})
@@ -10,8 +7,7 @@ exports.getOffsetTopSlim = void 0;
10
7
  * @param elem The HTML node element
11
8
  * @return Distance from the top in pixels
12
9
  */
13
- function getOffsetTopSlim(elem) {
10
+ export function getOffsetTopSlim(elem) {
14
11
  return elem.getBoundingClientRect().top + window.scrollY;
15
12
  }
16
- exports.getOffsetTopSlim = getOffsetTopSlim;
17
- exports.default = getOffsetTopSlim;
13
+ export default getOffsetTopSlim;
@@ -1,7 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getScrollbarWidth = void 0;
1
4
  /**
2
5
  * Get scrollbar's current width
3
6
  */
4
- export function getScrollbarWidth(element) {
7
+ function getScrollbarWidth(element) {
5
8
  return window.innerWidth - (element || document.documentElement).clientWidth;
6
9
  }
7
- export default getScrollbarWidth;
10
+ exports.getScrollbarWidth = getScrollbarWidth;
11
+ exports.default = getScrollbarWidth;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Get scrollbar's current width
3
+ */
4
+ export function getScrollbarWidth(element) {
5
+ return window.innerWidth - (element || document.documentElement).clientWidth;
6
+ }
7
+ export default getScrollbarWidth;
package/getStyleValue.js CHANGED
@@ -1,10 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStyleValue = void 0;
1
4
  /**
2
5
  * Return the current style value for an element CSS property
3
6
  *
4
7
  * @param el The element to compute
5
8
  * @param prop The style property
6
9
  */
7
- export function getStyleValue(el, prop) {
10
+ function getStyleValue(el, prop) {
8
11
  return getComputedStyle(el, null).getPropertyValue(prop);
9
12
  }
10
- export default getStyleValue;
13
+ exports.getStyleValue = getStyleValue;
14
+ exports.default = getStyleValue;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Return the current style value for an element CSS property
3
+ *
4
+ * @param el The element to compute
5
+ * @param prop The style property
6
+ */
7
+ export function getStyleValue(el, prop) {
8
+ return getComputedStyle(el, null).getPropertyValue(prop);
9
+ }
10
+ export default getStyleValue;
package/index.js CHANGED
@@ -1,45 +1,48 @@
1
- export * from "./$$";
2
- export * from "./$each";
3
- export * from "./$";
4
- export * from "./addClass";
5
- export * from "./calculateFixedOffset";
6
- export * from "./createElement";
7
- export * from "./emitEvent";
8
- export * from "./escapeSelector";
9
- export * from "./exists";
10
- export * from "./forEach";
11
- export * from "./getDataAttr";
12
- export * from "./getDocumentHeight";
13
- export * from "./getHeight";
14
- export * from "./getListeners";
15
- export * from "./getOffset";
16
- export * from "./getOffsetTop";
17
- export * from "./getOffsetTopSlim";
18
- export * from "./getScrollbarWidth";
19
- export * from "./getStyleValue";
20
- export * from "./injectCss";
21
- export * from "./isHidden";
22
- export * from "./isInViewport";
23
- export * from "./isNodeList";
24
- export * from "./isTotallyScrolled";
25
- export * from "./listenLoaded";
26
- export * from "./listenOnce";
27
- export * from "./listenResize";
28
- export * from "./listenResizeDebounced";
29
- export * from "./listenResizeThrottled";
30
- export * from "./listenScroll";
31
- export * from "./listenScrollDebounced";
32
- export * from "./listenScrollThrottled";
33
- export * from "./listen";
34
- export * from "./off";
35
- export * from "./once";
36
- export * from "./onClickOutside";
37
- export * from "./on";
38
- export * from "./removeClass";
39
- export * from "./scrollTo";
40
- export * from "./setDataAttr";
41
- export * from "./setVendorCSS";
42
- export * from "./siblings";
43
- export * from "./toArray";
44
- export * from "./unlisten";
45
- export * from "./types";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./$$"), exports);
5
+ tslib_1.__exportStar(require("./$each"), exports);
6
+ tslib_1.__exportStar(require("./$"), exports);
7
+ tslib_1.__exportStar(require("./addClass"), exports);
8
+ tslib_1.__exportStar(require("./calculateFixedOffset"), exports);
9
+ tslib_1.__exportStar(require("./createElement"), exports);
10
+ tslib_1.__exportStar(require("./emitEvent"), exports);
11
+ tslib_1.__exportStar(require("./escapeSelector"), exports);
12
+ tslib_1.__exportStar(require("./exists"), exports);
13
+ tslib_1.__exportStar(require("./forEach"), exports);
14
+ tslib_1.__exportStar(require("./getDataAttr"), exports);
15
+ tslib_1.__exportStar(require("./getDocumentHeight"), exports);
16
+ tslib_1.__exportStar(require("./getHeight"), exports);
17
+ tslib_1.__exportStar(require("./getListeners"), exports);
18
+ tslib_1.__exportStar(require("./getOffset"), exports);
19
+ tslib_1.__exportStar(require("./getOffsetTop"), exports);
20
+ tslib_1.__exportStar(require("./getOffsetTopSlim"), exports);
21
+ tslib_1.__exportStar(require("./getScrollbarWidth"), exports);
22
+ tslib_1.__exportStar(require("./getStyleValue"), exports);
23
+ tslib_1.__exportStar(require("./injectCss"), exports);
24
+ tslib_1.__exportStar(require("./isHidden"), exports);
25
+ tslib_1.__exportStar(require("./isInViewport"), exports);
26
+ tslib_1.__exportStar(require("./isNodeList"), exports);
27
+ tslib_1.__exportStar(require("./isTotallyScrolled"), exports);
28
+ tslib_1.__exportStar(require("./listenLoaded"), exports);
29
+ tslib_1.__exportStar(require("./listenOnce"), exports);
30
+ tslib_1.__exportStar(require("./listenResize"), exports);
31
+ tslib_1.__exportStar(require("./listenResizeDebounced"), exports);
32
+ tslib_1.__exportStar(require("./listenResizeThrottled"), exports);
33
+ tslib_1.__exportStar(require("./listenScroll"), exports);
34
+ tslib_1.__exportStar(require("./listenScrollDebounced"), exports);
35
+ tslib_1.__exportStar(require("./listenScrollThrottled"), exports);
36
+ tslib_1.__exportStar(require("./listen"), exports);
37
+ tslib_1.__exportStar(require("./off"), exports);
38
+ tslib_1.__exportStar(require("./once"), exports);
39
+ tslib_1.__exportStar(require("./onClickOutside"), exports);
40
+ tslib_1.__exportStar(require("./on"), exports);
41
+ tslib_1.__exportStar(require("./removeClass"), exports);
42
+ tslib_1.__exportStar(require("./scrollTo"), exports);
43
+ tslib_1.__exportStar(require("./setDataAttr"), exports);
44
+ tslib_1.__exportStar(require("./setVendorCSS"), exports);
45
+ tslib_1.__exportStar(require("./siblings"), exports);
46
+ tslib_1.__exportStar(require("./toArray"), exports);
47
+ tslib_1.__exportStar(require("./unlisten"), exports);
48
+ tslib_1.__exportStar(require("./types"), exports);
package/index.mjs ADDED
@@ -0,0 +1,45 @@
1
+ export * from "./$$";
2
+ export * from "./$each";
3
+ export * from "./$";
4
+ export * from "./addClass";
5
+ export * from "./calculateFixedOffset";
6
+ export * from "./createElement";
7
+ export * from "./emitEvent";
8
+ export * from "./escapeSelector";
9
+ export * from "./exists";
10
+ export * from "./forEach";
11
+ export * from "./getDataAttr";
12
+ export * from "./getDocumentHeight";
13
+ export * from "./getHeight";
14
+ export * from "./getListeners";
15
+ export * from "./getOffset";
16
+ export * from "./getOffsetTop";
17
+ export * from "./getOffsetTopSlim";
18
+ export * from "./getScrollbarWidth";
19
+ export * from "./getStyleValue";
20
+ export * from "./injectCss";
21
+ export * from "./isHidden";
22
+ export * from "./isInViewport";
23
+ export * from "./isNodeList";
24
+ export * from "./isTotallyScrolled";
25
+ export * from "./listenLoaded";
26
+ export * from "./listenOnce";
27
+ export * from "./listenResize";
28
+ export * from "./listenResizeDebounced";
29
+ export * from "./listenResizeThrottled";
30
+ export * from "./listenScroll";
31
+ export * from "./listenScrollDebounced";
32
+ export * from "./listenScrollThrottled";
33
+ export * from "./listen";
34
+ export * from "./off";
35
+ export * from "./once";
36
+ export * from "./onClickOutside";
37
+ export * from "./on";
38
+ export * from "./removeClass";
39
+ export * from "./scrollTo";
40
+ export * from "./setDataAttr";
41
+ export * from "./setVendorCSS";
42
+ export * from "./siblings";
43
+ export * from "./toArray";
44
+ export * from "./unlisten";
45
+ export * from "./types";
package/injectCss.js CHANGED
@@ -1,7 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.injectCss = void 0;
1
4
  /**
2
5
  * Inject css
3
6
  */
4
- export function injectCss(id, cssString, root) {
7
+ function injectCss(id, cssString, root) {
5
8
  if (cssString === void 0) { cssString = ""; }
6
9
  if (root === void 0) { root = document; }
7
10
  var styleblock;
@@ -13,4 +16,5 @@ export function injectCss(id, cssString, root) {
13
16
  }
14
17
  styleblock.innerHTML = cssString;
15
18
  }
16
- export default injectCss;
19
+ exports.injectCss = injectCss;
20
+ exports.default = injectCss;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.injectCss = void 0;
4
1
  /**
5
2
  * Inject css
6
3
  */
7
- function injectCss(id, cssString, root) {
4
+ export function injectCss(id, cssString, root) {
8
5
  if (cssString === void 0) { cssString = ""; }
9
6
  if (root === void 0) { root = document; }
10
7
  var styleblock;
@@ -16,5 +13,4 @@ function injectCss(id, cssString, root) {
16
13
  }
17
14
  styleblock.innerHTML = cssString;
18
15
  }
19
- exports.injectCss = injectCss;
20
- exports.default = injectCss;
16
+ export default injectCss;
package/isHidden.js CHANGED
@@ -1,7 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isHidden = void 0;
1
4
  /**
2
5
  * Is element hidden?
3
6
  */
4
- export function isHidden(el) {
7
+ function isHidden(el) {
5
8
  return !el || el.offsetParent === null;
6
9
  }
7
- export default isHidden;
10
+ exports.isHidden = isHidden;
11
+ exports.default = isHidden;
package/isHidden.mjs ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Is element hidden?
3
+ */
4
+ export function isHidden(el) {
5
+ return !el || el.offsetParent === null;
6
+ }
7
+ export default isHidden;
package/isInViewport.js CHANGED
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isInViewport = void 0;
1
4
  /**
2
5
  * Determine if an element is in the viewport
3
6
  *
@@ -6,7 +9,7 @@
6
9
  * @param elem The element
7
10
  * @return Returns true if element is in the viewport
8
11
  */
9
- export function isInViewport(elem) {
12
+ function isInViewport(elem) {
10
13
  var distance = elem.getBoundingClientRect();
11
14
  return (distance.top >= 0 &&
12
15
  distance.left >= 0 &&
@@ -15,4 +18,5 @@ export function isInViewport(elem) {
15
18
  distance.right <=
16
19
  (window.innerWidth || document.documentElement.clientWidth));
17
20
  }
18
- export default isInViewport;
21
+ exports.isInViewport = isInViewport;
22
+ exports.default = isInViewport;
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isInViewport = void 0;
4
1
  /**
5
2
  * Determine if an element is in the viewport
6
3
  *
@@ -9,7 +6,7 @@ exports.isInViewport = void 0;
9
6
  * @param elem The element
10
7
  * @return Returns true if element is in the viewport
11
8
  */
12
- function isInViewport(elem) {
9
+ export function isInViewport(elem) {
13
10
  var distance = elem.getBoundingClientRect();
14
11
  return (distance.top >= 0 &&
15
12
  distance.left >= 0 &&
@@ -18,5 +15,4 @@ function isInViewport(elem) {
18
15
  distance.right <=
19
16
  (window.innerWidth || document.documentElement.clientWidth));
20
17
  }
21
- exports.isInViewport = isInViewport;
22
- exports.default = isInViewport;
18
+ export default isInViewport;
package/isNodeList.js CHANGED
@@ -1,9 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNodeList = void 0;
1
4
  /**
2
5
  * Is node list
3
6
  *
4
7
  * @param nodes The object to check
5
8
  */
6
- export function isNodeList(nodes) {
9
+ function isNodeList(nodes) {
7
10
  var stringRepr = Object.prototype.toString.call(nodes);
8
11
  return (typeof nodes === "object" &&
9
12
  /^\[object (HTMLCollection|NodeList|Object)\]$/.test(stringRepr) &&
@@ -11,4 +14,5 @@ export function isNodeList(nodes) {
11
14
  (nodes.length === 0 ||
12
15
  (typeof nodes[0] === "object" && nodes[0].nodeType > 0)));
13
16
  }
14
- export default isNodeList;
17
+ exports.isNodeList = isNodeList;
18
+ exports.default = isNodeList;
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNodeList = void 0;
4
1
  /**
5
2
  * Is node list
6
3
  *
7
4
  * @param nodes The object to check
8
5
  */
9
- function isNodeList(nodes) {
6
+ export function isNodeList(nodes) {
10
7
  var stringRepr = Object.prototype.toString.call(nodes);
11
8
  return (typeof nodes === "object" &&
12
9
  /^\[object (HTMLCollection|NodeList|Object)\]$/.test(stringRepr) &&
@@ -14,5 +11,4 @@ function isNodeList(nodes) {
14
11
  (nodes.length === 0 ||
15
12
  (typeof nodes[0] === "object" && nodes[0].nodeType > 0)));
16
13
  }
17
- exports.isNodeList = isNodeList;
18
- exports.default = isNodeList;
14
+ export default isNodeList;
@@ -1,10 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTotallyScrolled = void 0;
1
4
  /**
2
5
  * Is element totally scrolled
3
6
  *
4
7
  * @see https://github.com/willmcpo/body-scroll-lock/blob/master/src/bodyScrollLock.js#L116
5
8
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
6
9
  */
7
- export function isTotallyScrolled(el) {
10
+ function isTotallyScrolled(el) {
8
11
  return el ? el.scrollHeight - el.scrollTop <= el.clientHeight : false;
9
12
  }
10
- export default isTotallyScrolled;
13
+ exports.isTotallyScrolled = isTotallyScrolled;
14
+ exports.default = isTotallyScrolled;
@@ -1,14 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTotallyScrolled = void 0;
4
1
  /**
5
2
  * Is element totally scrolled
6
3
  *
7
4
  * @see https://github.com/willmcpo/body-scroll-lock/blob/master/src/bodyScrollLock.js#L116
8
5
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
9
6
  */
10
- function isTotallyScrolled(el) {
7
+ export function isTotallyScrolled(el) {
11
8
  return el ? el.scrollHeight - el.scrollTop <= el.clientHeight : false;
12
9
  }
13
- exports.isTotallyScrolled = isTotallyScrolled;
14
- exports.default = isTotallyScrolled;
10
+ export default isTotallyScrolled;
package/listen.js CHANGED
@@ -1,5 +1,8 @@
1
- import { activeEvents, eventHandler, } from "./_listen-delegation";
2
- import { on } from "./on";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listen = void 0;
4
+ var _listen_delegation_1 = require("./_listen-delegation");
5
+ var on_1 = require("./on");
3
6
  // import { off } from "./off";
4
7
  /**
5
8
  * Listen an event
@@ -10,7 +13,7 @@ import { on } from "./on";
10
13
  * @param selector The selector to run the event on
11
14
  * @param callback The function to run when the event fires
12
15
  */
13
- export function listen(types, selector, callback) {
16
+ function listen(types, selector, callback) {
14
17
  // Make sure there's a selector and callback
15
18
  if (!selector || !callback)
16
19
  return;
@@ -19,15 +22,16 @@ export function listen(types, selector, callback) {
19
22
  // Remove whitespace
20
23
  type = type.trim();
21
24
  // If no event of this type yet, setup
22
- if (!activeEvents[type]) {
23
- activeEvents[type] = [];
24
- on(window, type, eventHandler, true);
25
+ if (!_listen_delegation_1.activeEvents[type]) {
26
+ _listen_delegation_1.activeEvents[type] = [];
27
+ (0, on_1.on)(window, type, _listen_delegation_1.eventHandler, true);
25
28
  }
26
29
  // Push to active events
27
- activeEvents[type].push({
30
+ _listen_delegation_1.activeEvents[type].push({
28
31
  selector: selector,
29
32
  callback: callback,
30
33
  });
31
34
  });
32
35
  }
33
- export default listen;
36
+ exports.listen = listen;
37
+ exports.default = listen;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listen = void 0;
4
- var _listen_delegation_1 = require("./_listen-delegation");
5
- var on_1 = require("./on");
1
+ import { activeEvents, eventHandler, } from "./_listen-delegation";
2
+ import { on } from "./on";
6
3
  // import { off } from "./off";
7
4
  /**
8
5
  * Listen an event
@@ -13,7 +10,7 @@ var on_1 = require("./on");
13
10
  * @param selector The selector to run the event on
14
11
  * @param callback The function to run when the event fires
15
12
  */
16
- function listen(types, selector, callback) {
13
+ export function listen(types, selector, callback) {
17
14
  // Make sure there's a selector and callback
18
15
  if (!selector || !callback)
19
16
  return;
@@ -22,16 +19,15 @@ function listen(types, selector, callback) {
22
19
  // Remove whitespace
23
20
  type = type.trim();
24
21
  // If no event of this type yet, setup
25
- if (!_listen_delegation_1.activeEvents[type]) {
26
- _listen_delegation_1.activeEvents[type] = [];
27
- (0, on_1.on)(window, type, _listen_delegation_1.eventHandler, true);
22
+ if (!activeEvents[type]) {
23
+ activeEvents[type] = [];
24
+ on(window, type, eventHandler, true);
28
25
  }
29
26
  // Push to active events
30
- _listen_delegation_1.activeEvents[type].push({
27
+ activeEvents[type].push({
31
28
  selector: selector,
32
29
  callback: callback,
33
30
  });
34
31
  });
35
32
  }
36
- exports.listen = listen;
37
- exports.default = listen;
33
+ export default listen;