diff --git a/src/modifier.js b/src/modifier.js index 4902796..2576427 100644 --- a/src/modifier.js +++ b/src/modifier.js @@ -59,7 +59,7 @@ class Modifier { */ padding(siding) { let keyToAdd = ""; - if (siding instanceof ChainablePadding || siding instanceof PaddingChain) { + if (siding instanceof PaddingChain) { } else if (siding instanceof Sides) { keyToAdd = "padding-" @@ -225,30 +225,6 @@ class ChainableModifier extends Modifier { this._component = component; } - /** - * - * @returns {ChainableDimensions} - */ - linkDimensions() { - return new ChainableDimensions(this); - } - - /** - * - * @returns {ChainablePadding} - */ - linkPadding() { - return new ChainablePadding(this); - } - - /** - * - * @returns {ChainableShape} - */ - linkClip() { - return new ChainableShape(this); - } - /** * * @returns {Component} @@ -259,18 +235,7 @@ class ChainableModifier extends Modifier { /** * - * @param {Component} innerComponent - * @returns {Component} the parent Component - */ - childContext(innerComponent) { - return this._component - .modifier(this) - .childContext(innerComponent); - } - - /** - * - * @param {Array} innerComponent + * @param {Component|Array} innerComponent * @returns {Component} the parent Component */ childContext(innerComponent) { diff --git a/src/sizeSide/dimensions.js b/src/sizeSide/dimensions.js index 6b0720a..ae42005 100644 --- a/src/sizeSide/dimensions.js +++ b/src/sizeSide/dimensions.js @@ -79,15 +79,22 @@ class DimensionsChain extends Dimensions { ensureModifier() { return this.toModifier() } -} -class ChainableDimensions extends DimensionsChain { + /** + * + * @returns {Component} the Component that was (supposed to be) modified by this obj. + */ toComponent() { return this._modifier .dimensions(this) .toComponent(); } + /** + * + * @param {Component|Array} innerComponent children of the Component under modification. + * @returns {Component} + */ childContext(innerComponent) { return this._modifier .dimensions(this) diff --git a/src/sizeSide/shapes.js b/src/sizeSide/shapes.js index 1c7607f..7ab1077 100644 --- a/src/sizeSide/shapes.js +++ b/src/sizeSide/shapes.js @@ -84,24 +84,38 @@ class ShapeChain extends Shape { this._modifier = modifier; } + /** + * + * @returns {Modifier|ChainableModifier} + */ toModifier() { return this._modifier .clip(this); } - + /** + * + * @returns {Modifier|ChainableModifier} + */ ensureModifier() { return this.toModifier() } -} -class ChainableShape extends ShapeChain { + /** + * + * @returns {Component} the Component that was (supposed to be) modified by this obj. + */ toComponent() { return this._modifier .clip(this) .toComponent(); } + /** + * + * @param {Component|Array} innerComponent children of the Component under modification. + * @returns {Component} + */ childContext(innerComponent) { return this._modifier .clip(this) diff --git a/src/sizeSide/siding.js b/src/sizeSide/siding.js index 6a9e3ca..f2a6a8b 100644 --- a/src/sizeSide/siding.js +++ b/src/sizeSide/siding.js @@ -33,7 +33,7 @@ class DirectionUnitDependentAttribute { * * @returns {array<*>} list of attributes */ - getOrderedAttributes(){ + getOrderedAttributes() { return [this._fFirst, this._fSecond, this._fThird, this._fForth]; } @@ -41,7 +41,7 @@ class DirectionUnitDependentAttribute { * @returns {Array} */ getOrderedValues() { - return this.getOrderedAttributes().map(a=>a+this._unit); + return this.getOrderedAttributes().map(a => a + this._unit); } /** @@ -222,6 +222,10 @@ class PaddingChain extends Sides { return this.toModifier() } + /** + * Returns the style-modifications of the class. + * @returns {Map} + */ toModifications() { return [ { key: "padding-left", value: this._fFirst + this._unit }, @@ -230,16 +234,22 @@ class PaddingChain extends Sides { { key: "padding-bottom", value: this._fForth + this._unit } ] } -} - -class ChainablePadding extends PaddingChain { + /** + * + * @returns {Component} the Component that was (supposed to be) modified by this obj. + */ toComponent() { return this._modifier .padding(this) .toComponent(); } + /** + * + * @param {Component|Array} innerComponent children of the Component under modification. + * @returns {Component} + */ childContext(innerComponent) { return this._modifier .padding(this)