@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,378 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/AngelsFrontAnimationLibrary.ts
|
|
23
|
+
function aLibConcealElement(originalElement) {
|
|
24
|
+
return __async(this, null, function* () {
|
|
25
|
+
const innerElement = aLibRequireElement(originalElement);
|
|
26
|
+
const promise = new Promise((resolve) => {
|
|
27
|
+
if (innerElement.hidden) {
|
|
28
|
+
resolve();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
let timeout;
|
|
32
|
+
const animationHandler = () => {
|
|
33
|
+
clearTimeout(timeout);
|
|
34
|
+
innerElement.removeEventListener("animationend", animationHandler);
|
|
35
|
+
innerElement.hidden = true;
|
|
36
|
+
innerElement.classList.remove("a-out-animation");
|
|
37
|
+
resolve();
|
|
38
|
+
};
|
|
39
|
+
innerElement.classList.add("a-out-animation");
|
|
40
|
+
const animations = innerElement.getAnimations();
|
|
41
|
+
if (animations.length > 0) {
|
|
42
|
+
timeout = setTimeout(() => {
|
|
43
|
+
innerElement.removeEventListener("animationend", animationHandler);
|
|
44
|
+
innerElement.hidden = true;
|
|
45
|
+
innerElement.classList.remove("a-out-animation");
|
|
46
|
+
console.warn("Animation timeout");
|
|
47
|
+
resolve();
|
|
48
|
+
}, 5e3);
|
|
49
|
+
innerElement.addEventListener("animationend", animationHandler);
|
|
50
|
+
} else {
|
|
51
|
+
innerElement.hidden = true;
|
|
52
|
+
resolve();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return promise;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function aLibEngageElement(originalElement, switcher = void 0) {
|
|
59
|
+
return __async(this, null, function* () {
|
|
60
|
+
const innerElement = aLibRequireElement(originalElement);
|
|
61
|
+
if (switcher === void 0) {
|
|
62
|
+
switcher = innerElement.hidden;
|
|
63
|
+
}
|
|
64
|
+
if (switcher) {
|
|
65
|
+
return yield aLibRevealElement(innerElement);
|
|
66
|
+
} else {
|
|
67
|
+
return yield aLibConcealElement(innerElement);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function aLibRevealElement(originalElement) {
|
|
72
|
+
return __async(this, null, function* () {
|
|
73
|
+
const innerElement = aLibRequireElement(originalElement);
|
|
74
|
+
const promise = new Promise((resolve) => {
|
|
75
|
+
if (!innerElement.hidden) {
|
|
76
|
+
resolve();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
let timeout;
|
|
80
|
+
const animationHandler = () => {
|
|
81
|
+
clearTimeout(timeout);
|
|
82
|
+
innerElement.removeEventListener("animationend", animationHandler);
|
|
83
|
+
resolve();
|
|
84
|
+
};
|
|
85
|
+
innerElement.hidden = false;
|
|
86
|
+
const animations = innerElement.getAnimations();
|
|
87
|
+
if (animations.length > 0) {
|
|
88
|
+
timeout = setTimeout(() => {
|
|
89
|
+
innerElement.removeEventListener("animationend", animationHandler);
|
|
90
|
+
console.warn("Animation timeout");
|
|
91
|
+
resolve();
|
|
92
|
+
}, 5e3);
|
|
93
|
+
innerElement.addEventListener("animationend", animationHandler);
|
|
94
|
+
} else {
|
|
95
|
+
resolve();
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return promise;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/AngelsFrontElement.ts
|
|
103
|
+
var AngelsFrontElementClass = class {
|
|
104
|
+
constructor(element) {
|
|
105
|
+
this.originalElement = element;
|
|
106
|
+
return new Proxy(this, {
|
|
107
|
+
get(target, prop, receiver) {
|
|
108
|
+
if (prop in target) {
|
|
109
|
+
return Reflect.get(target, prop);
|
|
110
|
+
}
|
|
111
|
+
const valueOfProperty = Reflect.get(target.originalElement, prop);
|
|
112
|
+
if (typeof valueOfProperty === "function") {
|
|
113
|
+
return valueOfProperty.bind(target.originalElement);
|
|
114
|
+
}
|
|
115
|
+
return valueOfProperty;
|
|
116
|
+
},
|
|
117
|
+
set(target, prop, newValue, receiver) {
|
|
118
|
+
if (prop in target.originalElement) {
|
|
119
|
+
target.originalElement[prop] = newValue;
|
|
120
|
+
} else {
|
|
121
|
+
target[prop] = newValue;
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
aConcealElement() {
|
|
128
|
+
aLibConcealElement(this.originalElement);
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
aEngageElement(switcher = void 0) {
|
|
132
|
+
aLibEngageElement(this.originalElement, switcher);
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
aHideElement() {
|
|
136
|
+
this.originalElement.hidden = true;
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
aRevealElement() {
|
|
140
|
+
aLibRevealElement(this.originalElement);
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
143
|
+
aShowElement() {
|
|
144
|
+
this.originalElement.hidden = false;
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
aSetTextContent(content) {
|
|
148
|
+
const contentToSet = content.toString();
|
|
149
|
+
this.originalElement.textContent = contentToSet;
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
aTextContent() {
|
|
153
|
+
if (this.originalElement.textContent === null) {
|
|
154
|
+
return ``;
|
|
155
|
+
}
|
|
156
|
+
return this.originalElement.textContent;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// src/AngelsFrontMod.ts
|
|
161
|
+
var AngelsFrontMod = class {
|
|
162
|
+
constructor() {
|
|
163
|
+
this.modWaitStartTimeout = 1e3;
|
|
164
|
+
this.modSubMods = new Array();
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Starts AngelsFrontMod.
|
|
168
|
+
*/
|
|
169
|
+
modStart() {
|
|
170
|
+
this.modInit();
|
|
171
|
+
this.modBind();
|
|
172
|
+
this.modLink();
|
|
173
|
+
this.modRun();
|
|
174
|
+
setTimeout(() => {
|
|
175
|
+
this.modWait();
|
|
176
|
+
}, this.modWaitStartTimeout);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Finishes AngelsFrontMod.
|
|
180
|
+
*/
|
|
181
|
+
modFinish() {
|
|
182
|
+
this.modDeWait();
|
|
183
|
+
this.modDeRun();
|
|
184
|
+
this.modDeLink();
|
|
185
|
+
this.modDeBind();
|
|
186
|
+
this.modDeInit();
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Inits AngelsFrontMod and its sub-modules AngelsFrontMod.
|
|
190
|
+
*/
|
|
191
|
+
modInit() {
|
|
192
|
+
this.modSubMods.forEach((mod) => mod.modInit());
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Binds AngelsFrontMod and its sub-modules AngelsFrontMod.
|
|
196
|
+
*/
|
|
197
|
+
modBind() {
|
|
198
|
+
this.modSubMods.forEach((mod) => mod.modBind());
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Links AngelsFrontMod and its sub-modules AngelsFrontMod.
|
|
202
|
+
*/
|
|
203
|
+
modLink() {
|
|
204
|
+
this.modSubMods.forEach((mod) => mod.modLink());
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Runs AngelsFrontMod and its sub-modules AngelsFrontMod.
|
|
208
|
+
*/
|
|
209
|
+
modRun() {
|
|
210
|
+
this.modSubMods.forEach((mod) => mod.modRun());
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Waits AngelsFrontMod and its sub-modules AngelsFrontMod.
|
|
214
|
+
*/
|
|
215
|
+
modWait() {
|
|
216
|
+
this.modSubMods.forEach((mod) => mod.modWait());
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* DeInits AngelsFrontMod and its sub-modules AngelsFrontMod.
|
|
220
|
+
*/
|
|
221
|
+
modDeInit() {
|
|
222
|
+
this.modSubMods.forEach((mod) => mod.modDeInit());
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* DeBinds AngelsFrontMod and its sub-modules AngelsFrontMod.
|
|
226
|
+
*/
|
|
227
|
+
modDeBind() {
|
|
228
|
+
this.modSubMods.forEach((mod) => mod.modDeBind());
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* DeLinks AngelsFrontMod and its sub-modules AngelsFrontMod.
|
|
232
|
+
*/
|
|
233
|
+
modDeLink() {
|
|
234
|
+
this.modSubMods.forEach((mod) => mod.modDeLink());
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* DeRuns AngelsFrontMod and its sub-modules AngelsFrontMod.
|
|
238
|
+
*/
|
|
239
|
+
modDeRun() {
|
|
240
|
+
this.modSubMods.forEach((mod) => mod.modDeRun());
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* DeWaits AngelsFrontMod and its sub-modules AngelsFrontMod.
|
|
244
|
+
*/
|
|
245
|
+
modDeWait() {
|
|
246
|
+
this.modSubMods.forEach((mod) => mod.modDeWait());
|
|
247
|
+
}
|
|
248
|
+
modDestructor() {
|
|
249
|
+
this.modSubMods.forEach((mod) => mod.modDestructor());
|
|
250
|
+
}
|
|
251
|
+
modAddSubMod(mod) {
|
|
252
|
+
if (mod) {
|
|
253
|
+
this.modSubMods.push(mod);
|
|
254
|
+
mod.modInit();
|
|
255
|
+
return mod;
|
|
256
|
+
}
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
modRequireSubMod(mod) {
|
|
260
|
+
this.modSubMods.push(mod);
|
|
261
|
+
mod.modInit();
|
|
262
|
+
return mod;
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// src/AngelsFrontWidgetClass.ts
|
|
267
|
+
var AngelsFrontWidgetClass = class extends AngelsFrontMod {
|
|
268
|
+
constructor(element) {
|
|
269
|
+
super();
|
|
270
|
+
this.widElement = new AngelsFrontElementClass(element);
|
|
271
|
+
return new Proxy(this, {
|
|
272
|
+
get(target, prop, receiver) {
|
|
273
|
+
if (prop in target) {
|
|
274
|
+
const valueOfProperty2 = target[prop];
|
|
275
|
+
if (typeof valueOfProperty2 === "function") {
|
|
276
|
+
return Reflect.get(target, prop);
|
|
277
|
+
}
|
|
278
|
+
return valueOfProperty2;
|
|
279
|
+
}
|
|
280
|
+
const valueOfProperty = target.widElement[prop];
|
|
281
|
+
if (typeof valueOfProperty === "function") {
|
|
282
|
+
return valueOfProperty.bind(target.widElement);
|
|
283
|
+
}
|
|
284
|
+
return valueOfProperty;
|
|
285
|
+
},
|
|
286
|
+
set(target, prop, newValue, receiver) {
|
|
287
|
+
if (prop in target) {
|
|
288
|
+
target[prop] = newValue;
|
|
289
|
+
} else {
|
|
290
|
+
target.widElement[prop] = newValue;
|
|
291
|
+
}
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
widFindElement(selector) {
|
|
297
|
+
const findElement = this.widElement.querySelector(selector);
|
|
298
|
+
if (findElement) {
|
|
299
|
+
return aFindElement(findElement);
|
|
300
|
+
}
|
|
301
|
+
return null;
|
|
302
|
+
}
|
|
303
|
+
widFindElements(selector) {
|
|
304
|
+
return Array.from(this.widElement.querySelectorAll(selector)).map(aFindElement);
|
|
305
|
+
}
|
|
306
|
+
widRequireElement(selector) {
|
|
307
|
+
const element = this.widElement.querySelector(selector);
|
|
308
|
+
if (element) {
|
|
309
|
+
return aFindElement(element);
|
|
310
|
+
}
|
|
311
|
+
throw Error(`Element '${selector}' is not found.`);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// src/AngelsFrontDOMLibrary.ts
|
|
316
|
+
function aLibCreateWidget(element) {
|
|
317
|
+
return new AngelsFrontWidgetClass(element);
|
|
318
|
+
}
|
|
319
|
+
function aLibFindElement(selector) {
|
|
320
|
+
let element;
|
|
321
|
+
if (typeof selector === "undefined") {
|
|
322
|
+
return null;
|
|
323
|
+
} else if (selector === null) {
|
|
324
|
+
return null;
|
|
325
|
+
} else if (typeof selector === "string") {
|
|
326
|
+
const findElement = document.querySelector(selector);
|
|
327
|
+
if (!findElement) {
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
element = findElement;
|
|
331
|
+
} else if (selector instanceof HTMLElement) {
|
|
332
|
+
element = selector;
|
|
333
|
+
} else if (selector instanceof Element) {
|
|
334
|
+
element = selector;
|
|
335
|
+
} else if (selector instanceof AngelsFrontElementClass) {
|
|
336
|
+
return selector;
|
|
337
|
+
} else {
|
|
338
|
+
element = selector;
|
|
339
|
+
}
|
|
340
|
+
return new AngelsFrontElementClass(element);
|
|
341
|
+
}
|
|
342
|
+
function aLibRequireElement(selector) {
|
|
343
|
+
const element = aLibFindElement(selector);
|
|
344
|
+
if (element) {
|
|
345
|
+
return element;
|
|
346
|
+
}
|
|
347
|
+
throw Error(`Element not found by '${selector}' selector.`);
|
|
348
|
+
}
|
|
349
|
+
function aLibHideElement(selector) {
|
|
350
|
+
const element = aLibRequireElement(selector);
|
|
351
|
+
element.hidden = true;
|
|
352
|
+
return element;
|
|
353
|
+
}
|
|
354
|
+
function aLibShowElement(selector) {
|
|
355
|
+
const element = aLibRequireElement(selector);
|
|
356
|
+
element.hidden = false;
|
|
357
|
+
return element;
|
|
358
|
+
}
|
|
359
|
+
function aLibToggleElement(originalElement, switcher = void 0) {
|
|
360
|
+
const innerElement = aLibRequireElement(originalElement);
|
|
361
|
+
if (switcher === void 0) {
|
|
362
|
+
switcher = !innerElement.hidden;
|
|
363
|
+
}
|
|
364
|
+
if (switcher) {
|
|
365
|
+
return aLibShowElement(innerElement);
|
|
366
|
+
} else {
|
|
367
|
+
return aLibHideElement(innerElement);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
export {
|
|
371
|
+
aLibCreateWidget,
|
|
372
|
+
aLibFindElement,
|
|
373
|
+
aLibHideElement,
|
|
374
|
+
aLibRequireElement,
|
|
375
|
+
aLibShowElement,
|
|
376
|
+
aLibToggleElement
|
|
377
|
+
};
|
|
378
|
+
//# sourceMappingURL=AngelsFrontDOMLibrary.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/AngelsFrontAnimationLibrary.ts","../src/AngelsFrontElement.ts","../src/AngelsFrontMod.ts","../src/AngelsFrontWidgetClass.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","export default class AngelsFrontMod {\n\n protected modSubMods: Array<AngelsFrontMod>;\n public modWaitStartTimeout = 1000;\n\n constructor() {\n this.modSubMods = new Array;\n }\n\n /**\n * Starts AngelsFrontMod.\n */\n modStart() {\n this.modInit();\n this.modBind();\n this.modLink();\n this.modRun();\n setTimeout(() => {\n this.modWait();\n }, this.modWaitStartTimeout);\n }\n\n /**\n * Finishes AngelsFrontMod.\n */\n modFinish() {\n this.modDeWait();\n this.modDeRun();\n this.modDeLink();\n this.modDeBind();\n this.modDeInit();\n }\n\n /**\n * Inits AngelsFrontMod and its sub-modules AngelsFrontMod.\n */\n modInit() {\n this.modSubMods.forEach(mod => mod.modInit());\n }\n\n /**\n * Binds AngelsFrontMod and its sub-modules AngelsFrontMod.\n */\n modBind() {\n this.modSubMods.forEach(mod => mod.modBind());\n }\n\n /**\n * Links AngelsFrontMod and its sub-modules AngelsFrontMod.\n */\n modLink() {\n this.modSubMods.forEach(mod => mod.modLink());\n }\n\n /**\n * Runs AngelsFrontMod and its sub-modules AngelsFrontMod.\n */\n modRun() {\n this.modSubMods.forEach(mod => mod.modRun());\n }\n\n /**\n * Waits AngelsFrontMod and its sub-modules AngelsFrontMod.\n */\n modWait() {\n this.modSubMods.forEach(mod => mod.modWait());\n }\n\n /**\n * DeInits AngelsFrontMod and its sub-modules AngelsFrontMod.\n */\n modDeInit() {\n this.modSubMods.forEach(mod => mod.modDeInit());\n }\n /**\n * DeBinds AngelsFrontMod and its sub-modules AngelsFrontMod.\n */\n modDeBind() {\n this.modSubMods.forEach(mod => mod.modDeBind());\n }\n /**\n * DeLinks AngelsFrontMod and its sub-modules AngelsFrontMod.\n */\n modDeLink() {\n this.modSubMods.forEach(mod => mod.modDeLink());\n }\n /**\n * DeRuns AngelsFrontMod and its sub-modules AngelsFrontMod.\n */\n modDeRun() {\n this.modSubMods.forEach(mod => mod.modDeRun());\n }\n /**\n * DeWaits AngelsFrontMod and its sub-modules AngelsFrontMod.\n */\n modDeWait() {\n this.modSubMods.forEach(mod => mod.modDeWait());\n }\n\n modDestructor() {\n this.modSubMods.forEach(mod => mod.modDestructor());\n }\n\n modAddSubMod(mod: null): null;\n modAddSubMod<TMod extends AngelsFrontMod>(mod: TMod): TMod;\n modAddSubMod<TMod extends AngelsFrontMod>(mod: TMod | null): TMod | null {\n if (mod) {\n this.modSubMods.push(mod);\n mod.modInit();\n return mod;\n }\n return null;\n }\n\n modRequireSubMod<TMod extends AngelsFrontMod>(mod: TMod): TMod {\n this.modSubMods.push(mod);\n mod.modInit();\n return mod;\n }\n}","import AngelsFrontElementClass, { AngelsFrontElement } from \"./AngelsFrontElement\";\nimport AngelsFrontMod from \"./AngelsFrontMod\";\n\nexport type AngelsFrontWidget<THTMLElement extends HTMLElement = HTMLElement> = AngelsFrontWidgetClass<THTMLElement> & THTMLElement;\n\nexport default interface AngelsFrontWidgetClass<TWidgetHTMLElement extends HTMLElement = HTMLElement> extends HTMLElement { }\n\nexport default class AngelsFrontWidgetClass<TWidgetHTMLElement extends HTMLElement = HTMLElement> extends AngelsFrontMod {\n\n readonly widElement: AngelsFrontElement<TWidgetHTMLElement>;\n\n constructor(element: TWidgetHTMLElement) {\n super();\n this.widElement = new AngelsFrontElementClass(element) as AngelsFrontElement<TWidgetHTMLElement>;\n return new Proxy(this, {\n get(target: any, prop: string | symbol, receiver: any) {\n if (prop in target) {\n const valueOfProperty = target[prop];\n if (typeof valueOfProperty === 'function') {\n return Reflect.get(target, prop);\n }\n return valueOfProperty;\n }\n\n const valueOfProperty = target.widElement[prop];\n if (typeof valueOfProperty === 'function') {\n return valueOfProperty.bind(target.widElement);\n }\n return valueOfProperty;\n },\n\n set(target: any, prop: string | symbol, newValue: any, receiver: any) {\n if (prop in target) {\n target[prop] = newValue;\n } else {\n target.widElement[prop] = newValue;\n }\n return true;\n }\n }) as unknown as AngelsFrontWidget<TWidgetHTMLElement>;\n }\n\n widFindElement<THTMLElement extends HTMLElement = HTMLElement>(selector: string): AngelsFrontElement<THTMLElement> | null | null {\n const findElement = this.widElement.querySelector(selector);\n if (findElement) {\n return aFindElement<THTMLElement>(findElement);\n }\n return null;\n }\n\n widFindElements<THTMLElement extends HTMLElement = HTMLElement>(selector: string): Array<AngelsFrontElement<THTMLElement>> {\n return Array.from(this.widElement.querySelectorAll(selector))\n .map(aFindElement);\n }\n\n widRequireElement<THTMLElement extends HTMLElement = HTMLElement>(selector: string): AngelsFrontElement<THTMLElement> {\n const element = this.widElement.querySelector(selector);\n if (element) {\n return aFindElement<THTMLElement>(element);\n }\n throw Error(`Element '${selector}' is not found.`);\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":";;;;;;;;;;;;;;;;;;;;;;AAEA,SAAsB,mBAAmB,iBAAqC;AAAA;AAC1E,UAAM,eAAe,mBAAmB,eAAe;AACvD,UAAM,UAAU,IAAI,QAAc,CAAC,YAAY;AAE3C,UAAI,aAAa,QAAQ;AACrB,gBAAQ;AACR;AAAA,MACJ;AAEA,UAAI;AAEJ,YAAM,mBAAmB,MAAM;AAC3B,qBAAa,OAA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D,MAAI,SAAS;AACT,WAAO;AAAA,EACX;AACA,QAAM,MAAM,yBAAyB,QAAQ,aAAa;AAC9D;AAEO,SAAS,gBAAkD,UAAgE;AAC9H,QAAM,UAAU,mBAAiC,QAAQ;AACzD,UAAQ,SAAS;AACjB,SAAO;AACX;AAEO,SAAS,gBAAkD,UAAgE;AAC9H,QAAM,UAAU,mBAAiC,QAAQ;AACzD,UAAQ,SAAS;AACjB,SAAO;AACX;AAEO,SAAS,kBAAkB,iBAAqC,WAAgC,QAAW;AAC9G,QAAM,eAAe,mBAAmB,eAAe;AACvD,MAAI,aAAa,QAAW;AACxB,eAAW,CAAC,aAAa;AAAA,EAC7B;AACA,MAAI,UAAU;AACV,WAAO,gBAAgB,YAAY;AAAA,EACvC,OAAO;AACH,WAAO,gBAAgB,YAAY;AAAA,EACvC;AACJ;","names":["valueOfProperty"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type AngelsFrontElement<THTMLElement extends HTMLElement = HTMLElement> = AngelsFrontElementClass<THTMLElement> & THTMLElement;
|
|
2
|
+
declare class AngelsFrontElementClass<THTMLElement extends HTMLElement = HTMLElement> {
|
|
3
|
+
originalElement: THTMLElement;
|
|
4
|
+
constructor(element: THTMLElement);
|
|
5
|
+
aConcealElement(): this;
|
|
6
|
+
aEngageElement(switcher?: boolean | undefined): this;
|
|
7
|
+
aHideElement(): this;
|
|
8
|
+
aRevealElement(): this;
|
|
9
|
+
aShowElement(): this;
|
|
10
|
+
aSetTextContent(content: string): this;
|
|
11
|
+
aTextContent(): string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { type AngelsFrontElement, AngelsFrontElementClass as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type AngelsFrontElement<THTMLElement extends HTMLElement = HTMLElement> = AngelsFrontElementClass<THTMLElement> & THTMLElement;
|
|
2
|
+
declare class AngelsFrontElementClass<THTMLElement extends HTMLElement = HTMLElement> {
|
|
3
|
+
originalElement: THTMLElement;
|
|
4
|
+
constructor(element: THTMLElement);
|
|
5
|
+
aConcealElement(): this;
|
|
6
|
+
aEngageElement(switcher?: boolean | undefined): this;
|
|
7
|
+
aHideElement(): this;
|
|
8
|
+
aRevealElement(): this;
|
|
9
|
+
aShowElement(): this;
|
|
10
|
+
aSetTextContent(content: string): this;
|
|
11
|
+
aTextContent(): string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { type AngelsFrontElement, AngelsFrontElementClass as default };
|
|
@@ -37,44 +37,51 @@ var __async = (__this, __arguments, generator) => {
|
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
// src/
|
|
41
|
-
var
|
|
42
|
-
__export(
|
|
43
|
-
|
|
44
|
-
aLibShowElement: () => aLibShowElement,
|
|
45
|
-
aLibToggleElement: () => aLibToggleElement
|
|
40
|
+
// src/AngelsFrontElement.ts
|
|
41
|
+
var AngelsFrontElement_exports = {};
|
|
42
|
+
__export(AngelsFrontElement_exports, {
|
|
43
|
+
default: () => AngelsFrontElementClass
|
|
46
44
|
});
|
|
47
|
-
module.exports = __toCommonJS(
|
|
45
|
+
module.exports = __toCommonJS(AngelsFrontElement_exports);
|
|
48
46
|
|
|
49
47
|
// src/AngelsFrontDOMLibrary.ts
|
|
50
|
-
function
|
|
48
|
+
function aLibFindElement(selector) {
|
|
51
49
|
let element;
|
|
52
50
|
if (typeof selector === "undefined") {
|
|
53
|
-
|
|
51
|
+
return null;
|
|
54
52
|
} else if (selector === null) {
|
|
55
|
-
|
|
53
|
+
return null;
|
|
56
54
|
} else if (typeof selector === "string") {
|
|
57
55
|
const findElement = document.querySelector(selector);
|
|
58
56
|
if (!findElement) {
|
|
59
|
-
|
|
57
|
+
return null;
|
|
60
58
|
}
|
|
61
59
|
element = findElement;
|
|
62
60
|
} else if (selector instanceof HTMLElement) {
|
|
63
61
|
element = selector;
|
|
64
62
|
} else if (selector instanceof Element) {
|
|
65
63
|
element = selector;
|
|
64
|
+
} else if (selector instanceof AngelsFrontElementClass) {
|
|
65
|
+
return selector;
|
|
66
66
|
} else {
|
|
67
67
|
element = selector;
|
|
68
68
|
}
|
|
69
|
-
return element;
|
|
69
|
+
return new AngelsFrontElementClass(element);
|
|
70
|
+
}
|
|
71
|
+
function aLibRequireElement(selector) {
|
|
72
|
+
const element = aLibFindElement(selector);
|
|
73
|
+
if (element) {
|
|
74
|
+
return element;
|
|
75
|
+
}
|
|
76
|
+
throw Error(`Element not found by '${selector}' selector.`);
|
|
70
77
|
}
|
|
71
78
|
|
|
72
79
|
// src/AngelsFrontAnimationLibrary.ts
|
|
73
|
-
function
|
|
80
|
+
function aLibConcealElement(originalElement) {
|
|
74
81
|
return __async(this, null, function* () {
|
|
75
82
|
const innerElement = aLibRequireElement(originalElement);
|
|
76
83
|
const promise = new Promise((resolve) => {
|
|
77
|
-
if (
|
|
84
|
+
if (innerElement.hidden) {
|
|
78
85
|
resolve();
|
|
79
86
|
return;
|
|
80
87
|
}
|
|
@@ -82,42 +89,47 @@ function aLibShowElement(originalElement) {
|
|
|
82
89
|
const animationHandler = () => {
|
|
83
90
|
clearTimeout(timeout);
|
|
84
91
|
innerElement.removeEventListener("animationend", animationHandler);
|
|
92
|
+
innerElement.hidden = true;
|
|
93
|
+
innerElement.classList.remove("a-out-animation");
|
|
85
94
|
resolve();
|
|
86
95
|
};
|
|
87
|
-
innerElement.
|
|
96
|
+
innerElement.classList.add("a-out-animation");
|
|
88
97
|
const animations = innerElement.getAnimations();
|
|
89
98
|
if (animations.length > 0) {
|
|
90
99
|
timeout = setTimeout(() => {
|
|
91
100
|
innerElement.removeEventListener("animationend", animationHandler);
|
|
101
|
+
innerElement.hidden = true;
|
|
102
|
+
innerElement.classList.remove("a-out-animation");
|
|
92
103
|
console.warn("Animation timeout");
|
|
93
104
|
resolve();
|
|
94
105
|
}, 5e3);
|
|
95
106
|
innerElement.addEventListener("animationend", animationHandler);
|
|
96
107
|
} else {
|
|
108
|
+
innerElement.hidden = true;
|
|
97
109
|
resolve();
|
|
98
110
|
}
|
|
99
111
|
});
|
|
100
112
|
return promise;
|
|
101
113
|
});
|
|
102
114
|
}
|
|
103
|
-
function
|
|
115
|
+
function aLibEngageElement(originalElement, switcher = void 0) {
|
|
104
116
|
return __async(this, null, function* () {
|
|
105
117
|
const innerElement = aLibRequireElement(originalElement);
|
|
106
118
|
if (switcher === void 0) {
|
|
107
|
-
switcher =
|
|
119
|
+
switcher = innerElement.hidden;
|
|
108
120
|
}
|
|
109
121
|
if (switcher) {
|
|
110
|
-
return yield
|
|
122
|
+
return yield aLibRevealElement(innerElement);
|
|
111
123
|
} else {
|
|
112
|
-
return yield
|
|
124
|
+
return yield aLibConcealElement(innerElement);
|
|
113
125
|
}
|
|
114
126
|
});
|
|
115
127
|
}
|
|
116
|
-
function
|
|
128
|
+
function aLibRevealElement(originalElement) {
|
|
117
129
|
return __async(this, null, function* () {
|
|
118
130
|
const innerElement = aLibRequireElement(originalElement);
|
|
119
131
|
const promise = new Promise((resolve) => {
|
|
120
|
-
if (innerElement.hidden) {
|
|
132
|
+
if (!innerElement.hidden) {
|
|
121
133
|
resolve();
|
|
122
134
|
return;
|
|
123
135
|
}
|
|
@@ -125,33 +137,80 @@ function aLibHideElement(originalElement) {
|
|
|
125
137
|
const animationHandler = () => {
|
|
126
138
|
clearTimeout(timeout);
|
|
127
139
|
innerElement.removeEventListener("animationend", animationHandler);
|
|
128
|
-
innerElement.hidden = true;
|
|
129
|
-
innerElement.classList.remove("a-out-animation");
|
|
130
140
|
resolve();
|
|
131
141
|
};
|
|
132
|
-
innerElement.
|
|
142
|
+
innerElement.hidden = false;
|
|
133
143
|
const animations = innerElement.getAnimations();
|
|
134
144
|
if (animations.length > 0) {
|
|
135
145
|
timeout = setTimeout(() => {
|
|
136
146
|
innerElement.removeEventListener("animationend", animationHandler);
|
|
137
|
-
innerElement.hidden = true;
|
|
138
|
-
innerElement.classList.remove("a-out-animation");
|
|
139
147
|
console.warn("Animation timeout");
|
|
140
148
|
resolve();
|
|
141
149
|
}, 5e3);
|
|
142
150
|
innerElement.addEventListener("animationend", animationHandler);
|
|
143
151
|
} else {
|
|
144
|
-
innerElement.hidden = true;
|
|
145
152
|
resolve();
|
|
146
153
|
}
|
|
147
154
|
});
|
|
148
155
|
return promise;
|
|
149
156
|
});
|
|
150
157
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
|
|
159
|
+
// src/AngelsFrontElement.ts
|
|
160
|
+
var AngelsFrontElementClass = class {
|
|
161
|
+
constructor(element) {
|
|
162
|
+
this.originalElement = element;
|
|
163
|
+
return new Proxy(this, {
|
|
164
|
+
get(target, prop, receiver) {
|
|
165
|
+
if (prop in target) {
|
|
166
|
+
return Reflect.get(target, prop);
|
|
167
|
+
}
|
|
168
|
+
const valueOfProperty = Reflect.get(target.originalElement, prop);
|
|
169
|
+
if (typeof valueOfProperty === "function") {
|
|
170
|
+
return valueOfProperty.bind(target.originalElement);
|
|
171
|
+
}
|
|
172
|
+
return valueOfProperty;
|
|
173
|
+
},
|
|
174
|
+
set(target, prop, newValue, receiver) {
|
|
175
|
+
if (prop in target.originalElement) {
|
|
176
|
+
target.originalElement[prop] = newValue;
|
|
177
|
+
} else {
|
|
178
|
+
target[prop] = newValue;
|
|
179
|
+
}
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
aConcealElement() {
|
|
185
|
+
aLibConcealElement(this.originalElement);
|
|
186
|
+
return this;
|
|
187
|
+
}
|
|
188
|
+
aEngageElement(switcher = void 0) {
|
|
189
|
+
aLibEngageElement(this.originalElement, switcher);
|
|
190
|
+
return this;
|
|
191
|
+
}
|
|
192
|
+
aHideElement() {
|
|
193
|
+
this.originalElement.hidden = true;
|
|
194
|
+
return this;
|
|
195
|
+
}
|
|
196
|
+
aRevealElement() {
|
|
197
|
+
aLibRevealElement(this.originalElement);
|
|
198
|
+
return this;
|
|
199
|
+
}
|
|
200
|
+
aShowElement() {
|
|
201
|
+
this.originalElement.hidden = false;
|
|
202
|
+
return this;
|
|
203
|
+
}
|
|
204
|
+
aSetTextContent(content) {
|
|
205
|
+
const contentToSet = content.toString();
|
|
206
|
+
this.originalElement.textContent = contentToSet;
|
|
207
|
+
return this;
|
|
208
|
+
}
|
|
209
|
+
aTextContent() {
|
|
210
|
+
if (this.originalElement.textContent === null) {
|
|
211
|
+
return ``;
|
|
212
|
+
}
|
|
213
|
+
return this.originalElement.textContent;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
//# sourceMappingURL=AngelsFrontElement.js.map
|