@linear_non/stellar-kit 2.1.13 → 2.1.15

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.
Files changed (2) hide show
  1. package/classes/Manager.js +11 -10
  2. package/package.json +1 -1
@@ -2,9 +2,7 @@ import { qsa } from "../utils"
2
2
 
3
3
  export default class Manager {
4
4
  constructor({ data = {} } = {}) {
5
- this.components = []
6
-
7
- this.renderer = null
5
+ this.components = [] // now stores { name, component }
8
6
  this.data = data
9
7
  }
10
8
 
@@ -12,15 +10,12 @@ export default class Manager {
12
10
  if (!def || !def.instance || !def.name) return
13
11
 
14
12
  const { name, instance, data = null } = def
15
- this.renderer = renderer
16
13
 
17
14
  // resolve selector from name
18
15
  let selector
19
16
  if (name.startsWith(".") || name.startsWith("[")) {
20
- // "Class: .c-hero" or "Attribute: [data-hero]"
21
17
  selector = name
22
18
  } else {
23
- // "Transform: hero" -> "[data-hero]"
24
19
  selector = `[data-${name}]`
25
20
  }
26
21
 
@@ -30,20 +25,26 @@ export default class Manager {
30
25
  const mergedData = data ? { ...this.data, ...data } : this.data
31
26
 
32
27
  els.forEach((el, index) => {
33
- const c = new instance({
28
+ const component = new instance({
34
29
  el,
35
30
  index,
36
31
  name,
37
- renderer: this.renderer,
32
+ renderer,
38
33
  data: mergedData,
39
34
  })
40
35
 
41
- this.components.push(c)
36
+ // ⬅️ NEW STORAGE FORMAT
37
+ this.components.push({
38
+ name,
39
+ component,
40
+ })
42
41
  })
43
42
  }
44
43
 
44
+ // INTERNAL CALLER
45
45
  _call(method, ...args) {
46
- this.components.forEach(c => {
46
+ this.components.forEach(entry => {
47
+ const c = entry.component
47
48
  const fn = c[method]
48
49
  if (typeof fn === "function") fn.apply(c, args)
49
50
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linear_non/stellar-kit",
3
- "version": "2.1.13",
3
+ "version": "2.1.15",
4
4
  "description": "Stellar frontend core for Non-Linear Studio projects.",
5
5
  "main": "index.js",
6
6
  "exports": {