@appartmint/mint 0.8.12 → 0.9.0

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.
Files changed (58) hide show
  1. package/dist/css/mint.css +161 -4
  2. package/dist/css/mint.css.map +1 -1
  3. package/dist/css/mint.min.css +1 -1
  4. package/dist/css/mint.min.css.map +1 -1
  5. package/dist/css/noscript.css +8 -0
  6. package/dist/css/noscript.css.map +1 -0
  7. package/dist/css/noscript.min.css +3 -0
  8. package/dist/css/noscript.min.css.map +1 -0
  9. package/dist/js/imports/components/header.d.ts +110 -0
  10. package/dist/js/imports/components/header.d.ts.map +1 -0
  11. package/dist/js/imports/enum.d.ts +10 -0
  12. package/dist/js/imports/enum.d.ts.map +1 -0
  13. package/dist/js/imports/models/color.d.ts +32 -0
  14. package/dist/js/imports/models/color.d.ts.map +1 -0
  15. package/dist/js/imports/models/item.d.ts +48 -0
  16. package/dist/js/imports/models/item.d.ts.map +1 -0
  17. package/dist/js/imports/util/display.d.ts +7 -0
  18. package/dist/js/imports/util/display.d.ts.map +1 -0
  19. package/dist/js/imports/util/event.d.ts +7 -0
  20. package/dist/js/imports/util/event.d.ts.map +1 -0
  21. package/dist/js/imports/util/icon.d.ts +24 -0
  22. package/dist/js/imports/util/icon.d.ts.map +1 -0
  23. package/dist/js/imports/util/math.d.ts +14 -0
  24. package/dist/js/imports/util/math.d.ts.map +1 -0
  25. package/dist/js/imports/util/object.d.ts +59 -0
  26. package/dist/js/imports/util/object.d.ts.map +1 -0
  27. package/dist/js/imports/util/selectors.d.ts +146 -0
  28. package/dist/js/imports/util/selectors.d.ts.map +1 -0
  29. package/dist/js/imports/util/settings.d.ts +53 -0
  30. package/dist/js/imports/util/settings.d.ts.map +1 -0
  31. package/dist/js/imports/util/text.d.ts +7 -0
  32. package/dist/js/imports/util/text.d.ts.map +1 -0
  33. package/dist/js/imports/util/window.d.ts +7 -0
  34. package/dist/js/imports/util/window.d.ts.map +1 -0
  35. package/dist/js/index.d.ts +19 -2
  36. package/dist/js/index.d.ts.map +1 -1
  37. package/dist/js/index.js +1505 -80
  38. package/dist/js/index.js.map +1 -1
  39. package/dist/js/index.min.js +1 -1
  40. package/dist/js/index.min.js.map +1 -1
  41. package/dist/js/util.d.ts +78 -0
  42. package/dist/js/util.d.ts.map +1 -0
  43. package/dist/js/util.js +638 -0
  44. package/dist/js/util.js.map +1 -0
  45. package/dist/js/util.min.js +2 -0
  46. package/dist/js/util.min.js.map +1 -0
  47. package/package.json +1 -5
  48. package/src/scss/imports/components/_buttons.scss +1 -0
  49. package/src/scss/imports/components/_header.scss +196 -0
  50. package/src/scss/imports/components/_index.scss +2 -1
  51. package/src/scss/imports/global/_animations.scss +5 -1
  52. package/src/scss/imports/global/_global.scss +5 -1
  53. package/src/scss/imports/global/_themes.scss +0 -1
  54. package/src/scss/imports/{_mint.scss → util/_index.scss} +1 -1
  55. package/src/scss/imports/util/_util.scss +713 -0
  56. package/src/scss/noscript.scss +14 -0
  57. package/src/scss/imports/_util.scss +0 -7
  58. /package/src/scss/imports/{_vars.scss → util/_vars.scss} +0 -0
@@ -0,0 +1,638 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["mintUtil"] = factory();
8
+ else
9
+ root["mintUtil"] = factory();
10
+ })(this, () => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ "./src/ts/imports/enum.ts":
16
+ /*!********************************!*\
17
+ !*** ./src/ts/imports/enum.ts ***!
18
+ \********************************/
19
+ /***/ ((__unused_webpack_module, exports) => {
20
+
21
+
22
+
23
+ Object.defineProperty(exports, "__esModule", ({
24
+ value: true
25
+ }));
26
+ exports.mintSide = void 0;
27
+ /**
28
+ * Side Enum
29
+ */
30
+ var mintSide;
31
+ (function (mintSide) {
32
+ mintSide[mintSide["Top"] = 0] = "Top";
33
+ mintSide[mintSide["Right"] = 1] = "Right";
34
+ mintSide[mintSide["Bottom"] = 2] = "Bottom";
35
+ mintSide[mintSide["Left"] = 3] = "Left";
36
+ })(mintSide = exports.mintSide || (exports.mintSide = {}));
37
+ ;
38
+
39
+ /***/ }),
40
+
41
+ /***/ "./src/ts/imports/util/selectors.ts":
42
+ /*!******************************************!*\
43
+ !*** ./src/ts/imports/util/selectors.ts ***!
44
+ \******************************************/
45
+ /***/ ((__unused_webpack_module, exports) => {
46
+
47
+
48
+
49
+ var _a;
50
+ Object.defineProperty(exports, "__esModule", ({
51
+ value: true
52
+ }));
53
+ exports.mintSelectors = void 0;
54
+ /**
55
+ * CSS-selector helpers
56
+ * @public
57
+ */
58
+ class mintSelectors {
59
+ /**
60
+ * Adds the library prefix to the beginning of the provided string
61
+ * @param base - the string to be prefixed
62
+ * @returns - the provided string prefixed with the library name
63
+ */
64
+ static prefix(base) {
65
+ base = base.toLowerCase();
66
+ return base.startsWith(this.pre) ? base : `${this.pre}${base}`;
67
+ }
68
+ /**
69
+ * Adds two dashes to the beginning of the provided string
70
+ * @param base - the string to be prefixed
71
+ * @returns - the provided string prefixed with two dashes
72
+ */
73
+ static cssPrefix(base) {
74
+ return `--${this.prefix(base.replace(/^-+/, ''))}`;
75
+ }
76
+ /**
77
+ * Turns the provided string into a CSS variable call
78
+ * @param base - the name of the CSS variable to call
79
+ * @returns - the CSS variable call for the provided string
80
+ */
81
+ static cssVar(base) {
82
+ return `var(${this.cssPrefix(base)})`;
83
+ }
84
+ /**
85
+ * Negates the provided CSS selector
86
+ * @param base - the CSS selector to negate
87
+ * @returns - the negated CSS selector
88
+ */
89
+ static neg(base) {
90
+ return `:not(${base})`;
91
+ }
92
+ /**
93
+ * Generates a class CSS selector
94
+ * @param base - the name of the class to generate
95
+ * @returns - the generated CSS selector
96
+ */
97
+ static class(base) {
98
+ return `.${this.prefix(base)}`;
99
+ }
100
+ /**
101
+ * Generates an id CSS selector
102
+ * @param base - the name of the id to generate
103
+ * @returns - the generated CSS selector
104
+ */
105
+ static id(base) {
106
+ return `#${this.prefix(base)}`;
107
+ }
108
+ /**
109
+ * Generates an aria-controls CSS selector
110
+ * @param id - the id of the controlled element
111
+ * @returns - the generated CSS selector
112
+ */
113
+ static controls(id) {
114
+ return id ? `[aria-controls="${this.prefix(id)}"]` : this.hasControls;
115
+ }
116
+ /**
117
+ * Generates an aria-expanded CSS selector
118
+ * @param bool - whether the element is expanded or not
119
+ * @returns - the generated CSS selector
120
+ */
121
+ static expanded(bool) {
122
+ return typeof bool === 'boolean' ? `[aria-expanded="${bool}"]` : this.hasExpanded;
123
+ }
124
+ /**
125
+ * Returns the id of the requested element
126
+ */
127
+ static getId(id) {
128
+ var _b;
129
+ return (_b = this.ids[id !== null && id !== void 0 ? id : -1]) !== null && _b !== void 0 ? _b : '';
130
+ }
131
+ /**
132
+ * Returns the class of the requested element
133
+ */
134
+ static getClass(className, classGroup) {
135
+ var _b, _c;
136
+ if (classGroup) {
137
+ let group = this.classes[classGroup];
138
+ return (_b = group[className !== null && className !== void 0 ? className : -1]) !== null && _b !== void 0 ? _b : '';
139
+ }
140
+ return (_c = this.classes[className !== null && className !== void 0 ? className : -1]) !== null && _c !== void 0 ? _c : '';
141
+ }
142
+ /**
143
+ * Returns a NodeList of HTMLElements within the given element that are focusable
144
+ * @param el - the element whose focusable children will be returned
145
+ * @returns - the elements within the given element that are focusable
146
+ */
147
+ static getFocusables(el) {
148
+ let focusables;
149
+ if (el) {
150
+ focusables = [...el.querySelectorAll(this.focusable)];
151
+ } else {
152
+ focusables = [...document.querySelectorAll(this.focusable)];
153
+ }
154
+ return focusables.filter(el => this.isFocusable(el));
155
+ }
156
+ /**
157
+ * Returns true if an element is focusable and false if not,
158
+ * based on styles (i.e. a parent has display: none;)
159
+ * NOTE: Still need to determine what other styles may make an element un-focusable
160
+ * @param el - the element
161
+ * @returns - true if the element is focusable; false if not
162
+ */
163
+ static isFocusable(el) {
164
+ let current = el;
165
+ do {
166
+ if (window.getComputedStyle(current).getPropertyValue('display').toLowerCase() === 'none') {
167
+ return false;
168
+ }
169
+ current = current.parentElement;
170
+ } while (current);
171
+ return true;
172
+ }
173
+ }
174
+ exports.mintSelectors = mintSelectors;
175
+ _a = mintSelectors;
176
+ /**
177
+ * The library name that will be added as a prefix
178
+ */
179
+ mintSelectors.lib = 'mint';
180
+ /**
181
+ * The prefix built from the library name
182
+ */
183
+ mintSelectors.pre = `${_a.lib}-`;
184
+ /**
185
+ * CSS-selector for disabled elements
186
+ */
187
+ mintSelectors.disabled = '[disabled]';
188
+ /**
189
+ * CSS-selector for elements with an aria-controls attribute
190
+ */
191
+ mintSelectors.hasControls = '[aria-controls]';
192
+ /**
193
+ * CSS-selector for elements with an aria-expanded attribute
194
+ */
195
+ mintSelectors.hasExpanded = '[aria-expanded]';
196
+ /**
197
+ * CSS-selector for elements with an href attribute
198
+ */
199
+ mintSelectors.hasLink = '[href]';
200
+ /**
201
+ * CSS-selector for elements with a routerLink attribute
202
+ */
203
+ mintSelectors.hasRouterLink = '[routerLink]';
204
+ /**
205
+ * CSS-selector for elements with an id attribute
206
+ */
207
+ mintSelectors.hasId = '[id]';
208
+ /**
209
+ * CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
210
+ */
211
+ mintSelectors.notTabbable = '[tabindex^="-"]';
212
+ /**
213
+ * CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
214
+ */
215
+ mintSelectors.tabbable = `[tabindex]${_a.neg(_a.notTabbable)}`;
216
+ /**
217
+ * CSS-selector for elements that can receive focus
218
+ */
219
+ mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
220
+ select${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
221
+ textarea${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
222
+ button${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
223
+ object${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
224
+ a${_a.hasLink}, a${_a.hasRouterLink},
225
+ area${_a.hasLink},
226
+ ${_a.tabbable}`.replace(/\s/g, '');
227
+ /**
228
+ * CSS-selector for submenu buttons
229
+ */
230
+ mintSelectors.subMenuButtons = `button${_a.hasControls}`;
231
+ /**
232
+ * CSS-selector for submenus
233
+ */
234
+ mintSelectors.subMenu = `${_a.subMenuButtons} + ul${_a.hasId}`;
235
+ /**
236
+ * Frequently-used ids
237
+ */
238
+ mintSelectors.ids = {
239
+ header: _a.prefix('header'),
240
+ logo: _a.prefix('logo'),
241
+ wrapper: _a.prefix('wrapper'),
242
+ mainContent: _a.prefix('main-content')
243
+ };
244
+ /**
245
+ * Classes
246
+ */
247
+ mintSelectors.classes = {
248
+ sides: {
249
+ top: _a.prefix('top'),
250
+ right: _a.prefix('right'),
251
+ bottom: _a.prefix('bottom'),
252
+ left: _a.prefix('left')
253
+ },
254
+ srOnly: _a.prefix('sr-only'),
255
+ js: _a.prefix('js'),
256
+ ready: _a.prefix('ready'),
257
+ fixed: _a.prefix('fixed'),
258
+ open: _a.prefix('open')
259
+ };
260
+ exports["default"] = mintSelectors;
261
+
262
+ /***/ }),
263
+
264
+ /***/ "./src/ts/imports/util/settings.ts":
265
+ /*!*****************************************!*\
266
+ !*** ./src/ts/imports/util/settings.ts ***!
267
+ \*****************************************/
268
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
269
+
270
+
271
+
272
+ var _a;
273
+ Object.defineProperty(exports, "__esModule", ({
274
+ value: true
275
+ }));
276
+ exports.mintSettings = void 0;
277
+ /**
278
+ * Imports
279
+ */
280
+ const enum_1 = __webpack_require__(/*! ../enum */ "./src/ts/imports/enum.ts");
281
+ const selectors_1 = __webpack_require__(/*! ./selectors */ "./src/ts/imports/util/selectors.ts");
282
+ /**
283
+ * Settings management
284
+ * @public
285
+ */
286
+ class mintSettings {
287
+ /**
288
+ * Update the provided settings variables
289
+ * @param settings - Object of settings variables to update
290
+ */
291
+ static set(settings) {
292
+ let newDelay = false;
293
+ if (typeof settings.delayBase === 'number') {
294
+ this.delayBase = settings.delayBase;
295
+ newDelay = true;
296
+ }
297
+ if (typeof settings.delayStep === 'number') {
298
+ this.delayStep = settings.delayStep;
299
+ newDelay = true;
300
+ }
301
+ if (newDelay) {
302
+ this.setDelay();
303
+ }
304
+ if (settings.delay && Object.keys(settings.delay).length) {
305
+ if (Object.values(settings.delay).reduce((prev, next) => prev && typeof next === 'number', true)) {
306
+ this.delay = Object.assign(Object.assign({}, this.delay), settings.delay);
307
+ }
308
+ }
309
+ }
310
+ /**
311
+ * Updates the delay variables based on `this.delayBase` and `this.delayStep`
312
+ */
313
+ static setDelay() {
314
+ this.delay = {
315
+ instant: this.delayBase + this.delayStep * 0,
316
+ fast: this.delayBase + this.delayStep * 1,
317
+ medFast: this.delayBase + this.delayStep * 2,
318
+ default: this.delayBase + this.delayStep * 3,
319
+ medSlow: this.delayBase + this.delayStep * 4,
320
+ slow: this.delayBase + this.delayStep * 5
321
+ };
322
+ }
323
+ /**
324
+ * Updates the direction the navbar enters from
325
+ */
326
+ static setFrom(from) {
327
+ if (this.from !== from) {
328
+ this.from = from;
329
+ let header = document.getElementById(selectors_1.mintSelectors.getId('header'));
330
+ header === null || header === void 0 ? void 0 : header.classList.remove(...Object.values(selectors_1.mintSelectors.classes.sides));
331
+ header === null || header === void 0 ? void 0 : header.classList.add(selectors_1.mintSelectors.getClass(enum_1.mintSide[this.from].toLowerCase(), 'sides'));
332
+ }
333
+ }
334
+ /**
335
+ * Updates whether or not the navbar is fixed
336
+ */
337
+ static setFixed(fixed) {
338
+ if (this.fixed !== fixed) {
339
+ this.fixed = fixed;
340
+ let header = document.getElementById(selectors_1.mintSelectors.getId('header')),
341
+ fixedClass = selectors_1.mintSelectors.getClass('fixed');
342
+ if (this.fixed) {
343
+ header === null || header === void 0 ? void 0 : header.classList.add(fixedClass);
344
+ } else {
345
+ header === null || header === void 0 ? void 0 : header.classList.remove(fixedClass);
346
+ }
347
+ }
348
+ }
349
+ }
350
+ exports.mintSettings = mintSettings;
351
+ _a = mintSettings;
352
+ /**
353
+ * Value added to all delay variables
354
+ */
355
+ mintSettings.delayBase = 0;
356
+ /**
357
+ * Value multiplied by delay variable index
358
+ */
359
+ mintSettings.delayStep = 100;
360
+ /**
361
+ * Delay variables
362
+ */
363
+ mintSettings.delay = {
364
+ instant: _a.delayBase + _a.delayStep * 0,
365
+ fast: _a.delayBase + _a.delayStep * 1,
366
+ medFast: _a.delayBase + _a.delayStep * 2,
367
+ default: _a.delayBase + _a.delayStep * 3,
368
+ medSlow: _a.delayBase + _a.delayStep * 4,
369
+ slow: _a.delayBase + _a.delayStep * 5
370
+ };
371
+ ;
372
+ exports["default"] = mintSettings;
373
+
374
+ /***/ }),
375
+
376
+ /***/ "./src/ts/util.ts":
377
+ /*!************************!*\
378
+ !*** ./src/ts/util.ts ***!
379
+ \************************/
380
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
381
+
382
+
383
+
384
+ var __importDefault = this && this.__importDefault || function (mod) {
385
+ return mod && mod.__esModule ? mod : {
386
+ "default": mod
387
+ };
388
+ };
389
+ Object.defineProperty(exports, "__esModule", ({
390
+ value: true
391
+ }));
392
+ exports.mintUtil = void 0;
393
+ /**
394
+ * Imports
395
+ */
396
+ const enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts");
397
+ const settings_1 = __importDefault(__webpack_require__(/*! ./imports/util/settings */ "./src/ts/imports/util/settings.ts"));
398
+ /**
399
+ * Utility functions
400
+ * @public
401
+ */
402
+ class mintUtil {
403
+ /**
404
+ * Returns the width of the window, including fractional pixels
405
+ * @returns the width of the window
406
+ */
407
+ static windowWidth() {
408
+ let body = document.getElementsByTagName('body')[0],
409
+ decimal = body.getBoundingClientRect().width % 1;
410
+ return window.innerWidth + decimal;
411
+ }
412
+ /**
413
+ * Ensures that a function `func` is run only after not being called for `wait` milliseconds
414
+ * @param func - the function to debounce
415
+ * @param wait - the amount of time to wait before running the function
416
+ * @returns - the debounced function
417
+ */
418
+ static debounce(func) {
419
+ let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
420
+ let timer;
421
+ return function (e) {
422
+ if (timer) {
423
+ clearTimeout(timer);
424
+ }
425
+ timer = setTimeout(func, wait, e);
426
+ };
427
+ }
428
+ /**
429
+ * Ensures that a function `func` is run only after not being called for `wait` milliseconds
430
+ * @param func - the function to debounce
431
+ * @param wait - the amount of time to wait before running the function
432
+ * @returns - the debounced function as an EventListener
433
+ */
434
+ static debounceEvent(func) {
435
+ let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
436
+ return mintUtil.debounce(func, wait);
437
+ }
438
+ /**
439
+ * Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
440
+ * @param func - the function to throttle
441
+ * @param wait - the amount of time between function calls
442
+ * @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
443
+ * @returns - the throttled function
444
+ */
445
+ static throttle(func) {
446
+ let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
447
+ let options = arguments.length > 2 ? arguments[2] : undefined;
448
+ let context,
449
+ args,
450
+ result,
451
+ timeout,
452
+ previous = 0,
453
+ later = function () {
454
+ previous = (options === null || options === void 0 ? void 0 : options.leading) === false ? 0 : new Date().getTime();
455
+ timeout = 0;
456
+ result = func.apply(context, args);
457
+ if (!timeout) {
458
+ context = args = null;
459
+ }
460
+ },
461
+ throttled = function () {
462
+ let now = new Date().getTime();
463
+ if (!previous && (options === null || options === void 0 ? void 0 : options.leading) === false) {
464
+ previous = now;
465
+ }
466
+ let remaining = wait - now + previous;
467
+ context = this;
468
+ args = arguments;
469
+ if (remaining <= 0 || remaining > wait) {
470
+ if (timeout) {
471
+ clearTimeout(timeout);
472
+ timeout = 0;
473
+ }
474
+ previous = now;
475
+ result = func.apply(context, args);
476
+ if (!timeout) {
477
+ context = args = null;
478
+ }
479
+ } else if (!timeout && (options === null || options === void 0 ? void 0 : options.trailing) !== false) {
480
+ timeout = window.setTimeout(later, remaining);
481
+ }
482
+ return result;
483
+ };
484
+ return throttled;
485
+ }
486
+ /**
487
+ * Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
488
+ * @param func - the function to throttle
489
+ * @param wait - the amount of time between function calls
490
+ * @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
491
+ * @returns - the throttled function as an EventListener
492
+ */
493
+ static throttleEvent(func) {
494
+ let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
495
+ let options = arguments.length > 2 ? arguments[2] : undefined;
496
+ return mintUtil.throttle(func, wait, options);
497
+ }
498
+ /**
499
+ * Sets the element's height to its `innerHeight`, then to `auto` after a delay
500
+ * @param el - the element whose height will be set
501
+ * @param delay - the amount of time in milliseconds that the show animation will be active
502
+ * @param from - the side that the element is animating from
503
+ */
504
+ static show(el) {
505
+ let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
506
+ let from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : enum_1.mintSide.Top;
507
+ if (el) {
508
+ el.style.display = '';
509
+ requestAnimationFrame(() => {
510
+ if (from === enum_1.mintSide.Top || from === enum_1.mintSide.Bottom) {
511
+ el.style.height = `${el.scrollHeight}px`;
512
+ } else {
513
+ el.style.width = `${el.scrollWidth}px`;
514
+ }
515
+ setTimeout(() => {
516
+ if (from === enum_1.mintSide.Top || from === enum_1.mintSide.Bottom) {
517
+ el.style.height = 'auto';
518
+ } else {
519
+ el.style.width = 'auto';
520
+ }
521
+ }, delay);
522
+ });
523
+ }
524
+ }
525
+ /**
526
+ * Sets the element's height to 0
527
+ * @param el - the element whose height will be set
528
+ * @param delay - the amount of time in milliseconds that the show animation will be active
529
+ * @param from - the side that the element is animating from
530
+ */
531
+ static hide(el) {
532
+ let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
533
+ let from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : enum_1.mintSide.Top;
534
+ if (el) {
535
+ let height = el.scrollHeight,
536
+ width = el.scrollWidth,
537
+ transition = el.style.transition;
538
+ el.style.transition = '';
539
+ requestAnimationFrame(() => {
540
+ if (from === enum_1.mintSide.Top || from === enum_1.mintSide.Bottom) {
541
+ el.style.height = `${height}px`;
542
+ } else {
543
+ el.style.width = `${width}px`;
544
+ }
545
+ el.style.transition = transition;
546
+ requestAnimationFrame(() => {
547
+ if (from === enum_1.mintSide.Top || from === enum_1.mintSide.Bottom) {
548
+ el.style.height = '0';
549
+ } else {
550
+ el.style.width = '0';
551
+ }
552
+ });
553
+ });
554
+ setTimeout(() => {
555
+ el.style.display = 'none';
556
+ }, delay);
557
+ }
558
+ }
559
+ /**
560
+ * Copies the provided text to the clipboard
561
+ * @param text - the text to copy
562
+ * @returns - true if the text was successfully copied to the clipboard; else false
563
+ */
564
+ static copyText(text) {
565
+ let textArea = document.createElement('textarea');
566
+ if (!text || !textArea) {
567
+ return false;
568
+ }
569
+ textArea.value = text;
570
+ textArea.style.cssText = `
571
+ position: fixed;
572
+ top: 0;
573
+ left: 0;
574
+ transform: translate(-100%, -100%);
575
+ opacity: 0;
576
+ z-index: -1;
577
+ `;
578
+ document.body.appendChild(textArea);
579
+ textArea.select();
580
+ textArea.setSelectionRange(0, 99999);
581
+ navigator.clipboard.writeText(textArea.value);
582
+ document.body.removeChild(textArea);
583
+ return true;
584
+ }
585
+ /**
586
+ * Tests the validity of an email address
587
+ * @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
588
+ * @param text - the string to test
589
+ * @returns - true if the given string is an email address; false if not
590
+ */
591
+ static isEmail(text) {
592
+ return null !== text.match(/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/);
593
+ }
594
+ }
595
+ exports.mintUtil = mintUtil;
596
+ exports["default"] = mintUtil;
597
+
598
+ /***/ })
599
+
600
+ /******/ });
601
+ /************************************************************************/
602
+ /******/ // The module cache
603
+ /******/ var __webpack_module_cache__ = {};
604
+ /******/
605
+ /******/ // The require function
606
+ /******/ function __webpack_require__(moduleId) {
607
+ /******/ // Check if module is in cache
608
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
609
+ /******/ if (cachedModule !== undefined) {
610
+ /******/ return cachedModule.exports;
611
+ /******/ }
612
+ /******/ // Create a new module (and put it into the cache)
613
+ /******/ var module = __webpack_module_cache__[moduleId] = {
614
+ /******/ // no module.id needed
615
+ /******/ // no module.loaded needed
616
+ /******/ exports: {}
617
+ /******/ };
618
+ /******/
619
+ /******/ // Execute the module function
620
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
621
+ /******/
622
+ /******/ // Return the exports of the module
623
+ /******/ return module.exports;
624
+ /******/ }
625
+ /******/
626
+ /************************************************************************/
627
+ /******/
628
+ /******/ // startup
629
+ /******/ // Load entry module and return exports
630
+ /******/ // This entry module is referenced by other modules so it can't be inlined
631
+ /******/ var __webpack_exports__ = __webpack_require__("./src/ts/util.ts");
632
+ /******/ __webpack_exports__ = __webpack_exports__["default"];
633
+ /******/
634
+ /******/ return __webpack_exports__;
635
+ /******/ })()
636
+ ;
637
+ });
638
+ //# sourceMappingURL=util.js.map