@alexgyver/component 1.0.6 → 1.0.7
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
CHANGED
|
@@ -79,7 +79,7 @@ export class Component {
|
|
|
79
79
|
also {function} - вызвать с текущим компонентом: { ... , also(el) { console.log(el); }, }
|
|
80
80
|
var {string} создаёт переменную $имя в указанном контексте
|
|
81
81
|
events {object} добавляет addEventListener'ы {event: handler}
|
|
82
|
-
|
|
82
|
+
parent - {Element} добавляет компонент к указанному элементу (имеет смысл только для корневого компонента)
|
|
83
83
|
style {string | object} объект в виде { padding: '0px', ... } или строка css стилей
|
|
84
84
|
children - массив DOM, Component, object, html string
|
|
85
85
|
*/
|
|
@@ -110,7 +110,7 @@ export class Component {
|
|
|
110
110
|
case 'also': if (context) val.call(context, $el); break;
|
|
111
111
|
case 'var': if (context) context['$' + val] = $el; break;
|
|
112
112
|
case 'events': for (const [ev, handler] of Object.entries(val)) $el.addEventListener(ev, handler.bind(context)); break;
|
|
113
|
-
case '
|
|
113
|
+
case 'parent': if (val instanceof Element) val.append($el); break;
|
|
114
114
|
case 'style':
|
|
115
115
|
if (typeof val === 'string') $el.style = val + ';';
|
|
116
116
|
else for (const [skey, sval] of Object.entries(val)) $el.style[skey] = sval;
|
package/package.json
CHANGED
|
File without changes
|