@linear_non/stellar-libs 1.2.9 → 1.3.0

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-libs",
3
- "version": "1.2.9",
3
+ "version": "1.3.0",
4
4
  "description": "Reusable JavaScript libraries for Non-Linear Studio projects.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -1,5 +1,6 @@
1
1
  import { lerp } from "@linear_non/stellar-kit/utils"
2
2
  import { gsap } from "@linear_non/stellar-kit/gsap"
3
+ import { emitter, EVENTS } from "@linear_non/stellar-kit/events"
3
4
 
4
5
  export default class CursorTracker {
5
6
  constructor({ container, el, ease = 0.12, isCentered = true }) {
@@ -22,7 +23,7 @@ export default class CursorTracker {
22
23
  }
23
24
 
24
25
  // GLOBAL TICK
25
- tick({ mouse }) {
26
+ tick = ({ mouse }) => {
26
27
  if (!this.isHovering) return
27
28
 
28
29
  this.target.x = mouse.x
@@ -52,6 +53,7 @@ export default class CursorTracker {
52
53
 
53
54
  this.container.addEventListener("mouseenter", this.hoverIn)
54
55
  this.container.addEventListener("mouseleave", this.hoverOut)
56
+ emitter.on(EVENTS.APP_TICK, this.tick)
55
57
  }
56
58
 
57
59
  off() {
@@ -59,6 +61,7 @@ export default class CursorTracker {
59
61
 
60
62
  this.container.removeEventListener("mouseenter", this.hoverIn)
61
63
  this.container.removeEventListener("mouseleave", this.hoverOut)
64
+ emitter.off(EVENTS.APP_TICK, this.tick)
62
65
  }
63
66
 
64
67
  destroy() {
@@ -1,4 +1,5 @@
1
1
  import { gsap } from "@linear_non/stellar-kit/gsap"
2
+ import { emitter, EVENTS } from "@linear_non/stellar-kit/events"
2
3
 
3
4
  export default class Marquee {
4
5
  constructor({ container, el, speed = 50, gap = "1.6rem" }) {
@@ -69,13 +70,11 @@ export default class Marquee {
69
70
  }
70
71
 
71
72
  on() {
72
- this._onResize = () => this.setup()
73
- window.addEventListener("resize", this._onResize)
73
+ emitter.on(EVENTS.APP_RESIZE, this.setup)
74
74
  }
75
75
 
76
76
  off() {
77
- if (this._onResize) window.removeEventListener("resize", this._onResize)
78
- this._onResize = null
77
+ emitter.off(EVENTS.APP_RESIZE, this.setup)
79
78
  }
80
79
 
81
80
  destroy() {
@@ -61,8 +61,8 @@ export default class Scrollbar {
61
61
 
62
62
  calcScroll(e) {
63
63
  const delta = e.clientY * this.state.scale
64
- Raf.target = delta
65
- Raf.clampTarget()
64
+ kitStore.raf.scroll.target = delta
65
+ kitStore.raf.clamp()
66
66
  }
67
67
 
68
68
  create() {
package/src/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import Sticky from "./Sticky"
2
2
  import Smooth from "./Smooth"
3
- import SplitonScroll from "./SplitOnScroll"
3
+ import SplitOnScroll from "./SplitOnScroll"
4
4
  import Noise from "./Noise"
5
5
  import SpritePlayer from "./SpritePlayer"
6
6
  import CursorTracker from "./CursorTracker"
7
7
  import Marquee from "./Marquee"
8
8
 
9
- export { Sticky, Smooth, SplitonScroll, Noise, SpritePlayer, CursorTracker, Marquee }
9
+ export { Sticky, Smooth, SplitOnScroll, Noise, SpritePlayer, CursorTracker, Marquee }