@alexgyver/component 1.3.1 → 1.3.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/Component.js +4 -2
- package/package.json +1 -1
package/Component.js
CHANGED
|
@@ -57,14 +57,14 @@ export class Component {
|
|
|
57
57
|
}
|
|
58
58
|
if (!(el instanceof Node) || (typeof data !== 'object')) return el;
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
Component.ctx = (data.context === null) ? null : (data.context ? data.context : Component.ctx);
|
|
61
|
+
const ctx = Component.ctx;
|
|
61
62
|
|
|
62
63
|
let addChild = (obj) => {
|
|
63
64
|
if (!obj) return;
|
|
64
65
|
if (obj instanceof Node) el.appendChild(obj);
|
|
65
66
|
else if (obj instanceof Component) el.appendChild(obj.$root);
|
|
66
67
|
else if (typeof obj === 'object') {
|
|
67
|
-
if (!obj.context) obj.context = ctx;
|
|
68
68
|
let cmp = Component.make(obj.tag ?? 'div', obj, svg || obj.tag == 'svg');
|
|
69
69
|
if (cmp) el.appendChild(cmp);
|
|
70
70
|
} else if (typeof obj === 'string') {
|
|
@@ -151,6 +151,8 @@ export class Component {
|
|
|
151
151
|
Component.config($host, data);
|
|
152
152
|
return $host;
|
|
153
153
|
}
|
|
154
|
+
|
|
155
|
+
static ctx;
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
export class Sheet {
|