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