@linear_non/stellar-kit 1.1.1 → 1.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linear_non/stellar-kit",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Stellar frontend core for Non-Linear Studio projects.",
5
5
  "main": "index.js",
6
6
  "exports": {
package/utils/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { qs, qsa, getid, gettag } from "./selector"
2
2
  export { bounds } from "./bounds"
3
+ export { offset } from "./offset"
3
4
  export { getViewport, getWindowSizes, setViewportHeight } from "./window"
4
5
  export { sniffer } from "./sniffer"
5
6
  export { lerp, clamp, norm, round } from "./math"
@@ -0,0 +1,14 @@
1
+ // offset.js
2
+ // Helpfull to use instead of
3
+ // bounds when using smooth scroll
4
+ export const offset = el => {
5
+ let left = 0,
6
+ top = 0
7
+ const node = el
8
+ while (el) {
9
+ left += el.offsetLeft
10
+ top += el.offsetTop
11
+ el = el.offsetParent
12
+ }
13
+ return { left, top, bottom: top + node.offsetHeight }
14
+ }