diff --git a/src/componentAncestry/addStyleAndFunctions.js b/src/componentAncestry/addStyleAndFunctions.js index fed1e4d..fc3c138 100644 --- a/src/componentAncestry/addStyleAndFunctions.js +++ b/src/componentAncestry/addStyleAndFunctions.js @@ -14,10 +14,18 @@ class StyleAndScriptStoringComponent extends ModifiableComponent { * @type {ExtStorage} */ _styleClassesExtStore + /** + * @type {boolean} + */ + _isClassESDefault; /** * @type {ExtStorage} */ _stylesExtStore; + /** + * @type {boolean} + */ + _isStyleESDefault; /** * @type {Array} */ @@ -26,25 +34,40 @@ class StyleAndScriptStoringComponent extends ModifiableComponent { * @type {ExtStorage} */ _functionsExtStore; + /** + * @type {boolean} + */ + _isFunESDefault; /** * @type {Array} */ _functions; + /** + * + * @param {HTMLElement} element + * @param {Map} attr + */ constructor(element, attr = {}) { super(element, attr); this._styleClassesExtStore = ExtStoreType.CENTRALIZED_DOC_HEAD .setOverwriteBehaviour(OverwriteBehaviour.REPLACE); + this._isClassESDefault = true; + this._stylesExtStore = ExtStoreType.INTERNALIZED_WITHIN .setOverwriteBehaviour(OverwriteBehaviour.REPLACE); + this._isStyleESDefault = true; + this._styles = []; this._functionsExtStore = ExtStoreType.CENTRALIZED_DOC_HEAD .setOverwriteBehaviour(OverwriteBehaviour.REPLACE); + this._isFunESDefault = true; + this._functions = []; } @@ -55,7 +78,7 @@ class StyleAndScriptStoringComponent extends ModifiableComponent { * @todo: Differentiate between directions (horizontal, vertiacl) * @override * @inheritdoc - * Sets the alignment (modifications) for this element or more specific for its children. + * Sets the alignment (modifications) for this element. * @param {Alignment} alignment * @returns {Component} this component object */ @@ -69,7 +92,7 @@ class StyleAndScriptStoringComponent extends ModifiableComponent { this._alignment = alignment; this._modifier._modifications["align-content"] = this._alignment; this._modifier._modifications["align-items"] = this._alignment; - this._modifier._modifications["text-align"] = this._alignment; + this._modifier._modifications["text-align"] = this._alignment; return this; } @@ -80,6 +103,7 @@ class StyleAndScriptStoringComponent extends ModifiableComponent { * @override * @inheritdoc * Sets the arrangement (modifications) for this element or more specific for its children. + * Therefore it defines the space distribution to the children. * @param {Arrangement} arrangement * @returns {Component} this component object */ @@ -110,6 +134,7 @@ class StyleAndScriptStoringComponent extends ModifiableComponent { } else { this._stylesExtStore.OverwriteBehaviour(extStore); } + this._isStyleESDefault = false; } else { console.log("(Style)ExtStore was empty, did nothing"); } @@ -133,6 +158,7 @@ class StyleAndScriptStoringComponent extends ModifiableComponent { } else { this._stylesExtStore.OverwriteBehaviour(extStore); } + this._isFunESDefault = false; } else { console.log("(Function)ExtStore was empty, did nothing"); } diff --git a/src/componentAncestry/wrapperComponent.js b/src/componentAncestry/wrapperComponent.js index edea0f0..3d1b701 100644 --- a/src/componentAncestry/wrapperComponent.js +++ b/src/componentAncestry/wrapperComponent.js @@ -58,6 +58,7 @@ class ElementWrapper { /** * (Wrapper) Sets the innerText of the element + * @todo add Alignment of text functionality * @param {string} text * @returns {Component} this component object */ @@ -193,7 +194,11 @@ class ChildbearerComponent extends ElementWrapper { this.childContext(component[i]); } } else { - this._children.push(component); + if (!(component instanceof Component)) { + this.childContext(component.toComponent()) + } else { + this._children.push(component); + } } return this; }