@loudy/lib 0.0.4 → 0.0.5
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/dist/index.d.mts +1 -1
- package/dist/index.mjs +6 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region src/index.ts
|
|
2
2
|
function $(elementName) {
|
|
3
|
-
|
|
3
|
+
const element = document.querySelector(elementName);
|
|
4
|
+
return element ? new LoudLibElement(element) : null;
|
|
4
5
|
}
|
|
5
6
|
var LoudLibElement = class {
|
|
6
7
|
constructor(element) {
|
|
@@ -18,17 +19,16 @@ var LoudLibElement = class {
|
|
|
18
19
|
hidden = false;
|
|
19
20
|
hide() {
|
|
20
21
|
this.element.style.display = "none";
|
|
22
|
+
this.hidden = true;
|
|
21
23
|
return this;
|
|
22
24
|
}
|
|
23
25
|
show() {
|
|
24
|
-
this.element.style.display = "
|
|
26
|
+
this.element.style.display = "";
|
|
27
|
+
this.hidden = false;
|
|
25
28
|
return this;
|
|
26
29
|
}
|
|
27
30
|
toggle() {
|
|
28
|
-
this.hidden
|
|
29
|
-
if (this.hidden == false) this.element.style.display = "initial";
|
|
30
|
-
else if (this.hidden == true) this.element.style.display = "none";
|
|
31
|
-
return this;
|
|
31
|
+
return this.hidden ? this.show() : this.hide();
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
|