From 3782344e1f88530897d9f540b588e518c926792e Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 18 Feb 2025 15:28:59 +0100 Subject: [PATCH] FEAT: added hidden() and overflow() functions --- src/component.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/component.js b/src/component.js index 6cdee27..5283f9e 100644 --- a/src/component.js +++ b/src/component.js @@ -84,6 +84,38 @@ class Component extends StyleAndScriptStoringComponent { return this; } + /** + * + * @param {boolean} vertical Defines if the Component should overflow vertically (default: true) + * @param {boolean} horizontal Defines if the Component should overflow horizontally (default: false) + * @returns {Component} + */ + overflow(vertical = true, horizontal = false) { + if (vertical) { + this._modifier._modifications["overflow-y"] = "auto"; + } + if (horizontal) { + this._modifier._modifications["overflow-x"] = "auto"; + } + return this; + } + + + /** + * + * @param {boolean} untilFound + * @returns {Component} + */ + hidden(untilFound = false) { + this._modifier.removeStyleRule("display"); + this.setAttribute( + "hidden", + (untilFound ? "until-found" : "hidden") + ); + + return this; + } + /** * * @returns {Component}