@appartmint/mint 0.15.2 → 0.15.4
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/README.md +3 -3
- package/dist/css/mint.css +70 -2
- package/dist/css/mint.css.map +1 -1
- package/dist/css/mint.min.css +1 -1
- package/dist/css/mint.min.css.map +1 -1
- package/dist/js/imports/components/header.d.ts +124 -124
- package/dist/js/imports/enum.d.ts +9 -9
- package/dist/js/imports/models/color.d.ts +31 -31
- package/dist/js/imports/models/item.d.ts +69 -69
- package/dist/js/imports/util/display.d.ts +6 -6
- package/dist/js/imports/util/event.d.ts +6 -6
- package/dist/js/imports/util/icon.d.ts +28 -28
- package/dist/js/imports/util/list.d.ts +22 -22
- package/dist/js/imports/util/math.d.ts +13 -13
- package/dist/js/imports/util/object.d.ts +73 -73
- package/dist/js/imports/util/scroll.d.ts +18 -18
- package/dist/js/imports/util/selectors.d.ts +121 -121
- package/dist/js/imports/util/settings.d.ts +38 -38
- package/dist/js/imports/util/text.d.ts +20 -20
- package/dist/js/imports/util/window.d.ts +6 -6
- package/dist/js/index.d.ts +24 -24
- package/dist/js/index.js +344 -344
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.min.js.map +1 -1
- package/dist/js/util.d.ts +77 -77
- package/dist/js/util.js +67 -67
- package/dist/js/util.js.map +1 -1
- package/dist/js/util.min.js.map +1 -1
- package/package.json +1 -1
- package/src/scss/imports/_index.scss +8 -8
- package/src/scss/imports/components/_header.scss +3 -1
- package/src/scss/imports/components/_index.scss +7 -7
- package/src/scss/imports/global/_icons.scss +6 -6
- package/src/scss/imports/global/_index.scss +1 -0
- package/src/scss/imports/global/_inputs.scss +63 -0
- package/src/scss/imports/global/_structure.scss +8 -2
- package/src/scss/imports/global/_themes.scss +4 -0
- package/src/scss/imports/util/_index.scss +8 -8
- package/src/scss/imports/util/_vars.scss +1 -1
- package/src/ts/imports/enum.ts +9 -9
- package/src/ts/imports/models/color.ts +96 -96
- package/src/ts/imports/util/display.ts +6 -6
- package/src/ts/imports/util/event.ts +7 -7
- package/src/ts/imports/util/math.ts +17 -17
- package/src/ts/imports/util/window.ts +6 -6
package/dist/js/index.js
CHANGED
|
@@ -29,31 +29,31 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
29
29
|
value: true
|
|
30
30
|
}));
|
|
31
31
|
exports.mintHeader = void 0;
|
|
32
|
-
/**
|
|
33
|
-
* Imports
|
|
32
|
+
/**
|
|
33
|
+
* Imports
|
|
34
34
|
*/
|
|
35
35
|
const enum_1 = __webpack_require__(/*! ../enum */ "./src/ts/imports/enum.ts");
|
|
36
36
|
const util_1 = __importDefault(__webpack_require__(/*! ../../util */ "./src/ts/util.ts"));
|
|
37
37
|
const selectors_1 = __importDefault(__webpack_require__(/*! ../util/selectors */ "./src/ts/imports/util/selectors.ts"));
|
|
38
38
|
const settings_1 = __importDefault(__webpack_require__(/*! ../util/settings */ "./src/ts/imports/util/settings.ts"));
|
|
39
|
-
/**
|
|
40
|
-
* Main header functionality
|
|
41
|
-
* @public
|
|
39
|
+
/**
|
|
40
|
+
* Main header functionality
|
|
41
|
+
* @public
|
|
42
42
|
*/
|
|
43
43
|
class mintHeader {
|
|
44
|
-
/**
|
|
45
|
-
* Initializes and closes the menu
|
|
44
|
+
/**
|
|
45
|
+
* Initializes and closes the menu
|
|
46
46
|
*/
|
|
47
47
|
constructor(settings) {
|
|
48
|
-
/**
|
|
49
|
-
* Navbar settings
|
|
48
|
+
/**
|
|
49
|
+
* Navbar settings
|
|
50
50
|
*/
|
|
51
51
|
this.settings = {
|
|
52
52
|
from: enum_1.mintSide.Top,
|
|
53
53
|
fixed: true
|
|
54
54
|
};
|
|
55
|
-
/**
|
|
56
|
-
* Frequently-referenced elements
|
|
55
|
+
/**
|
|
56
|
+
* Frequently-referenced elements
|
|
57
57
|
*/
|
|
58
58
|
this.el = {};
|
|
59
59
|
this.settings = Object.assign(Object.assign({}, this.settings), settings);
|
|
@@ -61,8 +61,8 @@ class mintHeader {
|
|
|
61
61
|
this.attachEvents();
|
|
62
62
|
this.addClasses();
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Adds elements to {@link el | `this.el`}
|
|
64
|
+
/**
|
|
65
|
+
* Adds elements to {@link el | `this.el`}
|
|
66
66
|
*/
|
|
67
67
|
attachElements() {
|
|
68
68
|
var _a;
|
|
@@ -72,8 +72,8 @@ class mintHeader {
|
|
|
72
72
|
this.el.mobileButton = ((_a = this.el.header) === null || _a === void 0 ? void 0 : _a.querySelector(selectors_1.default.controls('mint-wrapper'))) || null;
|
|
73
73
|
this.el.wrapper = document.getElementById('mint-wrapper');
|
|
74
74
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Adds events to the dom
|
|
75
|
+
/**
|
|
76
|
+
* Adds events to the dom
|
|
77
77
|
*/
|
|
78
78
|
attachEvents() {
|
|
79
79
|
var _a, _b, _c, _d;
|
|
@@ -98,8 +98,8 @@ class mintHeader {
|
|
|
98
98
|
}));
|
|
99
99
|
(_d = this.el.wrapper) === null || _d === void 0 ? void 0 : _d.addEventListener('transitionend', this.eTransitionEnd.bind(this));
|
|
100
100
|
}
|
|
101
|
-
/**
|
|
102
|
-
* Adds classes that inform the styles based on settings
|
|
101
|
+
/**
|
|
102
|
+
* Adds classes that inform the styles based on settings
|
|
103
103
|
*/
|
|
104
104
|
addClasses() {
|
|
105
105
|
var _a, _b, _c, _d, _e;
|
|
@@ -112,9 +112,9 @@ class mintHeader {
|
|
|
112
112
|
(_e = this.el.header) === null || _e === void 0 ? void 0 : _e.classList.add('mint-tray');
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
/**
|
|
116
|
-
* Sets the state of the mobile menu
|
|
117
|
-
* @param open - `true` to open the menu or `false` to close it
|
|
115
|
+
/**
|
|
116
|
+
* Sets the state of the mobile menu
|
|
117
|
+
* @param open - `true` to open the menu or `false` to close it
|
|
118
118
|
*/
|
|
119
119
|
setMobileMenu() {
|
|
120
120
|
let open = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
@@ -166,17 +166,17 @@ class mintHeader {
|
|
|
166
166
|
this.closeAllMenus();
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
/**
|
|
170
|
-
* Toggles the state of the mobile menu
|
|
169
|
+
/**
|
|
170
|
+
* Toggles the state of the mobile menu
|
|
171
171
|
*/
|
|
172
172
|
toggleMobileMenu() {
|
|
173
173
|
var _a, _b;
|
|
174
174
|
this.setMobileMenu(((_b = (_a = this.el.mobileButton) === null || _a === void 0 ? void 0 : _a.getAttribute('aria-expanded')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'false');
|
|
175
175
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Sets the state of the provided button's menu
|
|
178
|
-
* @param button - Button element to set
|
|
179
|
-
* @param open - `true` to open the menu or `false` to close it
|
|
176
|
+
/**
|
|
177
|
+
* Sets the state of the provided button's menu
|
|
178
|
+
* @param button - Button element to set
|
|
179
|
+
* @param open - `true` to open the menu or `false` to close it
|
|
180
180
|
*/
|
|
181
181
|
setMenu(button) {
|
|
182
182
|
let open = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -192,17 +192,17 @@ class mintHeader {
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
/**
|
|
196
|
-
* Toggles the state of the provided button's menu
|
|
197
|
-
* @param button - Button element to toggle
|
|
195
|
+
/**
|
|
196
|
+
* Toggles the state of the provided button's menu
|
|
197
|
+
* @param button - Button element to toggle
|
|
198
198
|
*/
|
|
199
199
|
toggleMenu(button) {
|
|
200
200
|
var _a;
|
|
201
201
|
this.setMenu(button, ((_a = button === null || button === void 0 ? void 0 : button.getAttribute('aria-expanded')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== 'true');
|
|
202
202
|
}
|
|
203
|
-
/**
|
|
204
|
-
* Closes all submenus of the provided button's menu
|
|
205
|
-
* @param button - Button element of the parent menu
|
|
203
|
+
/**
|
|
204
|
+
* Closes all submenus of the provided button's menu
|
|
205
|
+
* @param button - Button element of the parent menu
|
|
206
206
|
*/
|
|
207
207
|
closeSubMenus(button) {
|
|
208
208
|
let menu = button === null || button === void 0 ? void 0 : button.nextElementSibling,
|
|
@@ -215,9 +215,9 @@ class mintHeader {
|
|
|
215
215
|
}
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
|
-
/**
|
|
219
|
-
* Closes all sibling menus of the provided button's menu
|
|
220
|
-
* @param button - Button element of the sibling menus
|
|
218
|
+
/**
|
|
219
|
+
* Closes all sibling menus of the provided button's menu
|
|
220
|
+
* @param button - Button element of the sibling menus
|
|
221
221
|
*/
|
|
222
222
|
closeSiblingMenus(button) {
|
|
223
223
|
var _a;
|
|
@@ -229,8 +229,8 @@ class mintHeader {
|
|
|
229
229
|
}
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
|
-
/**
|
|
233
|
-
* Closes all submenus of the n4vbar
|
|
232
|
+
/**
|
|
233
|
+
* Closes all submenus of the n4vbar
|
|
234
234
|
*/
|
|
235
235
|
closeAllMenus() {
|
|
236
236
|
var _a;
|
|
@@ -239,8 +239,8 @@ class mintHeader {
|
|
|
239
239
|
this.setMenu(menuButton);
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
|
-
/**
|
|
243
|
-
* Opens the menu closest to the document's focus
|
|
242
|
+
/**
|
|
243
|
+
* Opens the menu closest to the document's focus
|
|
244
244
|
*/
|
|
245
245
|
openClosestMenu() {
|
|
246
246
|
var _a;
|
|
@@ -256,8 +256,8 @@ class mintHeader {
|
|
|
256
256
|
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
/**
|
|
260
|
-
* Closes the menu closest to the document's focus
|
|
259
|
+
/**
|
|
260
|
+
* Closes the menu closest to the document's focus
|
|
261
261
|
*/
|
|
262
262
|
closeClosestMenu() {
|
|
263
263
|
var _a, _b;
|
|
@@ -272,8 +272,8 @@ class mintHeader {
|
|
|
272
272
|
activeButton === null || activeButton === void 0 ? void 0 : activeButton.focus();
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
/**
|
|
276
|
-
* Toggles the menu closest to the document's focus
|
|
275
|
+
/**
|
|
276
|
+
* Toggles the menu closest to the document's focus
|
|
277
277
|
*/
|
|
278
278
|
toggleClosestMenu() {
|
|
279
279
|
var _a, _b;
|
|
@@ -283,8 +283,8 @@ class mintHeader {
|
|
|
283
283
|
this.openClosestMenu();
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
/**
|
|
287
|
-
* Closes the mobile menu when the window resizes
|
|
286
|
+
/**
|
|
287
|
+
* Closes the mobile menu when the window resizes
|
|
288
288
|
*/
|
|
289
289
|
eHandleResize() {
|
|
290
290
|
var _a, _b;
|
|
@@ -304,15 +304,15 @@ class mintHeader {
|
|
|
304
304
|
this.el.html.style.overflow = overflow;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
/**
|
|
308
|
-
* Closes all submenus when the page is scrolled
|
|
307
|
+
/**
|
|
308
|
+
* Closes all submenus when the page is scrolled
|
|
309
309
|
*/
|
|
310
310
|
eHandleScroll() {
|
|
311
311
|
this.closeAllMenus();
|
|
312
312
|
}
|
|
313
|
-
/**
|
|
314
|
-
* Sends the focus to the menu button after tabbing past the last menu item
|
|
315
|
-
* @param e - Keyboard event
|
|
313
|
+
/**
|
|
314
|
+
* Sends the focus to the menu button after tabbing past the last menu item
|
|
315
|
+
* @param e - Keyboard event
|
|
316
316
|
*/
|
|
317
317
|
eWrapTab(e) {
|
|
318
318
|
var _a;
|
|
@@ -323,9 +323,9 @@ class mintHeader {
|
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
/**
|
|
327
|
-
* Handles keypresses on n4vbar buttons
|
|
328
|
-
* @param e - Keyboard event
|
|
326
|
+
/**
|
|
327
|
+
* Handles keypresses on n4vbar buttons
|
|
328
|
+
* @param e - Keyboard event
|
|
329
329
|
*/
|
|
330
330
|
eHandleButtonKeypress(e) {
|
|
331
331
|
var _a;
|
|
@@ -352,9 +352,9 @@ class mintHeader {
|
|
|
352
352
|
break;
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
/**
|
|
356
|
-
* Handles keypresses on n4vbar links
|
|
357
|
-
* @param e - Keyboard event
|
|
355
|
+
/**
|
|
356
|
+
* Handles keypresses on n4vbar links
|
|
357
|
+
* @param e - Keyboard event
|
|
358
358
|
*/
|
|
359
359
|
eHandleLinkKeypress(e) {
|
|
360
360
|
let target = e.target;
|
|
@@ -372,9 +372,9 @@ class mintHeader {
|
|
|
372
372
|
break;
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
/**
|
|
376
|
-
* Handles keypresses on the n4vbar
|
|
377
|
-
* @param e - Keyboard event
|
|
375
|
+
/**
|
|
376
|
+
* Handles keypresses on the n4vbar
|
|
377
|
+
* @param e - Keyboard event
|
|
378
378
|
*/
|
|
379
379
|
eHandleKeypress(e) {
|
|
380
380
|
if (e.key.toLowerCase() !== 'tab') {
|
|
@@ -390,23 +390,23 @@ class mintHeader {
|
|
|
390
390
|
break;
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
-
/**
|
|
394
|
-
* Toggles the mobile menu
|
|
393
|
+
/**
|
|
394
|
+
* Toggles the mobile menu
|
|
395
395
|
*/
|
|
396
396
|
eToggleMobileMenu() {
|
|
397
397
|
this.toggleMobileMenu();
|
|
398
398
|
}
|
|
399
|
-
/**
|
|
400
|
-
* Toggles the clicked submenu
|
|
401
|
-
* @param e - Mouse event
|
|
399
|
+
/**
|
|
400
|
+
* Toggles the clicked submenu
|
|
401
|
+
* @param e - Mouse event
|
|
402
402
|
*/
|
|
403
403
|
eToggleMenu(e) {
|
|
404
404
|
let target = e.target;
|
|
405
405
|
this.closeSiblingMenus(target);
|
|
406
406
|
this.toggleMenu(target);
|
|
407
407
|
}
|
|
408
|
-
/**
|
|
409
|
-
* Runs after the mobile menu transitions
|
|
408
|
+
/**
|
|
409
|
+
* Runs after the mobile menu transitions
|
|
410
410
|
*/
|
|
411
411
|
eTransitionEnd() {
|
|
412
412
|
var _a;
|
|
@@ -432,8 +432,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
432
432
|
value: true
|
|
433
433
|
}));
|
|
434
434
|
exports.mintSide = void 0;
|
|
435
|
-
/**
|
|
436
|
-
* Side Enum
|
|
435
|
+
/**
|
|
436
|
+
* Side Enum
|
|
437
437
|
*/
|
|
438
438
|
var mintSide;
|
|
439
439
|
(function (mintSide) {
|
|
@@ -458,8 +458,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
458
458
|
value: true
|
|
459
459
|
}));
|
|
460
460
|
exports.mintColor = void 0;
|
|
461
|
-
/**
|
|
462
|
-
* Color
|
|
461
|
+
/**
|
|
462
|
+
* Color
|
|
463
463
|
*/
|
|
464
464
|
class mintColor {
|
|
465
465
|
constructor(args) {
|
|
@@ -471,8 +471,8 @@ class mintColor {
|
|
|
471
471
|
this.stringConstructor(args.color);
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
|
-
/**
|
|
475
|
-
* Constructor from a string argument
|
|
474
|
+
/**
|
|
475
|
+
* Constructor from a string argument
|
|
476
476
|
*/
|
|
477
477
|
stringConstructor(str) {
|
|
478
478
|
if (str.startsWith('#')) {
|
|
@@ -484,8 +484,8 @@ class mintColor {
|
|
|
484
484
|
this.rgbConstructor(str);
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
|
-
/**
|
|
488
|
-
* Constructor from a hex argument
|
|
487
|
+
/**
|
|
488
|
+
* Constructor from a hex argument
|
|
489
489
|
*/
|
|
490
490
|
hexConstructor(hex) {
|
|
491
491
|
switch (hex.length) {
|
|
@@ -516,8 +516,8 @@ class mintColor {
|
|
|
516
516
|
this.b = parseInt(hex.substring(5, 7), mintColor.hexBase);
|
|
517
517
|
this.a = parseInt(hex.substring(7, 9), mintColor.hexBase) / mintColor.hexBase ** 2;
|
|
518
518
|
}
|
|
519
|
-
/**
|
|
520
|
-
* Constructor from an rgba argument
|
|
519
|
+
/**
|
|
520
|
+
* Constructor from an rgba argument
|
|
521
521
|
*/
|
|
522
522
|
rgbConstructor(rgb) {
|
|
523
523
|
let match = rgb.match(/rgba?\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)?(?:, ?(\d(?:\.\d*)?)\))?/);
|
|
@@ -528,8 +528,8 @@ class mintColor {
|
|
|
528
528
|
this.a = parseFloat(match[4]);
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
|
-
/**
|
|
532
|
-
* Returns the perceived brightness of the color
|
|
531
|
+
/**
|
|
532
|
+
* Returns the perceived brightness of the color
|
|
533
533
|
*/
|
|
534
534
|
getBrightness() {
|
|
535
535
|
if (this.a === 0) {
|
|
@@ -560,15 +560,15 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
560
560
|
value: true
|
|
561
561
|
}));
|
|
562
562
|
exports.mintItem = void 0;
|
|
563
|
-
/**
|
|
564
|
-
* A generic item
|
|
565
|
-
* @note - this class must be convertable with JSON
|
|
566
|
-
* - only add strings, numbers, booleans, arrays, and objects
|
|
563
|
+
/**
|
|
564
|
+
* A generic item
|
|
565
|
+
* @note - this class must be convertable with JSON
|
|
566
|
+
* - only add strings, numbers, booleans, arrays, and objects
|
|
567
567
|
*/
|
|
568
568
|
class mintItem {
|
|
569
569
|
constructor() {
|
|
570
|
-
/**
|
|
571
|
-
* Item settings
|
|
570
|
+
/**
|
|
571
|
+
* Item settings
|
|
572
572
|
*/
|
|
573
573
|
this.version = 0;
|
|
574
574
|
this.priority = 0;
|
|
@@ -581,15 +581,15 @@ class mintItem {
|
|
|
581
581
|
this.centered = false;
|
|
582
582
|
this.disabled = false;
|
|
583
583
|
this.private = false;
|
|
584
|
-
/**
|
|
585
|
-
* Item data
|
|
584
|
+
/**
|
|
585
|
+
* Item data
|
|
586
586
|
*/
|
|
587
587
|
this.attr = {};
|
|
588
588
|
this.params = {};
|
|
589
589
|
this.options = {};
|
|
590
590
|
this.lists = {};
|
|
591
|
-
/**
|
|
592
|
-
* Item lists
|
|
591
|
+
/**
|
|
592
|
+
* Item lists
|
|
593
593
|
*/
|
|
594
594
|
this.paragraphs = [];
|
|
595
595
|
this.classes = [];
|
|
@@ -616,8 +616,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
616
616
|
value: true
|
|
617
617
|
}));
|
|
618
618
|
exports.mintDisplay = void 0;
|
|
619
|
-
/**
|
|
620
|
-
* Handles the display of elements
|
|
619
|
+
/**
|
|
620
|
+
* Handles the display of elements
|
|
621
621
|
*/
|
|
622
622
|
class mintDisplay {}
|
|
623
623
|
exports.mintDisplay = mintDisplay;
|
|
@@ -638,8 +638,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
638
638
|
value: true
|
|
639
639
|
}));
|
|
640
640
|
exports.mintEvent = void 0;
|
|
641
|
-
/**
|
|
642
|
-
* Event helper functions
|
|
641
|
+
/**
|
|
642
|
+
* Event helper functions
|
|
643
643
|
*/
|
|
644
644
|
class mintEvent {}
|
|
645
645
|
exports.mintEvent = mintEvent;
|
|
@@ -665,16 +665,16 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
665
665
|
value: true
|
|
666
666
|
}));
|
|
667
667
|
exports.mintIcon = void 0;
|
|
668
|
-
/**
|
|
669
|
-
* Imports
|
|
668
|
+
/**
|
|
669
|
+
* Imports
|
|
670
670
|
*/
|
|
671
671
|
const object_1 = __importDefault(__webpack_require__(/*! ./object */ "./src/ts/imports/util/object.ts"));
|
|
672
|
-
/**
|
|
673
|
-
* Icon helper functions
|
|
672
|
+
/**
|
|
673
|
+
* Icon helper functions
|
|
674
674
|
*/
|
|
675
675
|
class mintIcon {
|
|
676
|
-
/**
|
|
677
|
-
* Appends the given icon to the given selector if there is not already an icon appended
|
|
676
|
+
/**
|
|
677
|
+
* Appends the given icon to the given selector if there is not already an icon appended
|
|
678
678
|
*/
|
|
679
679
|
static append(icon, selector) {
|
|
680
680
|
let items = document.querySelectorAll(selector);
|
|
@@ -689,9 +689,9 @@ class mintIcon {
|
|
|
689
689
|
}
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
|
-
/**
|
|
693
|
-
* Updates the icons
|
|
694
|
-
* @param icons - the icons to update
|
|
692
|
+
/**
|
|
693
|
+
* Updates the icons
|
|
694
|
+
* @param icons - the icons to update
|
|
695
695
|
*/
|
|
696
696
|
static update(icons) {
|
|
697
697
|
let activeIcons = object_1.default.removeValues(Object.assign(Object.assign({}, this.icons), icons), [false]);
|
|
@@ -699,9 +699,9 @@ class mintIcon {
|
|
|
699
699
|
this.append(activeIcons[selector], selector);
|
|
700
700
|
});
|
|
701
701
|
}
|
|
702
|
-
/**
|
|
703
|
-
* Removes the given icon from the given selector
|
|
704
|
-
* @param icon - the icon to remove
|
|
702
|
+
/**
|
|
703
|
+
* Removes the given icon from the given selector
|
|
704
|
+
* @param icon - the icon to remove
|
|
705
705
|
*/
|
|
706
706
|
static remove(icon, selector) {
|
|
707
707
|
let items = document.querySelectorAll(selector);
|
|
@@ -714,8 +714,8 @@ class mintIcon {
|
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
716
|
exports.mintIcon = mintIcon;
|
|
717
|
-
/**
|
|
718
|
-
* Default icons
|
|
717
|
+
/**
|
|
718
|
+
* Default icons
|
|
719
719
|
*/
|
|
720
720
|
mintIcon.icons = {
|
|
721
721
|
'a[href^="mailto:"]': 'far fa-envelope',
|
|
@@ -741,14 +741,14 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
741
741
|
value: true
|
|
742
742
|
}));
|
|
743
743
|
exports.mintList = void 0;
|
|
744
|
-
/**
|
|
745
|
-
* List functions for the util library
|
|
744
|
+
/**
|
|
745
|
+
* List functions for the util library
|
|
746
746
|
*/
|
|
747
747
|
class mintList {
|
|
748
|
-
/**
|
|
749
|
-
* Returns a copy of the provided list with the items in random order
|
|
750
|
-
* @param list - the list to shuffle
|
|
751
|
-
* @returns - the shuffled list
|
|
748
|
+
/**
|
|
749
|
+
* Returns a copy of the provided list with the items in random order
|
|
750
|
+
* @param list - the list to shuffle
|
|
751
|
+
* @returns - the shuffled list
|
|
752
752
|
*/
|
|
753
753
|
static shuffleCopy(list) {
|
|
754
754
|
let copy = [...list];
|
|
@@ -758,14 +758,14 @@ class mintList {
|
|
|
758
758
|
}
|
|
759
759
|
return copy;
|
|
760
760
|
}
|
|
761
|
-
/**
|
|
762
|
-
* Filters the array in place based on a test condition and returns the filtered array.
|
|
763
|
-
* This method modifies the original array by removing elements that do not pass the test implemented by the provided function.
|
|
764
|
-
*
|
|
765
|
-
* @template T The type of elements in the array.
|
|
766
|
-
* @param {T[]} list The array to filter, which will be modified in place.
|
|
767
|
-
* @param {(item: T) => boolean} test A function that tests each element of the array. Return `true` to keep the element, `false` otherwise.
|
|
768
|
-
* @returns {T[]} The original array with only the elements that passed the test.
|
|
761
|
+
/**
|
|
762
|
+
* Filters the array in place based on a test condition and returns the filtered array.
|
|
763
|
+
* This method modifies the original array by removing elements that do not pass the test implemented by the provided function.
|
|
764
|
+
*
|
|
765
|
+
* @template T The type of elements in the array.
|
|
766
|
+
* @param {T[]} list The array to filter, which will be modified in place.
|
|
767
|
+
* @param {(item: T) => boolean} test A function that tests each element of the array. Return `true` to keep the element, `false` otherwise.
|
|
768
|
+
* @returns {T[]} The original array with only the elements that passed the test.
|
|
769
769
|
*/
|
|
770
770
|
static filter(list, test) {
|
|
771
771
|
let newLength = 0;
|
|
@@ -796,15 +796,15 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
796
796
|
value: true
|
|
797
797
|
}));
|
|
798
798
|
exports.mintMath = void 0;
|
|
799
|
-
/**
|
|
800
|
-
* Math functions for the util library
|
|
799
|
+
/**
|
|
800
|
+
* Math functions for the util library
|
|
801
801
|
*/
|
|
802
802
|
class mintMath {
|
|
803
|
-
/**
|
|
804
|
-
* Get a random integer between min and max
|
|
805
|
-
* @param max Maximum value to return
|
|
806
|
-
* @param min Minimum value to return (default is 0)
|
|
807
|
-
* @returns a random integer between min and max
|
|
803
|
+
/**
|
|
804
|
+
* Get a random integer between min and max
|
|
805
|
+
* @param max Maximum value to return
|
|
806
|
+
* @param min Minimum value to return (default is 0)
|
|
807
|
+
* @returns a random integer between min and max
|
|
808
808
|
*/
|
|
809
809
|
static randomInt(max) {
|
|
810
810
|
let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -831,12 +831,12 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
831
831
|
value: true
|
|
832
832
|
}));
|
|
833
833
|
exports.mintObject = void 0;
|
|
834
|
-
/**
|
|
835
|
-
* Object functions for the util library
|
|
834
|
+
/**
|
|
835
|
+
* Object functions for the util library
|
|
836
836
|
*/
|
|
837
837
|
class mintObject {
|
|
838
|
-
/**
|
|
839
|
-
* Returns true if the provided objects have the same entries
|
|
838
|
+
/**
|
|
839
|
+
* Returns true if the provided objects have the same entries
|
|
840
840
|
*/
|
|
841
841
|
static isSimilar(obj1, obj2) {
|
|
842
842
|
let keys = Object.keys(obj1);
|
|
@@ -851,13 +851,13 @@ class mintObject {
|
|
|
851
851
|
});
|
|
852
852
|
return isSimilar;
|
|
853
853
|
}
|
|
854
|
-
/**
|
|
855
|
-
* Returns true if the first object has at least the same
|
|
856
|
-
* entries as the second object
|
|
857
|
-
* @param superset - the object to check
|
|
858
|
-
* @param subset - the object whose entries are required
|
|
859
|
-
* @returns - true if the first object is a superset of the second
|
|
860
|
-
* @recursive
|
|
854
|
+
/**
|
|
855
|
+
* Returns true if the first object has at least the same
|
|
856
|
+
* entries as the second object
|
|
857
|
+
* @param superset - the object to check
|
|
858
|
+
* @param subset - the object whose entries are required
|
|
859
|
+
* @returns - true if the first object is a superset of the second
|
|
860
|
+
* @recursive
|
|
861
861
|
*/
|
|
862
862
|
static isSuperset(superset, subset) {
|
|
863
863
|
let isSuperset = true;
|
|
@@ -885,19 +885,19 @@ class mintObject {
|
|
|
885
885
|
});
|
|
886
886
|
return isSuperset;
|
|
887
887
|
}
|
|
888
|
-
/**
|
|
889
|
-
* Removes object entries by key
|
|
890
|
-
* @alias mintObject.removeKeys
|
|
891
|
-
* @param object - the object to remove entries from
|
|
892
|
-
* @param keys - the keys to remove
|
|
888
|
+
/**
|
|
889
|
+
* Removes object entries by key
|
|
890
|
+
* @alias mintObject.removeKeys
|
|
891
|
+
* @param object - the object to remove entries from
|
|
892
|
+
* @param keys - the keys to remove
|
|
893
893
|
*/
|
|
894
894
|
static remove(object, keys) {
|
|
895
895
|
return this.removeKeys(object, keys);
|
|
896
896
|
}
|
|
897
|
-
/**
|
|
898
|
-
* Removes object entries by key
|
|
899
|
-
* @param object - the object to remove entries from
|
|
900
|
-
* @param keys - the keys to remove
|
|
897
|
+
/**
|
|
898
|
+
* Removes object entries by key
|
|
899
|
+
* @param object - the object to remove entries from
|
|
900
|
+
* @param keys - the keys to remove
|
|
901
901
|
*/
|
|
902
902
|
static removeKeys(object, keys) {
|
|
903
903
|
return Object.keys(object).reduce((obj, key) => {
|
|
@@ -907,8 +907,8 @@ class mintObject {
|
|
|
907
907
|
return obj;
|
|
908
908
|
}, {});
|
|
909
909
|
}
|
|
910
|
-
/**
|
|
911
|
-
* Removes object entries by value
|
|
910
|
+
/**
|
|
911
|
+
* Removes object entries by value
|
|
912
912
|
*/
|
|
913
913
|
static removeValues(object, values) {
|
|
914
914
|
return Object.keys(object).reduce((obj, key) => {
|
|
@@ -918,14 +918,14 @@ class mintObject {
|
|
|
918
918
|
return obj;
|
|
919
919
|
}, {});
|
|
920
920
|
}
|
|
921
|
-
/**
|
|
922
|
-
* Sorts an object's entries alphabetically by key
|
|
921
|
+
/**
|
|
922
|
+
* Sorts an object's entries alphabetically by key
|
|
923
923
|
*/
|
|
924
924
|
static sort(object, compareFn) {
|
|
925
925
|
return this.sortKeys(object, compareFn);
|
|
926
926
|
}
|
|
927
|
-
/**
|
|
928
|
-
* Sorts an object's entries alphabetically by key
|
|
927
|
+
/**
|
|
928
|
+
* Sorts an object's entries alphabetically by key
|
|
929
929
|
*/
|
|
930
930
|
static sortKeys(object, compareFn) {
|
|
931
931
|
return Object.keys(object).sort(compareFn).reduce((obj, key) => {
|
|
@@ -933,8 +933,8 @@ class mintObject {
|
|
|
933
933
|
return obj;
|
|
934
934
|
}, {});
|
|
935
935
|
}
|
|
936
|
-
/**
|
|
937
|
-
* Sorts an object's entries alphabetically by value
|
|
936
|
+
/**
|
|
937
|
+
* Sorts an object's entries alphabetically by value
|
|
938
938
|
*/
|
|
939
939
|
static sortValues(object, compareFn) {
|
|
940
940
|
return Object.keys(object).sort((a, b) => compareFn(object[a], object[b])).reduce((obj, key) => {
|
|
@@ -942,17 +942,17 @@ class mintObject {
|
|
|
942
942
|
return obj;
|
|
943
943
|
}, {});
|
|
944
944
|
}
|
|
945
|
-
/**
|
|
946
|
-
* @alias mintObject.filterKeys
|
|
945
|
+
/**
|
|
946
|
+
* @alias mintObject.filterKeys
|
|
947
947
|
*/
|
|
948
948
|
static filter(object, keys) {
|
|
949
949
|
return this.filterKeys(object, keys);
|
|
950
950
|
}
|
|
951
|
-
/**
|
|
952
|
-
* Filters an object by its keys
|
|
953
|
-
* @param object - the object to filter
|
|
954
|
-
* @param keys - the keys to keep
|
|
955
|
-
* @returns - the filtered object
|
|
951
|
+
/**
|
|
952
|
+
* Filters an object by its keys
|
|
953
|
+
* @param object - the object to filter
|
|
954
|
+
* @param keys - the keys to keep
|
|
955
|
+
* @returns - the filtered object
|
|
956
956
|
*/
|
|
957
957
|
static filterKeys(object, keys) {
|
|
958
958
|
return keys.reduce((obj, key) => {
|
|
@@ -960,11 +960,11 @@ class mintObject {
|
|
|
960
960
|
return obj;
|
|
961
961
|
}, {});
|
|
962
962
|
}
|
|
963
|
-
/**
|
|
964
|
-
* Filters an object by its values
|
|
965
|
-
* @param object - the object to filter
|
|
966
|
-
* @param values - the values to keep
|
|
967
|
-
* @returns - the filtered object
|
|
963
|
+
/**
|
|
964
|
+
* Filters an object by its values
|
|
965
|
+
* @param object - the object to filter
|
|
966
|
+
* @param values - the values to keep
|
|
967
|
+
* @returns - the filtered object
|
|
968
968
|
*/
|
|
969
969
|
static filterValues(object, values) {
|
|
970
970
|
return Object.keys(object).reduce((obj, key) => {
|
|
@@ -974,11 +974,11 @@ class mintObject {
|
|
|
974
974
|
return obj;
|
|
975
975
|
}, {});
|
|
976
976
|
}
|
|
977
|
-
/**
|
|
978
|
-
* Update two sets of objects
|
|
979
|
-
* @param original - the original object
|
|
980
|
-
* @param update - the object to update the original with
|
|
981
|
-
* @returns - the original objects with updated data from the update
|
|
977
|
+
/**
|
|
978
|
+
* Update two sets of objects
|
|
979
|
+
* @param original - the original object
|
|
980
|
+
* @param update - the object to update the original with
|
|
981
|
+
* @returns - the original objects with updated data from the update
|
|
982
982
|
*/
|
|
983
983
|
static updateArray(original, update) {
|
|
984
984
|
let key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';
|
|
@@ -1036,24 +1036,24 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1036
1036
|
value: true
|
|
1037
1037
|
}));
|
|
1038
1038
|
exports.mintScroll = void 0;
|
|
1039
|
-
/**
|
|
1040
|
-
* Scroll functions
|
|
1039
|
+
/**
|
|
1040
|
+
* Scroll functions
|
|
1041
1041
|
*/
|
|
1042
1042
|
class mintScroll {
|
|
1043
|
-
/**
|
|
1044
|
-
* Scroll to the top of the page
|
|
1043
|
+
/**
|
|
1044
|
+
* Scroll to the top of the page
|
|
1045
1045
|
*/
|
|
1046
1046
|
static toTop() {
|
|
1047
1047
|
window.scrollTo(0, 0);
|
|
1048
1048
|
}
|
|
1049
|
-
/**
|
|
1050
|
-
* Scroll to the bottom of the page
|
|
1049
|
+
/**
|
|
1050
|
+
* Scroll to the bottom of the page
|
|
1051
1051
|
*/
|
|
1052
1052
|
static toBottom() {
|
|
1053
1053
|
window.scrollTo(0, document.body.scrollHeight);
|
|
1054
1054
|
}
|
|
1055
|
-
/**
|
|
1056
|
-
* Show visible elements
|
|
1055
|
+
/**
|
|
1056
|
+
* Show visible elements
|
|
1057
1057
|
*/
|
|
1058
1058
|
static showElements() {
|
|
1059
1059
|
requestAnimationFrame(() => {
|
|
@@ -1093,80 +1093,80 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1093
1093
|
value: true
|
|
1094
1094
|
}));
|
|
1095
1095
|
exports.mintSelectors = void 0;
|
|
1096
|
-
/**
|
|
1097
|
-
* CSS-selector helpers
|
|
1098
|
-
* @public
|
|
1096
|
+
/**
|
|
1097
|
+
* CSS-selector helpers
|
|
1098
|
+
* @public
|
|
1099
1099
|
*/
|
|
1100
1100
|
class mintSelectors {
|
|
1101
|
-
/**
|
|
1102
|
-
* Adds the library prefix to the beginning of the provided string
|
|
1103
|
-
* @param base - the string to be prefixed
|
|
1104
|
-
* @returns - the provided string prefixed with the library name
|
|
1101
|
+
/**
|
|
1102
|
+
* Adds the library prefix to the beginning of the provided string
|
|
1103
|
+
* @param base - the string to be prefixed
|
|
1104
|
+
* @returns - the provided string prefixed with the library name
|
|
1105
1105
|
*/
|
|
1106
1106
|
static prefix(base) {
|
|
1107
1107
|
base = base.toLowerCase();
|
|
1108
1108
|
return base.startsWith(this.pre) ? base : `${this.pre}${base}`;
|
|
1109
1109
|
}
|
|
1110
|
-
/**
|
|
1111
|
-
* Adds two dashes to the beginning of the provided string
|
|
1112
|
-
* @param base - the string to be prefixed
|
|
1113
|
-
* @returns - the provided string prefixed with two dashes
|
|
1110
|
+
/**
|
|
1111
|
+
* Adds two dashes to the beginning of the provided string
|
|
1112
|
+
* @param base - the string to be prefixed
|
|
1113
|
+
* @returns - the provided string prefixed with two dashes
|
|
1114
1114
|
*/
|
|
1115
1115
|
static cssPrefix(base) {
|
|
1116
1116
|
return `--${this.prefix(base.replace(/^-+/, ''))}`;
|
|
1117
1117
|
}
|
|
1118
|
-
/**
|
|
1119
|
-
* Turns the provided string into a CSS variable call
|
|
1120
|
-
* @param base - the name of the CSS variable to call
|
|
1121
|
-
* @returns - the CSS variable call for the provided string
|
|
1118
|
+
/**
|
|
1119
|
+
* Turns the provided string into a CSS variable call
|
|
1120
|
+
* @param base - the name of the CSS variable to call
|
|
1121
|
+
* @returns - the CSS variable call for the provided string
|
|
1122
1122
|
*/
|
|
1123
1123
|
static cssVar(base) {
|
|
1124
1124
|
return `var(${this.cssPrefix(base)})`;
|
|
1125
1125
|
}
|
|
1126
|
-
/**
|
|
1127
|
-
* Negates the provided CSS selector
|
|
1128
|
-
* @param base - the CSS selector to negate
|
|
1129
|
-
* @returns - the negated CSS selector
|
|
1126
|
+
/**
|
|
1127
|
+
* Negates the provided CSS selector
|
|
1128
|
+
* @param base - the CSS selector to negate
|
|
1129
|
+
* @returns - the negated CSS selector
|
|
1130
1130
|
*/
|
|
1131
1131
|
static neg(base) {
|
|
1132
1132
|
return `:not(${base})`;
|
|
1133
1133
|
}
|
|
1134
|
-
/**
|
|
1135
|
-
* Generates a class CSS selector
|
|
1136
|
-
* @param base - the name of the class to generate
|
|
1137
|
-
* @returns - the generated CSS selector
|
|
1134
|
+
/**
|
|
1135
|
+
* Generates a class CSS selector
|
|
1136
|
+
* @param base - the name of the class to generate
|
|
1137
|
+
* @returns - the generated CSS selector
|
|
1138
1138
|
*/
|
|
1139
1139
|
static class(base) {
|
|
1140
1140
|
return `.${this.prefix(base)}`;
|
|
1141
1141
|
}
|
|
1142
|
-
/**
|
|
1143
|
-
* Generates an id CSS selector
|
|
1144
|
-
* @param base - the name of the id to generate
|
|
1145
|
-
* @returns - the generated CSS selector
|
|
1142
|
+
/**
|
|
1143
|
+
* Generates an id CSS selector
|
|
1144
|
+
* @param base - the name of the id to generate
|
|
1145
|
+
* @returns - the generated CSS selector
|
|
1146
1146
|
*/
|
|
1147
1147
|
static id(base) {
|
|
1148
1148
|
return `#${this.prefix(base)}`;
|
|
1149
1149
|
}
|
|
1150
|
-
/**
|
|
1151
|
-
* Generates an aria-controls CSS selector
|
|
1152
|
-
* @param id - the id of the controlled element
|
|
1153
|
-
* @returns - the generated CSS selector
|
|
1150
|
+
/**
|
|
1151
|
+
* Generates an aria-controls CSS selector
|
|
1152
|
+
* @param id - the id of the controlled element
|
|
1153
|
+
* @returns - the generated CSS selector
|
|
1154
1154
|
*/
|
|
1155
1155
|
static controls(id) {
|
|
1156
1156
|
return id ? `[aria-controls="${this.prefix(id)}"]` : this.hasControls;
|
|
1157
1157
|
}
|
|
1158
|
-
/**
|
|
1159
|
-
* Generates an aria-expanded CSS selector
|
|
1160
|
-
* @param bool - whether the element is expanded or not
|
|
1161
|
-
* @returns - the generated CSS selector
|
|
1158
|
+
/**
|
|
1159
|
+
* Generates an aria-expanded CSS selector
|
|
1160
|
+
* @param bool - whether the element is expanded or not
|
|
1161
|
+
* @returns - the generated CSS selector
|
|
1162
1162
|
*/
|
|
1163
1163
|
static expanded(bool) {
|
|
1164
1164
|
return typeof bool === 'boolean' ? `[aria-expanded="${bool}"]` : this.hasExpanded;
|
|
1165
1165
|
}
|
|
1166
|
-
/**
|
|
1167
|
-
* Returns a NodeList of HTMLElements within the given element that are focusable
|
|
1168
|
-
* @param el - the element whose focusable children will be returned
|
|
1169
|
-
* @returns - the elements within the given element that are focusable
|
|
1166
|
+
/**
|
|
1167
|
+
* Returns a NodeList of HTMLElements within the given element that are focusable
|
|
1168
|
+
* @param el - the element whose focusable children will be returned
|
|
1169
|
+
* @returns - the elements within the given element that are focusable
|
|
1170
1170
|
*/
|
|
1171
1171
|
static getFocusables(el) {
|
|
1172
1172
|
let focusables;
|
|
@@ -1177,12 +1177,12 @@ class mintSelectors {
|
|
|
1177
1177
|
}
|
|
1178
1178
|
return focusables.filter(el => this.isFocusable(el));
|
|
1179
1179
|
}
|
|
1180
|
-
/**
|
|
1181
|
-
* Returns true if an element is focusable and false if not,
|
|
1182
|
-
* based on styles (i.e. a parent has display: none;)
|
|
1183
|
-
* NOTE: Still need to determine what other styles may make an element un-focusable
|
|
1184
|
-
* @param el - the element
|
|
1185
|
-
* @returns - true if the element is focusable; false if not
|
|
1180
|
+
/**
|
|
1181
|
+
* Returns true if an element is focusable and false if not,
|
|
1182
|
+
* based on styles (i.e. a parent has display: none;)
|
|
1183
|
+
* NOTE: Still need to determine what other styles may make an element un-focusable
|
|
1184
|
+
* @param el - the element
|
|
1185
|
+
* @returns - true if the element is focusable; false if not
|
|
1186
1186
|
*/
|
|
1187
1187
|
static isFocusable(el) {
|
|
1188
1188
|
let current = el;
|
|
@@ -1197,48 +1197,48 @@ class mintSelectors {
|
|
|
1197
1197
|
}
|
|
1198
1198
|
exports.mintSelectors = mintSelectors;
|
|
1199
1199
|
_a = mintSelectors;
|
|
1200
|
-
/**
|
|
1201
|
-
* The library name that will be added as a prefix
|
|
1200
|
+
/**
|
|
1201
|
+
* The library name that will be added as a prefix
|
|
1202
1202
|
*/
|
|
1203
1203
|
mintSelectors.lib = 'mint';
|
|
1204
|
-
/**
|
|
1205
|
-
* The prefix built from the library name
|
|
1204
|
+
/**
|
|
1205
|
+
* The prefix built from the library name
|
|
1206
1206
|
*/
|
|
1207
1207
|
mintSelectors.pre = `${_a.lib}-`;
|
|
1208
|
-
/**
|
|
1209
|
-
* CSS-selector for disabled elements
|
|
1208
|
+
/**
|
|
1209
|
+
* CSS-selector for disabled elements
|
|
1210
1210
|
*/
|
|
1211
1211
|
mintSelectors.disabled = '[disabled]';
|
|
1212
|
-
/**
|
|
1213
|
-
* CSS-selector for elements with an aria-controls attribute
|
|
1212
|
+
/**
|
|
1213
|
+
* CSS-selector for elements with an aria-controls attribute
|
|
1214
1214
|
*/
|
|
1215
1215
|
mintSelectors.hasControls = '[aria-controls]';
|
|
1216
|
-
/**
|
|
1217
|
-
* CSS-selector for elements with an aria-expanded attribute
|
|
1216
|
+
/**
|
|
1217
|
+
* CSS-selector for elements with an aria-expanded attribute
|
|
1218
1218
|
*/
|
|
1219
1219
|
mintSelectors.hasExpanded = '[aria-expanded]';
|
|
1220
|
-
/**
|
|
1221
|
-
* CSS-selector for elements with an href attribute
|
|
1220
|
+
/**
|
|
1221
|
+
* CSS-selector for elements with an href attribute
|
|
1222
1222
|
*/
|
|
1223
1223
|
mintSelectors.hasLink = '[href]';
|
|
1224
|
-
/**
|
|
1225
|
-
* CSS-selector for elements with a routerLink attribute
|
|
1224
|
+
/**
|
|
1225
|
+
* CSS-selector for elements with a routerLink attribute
|
|
1226
1226
|
*/
|
|
1227
1227
|
mintSelectors.hasRouterLink = '[routerLink]';
|
|
1228
|
-
/**
|
|
1229
|
-
* CSS-selector for elements with an id attribute
|
|
1228
|
+
/**
|
|
1229
|
+
* CSS-selector for elements with an id attribute
|
|
1230
1230
|
*/
|
|
1231
1231
|
mintSelectors.hasId = '[id]';
|
|
1232
|
-
/**
|
|
1233
|
-
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
|
|
1232
|
+
/**
|
|
1233
|
+
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
|
|
1234
1234
|
*/
|
|
1235
1235
|
mintSelectors.notTabbable = '[tabindex^="-"]';
|
|
1236
|
-
/**
|
|
1237
|
-
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
|
|
1236
|
+
/**
|
|
1237
|
+
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
|
|
1238
1238
|
*/
|
|
1239
1239
|
mintSelectors.tabbable = `[tabindex]${_a.neg(_a.notTabbable)}`;
|
|
1240
|
-
/**
|
|
1241
|
-
* CSS-selector for elements that can receive focus
|
|
1240
|
+
/**
|
|
1241
|
+
* CSS-selector for elements that can receive focus
|
|
1242
1242
|
*/
|
|
1243
1243
|
mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
1244
1244
|
select${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
@@ -1248,12 +1248,12 @@ mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
|
1248
1248
|
a${_a.hasLink}, a${_a.hasRouterLink},
|
|
1249
1249
|
area${_a.hasLink},
|
|
1250
1250
|
${_a.tabbable}`.replace(/\s/g, '');
|
|
1251
|
-
/**
|
|
1252
|
-
* CSS-selector for submenu buttons
|
|
1251
|
+
/**
|
|
1252
|
+
* CSS-selector for submenu buttons
|
|
1253
1253
|
*/
|
|
1254
1254
|
mintSelectors.subMenuButtons = `button${_a.hasControls}`;
|
|
1255
|
-
/**
|
|
1256
|
-
* CSS-selector for submenus
|
|
1255
|
+
/**
|
|
1256
|
+
* CSS-selector for submenus
|
|
1257
1257
|
*/
|
|
1258
1258
|
mintSelectors.subMenu = `${_a.subMenuButtons} + ul${_a.hasId}`;
|
|
1259
1259
|
exports["default"] = mintSelectors;
|
|
@@ -1273,14 +1273,14 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1273
1273
|
value: true
|
|
1274
1274
|
}));
|
|
1275
1275
|
exports.mintSettings = void 0;
|
|
1276
|
-
/**
|
|
1277
|
-
* Settings management
|
|
1278
|
-
* @public
|
|
1276
|
+
/**
|
|
1277
|
+
* Settings management
|
|
1278
|
+
* @public
|
|
1279
1279
|
*/
|
|
1280
1280
|
class mintSettings {
|
|
1281
|
-
/**
|
|
1282
|
-
* Update the provided settings variables
|
|
1283
|
-
* @param settings - Object of settings variables to update
|
|
1281
|
+
/**
|
|
1282
|
+
* Update the provided settings variables
|
|
1283
|
+
* @param settings - Object of settings variables to update
|
|
1284
1284
|
*/
|
|
1285
1285
|
static set(settings) {
|
|
1286
1286
|
let newDelay = false;
|
|
@@ -1306,8 +1306,8 @@ class mintSettings {
|
|
|
1306
1306
|
}
|
|
1307
1307
|
}
|
|
1308
1308
|
}
|
|
1309
|
-
/**
|
|
1310
|
-
* Updates the delay variables based on `this.delayBase` and `this.delayStep`
|
|
1309
|
+
/**
|
|
1310
|
+
* Updates the delay variables based on `this.delayBase` and `this.delayStep`
|
|
1311
1311
|
*/
|
|
1312
1312
|
static setDelay() {
|
|
1313
1313
|
this.delay = {
|
|
@@ -1322,16 +1322,16 @@ class mintSettings {
|
|
|
1322
1322
|
}
|
|
1323
1323
|
exports.mintSettings = mintSettings;
|
|
1324
1324
|
_a = mintSettings;
|
|
1325
|
-
/**
|
|
1326
|
-
* Value added to all delay variables
|
|
1325
|
+
/**
|
|
1326
|
+
* Value added to all delay variables
|
|
1327
1327
|
*/
|
|
1328
1328
|
mintSettings.delayBase = 0;
|
|
1329
|
-
/**
|
|
1330
|
-
* Value multiplied by delay variable index
|
|
1329
|
+
/**
|
|
1330
|
+
* Value multiplied by delay variable index
|
|
1331
1331
|
*/
|
|
1332
1332
|
mintSettings.delayStep = 100;
|
|
1333
|
-
/**
|
|
1334
|
-
* Delay variables
|
|
1333
|
+
/**
|
|
1334
|
+
* Delay variables
|
|
1335
1335
|
*/
|
|
1336
1336
|
mintSettings.delay = {
|
|
1337
1337
|
instant: _a.delayBase + _a.delayStep * 0,
|
|
@@ -1341,8 +1341,8 @@ mintSettings.delay = {
|
|
|
1341
1341
|
medSlow: _a.delayBase + _a.delayStep * 4,
|
|
1342
1342
|
slow: _a.delayBase + _a.delayStep * 5
|
|
1343
1343
|
};
|
|
1344
|
-
/**
|
|
1345
|
-
* Breakpoint variables
|
|
1344
|
+
/**
|
|
1345
|
+
* Breakpoint variables
|
|
1346
1346
|
*/
|
|
1347
1347
|
mintSettings.break = {
|
|
1348
1348
|
z: 0,
|
|
@@ -1369,31 +1369,31 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1369
1369
|
value: true
|
|
1370
1370
|
}));
|
|
1371
1371
|
exports.mintText = void 0;
|
|
1372
|
-
/**
|
|
1373
|
-
* Functions for analyzing and manipulating text.
|
|
1372
|
+
/**
|
|
1373
|
+
* Functions for analyzing and manipulating text.
|
|
1374
1374
|
*/
|
|
1375
1375
|
class mintText {
|
|
1376
|
-
/*static fitContainer () {
|
|
1377
|
-
let $warning: JQuery<HTMLElement> = $(warningSelector);
|
|
1378
|
-
$warning.css({
|
|
1379
|
-
overflow: 'scroll',
|
|
1380
|
-
fontSize: ''
|
|
1381
|
-
});
|
|
1382
|
-
while (($warning?.[0].scrollHeight ?? Number.MIN_SAFE_INTEGER) > ($warning?.innerHeight() ?? Number.MAX_SAFE_INTEGER)) {
|
|
1383
|
-
let fontSize: number = parseInt($warning.css('font-size')) - 1;
|
|
1384
|
-
$warning.css('font-size', fontSize + 'px');
|
|
1385
|
-
}
|
|
1376
|
+
/*static fitContainer () {
|
|
1377
|
+
let $warning: JQuery<HTMLElement> = $(warningSelector);
|
|
1378
|
+
$warning.css({
|
|
1379
|
+
overflow: 'scroll',
|
|
1380
|
+
fontSize: ''
|
|
1381
|
+
});
|
|
1382
|
+
while (($warning?.[0].scrollHeight ?? Number.MIN_SAFE_INTEGER) > ($warning?.innerHeight() ?? Number.MAX_SAFE_INTEGER)) {
|
|
1383
|
+
let fontSize: number = parseInt($warning.css('font-size')) - 1;
|
|
1384
|
+
$warning.css('font-size', fontSize + 'px');
|
|
1385
|
+
}
|
|
1386
1386
|
}*/
|
|
1387
|
-
/**
|
|
1388
|
-
* Generate a slug from a string
|
|
1389
|
-
* @param str - The string to slugify
|
|
1390
|
-
* @returns The slugified string
|
|
1387
|
+
/**
|
|
1388
|
+
* Generate a slug from a string
|
|
1389
|
+
* @param str - The string to slugify
|
|
1390
|
+
* @returns The slugified string
|
|
1391
1391
|
*/
|
|
1392
1392
|
static slug(str) {
|
|
1393
1393
|
return str.toLowerCase().replace(/\W+/g, '-').replace(/^-+|-+$/g, '');
|
|
1394
1394
|
}
|
|
1395
|
-
/**
|
|
1396
|
-
* Pluralize the given word
|
|
1395
|
+
/**
|
|
1396
|
+
* Pluralize the given word
|
|
1397
1397
|
*/
|
|
1398
1398
|
static pluralize(word) {
|
|
1399
1399
|
if (word.endsWith('ies') || word.endsWith('es') || word.endsWith('s') && !word.endsWith('us') && !word.endsWith('is') && !word.endsWith('ss')) {
|
|
@@ -1407,8 +1407,8 @@ class mintText {
|
|
|
1407
1407
|
}
|
|
1408
1408
|
return word + 's';
|
|
1409
1409
|
}
|
|
1410
|
-
/**
|
|
1411
|
-
* Capitalize the first letter of the given word
|
|
1410
|
+
/**
|
|
1411
|
+
* Capitalize the first letter of the given word
|
|
1412
1412
|
*/
|
|
1413
1413
|
static titleCase(text) {
|
|
1414
1414
|
return text.toLowerCase().replace(/(?:^|\s)\S/g, a => a.toUpperCase());
|
|
@@ -1432,8 +1432,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1432
1432
|
value: true
|
|
1433
1433
|
}));
|
|
1434
1434
|
exports.mintWindow = void 0;
|
|
1435
|
-
/**
|
|
1436
|
-
* Functions related to the browser window.
|
|
1435
|
+
/**
|
|
1436
|
+
* Functions related to the browser window.
|
|
1437
1437
|
*/
|
|
1438
1438
|
class mintWindow {}
|
|
1439
1439
|
exports.mintWindow = mintWindow;
|
|
@@ -1450,10 +1450,10 @@ exports["default"] = mintWindow;
|
|
|
1450
1450
|
|
|
1451
1451
|
|
|
1452
1452
|
|
|
1453
|
-
/**
|
|
1454
|
-
* A library for building responsive web applications.
|
|
1455
|
-
*
|
|
1456
|
-
* @packageDocumentation
|
|
1453
|
+
/**
|
|
1454
|
+
* A library for building responsive web applications.
|
|
1455
|
+
*
|
|
1456
|
+
* @packageDocumentation
|
|
1457
1457
|
*/
|
|
1458
1458
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
1459
1459
|
return mod && mod.__esModule ? mod : {
|
|
@@ -1464,8 +1464,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1464
1464
|
value: true
|
|
1465
1465
|
}));
|
|
1466
1466
|
exports["default"] = exports.mintUtil = exports.mintSettings = exports.mintSelectors = exports.mintWindow = exports.mintText = exports.mintScroll = exports.mintObject = exports.mintMath = exports.mintList = exports.mintIcon = exports.mintEvent = exports.mintDisplay = exports.mintItem = exports.mintColor = exports.mintHeader = exports.mintSide = void 0;
|
|
1467
|
-
/**
|
|
1468
|
-
* Exports
|
|
1467
|
+
/**
|
|
1468
|
+
* Exports
|
|
1469
1469
|
*/
|
|
1470
1470
|
// Enums
|
|
1471
1471
|
var enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts");
|
|
@@ -1610,29 +1610,29 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1610
1610
|
value: true
|
|
1611
1611
|
}));
|
|
1612
1612
|
exports.mintUtil = void 0;
|
|
1613
|
-
/**
|
|
1614
|
-
* Imports
|
|
1613
|
+
/**
|
|
1614
|
+
* Imports
|
|
1615
1615
|
*/
|
|
1616
1616
|
const enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts");
|
|
1617
1617
|
const settings_1 = __importDefault(__webpack_require__(/*! ./imports/util/settings */ "./src/ts/imports/util/settings.ts"));
|
|
1618
|
-
/**
|
|
1619
|
-
* Utility functions
|
|
1620
|
-
* @public
|
|
1618
|
+
/**
|
|
1619
|
+
* Utility functions
|
|
1620
|
+
* @public
|
|
1621
1621
|
*/
|
|
1622
1622
|
class mintUtil {
|
|
1623
|
-
/**
|
|
1624
|
-
* Returns the width of the window, including fractional pixels
|
|
1625
|
-
* @returns the width of the window
|
|
1623
|
+
/**
|
|
1624
|
+
* Returns the width of the window, including fractional pixels
|
|
1625
|
+
* @returns the width of the window
|
|
1626
1626
|
*/
|
|
1627
1627
|
static windowWidth() {
|
|
1628
1628
|
const decimal = document.body.getBoundingClientRect().width % 1;
|
|
1629
1629
|
return window.innerWidth + decimal;
|
|
1630
1630
|
}
|
|
1631
|
-
/**
|
|
1632
|
-
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1633
|
-
* @param func - the function to debounce
|
|
1634
|
-
* @param wait - the amount of time to wait before running the function
|
|
1635
|
-
* @returns - the debounced function
|
|
1631
|
+
/**
|
|
1632
|
+
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1633
|
+
* @param func - the function to debounce
|
|
1634
|
+
* @param wait - the amount of time to wait before running the function
|
|
1635
|
+
* @returns - the debounced function
|
|
1636
1636
|
*/
|
|
1637
1637
|
static debounce(func) {
|
|
1638
1638
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1644,22 +1644,22 @@ class mintUtil {
|
|
|
1644
1644
|
timer = setTimeout(func, wait, e);
|
|
1645
1645
|
};
|
|
1646
1646
|
}
|
|
1647
|
-
/**
|
|
1648
|
-
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1649
|
-
* @param func - the function to debounce
|
|
1650
|
-
* @param wait - the amount of time to wait before running the function
|
|
1651
|
-
* @returns - the debounced function as an EventListener
|
|
1647
|
+
/**
|
|
1648
|
+
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1649
|
+
* @param func - the function to debounce
|
|
1650
|
+
* @param wait - the amount of time to wait before running the function
|
|
1651
|
+
* @returns - the debounced function as an EventListener
|
|
1652
1652
|
*/
|
|
1653
1653
|
static debounceEvent(func) {
|
|
1654
1654
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
1655
1655
|
return mintUtil.debounce(func, wait);
|
|
1656
1656
|
}
|
|
1657
|
-
/**
|
|
1658
|
-
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1659
|
-
* @param func - the function to throttle
|
|
1660
|
-
* @param wait - the amount of time between function calls
|
|
1661
|
-
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1662
|
-
* @returns - the throttled function
|
|
1657
|
+
/**
|
|
1658
|
+
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1659
|
+
* @param func - the function to throttle
|
|
1660
|
+
* @param wait - the amount of time between function calls
|
|
1661
|
+
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1662
|
+
* @returns - the throttled function
|
|
1663
1663
|
*/
|
|
1664
1664
|
static throttle(func) {
|
|
1665
1665
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1702,23 +1702,23 @@ class mintUtil {
|
|
|
1702
1702
|
};
|
|
1703
1703
|
return throttled;
|
|
1704
1704
|
}
|
|
1705
|
-
/**
|
|
1706
|
-
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1707
|
-
* @param func - the function to throttle
|
|
1708
|
-
* @param wait - the amount of time between function calls
|
|
1709
|
-
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1710
|
-
* @returns - the throttled function as an EventListener
|
|
1705
|
+
/**
|
|
1706
|
+
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1707
|
+
* @param func - the function to throttle
|
|
1708
|
+
* @param wait - the amount of time between function calls
|
|
1709
|
+
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1710
|
+
* @returns - the throttled function as an EventListener
|
|
1711
1711
|
*/
|
|
1712
1712
|
static throttleEvent(func) {
|
|
1713
1713
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
1714
1714
|
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
1715
1715
|
return mintUtil.throttle(func, wait, options);
|
|
1716
1716
|
}
|
|
1717
|
-
/**
|
|
1718
|
-
* Sets the element's height to its `innerHeight`, then to `auto` after a delay
|
|
1719
|
-
* @param el - the element whose height will be set
|
|
1720
|
-
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1721
|
-
* @param from - the side that the element is animating from
|
|
1717
|
+
/**
|
|
1718
|
+
* Sets the element's height to its `innerHeight`, then to `auto` after a delay
|
|
1719
|
+
* @param el - the element whose height will be set
|
|
1720
|
+
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1721
|
+
* @param from - the side that the element is animating from
|
|
1722
1722
|
*/
|
|
1723
1723
|
static show(el) {
|
|
1724
1724
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1741,11 +1741,11 @@ class mintUtil {
|
|
|
1741
1741
|
});
|
|
1742
1742
|
}
|
|
1743
1743
|
}
|
|
1744
|
-
/**
|
|
1745
|
-
* Sets the element's height to 0
|
|
1746
|
-
* @param el - the element whose height will be set
|
|
1747
|
-
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1748
|
-
* @param from - the side that the element is animating from
|
|
1744
|
+
/**
|
|
1745
|
+
* Sets the element's height to 0
|
|
1746
|
+
* @param el - the element whose height will be set
|
|
1747
|
+
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1748
|
+
* @param from - the side that the element is animating from
|
|
1749
1749
|
*/
|
|
1750
1750
|
static hide(el) {
|
|
1751
1751
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1775,10 +1775,10 @@ class mintUtil {
|
|
|
1775
1775
|
}, delay);
|
|
1776
1776
|
}
|
|
1777
1777
|
}
|
|
1778
|
-
/**
|
|
1779
|
-
* Copies the provided text to the clipboard
|
|
1780
|
-
* @param text - the text to copy
|
|
1781
|
-
* @returns - true if the text was successfully copied to the clipboard; else false
|
|
1778
|
+
/**
|
|
1779
|
+
* Copies the provided text to the clipboard
|
|
1780
|
+
* @param text - the text to copy
|
|
1781
|
+
* @returns - true if the text was successfully copied to the clipboard; else false
|
|
1782
1782
|
*/
|
|
1783
1783
|
static copyText(text) {
|
|
1784
1784
|
let textArea = document.createElement('textarea');
|
|
@@ -1801,11 +1801,11 @@ class mintUtil {
|
|
|
1801
1801
|
document.body.removeChild(textArea);
|
|
1802
1802
|
return true;
|
|
1803
1803
|
}
|
|
1804
|
-
/**
|
|
1805
|
-
* Tests the validity of an email address
|
|
1806
|
-
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
|
|
1807
|
-
* @param text - the string to test
|
|
1808
|
-
* @returns - true if the given string is an email address; false if not
|
|
1804
|
+
/**
|
|
1805
|
+
* Tests the validity of an email address
|
|
1806
|
+
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
|
|
1807
|
+
* @param text - the string to test
|
|
1808
|
+
* @returns - true if the given string is an email address; false if not
|
|
1809
1809
|
*/
|
|
1810
1810
|
static isEmail(text) {
|
|
1811
1811
|
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])+)\])/);
|