@angelscmf/front 1.0.28 → 1.0.30
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/AngelsFrontAnimationLibrary.d.mts +5 -0
- package/dist/AngelsFrontAnimationLibrary.d.ts +4 -4
- package/dist/AngelsFrontAnimationLibrary.js +120 -25
- package/dist/AngelsFrontAnimationLibrary.js.map +1 -1
- package/dist/{AngelsFrontLibrary.cjs → AngelsFrontAnimationLibrary.mjs} +93 -28
- package/dist/AngelsFrontAnimationLibrary.mjs.map +1 -0
- package/dist/AngelsFrontApplication.d.mts +11 -0
- package/dist/AngelsFrontApplication.d.ts +3 -2
- package/dist/AngelsFrontApplication.js +271 -28
- package/dist/AngelsFrontApplication.js.map +1 -1
- package/dist/AngelsFrontApplication.mjs +353 -0
- package/dist/AngelsFrontApplication.mjs.map +1 -0
- package/dist/AngelsFrontDOMLibrary.d.mts +12 -0
- package/dist/AngelsFrontDOMLibrary.d.ts +11 -2
- package/dist/AngelsFrontDOMLibrary.js +390 -7
- package/dist/AngelsFrontDOMLibrary.js.map +1 -1
- package/dist/AngelsFrontDOMLibrary.mjs +378 -0
- package/dist/AngelsFrontDOMLibrary.mjs.map +1 -0
- package/dist/AngelsFrontElement.d.mts +14 -0
- package/dist/AngelsFrontElement.d.ts +14 -0
- package/dist/{AngelsFrontAnimationLibrary.cjs → AngelsFrontElement.js} +93 -34
- package/dist/AngelsFrontElement.js.map +1 -0
- package/dist/{AngelsFrontLibrary.js → AngelsFrontElement.mjs} +90 -26
- package/dist/AngelsFrontElement.mjs.map +1 -0
- package/dist/AngelsFrontLoader.js +623 -0
- package/dist/AngelsFrontLoader.js.map +1 -0
- package/dist/AngelsFrontLoader.mjs +622 -0
- package/dist/AngelsFrontLoader.mjs.map +1 -0
- package/dist/{AngelsFrontMod.d.cts → AngelsFrontMod.d.mts} +4 -3
- package/dist/AngelsFrontMod.d.ts +4 -3
- package/dist/AngelsFrontMod.js +40 -17
- package/dist/AngelsFrontMod.js.map +1 -1
- package/dist/{AngelsFrontComponent.js → AngelsFrontMod.mjs} +18 -37
- package/dist/AngelsFrontMod.mjs.map +1 -0
- package/dist/AngelsFrontPage.d.mts +11 -0
- package/dist/AngelsFrontPage.d.ts +3 -2
- package/dist/AngelsFrontPage.js +271 -28
- package/dist/AngelsFrontPage.js.map +1 -1
- package/dist/AngelsFrontPage.mjs +353 -0
- package/dist/AngelsFrontPage.mjs.map +1 -0
- package/dist/AngelsFrontWidgetClass.d.mts +15 -0
- package/dist/AngelsFrontWidgetClass.d.ts +15 -0
- package/dist/AngelsFrontWidgetClass.js +371 -0
- package/dist/AngelsFrontWidgetClass.js.map +1 -0
- package/dist/AngelsFrontWidgetClass.mjs +349 -0
- package/dist/AngelsFrontWidgetClass.mjs.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +9 -2
- package/sass/AngelsDesign.scss +1 -0
- package/sass/_AngelsHTMLElements.scss +244 -244
- package/sass/_AngelsPageLayout.scss +0 -4
- package/sass/_AngelsTheme.scss +47 -15
- package/sass/_AngelsVariables.scss +1 -4
- package/sass/angelsMessages/_AngelsAlert.scss +23 -12
- package/sass/angelsMessages/_AngelsDebug.scss +18 -12
- package/sass/angelsMessages/_AngelsDone.scss +18 -12
- package/sass/angelsMessages/_AngelsError.scss +18 -12
- package/sass/angelsMessages/_AngelsInfo.scss +18 -12
- package/sass/angelsMessages/_AngelsTip.scss +18 -12
- package/sass/angelsMessages/_AngelsWarn.scss +18 -12
- package/sass/angelsTags/_a-page.scss +13 -4
- package/sass/angelsTags/_a-state.scss +11 -0
- package/sass/angelsTags/_a-table.scss +22 -19
- package/dist/AngelsCore.cjs +0 -203
- package/dist/AngelsCore.cjs.map +0 -1
- package/dist/AngelsCore.js +0 -202
- package/dist/AngelsCore.js.map +0 -1
- package/dist/AngelsFrontAnimationLibrary.cjs.map +0 -1
- package/dist/AngelsFrontAnimationLibrary.d.cts +0 -5
- package/dist/AngelsFrontApplication.cjs +0 -155
- package/dist/AngelsFrontApplication.cjs.map +0 -1
- package/dist/AngelsFrontApplication.d.cts +0 -10
- package/dist/AngelsFrontComponent.cjs +0 -151
- package/dist/AngelsFrontComponent.cjs.map +0 -1
- package/dist/AngelsFrontComponent.d.cts +0 -11
- package/dist/AngelsFrontComponent.d.ts +0 -11
- package/dist/AngelsFrontComponent.js.map +0 -1
- package/dist/AngelsFrontDOMLibrary.cjs +0 -51
- package/dist/AngelsFrontDOMLibrary.cjs.map +0 -1
- package/dist/AngelsFrontDOMLibrary.d.cts +0 -3
- package/dist/AngelsFrontLibrary.cjs.map +0 -1
- package/dist/AngelsFrontLibrary.d.ts +0 -2
- package/dist/AngelsFrontLibrary.js.map +0 -1
- package/dist/AngelsFrontMod.cjs +0 -128
- package/dist/AngelsFrontMod.cjs.map +0 -1
- package/dist/AngelsFrontPage.cjs +0 -155
- package/dist/AngelsFrontPage.cjs.map +0 -1
- package/dist/AngelsFrontPage.d.cts +0 -10
- package/dist/index.cjs +0 -2
- package/dist/index.d.cts +0 -2
- /package/dist/{AngelsCore.d.cts → AngelsFrontLoader.d.mts} +0 -0
- /package/dist/{AngelsCore.d.ts → AngelsFrontLoader.d.ts} +0 -0
- /package/dist/{AngelsFrontLibrary.d.cts → index.d.mts} +0 -0
- /package/dist/{index.cjs.map → index.mjs.map} +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare function aLibConcealElement(originalElement: AngelsSelectorType): Promise<void>;
|
|
2
|
+
declare function aLibEngageElement(originalElement: AngelsSelectorType, switcher?: boolean | undefined): Promise<void>;
|
|
3
|
+
declare function aLibRevealElement(originalElement: AngelsSelectorType): Promise<void>;
|
|
4
|
+
|
|
5
|
+
export { aLibConcealElement, aLibEngageElement, aLibRevealElement };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
declare function
|
|
3
|
-
declare function
|
|
1
|
+
declare function aLibConcealElement(originalElement: AngelsSelectorType): Promise<void>;
|
|
2
|
+
declare function aLibEngageElement(originalElement: AngelsSelectorType, switcher?: boolean | undefined): Promise<void>;
|
|
3
|
+
declare function aLibRevealElement(originalElement: AngelsSelectorType): Promise<void>;
|
|
4
4
|
|
|
5
|
-
export {
|
|
5
|
+
export { aLibConcealElement, aLibEngageElement, aLibRevealElement };
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
19
|
var __async = (__this, __arguments, generator) => {
|
|
2
20
|
return new Promise((resolve, reject) => {
|
|
3
21
|
var fulfilled = (value) => {
|
|
@@ -19,35 +37,111 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19
37
|
});
|
|
20
38
|
};
|
|
21
39
|
|
|
40
|
+
// src/AngelsFrontAnimationLibrary.ts
|
|
41
|
+
var AngelsFrontAnimationLibrary_exports = {};
|
|
42
|
+
__export(AngelsFrontAnimationLibrary_exports, {
|
|
43
|
+
aLibConcealElement: () => aLibConcealElement,
|
|
44
|
+
aLibEngageElement: () => aLibEngageElement,
|
|
45
|
+
aLibRevealElement: () => aLibRevealElement
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(AngelsFrontAnimationLibrary_exports);
|
|
48
|
+
|
|
49
|
+
// src/AngelsFrontElement.ts
|
|
50
|
+
var AngelsFrontElementClass = class {
|
|
51
|
+
constructor(element) {
|
|
52
|
+
this.originalElement = element;
|
|
53
|
+
return new Proxy(this, {
|
|
54
|
+
get(target, prop, receiver) {
|
|
55
|
+
if (prop in target) {
|
|
56
|
+
return Reflect.get(target, prop);
|
|
57
|
+
}
|
|
58
|
+
const valueOfProperty = Reflect.get(target.originalElement, prop);
|
|
59
|
+
if (typeof valueOfProperty === "function") {
|
|
60
|
+
return valueOfProperty.bind(target.originalElement);
|
|
61
|
+
}
|
|
62
|
+
return valueOfProperty;
|
|
63
|
+
},
|
|
64
|
+
set(target, prop, newValue, receiver) {
|
|
65
|
+
if (prop in target.originalElement) {
|
|
66
|
+
target.originalElement[prop] = newValue;
|
|
67
|
+
} else {
|
|
68
|
+
target[prop] = newValue;
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
aConcealElement() {
|
|
75
|
+
aLibConcealElement(this.originalElement);
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
aEngageElement(switcher = void 0) {
|
|
79
|
+
aLibEngageElement(this.originalElement, switcher);
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
aHideElement() {
|
|
83
|
+
this.originalElement.hidden = true;
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
aRevealElement() {
|
|
87
|
+
aLibRevealElement(this.originalElement);
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
aShowElement() {
|
|
91
|
+
this.originalElement.hidden = false;
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
aSetTextContent(content) {
|
|
95
|
+
const contentToSet = content.toString();
|
|
96
|
+
this.originalElement.textContent = contentToSet;
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
aTextContent() {
|
|
100
|
+
if (this.originalElement.textContent === null) {
|
|
101
|
+
return ``;
|
|
102
|
+
}
|
|
103
|
+
return this.originalElement.textContent;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
22
107
|
// src/AngelsFrontDOMLibrary.ts
|
|
23
|
-
function
|
|
108
|
+
function aLibFindElement(selector) {
|
|
24
109
|
let element;
|
|
25
110
|
if (typeof selector === "undefined") {
|
|
26
|
-
|
|
111
|
+
return null;
|
|
27
112
|
} else if (selector === null) {
|
|
28
|
-
|
|
113
|
+
return null;
|
|
29
114
|
} else if (typeof selector === "string") {
|
|
30
115
|
const findElement = document.querySelector(selector);
|
|
31
116
|
if (!findElement) {
|
|
32
|
-
|
|
117
|
+
return null;
|
|
33
118
|
}
|
|
34
119
|
element = findElement;
|
|
35
120
|
} else if (selector instanceof HTMLElement) {
|
|
36
121
|
element = selector;
|
|
37
122
|
} else if (selector instanceof Element) {
|
|
38
123
|
element = selector;
|
|
124
|
+
} else if (selector instanceof AngelsFrontElementClass) {
|
|
125
|
+
return selector;
|
|
39
126
|
} else {
|
|
40
127
|
element = selector;
|
|
41
128
|
}
|
|
42
|
-
return element;
|
|
129
|
+
return new AngelsFrontElementClass(element);
|
|
130
|
+
}
|
|
131
|
+
function aLibRequireElement(selector) {
|
|
132
|
+
const element = aLibFindElement(selector);
|
|
133
|
+
if (element) {
|
|
134
|
+
return element;
|
|
135
|
+
}
|
|
136
|
+
throw Error(`Element not found by '${selector}' selector.`);
|
|
43
137
|
}
|
|
44
138
|
|
|
45
139
|
// src/AngelsFrontAnimationLibrary.ts
|
|
46
|
-
function
|
|
140
|
+
function aLibConcealElement(originalElement) {
|
|
47
141
|
return __async(this, null, function* () {
|
|
48
142
|
const innerElement = aLibRequireElement(originalElement);
|
|
49
143
|
const promise = new Promise((resolve) => {
|
|
50
|
-
if (
|
|
144
|
+
if (innerElement.hidden) {
|
|
51
145
|
resolve();
|
|
52
146
|
return;
|
|
53
147
|
}
|
|
@@ -55,42 +149,47 @@ function aLibShowElement(originalElement) {
|
|
|
55
149
|
const animationHandler = () => {
|
|
56
150
|
clearTimeout(timeout);
|
|
57
151
|
innerElement.removeEventListener("animationend", animationHandler);
|
|
152
|
+
innerElement.hidden = true;
|
|
153
|
+
innerElement.classList.remove("a-out-animation");
|
|
58
154
|
resolve();
|
|
59
155
|
};
|
|
60
|
-
innerElement.
|
|
156
|
+
innerElement.classList.add("a-out-animation");
|
|
61
157
|
const animations = innerElement.getAnimations();
|
|
62
158
|
if (animations.length > 0) {
|
|
63
159
|
timeout = setTimeout(() => {
|
|
64
160
|
innerElement.removeEventListener("animationend", animationHandler);
|
|
161
|
+
innerElement.hidden = true;
|
|
162
|
+
innerElement.classList.remove("a-out-animation");
|
|
65
163
|
console.warn("Animation timeout");
|
|
66
164
|
resolve();
|
|
67
165
|
}, 5e3);
|
|
68
166
|
innerElement.addEventListener("animationend", animationHandler);
|
|
69
167
|
} else {
|
|
168
|
+
innerElement.hidden = true;
|
|
70
169
|
resolve();
|
|
71
170
|
}
|
|
72
171
|
});
|
|
73
172
|
return promise;
|
|
74
173
|
});
|
|
75
174
|
}
|
|
76
|
-
function
|
|
175
|
+
function aLibEngageElement(originalElement, switcher = void 0) {
|
|
77
176
|
return __async(this, null, function* () {
|
|
78
177
|
const innerElement = aLibRequireElement(originalElement);
|
|
79
178
|
if (switcher === void 0) {
|
|
80
|
-
switcher =
|
|
179
|
+
switcher = innerElement.hidden;
|
|
81
180
|
}
|
|
82
181
|
if (switcher) {
|
|
83
|
-
return yield
|
|
182
|
+
return yield aLibRevealElement(innerElement);
|
|
84
183
|
} else {
|
|
85
|
-
return yield
|
|
184
|
+
return yield aLibConcealElement(innerElement);
|
|
86
185
|
}
|
|
87
186
|
});
|
|
88
187
|
}
|
|
89
|
-
function
|
|
188
|
+
function aLibRevealElement(originalElement) {
|
|
90
189
|
return __async(this, null, function* () {
|
|
91
190
|
const innerElement = aLibRequireElement(originalElement);
|
|
92
191
|
const promise = new Promise((resolve) => {
|
|
93
|
-
if (innerElement.hidden) {
|
|
192
|
+
if (!innerElement.hidden) {
|
|
94
193
|
resolve();
|
|
95
194
|
return;
|
|
96
195
|
}
|
|
@@ -98,32 +197,28 @@ function aLibHideElement(originalElement) {
|
|
|
98
197
|
const animationHandler = () => {
|
|
99
198
|
clearTimeout(timeout);
|
|
100
199
|
innerElement.removeEventListener("animationend", animationHandler);
|
|
101
|
-
innerElement.hidden = true;
|
|
102
|
-
innerElement.classList.remove("a-out-animation");
|
|
103
200
|
resolve();
|
|
104
201
|
};
|
|
105
|
-
innerElement.
|
|
202
|
+
innerElement.hidden = false;
|
|
106
203
|
const animations = innerElement.getAnimations();
|
|
107
204
|
if (animations.length > 0) {
|
|
108
205
|
timeout = setTimeout(() => {
|
|
109
206
|
innerElement.removeEventListener("animationend", animationHandler);
|
|
110
|
-
innerElement.hidden = true;
|
|
111
|
-
innerElement.classList.remove("a-out-animation");
|
|
112
207
|
console.warn("Animation timeout");
|
|
113
208
|
resolve();
|
|
114
209
|
}, 5e3);
|
|
115
210
|
innerElement.addEventListener("animationend", animationHandler);
|
|
116
211
|
} else {
|
|
117
|
-
innerElement.hidden = true;
|
|
118
212
|
resolve();
|
|
119
213
|
}
|
|
120
214
|
});
|
|
121
215
|
return promise;
|
|
122
216
|
});
|
|
123
217
|
}
|
|
124
|
-
export
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
218
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
219
|
+
0 && (module.exports = {
|
|
220
|
+
aLibConcealElement,
|
|
221
|
+
aLibEngageElement,
|
|
222
|
+
aLibRevealElement
|
|
223
|
+
});
|
|
129
224
|
//# sourceMappingURL=AngelsFrontAnimationLibrary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AngelsFrontDOMLibrary.ts","../src/AngelsFrontAnimationLibrary.ts"],"sourcesContent":["export function aLibRequireElement<THTMLElement extends HTMLElement>(selector: AngelsSelectorType): THTMLElement {\n\n let element: THTMLElement;\n if (typeof selector === 'undefined') {\n throw Error(`Selector is undefined.`);\n } else if (selector === null) {\n throw Error(`Selector is null.`);\n } else if (typeof selector === 'string') {\n const findElement = document.querySelector<THTMLElement>(selector);\n if (!findElement) {\n throw Error(`Element not found by '${selector}' selector.`);\n }\n element = findElement;\n } else if (selector instanceof HTMLElement) {\n element = selector as THTMLElement;\n } else if (selector instanceof Element) {\n element = selector as THTMLElement;\n } else {\n element = selector;\n }\n return element\n}\n","import { aLibRequireElement } from \"./AngelsFrontDOMLibrary\";\n\nexport async function aLibShowElement(originalElement: AngelsSelectorType) {\n const innerElement = aLibRequireElement(originalElement);\n const promise = new Promise<void>((resolve) => {\n\n if (!innerElement.hidden) {\n resolve();\n return;\n }\n\n let timeout: NodeJS.Timeout | undefined;\n\n const animationHandler = () => {\n clearTimeout(timeout);\n innerElement.removeEventListener('animationend', animationHandler);\n resolve();\n }\n\n innerElement.hidden = false;\n\n const animations = innerElement.getAnimations();\n if (animations.length > 0) {\n timeout = setTimeout(() => {\n innerElement.removeEventListener('animationend', animationHandler);\n console.warn('Animation timeout');\n resolve();\n }, 5000); // 5 seconds timeout\n innerElement.addEventListener('animationend', animationHandler);\n } else {\n resolve();\n }\n });\n\n return promise;\n}\n\nexport async function aLibToggleElement(originalElement: AngelsSelectorType, switcher: boolean | undefined = undefined) {\n const innerElement = aLibRequireElement(originalElement);\n if (switcher === undefined) {\n switcher = !innerElement.hidden;\n }\n if (switcher) {\n return await aLibShowElement(innerElement);\n } else {\n return await aLibHideElement(innerElement);\n }\n}\n\nexport async function aLibHideElement(originalElement: AngelsSelectorType) {\n const innerElement = aLibRequireElement(originalElement);\n const promise = new Promise<void>((resolve) => {\n\n if (innerElement.hidden) {\n resolve();\n return;\n }\n\n let timeout: NodeJS.Timeout | undefined;\n\n const animationHandler = () => {\n clearTimeout(timeout);\n innerElement.removeEventListener('animationend', animationHandler);\n innerElement.hidden = true;\n innerElement.classList.remove('a-out-animation');\n resolve();\n }\n\n innerElement.classList.add('a-out-animation');\n\n const animations = innerElement.getAnimations();\n if (animations.length > 0) {\n timeout = setTimeout(() => {\n innerElement.removeEventListener('animationend', animationHandler);\n innerElement.hidden = true;\n innerElement.classList.remove('a-out-animation');\n console.warn('Animation timeout');\n resolve();\n }, 5000); // 5 seconds timeout\n innerElement.addEventListener('animationend', animationHandler);\n } else {\n innerElement.hidden = true;\n resolve();\n }\n });\n\n return promise;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAO,SAAS,mBAAqD,UAA4C;AAE7G,MAAI;AACJ,MAAI,OAAO,aAAa,aAAa;AACjC,UAAM,MAAM,wBAAwB;AAAA,EACxC,WAAW,aAAa,MAAM;AAC1B,UAAM,MAAM,mBAAmB;AAAA,EACnC,WAAW,OAAO,aAAa,UAAU;AACrC,UAAM,cAAc,SAAS,cAA4B,QAAQ;AACjE,QAAI,CAAC,aAAa;AACd,YAAM,MAAM,yBAAyB,QAAQ,aAAa;AAAA,IAC9D;AACA,cAAU;AAAA,EACd,WAAW,oBAAoB,aAAa;AACxC,cAAU;AAAA,EACd,WAAW,oBAAoB,SAAS;AACpC,cAAU;AAAA,EACd,OAAO;AACH,cAAU;AAAA,EACd;AACA,SAAO;AACX;;;ACnBA,SAAsB,gBAAgB,iBAAqC;AAAA;AACvE,UAAM,eAAe,mBAAmB,eAAe;AACvD,UAAM,UAAU,IAAI,QAAc,CAAC,YAAY;AAE3C,UAAI,CAAC,aAAa,QAAQ;AACtB,gBAAQ;AACR;AAAA,MACJ;AAEA,UAAI;AAEJ,YAAM,mBAAmB,MAAM;AAC3B,qBAAa,OAAO;AACpB,qBAAa,oBAAoB,gBAAgB,gBAAgB;AACjE,gBAAQ;AAAA,MACZ;AAEA,mBAAa,SAAS;AAEtB,YAAM,aAAa,aAAa,cAAc;AAC9C,UAAI,WAAW,SAAS,G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,SAAS;AACtB,gBAAQ;AAAA,MACZ;AAAA,IACJ,CAAC;AAED,WAAO;AAAA,EACX;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/AngelsFrontAnimationLibrary.ts","../src/AngelsFrontElement.ts","../src/AngelsFrontDOMLibrary.ts"],"sourcesContent":["import { aLibRequireElement } from \"./AngelsFrontDOMLibrary\";\n\nexport async function aLibConcealElement(originalElement: AngelsSelectorType) {\n const innerElement = aLibRequireElement(originalElement);\n const promise = new Promise<void>((resolve) => {\n\n if (innerElement.hidden) {\n resolve();\n return;\n }\n\n let timeout: NodeJS.Timeout | undefined;\n\n const animationHandler = () => {\n clearTimeout(timeout);\n innerElement.removeEventListener('animationend', animationHandler);\n innerElement.hidden = true;\n innerElement.classList.remove('a-out-animation');\n resolve();\n }\n\n innerElement.classList.add('a-out-animation');\n\n const animations = innerElement.getAnimations();\n if (animations.length > 0) {\n timeout = setTimeout(() => {\n innerElement.removeEventListener('animationend', animationHandler);\n innerElement.hidden = true;\n innerElement.classList.remove('a-out-animation');\n console.warn('Animation timeout');\n resolve();\n }, 5000); // 5 seconds timeout\n innerElement.addEventListener('animationend', animationHandler);\n } else {\n innerElement.hidden = true;\n resolve();\n }\n });\n\n return promise;\n}\n\nexport async function aLibEngageElement(originalElement: AngelsSelectorType, switcher: boolean | undefined = undefined) {\n const innerElement = aLibRequireElement(originalElement);\n if (switcher === undefined) {\n switcher = innerElement.hidden;\n }\n\n if (switcher) {\n return await aLibRevealElement(innerElement);\n } else {\n return await aLibConcealElement(innerElement);\n }\n}\n\nexport async function aLibRevealElement(originalElement: AngelsSelectorType) {\n const innerElement = aLibRequireElement(originalElement);\n const promise = new Promise<void>((resolve) => {\n\n if (!innerElement.hidden) {\n resolve();\n return;\n }\n\n let timeout: NodeJS.Timeout | undefined;\n\n const animationHandler = () => {\n clearTimeout(timeout);\n innerElement.removeEventListener('animationend', animationHandler);\n resolve();\n }\n\n innerElement.hidden = false;\n\n const animations = innerElement.getAnimations();\n if (animations.length > 0) {\n timeout = setTimeout(() => {\n innerElement.removeEventListener('animationend', animationHandler);\n console.warn('Animation timeout');\n resolve();\n }, 5000); // 5 seconds timeout\n innerElement.addEventListener('animationend', animationHandler);\n } else {\n resolve();\n }\n });\n\n return promise;\n}\n","import { aLibConcealElement, aLibEngageElement, aLibRevealElement } from \"./AngelsFrontAnimationLibrary\";\n\nexport type AngelsFrontElement<THTMLElement extends HTMLElement = HTMLElement> = AngelsFrontElementClass<THTMLElement> & THTMLElement;\n\nexport default class AngelsFrontElementClass<THTMLElement extends HTMLElement = HTMLElement> {\n\n public originalElement: THTMLElement;\n\n constructor(element: THTMLElement) {\n\n this.originalElement = element;\n\n return new Proxy(this, {\n\n get(target: any, prop: string | symbol, receiver: any) {\n if (prop in target) {\n // @test AngelsFrontElementClass proxies methods to the original element\n return Reflect.get(target, prop);\n }\n // @test AngelsFrontElementClass uses methods of the main object\n const valueOfProperty = Reflect.get(target.originalElement, prop);\n if (typeof valueOfProperty === 'function') {\n return valueOfProperty.bind(target.originalElement);\n }\n return valueOfProperty;\n },\n\n set(target: any, prop: string | symbol, newValue: any, receiver: any) {\n if (prop in target.originalElement) {\n // @test AngelsFrontElementClass sets properties on the original element\n target.originalElement[prop] = newValue;\n } else {\n // @test AngelsFrontElementClass sets properties on the main object\n target[prop] = newValue;\n }\n return true;\n }\n }) as unknown as AngelsFrontElement<THTMLElement>;\n }\n\n aConcealElement(): this {\n\n // @test aConcealElement() calls aLibConcealElement() with the original element\n aLibConcealElement(this.originalElement);\n\n // @test aConcealElement() returns this\n return this;\n }\n\n aEngageElement(switcher: boolean | undefined = undefined): this {\n\n // @test aEngageElement() calls aLibEngageElement() with the original element and the same switcher\n aLibEngageElement(this.originalElement, switcher);\n\n // @test aEngageElement() returns this\n return this;\n }\n\n aHideElement(): this {\n\n // @test aHideElement() sets the hidden property of the element to true\n this.originalElement.hidden = true;\n\n // @test aHideElement() returns this\n return this;\n }\n\n aRevealElement(): this {\n\n // @test aRevealElement() calls aLibRevealElement() with the original element\n aLibRevealElement(this.originalElement);\n\n // @test aRevealElement() returns this\n return this;\n }\n\n aShowElement(): this {\n\n // @test aShowElement() sets the hidden property of the element to false\n this.originalElement.hidden = false;\n\n // @test aShowElement() returns this\n return this;\n }\n\n aSetTextContent(content: string): this {\n\n // @test aSetTextContent() converts non-string content to string before setting\n const contentToSet = content.toString();\n\n // @test aSetTextContent() sets originalElement.textContent\n this.originalElement.textContent = contentToSet;\n\n // @test aSetTextContent() returns this for chaining\n return this;\n }\n\n aTextContent(): string {\n if (this.originalElement.textContent === null) {\n // @test aTextContent() returns empty string if originalElement.textContent is null\n return ``;\n }\n\n // @test aTextContent() returns textContent of originalElement\n return this.originalElement.textContent;\n }\n}\n","import AngelsFrontElementClass, { AngelsFrontElement } from \"./AngelsFrontElement\";\nimport { AngelsFrontWidget } from \"./AngelsFrontWidgetClass\";\nimport AngelsFrontWidgetClass from \"./AngelsFrontWidgetClass\";\n\nexport function aLibCreateWidget<THTMLElement extends HTMLElement = HTMLElement>(element: THTMLElement): AngelsFrontWidget<THTMLElement> {\n return (new AngelsFrontWidgetClass<THTMLElement>(element)) as AngelsFrontWidget<THTMLElement>;\n}\n\nexport function aLibFindElement<THTMLElement extends HTMLElement>(selector: AngelsSelectorType<THTMLElement>): AngelsFrontElement<THTMLElement> | null {\n\n let element: THTMLElement;\n if (typeof selector === 'undefined') {\n return null;\n } else if (selector === null) {\n return null;\n } else if (typeof selector === 'string') {\n const findElement = document.querySelector<THTMLElement>(selector);\n if (!findElement) {\n return null;\n }\n element = findElement;\n } else if (selector instanceof HTMLElement) {\n element = selector as THTMLElement;\n } else if (selector instanceof Element) {\n element = selector as THTMLElement;\n } else if (selector instanceof AngelsFrontElementClass) {\n return selector as AngelsFrontElement<THTMLElement>;\n } else {\n element = selector;\n }\n return new AngelsFrontElementClass(element) as AngelsFrontElement<THTMLElement>;\n}\n\nexport function aLibRequireElement<THTMLElement extends HTMLElement>(selector: AngelsSelectorType): AngelsFrontElement<THTMLElement> {\n const element = aLibFindElement<THTMLElement>(selector);\n if (element) {\n return element;\n }\n throw Error(`Element not found by '${selector}' selector.`);\n}\n\nexport function aLibHideElement<THTMLElement extends HTMLElement>(selector: AngelsSelectorType): AngelsFrontElement<THTMLElement> {\n const element = aLibRequireElement<THTMLElement>(selector);\n element.hidden = true;\n return element;\n}\n\nexport function aLibShowElement<THTMLElement extends HTMLElement>(selector: AngelsSelectorType): AngelsFrontElement<THTMLElement> {\n const element = aLibRequireElement<THTMLElement>(selector);\n element.hidden = false;\n return element;\n}\n\nexport function aLibToggleElement(originalElement: AngelsSelectorType, switcher: boolean | undefined = undefined) {\n const innerElement = aLibRequireElement(originalElement);\n if (switcher === undefined) {\n switcher = !innerElement.hidden;\n }\n if (switcher) {\n return aLibShowElement(innerElement);\n } else {\n return aLibHideElement(innerElement);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIA,IAAqB,0BAArB,MAA6F;AAAA,EAIzF,YAAY,SAAuB;AAE/B,SAAK,kBAAkB;AAEvB,WAAO,IAAI,MAAM,MAAM;AAAA,MAEnB,IAAI,QAAa,MAAuB,UAAe;AACnD,YAAI,QAAQ,QAAQ;AAEhB,iBAAO,QAAQ,IAAI,QAAQ,IAAI;AAAA,QACnC;AAEA,cAAM,kBAAkB,QAAQ,IAAI,OAAO,iBAAiB,IAAI;AAChE,YAAI,OAAO,oBAAoB,YAAY;AACvC,iBAAO,gBAAgB,KAAK,OAAO,eAAe;AAAA,QACtD;AACA,eAAO;AAAA,MACX;AAAA,MAEA,IAAI,QAAa,MAAuB,UAAe,UAAe;AAClE,YAAI,QAAQ,OAAO,iBAAiB;AAEhC,iBAAO,gBAAgB,IAAI,IAAI;AAAA,QACnC,OAAO;AAEH,iBAAO,IAAI,IAAI;AAAA,QACnB;AACA,eAAO;AAAA,MACX;AAAA,IACJ,CAAC;A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J;AAEA,UAAI;AAEJ,YAAM,mBAAmB,MAAM;AAC3B,qBAAa,OAAO;AACpB,qBAAa,oBAAoB,gBAAgB,gBAAgB;AACjE,gBAAQ;AAAA,MACZ;AAEA,mBAAa,SAAS;AAEtB,YAAM,aAAa,aAAa,cAAc;AAC9C,UAAI,WAAW,SAAS,GAAG;AACvB,kBAAU,WAAW,MAAM;AACvB,uBAAa,oBAAoB,gBAAgB,gBAAgB;AACjE,kBAAQ,KAAK,mBAAmB;AAChC,kBAAQ;AAAA,QACZ,GAAG,GAAI;AACP,qBAAa,iBAAiB,gBAAgB,gBAAgB;AAAA,MAClE,OAAO;AACH,gBAAQ;AAAA,MACZ;AAAA,IACJ,CAAC;AAED,WAAO;AAAA,EACX;AAAA;","names":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __async = (__this, __arguments, generator) => {
|
|
3
2
|
return new Promise((resolve, reject) => {
|
|
4
3
|
var fulfilled = (value) => {
|
|
@@ -20,35 +19,102 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20
19
|
});
|
|
21
20
|
};
|
|
22
21
|
|
|
22
|
+
// src/AngelsFrontElement.ts
|
|
23
|
+
var AngelsFrontElementClass = class {
|
|
24
|
+
constructor(element) {
|
|
25
|
+
this.originalElement = element;
|
|
26
|
+
return new Proxy(this, {
|
|
27
|
+
get(target, prop, receiver) {
|
|
28
|
+
if (prop in target) {
|
|
29
|
+
return Reflect.get(target, prop);
|
|
30
|
+
}
|
|
31
|
+
const valueOfProperty = Reflect.get(target.originalElement, prop);
|
|
32
|
+
if (typeof valueOfProperty === "function") {
|
|
33
|
+
return valueOfProperty.bind(target.originalElement);
|
|
34
|
+
}
|
|
35
|
+
return valueOfProperty;
|
|
36
|
+
},
|
|
37
|
+
set(target, prop, newValue, receiver) {
|
|
38
|
+
if (prop in target.originalElement) {
|
|
39
|
+
target.originalElement[prop] = newValue;
|
|
40
|
+
} else {
|
|
41
|
+
target[prop] = newValue;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
aConcealElement() {
|
|
48
|
+
aLibConcealElement(this.originalElement);
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
aEngageElement(switcher = void 0) {
|
|
52
|
+
aLibEngageElement(this.originalElement, switcher);
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
aHideElement() {
|
|
56
|
+
this.originalElement.hidden = true;
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
aRevealElement() {
|
|
60
|
+
aLibRevealElement(this.originalElement);
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
aShowElement() {
|
|
64
|
+
this.originalElement.hidden = false;
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
aSetTextContent(content) {
|
|
68
|
+
const contentToSet = content.toString();
|
|
69
|
+
this.originalElement.textContent = contentToSet;
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
aTextContent() {
|
|
73
|
+
if (this.originalElement.textContent === null) {
|
|
74
|
+
return ``;
|
|
75
|
+
}
|
|
76
|
+
return this.originalElement.textContent;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
23
80
|
// src/AngelsFrontDOMLibrary.ts
|
|
24
|
-
function
|
|
81
|
+
function aLibFindElement(selector) {
|
|
25
82
|
let element;
|
|
26
83
|
if (typeof selector === "undefined") {
|
|
27
|
-
|
|
84
|
+
return null;
|
|
28
85
|
} else if (selector === null) {
|
|
29
|
-
|
|
86
|
+
return null;
|
|
30
87
|
} else if (typeof selector === "string") {
|
|
31
88
|
const findElement = document.querySelector(selector);
|
|
32
89
|
if (!findElement) {
|
|
33
|
-
|
|
90
|
+
return null;
|
|
34
91
|
}
|
|
35
92
|
element = findElement;
|
|
36
93
|
} else if (selector instanceof HTMLElement) {
|
|
37
94
|
element = selector;
|
|
38
95
|
} else if (selector instanceof Element) {
|
|
39
96
|
element = selector;
|
|
97
|
+
} else if (selector instanceof AngelsFrontElementClass) {
|
|
98
|
+
return selector;
|
|
40
99
|
} else {
|
|
41
100
|
element = selector;
|
|
42
101
|
}
|
|
43
|
-
return element;
|
|
102
|
+
return new AngelsFrontElementClass(element);
|
|
103
|
+
}
|
|
104
|
+
function aLibRequireElement(selector) {
|
|
105
|
+
const element = aLibFindElement(selector);
|
|
106
|
+
if (element) {
|
|
107
|
+
return element;
|
|
108
|
+
}
|
|
109
|
+
throw Error(`Element not found by '${selector}' selector.`);
|
|
44
110
|
}
|
|
45
111
|
|
|
46
112
|
// src/AngelsFrontAnimationLibrary.ts
|
|
47
|
-
function
|
|
113
|
+
function aLibConcealElement(originalElement) {
|
|
48
114
|
return __async(this, null, function* () {
|
|
49
115
|
const innerElement = aLibRequireElement(originalElement);
|
|
50
116
|
const promise = new Promise((resolve) => {
|
|
51
|
-
if (
|
|
117
|
+
if (innerElement.hidden) {
|
|
52
118
|
resolve();
|
|
53
119
|
return;
|
|
54
120
|
}
|
|
@@ -56,42 +122,47 @@ function aLibShowElement(originalElement) {
|
|
|
56
122
|
const animationHandler = () => {
|
|
57
123
|
clearTimeout(timeout);
|
|
58
124
|
innerElement.removeEventListener("animationend", animationHandler);
|
|
125
|
+
innerElement.hidden = true;
|
|
126
|
+
innerElement.classList.remove("a-out-animation");
|
|
59
127
|
resolve();
|
|
60
128
|
};
|
|
61
|
-
innerElement.
|
|
129
|
+
innerElement.classList.add("a-out-animation");
|
|
62
130
|
const animations = innerElement.getAnimations();
|
|
63
131
|
if (animations.length > 0) {
|
|
64
132
|
timeout = setTimeout(() => {
|
|
65
133
|
innerElement.removeEventListener("animationend", animationHandler);
|
|
134
|
+
innerElement.hidden = true;
|
|
135
|
+
innerElement.classList.remove("a-out-animation");
|
|
66
136
|
console.warn("Animation timeout");
|
|
67
137
|
resolve();
|
|
68
138
|
}, 5e3);
|
|
69
139
|
innerElement.addEventListener("animationend", animationHandler);
|
|
70
140
|
} else {
|
|
141
|
+
innerElement.hidden = true;
|
|
71
142
|
resolve();
|
|
72
143
|
}
|
|
73
144
|
});
|
|
74
145
|
return promise;
|
|
75
146
|
});
|
|
76
147
|
}
|
|
77
|
-
function
|
|
148
|
+
function aLibEngageElement(originalElement, switcher = void 0) {
|
|
78
149
|
return __async(this, null, function* () {
|
|
79
150
|
const innerElement = aLibRequireElement(originalElement);
|
|
80
151
|
if (switcher === void 0) {
|
|
81
|
-
switcher =
|
|
152
|
+
switcher = innerElement.hidden;
|
|
82
153
|
}
|
|
83
154
|
if (switcher) {
|
|
84
|
-
return yield
|
|
155
|
+
return yield aLibRevealElement(innerElement);
|
|
85
156
|
} else {
|
|
86
|
-
return yield
|
|
157
|
+
return yield aLibConcealElement(innerElement);
|
|
87
158
|
}
|
|
88
159
|
});
|
|
89
160
|
}
|
|
90
|
-
function
|
|
161
|
+
function aLibRevealElement(originalElement) {
|
|
91
162
|
return __async(this, null, function* () {
|
|
92
163
|
const innerElement = aLibRequireElement(originalElement);
|
|
93
164
|
const promise = new Promise((resolve) => {
|
|
94
|
-
if (innerElement.hidden) {
|
|
165
|
+
if (!innerElement.hidden) {
|
|
95
166
|
resolve();
|
|
96
167
|
return;
|
|
97
168
|
}
|
|
@@ -99,33 +170,27 @@ function aLibHideElement(originalElement) {
|
|
|
99
170
|
const animationHandler = () => {
|
|
100
171
|
clearTimeout(timeout);
|
|
101
172
|
innerElement.removeEventListener("animationend", animationHandler);
|
|
102
|
-
innerElement.hidden = true;
|
|
103
|
-
innerElement.classList.remove("a-out-animation");
|
|
104
173
|
resolve();
|
|
105
174
|
};
|
|
106
|
-
innerElement.
|
|
175
|
+
innerElement.hidden = false;
|
|
107
176
|
const animations = innerElement.getAnimations();
|
|
108
177
|
if (animations.length > 0) {
|
|
109
178
|
timeout = setTimeout(() => {
|
|
110
179
|
innerElement.removeEventListener("animationend", animationHandler);
|
|
111
|
-
innerElement.hidden = true;
|
|
112
|
-
innerElement.classList.remove("a-out-animation");
|
|
113
180
|
console.warn("Animation timeout");
|
|
114
181
|
resolve();
|
|
115
182
|
}, 5e3);
|
|
116
183
|
innerElement.addEventListener("animationend", animationHandler);
|
|
117
184
|
} else {
|
|
118
|
-
innerElement.hidden = true;
|
|
119
185
|
resolve();
|
|
120
186
|
}
|
|
121
187
|
});
|
|
122
188
|
return promise;
|
|
123
189
|
});
|
|
124
190
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
//# sourceMappingURL=AngelsFrontLibrary.cjs.map
|
|
191
|
+
export {
|
|
192
|
+
aLibConcealElement,
|
|
193
|
+
aLibEngageElement,
|
|
194
|
+
aLibRevealElement
|
|
195
|
+
};
|
|
196
|
+
//# sourceMappingURL=AngelsFrontAnimationLibrary.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/AngelsFrontElement.ts","../src/AngelsFrontDOMLibrary.ts","../src/AngelsFrontAnimationLibrary.ts"],"sourcesContent":["import { aLibConcealElement, aLibEngageElement, aLibRevealElement } from \"./AngelsFrontAnimationLibrary\";\n\nexport type AngelsFrontElement<THTMLElement extends HTMLElement = HTMLElement> = AngelsFrontElementClass<THTMLElement> & THTMLElement;\n\nexport default class AngelsFrontElementClass<THTMLElement extends HTMLElement = HTMLElement> {\n\n public originalElement: THTMLElement;\n\n constructor(element: THTMLElement) {\n\n this.originalElement = element;\n\n return new Proxy(this, {\n\n get(target: any, prop: string | symbol, receiver: any) {\n if (prop in target) {\n // @test AngelsFrontElementClass proxies methods to the original element\n return Reflect.get(target, prop);\n }\n // @test AngelsFrontElementClass uses methods of the main object\n const valueOfProperty = Reflect.get(target.originalElement, prop);\n if (typeof valueOfProperty === 'function') {\n return valueOfProperty.bind(target.originalElement);\n }\n return valueOfProperty;\n },\n\n set(target: any, prop: string | symbol, newValue: any, receiver: any) {\n if (prop in target.originalElement) {\n // @test AngelsFrontElementClass sets properties on the original element\n target.originalElement[prop] = newValue;\n } else {\n // @test AngelsFrontElementClass sets properties on the main object\n target[prop] = newValue;\n }\n return true;\n }\n }) as unknown as AngelsFrontElement<THTMLElement>;\n }\n\n aConcealElement(): this {\n\n // @test aConcealElement() calls aLibConcealElement() with the original element\n aLibConcealElement(this.originalElement);\n\n // @test aConcealElement() returns this\n return this;\n }\n\n aEngageElement(switcher: boolean | undefined = undefined): this {\n\n // @test aEngageElement() calls aLibEngageElement() with the original element and the same switcher\n aLibEngageElement(this.originalElement, switcher);\n\n // @test aEngageElement() returns this\n return this;\n }\n\n aHideElement(): this {\n\n // @test aHideElement() sets the hidden property of the element to true\n this.originalElement.hidden = true;\n\n // @test aHideElement() returns this\n return this;\n }\n\n aRevealElement(): this {\n\n // @test aRevealElement() calls aLibRevealElement() with the original element\n aLibRevealElement(this.originalElement);\n\n // @test aRevealElement() returns this\n return this;\n }\n\n aShowElement(): this {\n\n // @test aShowElement() sets the hidden property of the element to false\n this.originalElement.hidden = false;\n\n // @test aShowElement() returns this\n return this;\n }\n\n aSetTextContent(content: string): this {\n\n // @test aSetTextContent() converts non-string content to string before setting\n const contentToSet = content.toString();\n\n // @test aSetTextContent() sets originalElement.textContent\n this.originalElement.textContent = contentToSet;\n\n // @test aSetTextContent() returns this for chaining\n return this;\n }\n\n aTextContent(): string {\n if (this.originalElement.textContent === null) {\n // @test aTextContent() returns empty string if originalElement.textContent is null\n return ``;\n }\n\n // @test aTextContent() returns textContent of originalElement\n return this.originalElement.textContent;\n }\n}\n","import AngelsFrontElementClass, { AngelsFrontElement } from \"./AngelsFrontElement\";\nimport { AngelsFrontWidget } from \"./AngelsFrontWidgetClass\";\nimport AngelsFrontWidgetClass from \"./AngelsFrontWidgetClass\";\n\nexport function aLibCreateWidget<THTMLElement extends HTMLElement = HTMLElement>(element: THTMLElement): AngelsFrontWidget<THTMLElement> {\n return (new AngelsFrontWidgetClass<THTMLElement>(element)) as AngelsFrontWidget<THTMLElement>;\n}\n\nexport function aLibFindElement<THTMLElement extends HTMLElement>(selector: AngelsSelectorType<THTMLElement>): AngelsFrontElement<THTMLElement> | null {\n\n let element: THTMLElement;\n if (typeof selector === 'undefined') {\n return null;\n } else if (selector === null) {\n return null;\n } else if (typeof selector === 'string') {\n const findElement = document.querySelector<THTMLElement>(selector);\n if (!findElement) {\n return null;\n }\n element = findElement;\n } else if (selector instanceof HTMLElement) {\n element = selector as THTMLElement;\n } else if (selector instanceof Element) {\n element = selector as THTMLElement;\n } else if (selector instanceof AngelsFrontElementClass) {\n return selector as AngelsFrontElement<THTMLElement>;\n } else {\n element = selector;\n }\n return new AngelsFrontElementClass(element) as AngelsFrontElement<THTMLElement>;\n}\n\nexport function aLibRequireElement<THTMLElement extends HTMLElement>(selector: AngelsSelectorType): AngelsFrontElement<THTMLElement> {\n const element = aLibFindElement<THTMLElement>(selector);\n if (element) {\n return element;\n }\n throw Error(`Element not found by '${selector}' selector.`);\n}\n\nexport function aLibHideElement<THTMLElement extends HTMLElement>(selector: AngelsSelectorType): AngelsFrontElement<THTMLElement> {\n const element = aLibRequireElement<THTMLElement>(selector);\n element.hidden = true;\n return element;\n}\n\nexport function aLibShowElement<THTMLElement extends HTMLElement>(selector: AngelsSelectorType): AngelsFrontElement<THTMLElement> {\n const element = aLibRequireElement<THTMLElement>(selector);\n element.hidden = false;\n return element;\n}\n\nexport function aLibToggleElement(originalElement: AngelsSelectorType, switcher: boolean | undefined = undefined) {\n const innerElement = aLibRequireElement(originalElement);\n if (switcher === undefined) {\n switcher = !innerElement.hidden;\n }\n if (switcher) {\n return aLibShowElement(innerElement);\n } else {\n return aLibHideElement(innerElement);\n }\n}\n","import { aLibRequireElement } from \"./AngelsFrontDOMLibrary\";\n\nexport async function aLibConcealElement(originalElement: AngelsSelectorType) {\n const innerElement = aLibRequireElement(originalElement);\n const promise = new Promise<void>((resolve) => {\n\n if (innerElement.hidden) {\n resolve();\n return;\n }\n\n let timeout: NodeJS.Timeout | undefined;\n\n const animationHandler = () => {\n clearTimeout(timeout);\n innerElement.removeEventListener('animationend', animationHandler);\n innerElement.hidden = true;\n innerElement.classList.remove('a-out-animation');\n resolve();\n }\n\n innerElement.classList.add('a-out-animation');\n\n const animations = innerElement.getAnimations();\n if (animations.length > 0) {\n timeout = setTimeout(() => {\n innerElement.removeEventListener('animationend', animationHandler);\n innerElement.hidden = true;\n innerElement.classList.remove('a-out-animation');\n console.warn('Animation timeout');\n resolve();\n }, 5000); // 5 seconds timeout\n innerElement.addEventListener('animationend', animationHandler);\n } else {\n innerElement.hidden = true;\n resolve();\n }\n });\n\n return promise;\n}\n\nexport async function aLibEngageElement(originalElement: AngelsSelectorType, switcher: boolean | undefined = undefined) {\n const innerElement = aLibRequireElement(originalElement);\n if (switcher === undefined) {\n switcher = innerElement.hidden;\n }\n\n if (switcher) {\n return await aLibRevealElement(innerElement);\n } else {\n return await aLibConcealElement(innerElement);\n }\n}\n\nexport async function aLibRevealElement(originalElement: AngelsSelectorType) {\n const innerElement = aLibRequireElement(originalElement);\n const promise = new Promise<void>((resolve) => {\n\n if (!innerElement.hidden) {\n resolve();\n return;\n }\n\n let timeout: NodeJS.Timeout | undefined;\n\n const animationHandler = () => {\n clearTimeout(timeout);\n innerElement.removeEventListener('animationend', animationHandler);\n resolve();\n }\n\n innerElement.hidden = false;\n\n const animations = innerElement.getAnimations();\n if (animations.length > 0) {\n timeout = setTimeout(() => {\n innerElement.removeEventListener('animationend', animationHandler);\n console.warn('Animation timeout');\n resolve();\n }, 5000); // 5 seconds timeout\n innerElement.addEventListener('animationend', animationHandler);\n } else {\n resolve();\n }\n });\n\n return promise;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIA,IAAqB,0BAArB,MAA6F;AAAA,EAIzF,YAAY,SAAuB;AAE/B,SAAK,kBAAkB;AAEvB,WAAO,IAAI,MAAM,MAAM;AAAA,MAEnB,IAAI,QAAa,MAAuB,UAAe;AACnD,YAAI,QAAQ,QAAQ;AAEhB,iBAAO,QAAQ,IAAI,QAAQ,IA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UAAM,eAAe,mBAAmB,eAAe;AACvD,QAAI,aAAa,QAAW;AACxB,iBAAW,aAAa;AAAA,IAC5B;AAEA,QAAI,UAAU;AACV,aAAO,MAAM,kBAAkB,YAAY;AAAA,IAC/C,OAAO;AACH,aAAO,MAAM,mBAAmB,YAAY;AAAA,IAChD;AAAA,EACJ;AAAA;AAEA,SAAsB,kBAAkB,iBAAqC;AAAA;AACzE,UAAM,eAAe,mBAAmB,eAAe;AACvD,UAAM,UAAU,IAAI,QAAc,CAAC,YAAY;AAE3C,UAAI,CAAC,aAAa,QAAQ;AACtB,gBAAQ;AACR;AAAA,MACJ;AAEA,UAAI;AAEJ,YAAM,mBAAmB,MAAM;AAC3B,qBAAa,OAAO;AACpB,qBAAa,oBAAoB,gBAAgB,gBAAgB;AACjE,gBAAQ;AAAA,MACZ;AAEA,mBAAa,SAAS;AAEtB,YAAM,aAAa,aAAa,cAAc;AAC9C,UAAI,WAAW,SAAS,GAAG;AACvB,kBAAU,WAAW,MAAM;AACvB,uBAAa,oBAAoB,gBAAgB,gBAAgB;AACjE,kBAAQ,KAAK,mBAAmB;AAChC,kBAAQ;AAAA,QACZ,GAAG,GAAI;AACP,qBAAa,iBAAiB,gBAAgB,gBAAgB;AAAA,MAClE,OAAO;AACH,gBAAQ;AAAA,MACZ;AAAA,IACJ,CAAC;AAED,WAAO;AAAA,EACX;AAAA;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import AngelsFrontWidgetClass from './AngelsFrontWidgetClass.mjs';
|
|
2
|
+
import './AngelsFrontElement.mjs';
|
|
3
|
+
import './AngelsFrontMod.mjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @example new AngelsFrontApplication(document.body)
|
|
7
|
+
*/
|
|
8
|
+
declare class AngelsFrontApplication extends AngelsFrontWidgetClass {
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { AngelsFrontApplication as default };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AngelsFrontWidgetClass from './AngelsFrontWidgetClass.js';
|
|
2
|
+
import './AngelsFrontElement.js';
|
|
2
3
|
import './AngelsFrontMod.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @example new AngelsFrontApplication(document.body)
|
|
6
7
|
*/
|
|
7
|
-
declare class AngelsFrontApplication extends
|
|
8
|
+
declare class AngelsFrontApplication extends AngelsFrontWidgetClass {
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export { AngelsFrontApplication as default };
|