@linear_non/stellar-kit 1.1.0 → 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/events/Resize.js CHANGED
@@ -52,11 +52,14 @@ export default class Resize {
52
52
 
53
53
  updateBodyClasses() {
54
54
  const { vw, vh } = sizes
55
- const orientationClass = vw > vh ? "is-landscape" : "is-portrait"
56
- const deviceClass = sniffer.isDesktop ? "is-desktop" : "is-device"
55
+ const isLandscape = vw > vh
56
+ const isDesktop = sniffer.isDesktop
57
57
 
58
- document.body.classList.add(orientationClass)
59
- document.body.classList.add(deviceClass)
58
+ document.body.classList.toggle("is-landscape", isLandscape)
59
+ document.body.classList.toggle("is-portrait", !isLandscape)
60
+
61
+ document.body.classList.toggle("is-desktop", isDesktop)
62
+ document.body.classList.toggle("is-device", !isDesktop)
60
63
  }
61
64
 
62
65
  on() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linear_non/stellar-kit",
3
- "version": "1.1.0",
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
+ }