tool-shack 0.0.18 → 0.0.19

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.
@@ -1,4 +1,4 @@
1
- import { getOffset } from '../dom/getElementOffset.js';
1
+ import { getElementOffset } from '../dom/getElementOffset.js';
2
2
  import { scrollToPosition } from './scrollToPosition.js';
3
3
  /**
4
4
  * Scroll window to make HTMLElement visible
@@ -10,6 +10,6 @@ import { scrollToPosition } from './scrollToPosition.js';
10
10
  */
11
11
  export const scrollToElement = (element, offset = 0, smoothScroll = true) => {
12
12
  offset = offset ?? window.innerHeight / 6;
13
- scrollToPosition(0, getOffset(element).top - offset, smoothScroll);
13
+ scrollToPosition(0, getElementOffset(element).top - offset, smoothScroll);
14
14
  };
15
15
  //# sourceMappingURL=scrollToElement.js.map
@@ -4,7 +4,7 @@
4
4
  * @param element HTMLElement for which should be calculated offset
5
5
  * @returns Object with top and left offset value
6
6
  */
7
- export declare const getOffset: (element: HTMLElement) => {
7
+ export declare const getElementOffset: (element: HTMLElement) => {
8
8
  top: number;
9
9
  left: number;
10
10
  };
@@ -4,7 +4,7 @@
4
4
  * @param element HTMLElement for which should be calculated offset
5
5
  * @returns Object with top and left offset value
6
6
  */
7
- export const getOffset = (element) => {
7
+ export const getElementOffset = (element) => {
8
8
  const box = element.getBoundingClientRect();
9
9
  return { top: box.top + window.pageYOffset, left: box.left + window.pageXOffset };
10
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tool-shack",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Collection of usefull functions to ease work",
5
5
  "author": {
6
6
  "name": "David Myška",
@@ -1,4 +1,4 @@
1
- import { getOffset } from '../dom/getElementOffset.js';
1
+ import { getElementOffset } from '../dom/getElementOffset.js';
2
2
  import { scrollToPosition } from './scrollToPosition.js';
3
3
 
4
4
  /**
@@ -16,5 +16,5 @@ export const scrollToElement = (
16
16
  ): void => {
17
17
  offset = offset ?? window.innerHeight / 6;
18
18
 
19
- scrollToPosition(0, getOffset(element).top - offset, smoothScroll);
19
+ scrollToPosition(0, getElementOffset(element).top - offset, smoothScroll);
20
20
  };
@@ -4,7 +4,7 @@
4
4
  * @param element HTMLElement for which should be calculated offset
5
5
  * @returns Object with top and left offset value
6
6
  */
7
- export const getOffset = (element: HTMLElement): { top: number; left: number } => {
7
+ export const getElementOffset = (element: HTMLElement): { top: number; left: number } => {
8
8
  const box: DOMRect = element.getBoundingClientRect();
9
9
 
10
10
  return { top: box.top + window.pageYOffset, left: box.left + window.pageXOffset };