@linear_non/stellar-kit 2.1.15 → 2.1.17

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,11 +1,20 @@
1
+ // Manager.js
1
2
  import { qsa } from "../utils"
2
3
 
3
4
  export default class Manager {
4
5
  constructor({ data = {} } = {}) {
5
- this.components = [] // now stores { name, component }
6
+ this.components = [] // { name, component }
6
7
  this.data = data
7
8
  }
8
9
 
10
+ getComponents(name) {
11
+ return this.components.filter(c => c.name === name).map(c => c.component)
12
+ }
13
+
14
+ getComponent(name, index = 0) {
15
+ return this.getComponents(name)[index] || null
16
+ }
17
+
9
18
  addComponent(def, renderer = null) {
10
19
  if (!def || !def.instance || !def.name) return
11
20
 
@@ -33,7 +42,6 @@ export default class Manager {
33
42
  data: mergedData,
34
43
  })
35
44
 
36
- // ⬅️ NEW STORAGE FORMAT
37
45
  this.components.push({
38
46
  name,
39
47
  component,
@@ -1,4 +1,4 @@
1
- //MasterLoader.js
1
+ // MasterLoader.js
2
2
  import { emitter, EVENTS } from "../events"
3
3
 
4
4
  export default class MasterLoader {
package/events/Resize.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { sizes, flags, breakpoints } from "../kitStore"
3
3
  import emitter, { EVENTS } from "./Emitter"
4
4
  import debounce from "lodash.debounce"
5
- import { sniffer, getWindowSizes, getViewport, setViewportHeight, raf2 } from "../utils"
5
+ import { sniffer, getWindowSizes, getViewport, setViewportHeight } from "../utils"
6
6
  import { ScrollTrigger } from "../libraries/gsap"
7
7
 
8
8
  export default class Resize {
@@ -71,7 +71,18 @@ export default class Resize {
71
71
  }
72
72
 
73
73
  on() {
74
- window.addEventListener("resize", debounce(this.onResize, 200))
74
+ let scheduled = false
75
+
76
+ const handler = () => {
77
+ if (scheduled) return
78
+ scheduled = true
79
+ requestAnimationFrame(() => {
80
+ scheduled = false
81
+ this.onResize()
82
+ })
83
+ }
84
+
85
+ window.addEventListener("resize", debounce(handler, 200), { passive: true })
75
86
  window.addEventListener("load", this.onLoadOnce, { once: true })
76
87
  }
77
88
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linear_non/stellar-kit",
3
- "version": "2.1.15",
3
+ "version": "2.1.17",
4
4
  "description": "Stellar frontend core for Non-Linear Studio projects.",
5
5
  "main": "index.js",
6
6
  "exports": {