Browse Source

DOC: InputComponent class extending Component

dev-feat-component_preview
chris 4 months ago
parent
commit
7ff88c0e66
  1. 8
      src/builder.js
  2. 3
      src/component.js
  3. 9
      src/context/generalHelpers.js
  4. 35
      src/sizeSide/siding.js

8
src/builder.js

@ -93,7 +93,7 @@ const builder = {
* @param {InputTypes|string} type
* @param {Map<string,string>} attr
* @param {Modifier} modifier
* @returns {Component}
* @returns {InputComponent}
*/
input: function (type, attr = {}, modifier = null) {
return new InputComponent(
@ -109,7 +109,7 @@ const builder = {
*
* @param {Map<string,string>} attr
* @param {Modifier} modifier
* @returns {Function<Component>}
* @returns {function(Object): InputComponent}
*/
inputTags: Object.freeze({
button: function (attr = {}, modifier = null) { return builder.input("button", attr, modifier) },
@ -172,7 +172,7 @@ const builder = {
*
* @param {Map<string,string>} attr
* @param {Modifier} modifier
* @returns {Component}
* @returns {InputComponent}
*/
checkbox: function (attr = {}, modifier = null) { return builder.input({ "type": "checkbox" }, modifier) },
@ -220,7 +220,7 @@ const builder = {
*
* @param {Map<string,string>} attr
* @param {Modifier} modifier
* @returns {Component}
* @returns {InputComponent}
*/
textarea: function (attr = {}, modifier = null) {
return new InputComponent(

3
src/component.js

@ -126,6 +126,9 @@ class Component extends StyleAndScriptStoringComponent {
}
/**
* Subscribes element under higher_compel group
* sets corr. variable true
* setAttribute("data-compel-isHCompel", "true")
*
* @returns {Component}
*/

9
src/context/generalHelpers.js

@ -78,7 +78,14 @@ class ObjectAccessObject {
}
/**
* (De-) hides the given element.
* On ensureHidden=true it will be hidden regardless of the current state.
*
* @param {HTMLElement} element
* @param {boolean} ensureHidden
* @returns {boolean}
*/
function toggleElementVisibility(element, ensureHidden = false) {
element.classList.toggle("compel-mech-hidden");

35
src/sizeSide/siding.js

@ -176,8 +176,8 @@ class Sides extends DirectionUnitDependentAttribute {
/**
* sets the amount-value for the left side.
* @param {number} amount siding for left
* @returns {Siding} this Siding Object
* @param {number} amount Sides for left
* @returns {Sides} this Sides Object
*/
left(amount) {
return this.setByIndex(1, amount);
@ -185,8 +185,8 @@ class Sides extends DirectionUnitDependentAttribute {
/**
* sets the amount-value for the right side.
* @param {number} amount siding for right
* @returns {Siding} this Siding Object
* @param {number} amount Sides for right
* @returns {Sides} this Sides Object
*/
right(amount) {
return this.setByIndex(3, amount);
@ -194,8 +194,8 @@ class Sides extends DirectionUnitDependentAttribute {
/**
* sets the amount-value for the top side.
* @param {number} amount siding for top
* @returns {Siding} this Siding Object
* @param {number} amount Sides for top
* @returns {Sides} this Sides Object
*/
top(amount) {
return this.setByIndex(2, amount);
@ -203,8 +203,8 @@ class Sides extends DirectionUnitDependentAttribute {
/**
* sets the amount-value for the bottom side.
* @param {number} amount siding for bottom
* @returns {Siding} this Siding Object
* @param {number} amount Sides for bottom
* @returns {Sides} this Sides Object
*/
bottom(amount) {
return this.setByIndex(4, amount);
@ -213,8 +213,8 @@ class Sides extends DirectionUnitDependentAttribute {
/**
* sets the amount-value for the horizontal sides (left and right).
* @param {number} amount siding for left and right.
* @returns {Sides} this Siding Object
* @param {number} amount Sides for left and right.
* @returns {Sides} this Sides Object
*/
horizontal(amount) {
return this.left(amount).right(amount);
@ -222,8 +222,8 @@ class Sides extends DirectionUnitDependentAttribute {
/**
* sets the amount-value for the vertical sides (left and right).
* @param {number} amount siding for top and bottom.
* @returns {Sides} this Siding Object
* @param {number} amount Sides for top and bottom.
* @returns {Sides} this Sides Object
*/
vertical(amount) {
return this.top(amount).bottom(amount);
@ -259,12 +259,23 @@ class Sides extends DirectionUnitDependentAttribute {
* @extends Sides
*/
class PaddingChain extends Sides {
/**
* @type {Modifier}
*/
_modifier;
/**
*
* @param {Modifier} modifier
*/
constructor(modifier) {
super();
this._modifier = modifier;
}
/**
*
* @returns {Modifier}
*/
toModifier() {
return this._modifier
.padding(this);

Loading…
Cancel
Save