@appartmint/mint 0.14.0 → 0.14.2
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 +97 -4
- 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 +12 -12
- package/dist/js/imports/util/math.d.ts +13 -13
- package/dist/js/imports/util/object.d.ts +65 -58
- package/dist/js/imports/util/object.d.ts.map +1 -1
- 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 +16 -16
- package/dist/js/imports/util/window.d.ts +6 -6
- package/dist/js/index.d.ts +23 -23
- package/dist/js/index.js +360 -317
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.min.js +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/_buttons.scss +2 -0
- package/src/scss/imports/components/_cards.scss +23 -1
- package/src/scss/imports/components/_index.scss +7 -7
- package/src/scss/imports/global/_icons.scss +6 -6
- package/src/scss/imports/global/_structure.scss +117 -25
- package/src/scss/imports/util/_index.scss +8 -8
- 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/list.ts +19 -19
- package/src/ts/imports/util/math.ts +17 -17
- package/src/ts/imports/util/object.ts +43 -0
- package/src/ts/imports/util/window.ts +6 -6
- package/src/ts/index.ts +33 -33
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 shuffle(list) {
|
|
754
754
|
let copy = [...list];
|
|
@@ -777,15 +777,15 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
777
777
|
value: true
|
|
778
778
|
}));
|
|
779
779
|
exports.mintMath = void 0;
|
|
780
|
-
/**
|
|
781
|
-
* Math functions for the util library
|
|
780
|
+
/**
|
|
781
|
+
* Math functions for the util library
|
|
782
782
|
*/
|
|
783
783
|
class mintMath {
|
|
784
|
-
/**
|
|
785
|
-
* Get a random integer between min and max
|
|
786
|
-
* @param max Maximum value to return
|
|
787
|
-
* @param min Minimum value to return (default is 0)
|
|
788
|
-
* @returns a random integer between min and max
|
|
784
|
+
/**
|
|
785
|
+
* Get a random integer between min and max
|
|
786
|
+
* @param max Maximum value to return
|
|
787
|
+
* @param min Minimum value to return (default is 0)
|
|
788
|
+
* @returns a random integer between min and max
|
|
789
789
|
*/
|
|
790
790
|
static randomInt(max) {
|
|
791
791
|
let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -812,12 +812,12 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
812
812
|
value: true
|
|
813
813
|
}));
|
|
814
814
|
exports.mintObject = void 0;
|
|
815
|
-
/**
|
|
816
|
-
* Object functions for the util library
|
|
815
|
+
/**
|
|
816
|
+
* Object functions for the util library
|
|
817
817
|
*/
|
|
818
818
|
class mintObject {
|
|
819
|
-
/**
|
|
820
|
-
* Returns true if the provided objects have the same entries
|
|
819
|
+
/**
|
|
820
|
+
* Returns true if the provided objects have the same entries
|
|
821
821
|
*/
|
|
822
822
|
static isSimilar(obj1, obj2) {
|
|
823
823
|
let keys = Object.keys(obj1);
|
|
@@ -832,13 +832,13 @@ class mintObject {
|
|
|
832
832
|
});
|
|
833
833
|
return isSimilar;
|
|
834
834
|
}
|
|
835
|
-
/**
|
|
836
|
-
* Returns true if the first object has at least the same
|
|
837
|
-
* entries as the second object
|
|
838
|
-
* @param superset - the object to check
|
|
839
|
-
* @param subset - the object whose entries are required
|
|
840
|
-
* @returns - true if the first object is a superset of the second
|
|
841
|
-
* @recursive
|
|
835
|
+
/**
|
|
836
|
+
* Returns true if the first object has at least the same
|
|
837
|
+
* entries as the second object
|
|
838
|
+
* @param superset - the object to check
|
|
839
|
+
* @param subset - the object whose entries are required
|
|
840
|
+
* @returns - true if the first object is a superset of the second
|
|
841
|
+
* @recursive
|
|
842
842
|
*/
|
|
843
843
|
static isSuperset(superset, subset) {
|
|
844
844
|
let isSuperset = true;
|
|
@@ -866,19 +866,19 @@ class mintObject {
|
|
|
866
866
|
});
|
|
867
867
|
return isSuperset;
|
|
868
868
|
}
|
|
869
|
-
/**
|
|
870
|
-
* Removes object entries by key
|
|
871
|
-
* @alias mintObject.removeKeys
|
|
872
|
-
* @param object - the object to remove entries from
|
|
873
|
-
* @param keys - the keys to remove
|
|
869
|
+
/**
|
|
870
|
+
* Removes object entries by key
|
|
871
|
+
* @alias mintObject.removeKeys
|
|
872
|
+
* @param object - the object to remove entries from
|
|
873
|
+
* @param keys - the keys to remove
|
|
874
874
|
*/
|
|
875
875
|
static remove(object, keys) {
|
|
876
876
|
return this.removeKeys(object, keys);
|
|
877
877
|
}
|
|
878
|
-
/**
|
|
879
|
-
* Removes object entries by key
|
|
880
|
-
* @param object - the object to remove entries from
|
|
881
|
-
* @param keys - the keys to remove
|
|
878
|
+
/**
|
|
879
|
+
* Removes object entries by key
|
|
880
|
+
* @param object - the object to remove entries from
|
|
881
|
+
* @param keys - the keys to remove
|
|
882
882
|
*/
|
|
883
883
|
static removeKeys(object, keys) {
|
|
884
884
|
return Object.keys(object).reduce((obj, key) => {
|
|
@@ -888,8 +888,8 @@ class mintObject {
|
|
|
888
888
|
return obj;
|
|
889
889
|
}, {});
|
|
890
890
|
}
|
|
891
|
-
/**
|
|
892
|
-
* Removes object entries by value
|
|
891
|
+
/**
|
|
892
|
+
* Removes object entries by value
|
|
893
893
|
*/
|
|
894
894
|
static removeValues(object, values) {
|
|
895
895
|
return Object.keys(object).reduce((obj, key) => {
|
|
@@ -899,8 +899,8 @@ class mintObject {
|
|
|
899
899
|
return obj;
|
|
900
900
|
}, {});
|
|
901
901
|
}
|
|
902
|
-
/**
|
|
903
|
-
* Sorts an object's entries alphabetically by key
|
|
902
|
+
/**
|
|
903
|
+
* Sorts an object's entries alphabetically by key
|
|
904
904
|
*/
|
|
905
905
|
static sort(object) {
|
|
906
906
|
return Object.keys(object).sort().reduce((obj, key) => {
|
|
@@ -908,17 +908,17 @@ class mintObject {
|
|
|
908
908
|
return obj;
|
|
909
909
|
}, {});
|
|
910
910
|
}
|
|
911
|
-
/**
|
|
912
|
-
* @alias mintObject.filterKeys
|
|
911
|
+
/**
|
|
912
|
+
* @alias mintObject.filterKeys
|
|
913
913
|
*/
|
|
914
914
|
static filter(object, keys) {
|
|
915
915
|
return this.filterKeys(object, keys);
|
|
916
916
|
}
|
|
917
|
-
/**
|
|
918
|
-
* Filters an object by its keys
|
|
919
|
-
* @param object - the object to filter
|
|
920
|
-
* @param keys - the keys to keep
|
|
921
|
-
* @returns - the filtered object
|
|
917
|
+
/**
|
|
918
|
+
* Filters an object by its keys
|
|
919
|
+
* @param object - the object to filter
|
|
920
|
+
* @param keys - the keys to keep
|
|
921
|
+
* @returns - the filtered object
|
|
922
922
|
*/
|
|
923
923
|
static filterKeys(object, keys) {
|
|
924
924
|
return keys.reduce((obj, key) => {
|
|
@@ -926,11 +926,11 @@ class mintObject {
|
|
|
926
926
|
return obj;
|
|
927
927
|
}, {});
|
|
928
928
|
}
|
|
929
|
-
/**
|
|
930
|
-
* Filters an object by its values
|
|
931
|
-
* @param object - the object to filter
|
|
932
|
-
* @param values - the values to keep
|
|
933
|
-
* @returns - the filtered object
|
|
929
|
+
/**
|
|
930
|
+
* Filters an object by its values
|
|
931
|
+
* @param object - the object to filter
|
|
932
|
+
* @param values - the values to keep
|
|
933
|
+
* @returns - the filtered object
|
|
934
934
|
*/
|
|
935
935
|
static filterValues(object, values) {
|
|
936
936
|
return Object.keys(object).reduce((obj, key) => {
|
|
@@ -940,6 +940,49 @@ class mintObject {
|
|
|
940
940
|
return obj;
|
|
941
941
|
}, {});
|
|
942
942
|
}
|
|
943
|
+
/**
|
|
944
|
+
* Update two sets of objects
|
|
945
|
+
* @param original - the original object
|
|
946
|
+
* @param update - the object to update the original with
|
|
947
|
+
* @returns - the original objects with updated data from the update
|
|
948
|
+
*/
|
|
949
|
+
static updateArray(original, update) {
|
|
950
|
+
let key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';
|
|
951
|
+
// If there are no originals, push the updates
|
|
952
|
+
if (!(update === null || update === void 0 ? void 0 : update.length)) {
|
|
953
|
+
update === null || update === void 0 ? void 0 : update.forEach(object => original.push(object));
|
|
954
|
+
// If there are existing objects
|
|
955
|
+
} else {
|
|
956
|
+
// Create a dictionary of the updated objects
|
|
957
|
+
const updateObjects = update.reduce((objects, object) => {
|
|
958
|
+
var _a;
|
|
959
|
+
return Object.assign(Object.assign({}, objects), {
|
|
960
|
+
[(_a = object === null || object === void 0 ? void 0 : object[key]) !== null && _a !== void 0 ? _a : '']: object
|
|
961
|
+
});
|
|
962
|
+
}, {});
|
|
963
|
+
// Remove any objects that aren't in the updated objects
|
|
964
|
+
const missingObjects = original.filter(object => {
|
|
965
|
+
var _a;
|
|
966
|
+
return !updateObjects[(_a = object === null || object === void 0 ? void 0 : object[key]) !== null && _a !== void 0 ? _a : ''];
|
|
967
|
+
});
|
|
968
|
+
missingObjects === null || missingObjects === void 0 ? void 0 : missingObjects.forEach(object => {
|
|
969
|
+
const index = original.indexOf(object);
|
|
970
|
+
if (typeof index == 'number' && index !== -1) {
|
|
971
|
+
original.splice(index, 1);
|
|
972
|
+
}
|
|
973
|
+
});
|
|
974
|
+
// Update the existing objects with updates
|
|
975
|
+
original.forEach(object => {
|
|
976
|
+
var _a, _b;
|
|
977
|
+
if (updateObjects[(_a = object === null || object === void 0 ? void 0 : object[key]) !== null && _a !== void 0 ? _a : '']) {
|
|
978
|
+
Object.assign(object, updateObjects[(_b = object === null || object === void 0 ? void 0 : object[key]) !== null && _b !== void 0 ? _b : '']);
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
// Push any new objects
|
|
983
|
+
const newObjects = update === null || update === void 0 ? void 0 : update.filter(object => !original.some(existingObject => (existingObject === null || existingObject === void 0 ? void 0 : existingObject[key]) === (object === null || object === void 0 ? void 0 : object[key])));
|
|
984
|
+
newObjects === null || newObjects === void 0 ? void 0 : newObjects.forEach(newObject => original.push(newObject));
|
|
985
|
+
}
|
|
943
986
|
}
|
|
944
987
|
exports.mintObject = mintObject;
|
|
945
988
|
;
|
|
@@ -960,80 +1003,80 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
960
1003
|
value: true
|
|
961
1004
|
}));
|
|
962
1005
|
exports.mintSelectors = void 0;
|
|
963
|
-
/**
|
|
964
|
-
* CSS-selector helpers
|
|
965
|
-
* @public
|
|
1006
|
+
/**
|
|
1007
|
+
* CSS-selector helpers
|
|
1008
|
+
* @public
|
|
966
1009
|
*/
|
|
967
1010
|
class mintSelectors {
|
|
968
|
-
/**
|
|
969
|
-
* Adds the library prefix to the beginning of the provided string
|
|
970
|
-
* @param base - the string to be prefixed
|
|
971
|
-
* @returns - the provided string prefixed with the library name
|
|
1011
|
+
/**
|
|
1012
|
+
* Adds the library prefix to the beginning of the provided string
|
|
1013
|
+
* @param base - the string to be prefixed
|
|
1014
|
+
* @returns - the provided string prefixed with the library name
|
|
972
1015
|
*/
|
|
973
1016
|
static prefix(base) {
|
|
974
1017
|
base = base.toLowerCase();
|
|
975
1018
|
return base.startsWith(this.pre) ? base : `${this.pre}${base}`;
|
|
976
1019
|
}
|
|
977
|
-
/**
|
|
978
|
-
* Adds two dashes to the beginning of the provided string
|
|
979
|
-
* @param base - the string to be prefixed
|
|
980
|
-
* @returns - the provided string prefixed with two dashes
|
|
1020
|
+
/**
|
|
1021
|
+
* Adds two dashes to the beginning of the provided string
|
|
1022
|
+
* @param base - the string to be prefixed
|
|
1023
|
+
* @returns - the provided string prefixed with two dashes
|
|
981
1024
|
*/
|
|
982
1025
|
static cssPrefix(base) {
|
|
983
1026
|
return `--${this.prefix(base.replace(/^-+/, ''))}`;
|
|
984
1027
|
}
|
|
985
|
-
/**
|
|
986
|
-
* Turns the provided string into a CSS variable call
|
|
987
|
-
* @param base - the name of the CSS variable to call
|
|
988
|
-
* @returns - the CSS variable call for the provided string
|
|
1028
|
+
/**
|
|
1029
|
+
* Turns the provided string into a CSS variable call
|
|
1030
|
+
* @param base - the name of the CSS variable to call
|
|
1031
|
+
* @returns - the CSS variable call for the provided string
|
|
989
1032
|
*/
|
|
990
1033
|
static cssVar(base) {
|
|
991
1034
|
return `var(${this.cssPrefix(base)})`;
|
|
992
1035
|
}
|
|
993
|
-
/**
|
|
994
|
-
* Negates the provided CSS selector
|
|
995
|
-
* @param base - the CSS selector to negate
|
|
996
|
-
* @returns - the negated CSS selector
|
|
1036
|
+
/**
|
|
1037
|
+
* Negates the provided CSS selector
|
|
1038
|
+
* @param base - the CSS selector to negate
|
|
1039
|
+
* @returns - the negated CSS selector
|
|
997
1040
|
*/
|
|
998
1041
|
static neg(base) {
|
|
999
1042
|
return `:not(${base})`;
|
|
1000
1043
|
}
|
|
1001
|
-
/**
|
|
1002
|
-
* Generates a class CSS selector
|
|
1003
|
-
* @param base - the name of the class to generate
|
|
1004
|
-
* @returns - the generated CSS selector
|
|
1044
|
+
/**
|
|
1045
|
+
* Generates a class CSS selector
|
|
1046
|
+
* @param base - the name of the class to generate
|
|
1047
|
+
* @returns - the generated CSS selector
|
|
1005
1048
|
*/
|
|
1006
1049
|
static class(base) {
|
|
1007
1050
|
return `.${this.prefix(base)}`;
|
|
1008
1051
|
}
|
|
1009
|
-
/**
|
|
1010
|
-
* Generates an id CSS selector
|
|
1011
|
-
* @param base - the name of the id to generate
|
|
1012
|
-
* @returns - the generated CSS selector
|
|
1052
|
+
/**
|
|
1053
|
+
* Generates an id CSS selector
|
|
1054
|
+
* @param base - the name of the id to generate
|
|
1055
|
+
* @returns - the generated CSS selector
|
|
1013
1056
|
*/
|
|
1014
1057
|
static id(base) {
|
|
1015
1058
|
return `#${this.prefix(base)}`;
|
|
1016
1059
|
}
|
|
1017
|
-
/**
|
|
1018
|
-
* Generates an aria-controls CSS selector
|
|
1019
|
-
* @param id - the id of the controlled element
|
|
1020
|
-
* @returns - the generated CSS selector
|
|
1060
|
+
/**
|
|
1061
|
+
* Generates an aria-controls CSS selector
|
|
1062
|
+
* @param id - the id of the controlled element
|
|
1063
|
+
* @returns - the generated CSS selector
|
|
1021
1064
|
*/
|
|
1022
1065
|
static controls(id) {
|
|
1023
1066
|
return id ? `[aria-controls="${this.prefix(id)}"]` : this.hasControls;
|
|
1024
1067
|
}
|
|
1025
|
-
/**
|
|
1026
|
-
* Generates an aria-expanded CSS selector
|
|
1027
|
-
* @param bool - whether the element is expanded or not
|
|
1028
|
-
* @returns - the generated CSS selector
|
|
1068
|
+
/**
|
|
1069
|
+
* Generates an aria-expanded CSS selector
|
|
1070
|
+
* @param bool - whether the element is expanded or not
|
|
1071
|
+
* @returns - the generated CSS selector
|
|
1029
1072
|
*/
|
|
1030
1073
|
static expanded(bool) {
|
|
1031
1074
|
return typeof bool === 'boolean' ? `[aria-expanded="${bool}"]` : this.hasExpanded;
|
|
1032
1075
|
}
|
|
1033
|
-
/**
|
|
1034
|
-
* Returns a NodeList of HTMLElements within the given element that are focusable
|
|
1035
|
-
* @param el - the element whose focusable children will be returned
|
|
1036
|
-
* @returns - the elements within the given element that are focusable
|
|
1076
|
+
/**
|
|
1077
|
+
* Returns a NodeList of HTMLElements within the given element that are focusable
|
|
1078
|
+
* @param el - the element whose focusable children will be returned
|
|
1079
|
+
* @returns - the elements within the given element that are focusable
|
|
1037
1080
|
*/
|
|
1038
1081
|
static getFocusables(el) {
|
|
1039
1082
|
let focusables;
|
|
@@ -1044,12 +1087,12 @@ class mintSelectors {
|
|
|
1044
1087
|
}
|
|
1045
1088
|
return focusables.filter(el => this.isFocusable(el));
|
|
1046
1089
|
}
|
|
1047
|
-
/**
|
|
1048
|
-
* Returns true if an element is focusable and false if not,
|
|
1049
|
-
* based on styles (i.e. a parent has display: none;)
|
|
1050
|
-
* NOTE: Still need to determine what other styles may make an element un-focusable
|
|
1051
|
-
* @param el - the element
|
|
1052
|
-
* @returns - true if the element is focusable; false if not
|
|
1090
|
+
/**
|
|
1091
|
+
* Returns true if an element is focusable and false if not,
|
|
1092
|
+
* based on styles (i.e. a parent has display: none;)
|
|
1093
|
+
* NOTE: Still need to determine what other styles may make an element un-focusable
|
|
1094
|
+
* @param el - the element
|
|
1095
|
+
* @returns - true if the element is focusable; false if not
|
|
1053
1096
|
*/
|
|
1054
1097
|
static isFocusable(el) {
|
|
1055
1098
|
let current = el;
|
|
@@ -1064,48 +1107,48 @@ class mintSelectors {
|
|
|
1064
1107
|
}
|
|
1065
1108
|
exports.mintSelectors = mintSelectors;
|
|
1066
1109
|
_a = mintSelectors;
|
|
1067
|
-
/**
|
|
1068
|
-
* The library name that will be added as a prefix
|
|
1110
|
+
/**
|
|
1111
|
+
* The library name that will be added as a prefix
|
|
1069
1112
|
*/
|
|
1070
1113
|
mintSelectors.lib = 'mint';
|
|
1071
|
-
/**
|
|
1072
|
-
* The prefix built from the library name
|
|
1114
|
+
/**
|
|
1115
|
+
* The prefix built from the library name
|
|
1073
1116
|
*/
|
|
1074
1117
|
mintSelectors.pre = `${_a.lib}-`;
|
|
1075
|
-
/**
|
|
1076
|
-
* CSS-selector for disabled elements
|
|
1118
|
+
/**
|
|
1119
|
+
* CSS-selector for disabled elements
|
|
1077
1120
|
*/
|
|
1078
1121
|
mintSelectors.disabled = '[disabled]';
|
|
1079
|
-
/**
|
|
1080
|
-
* CSS-selector for elements with an aria-controls attribute
|
|
1122
|
+
/**
|
|
1123
|
+
* CSS-selector for elements with an aria-controls attribute
|
|
1081
1124
|
*/
|
|
1082
1125
|
mintSelectors.hasControls = '[aria-controls]';
|
|
1083
|
-
/**
|
|
1084
|
-
* CSS-selector for elements with an aria-expanded attribute
|
|
1126
|
+
/**
|
|
1127
|
+
* CSS-selector for elements with an aria-expanded attribute
|
|
1085
1128
|
*/
|
|
1086
1129
|
mintSelectors.hasExpanded = '[aria-expanded]';
|
|
1087
|
-
/**
|
|
1088
|
-
* CSS-selector for elements with an href attribute
|
|
1130
|
+
/**
|
|
1131
|
+
* CSS-selector for elements with an href attribute
|
|
1089
1132
|
*/
|
|
1090
1133
|
mintSelectors.hasLink = '[href]';
|
|
1091
|
-
/**
|
|
1092
|
-
* CSS-selector for elements with a routerLink attribute
|
|
1134
|
+
/**
|
|
1135
|
+
* CSS-selector for elements with a routerLink attribute
|
|
1093
1136
|
*/
|
|
1094
1137
|
mintSelectors.hasRouterLink = '[routerLink]';
|
|
1095
|
-
/**
|
|
1096
|
-
* CSS-selector for elements with an id attribute
|
|
1138
|
+
/**
|
|
1139
|
+
* CSS-selector for elements with an id attribute
|
|
1097
1140
|
*/
|
|
1098
1141
|
mintSelectors.hasId = '[id]';
|
|
1099
|
-
/**
|
|
1100
|
-
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
|
|
1142
|
+
/**
|
|
1143
|
+
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
|
|
1101
1144
|
*/
|
|
1102
1145
|
mintSelectors.notTabbable = '[tabindex^="-"]';
|
|
1103
|
-
/**
|
|
1104
|
-
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
|
|
1146
|
+
/**
|
|
1147
|
+
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
|
|
1105
1148
|
*/
|
|
1106
1149
|
mintSelectors.tabbable = `[tabindex]${_a.neg(_a.notTabbable)}`;
|
|
1107
|
-
/**
|
|
1108
|
-
* CSS-selector for elements that can receive focus
|
|
1150
|
+
/**
|
|
1151
|
+
* CSS-selector for elements that can receive focus
|
|
1109
1152
|
*/
|
|
1110
1153
|
mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
1111
1154
|
select${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
@@ -1115,12 +1158,12 @@ mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
|
1115
1158
|
a${_a.hasLink}, a${_a.hasRouterLink},
|
|
1116
1159
|
area${_a.hasLink},
|
|
1117
1160
|
${_a.tabbable}`.replace(/\s/g, '');
|
|
1118
|
-
/**
|
|
1119
|
-
* CSS-selector for submenu buttons
|
|
1161
|
+
/**
|
|
1162
|
+
* CSS-selector for submenu buttons
|
|
1120
1163
|
*/
|
|
1121
1164
|
mintSelectors.subMenuButtons = `button${_a.hasControls}`;
|
|
1122
|
-
/**
|
|
1123
|
-
* CSS-selector for submenus
|
|
1165
|
+
/**
|
|
1166
|
+
* CSS-selector for submenus
|
|
1124
1167
|
*/
|
|
1125
1168
|
mintSelectors.subMenu = `${_a.subMenuButtons} + ul${_a.hasId}`;
|
|
1126
1169
|
exports["default"] = mintSelectors;
|
|
@@ -1140,14 +1183,14 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1140
1183
|
value: true
|
|
1141
1184
|
}));
|
|
1142
1185
|
exports.mintSettings = void 0;
|
|
1143
|
-
/**
|
|
1144
|
-
* Settings management
|
|
1145
|
-
* @public
|
|
1186
|
+
/**
|
|
1187
|
+
* Settings management
|
|
1188
|
+
* @public
|
|
1146
1189
|
*/
|
|
1147
1190
|
class mintSettings {
|
|
1148
|
-
/**
|
|
1149
|
-
* Update the provided settings variables
|
|
1150
|
-
* @param settings - Object of settings variables to update
|
|
1191
|
+
/**
|
|
1192
|
+
* Update the provided settings variables
|
|
1193
|
+
* @param settings - Object of settings variables to update
|
|
1151
1194
|
*/
|
|
1152
1195
|
static set(settings) {
|
|
1153
1196
|
let newDelay = false;
|
|
@@ -1173,8 +1216,8 @@ class mintSettings {
|
|
|
1173
1216
|
}
|
|
1174
1217
|
}
|
|
1175
1218
|
}
|
|
1176
|
-
/**
|
|
1177
|
-
* Updates the delay variables based on `this.delayBase` and `this.delayStep`
|
|
1219
|
+
/**
|
|
1220
|
+
* Updates the delay variables based on `this.delayBase` and `this.delayStep`
|
|
1178
1221
|
*/
|
|
1179
1222
|
static setDelay() {
|
|
1180
1223
|
this.delay = {
|
|
@@ -1189,16 +1232,16 @@ class mintSettings {
|
|
|
1189
1232
|
}
|
|
1190
1233
|
exports.mintSettings = mintSettings;
|
|
1191
1234
|
_a = mintSettings;
|
|
1192
|
-
/**
|
|
1193
|
-
* Value added to all delay variables
|
|
1235
|
+
/**
|
|
1236
|
+
* Value added to all delay variables
|
|
1194
1237
|
*/
|
|
1195
1238
|
mintSettings.delayBase = 0;
|
|
1196
|
-
/**
|
|
1197
|
-
* Value multiplied by delay variable index
|
|
1239
|
+
/**
|
|
1240
|
+
* Value multiplied by delay variable index
|
|
1198
1241
|
*/
|
|
1199
1242
|
mintSettings.delayStep = 100;
|
|
1200
|
-
/**
|
|
1201
|
-
* Delay variables
|
|
1243
|
+
/**
|
|
1244
|
+
* Delay variables
|
|
1202
1245
|
*/
|
|
1203
1246
|
mintSettings.delay = {
|
|
1204
1247
|
instant: _a.delayBase + _a.delayStep * 0,
|
|
@@ -1208,8 +1251,8 @@ mintSettings.delay = {
|
|
|
1208
1251
|
medSlow: _a.delayBase + _a.delayStep * 4,
|
|
1209
1252
|
slow: _a.delayBase + _a.delayStep * 5
|
|
1210
1253
|
};
|
|
1211
|
-
/**
|
|
1212
|
-
* Breakpoint variables
|
|
1254
|
+
/**
|
|
1255
|
+
* Breakpoint variables
|
|
1213
1256
|
*/
|
|
1214
1257
|
mintSettings.break = {
|
|
1215
1258
|
z: 0,
|
|
@@ -1236,31 +1279,31 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1236
1279
|
value: true
|
|
1237
1280
|
}));
|
|
1238
1281
|
exports.mintText = void 0;
|
|
1239
|
-
/**
|
|
1240
|
-
* Functions for analyzing and manipulating text.
|
|
1282
|
+
/**
|
|
1283
|
+
* Functions for analyzing and manipulating text.
|
|
1241
1284
|
*/
|
|
1242
1285
|
class mintText {
|
|
1243
|
-
/*static fitContainer () {
|
|
1244
|
-
let $warning: JQuery<HTMLElement> = $(warningSelector);
|
|
1245
|
-
$warning.css({
|
|
1246
|
-
overflow: 'scroll',
|
|
1247
|
-
fontSize: ''
|
|
1248
|
-
});
|
|
1249
|
-
while (($warning?.[0].scrollHeight ?? Number.MIN_SAFE_INTEGER) > ($warning?.innerHeight() ?? Number.MAX_SAFE_INTEGER)) {
|
|
1250
|
-
let fontSize: number = parseInt($warning.css('font-size')) - 1;
|
|
1251
|
-
$warning.css('font-size', fontSize + 'px');
|
|
1252
|
-
}
|
|
1286
|
+
/*static fitContainer () {
|
|
1287
|
+
let $warning: JQuery<HTMLElement> = $(warningSelector);
|
|
1288
|
+
$warning.css({
|
|
1289
|
+
overflow: 'scroll',
|
|
1290
|
+
fontSize: ''
|
|
1291
|
+
});
|
|
1292
|
+
while (($warning?.[0].scrollHeight ?? Number.MIN_SAFE_INTEGER) > ($warning?.innerHeight() ?? Number.MAX_SAFE_INTEGER)) {
|
|
1293
|
+
let fontSize: number = parseInt($warning.css('font-size')) - 1;
|
|
1294
|
+
$warning.css('font-size', fontSize + 'px');
|
|
1295
|
+
}
|
|
1253
1296
|
}*/
|
|
1254
|
-
/**
|
|
1255
|
-
* Generate a slug from a string
|
|
1256
|
-
* @param str - The string to slugify
|
|
1257
|
-
* @returns The slugified string
|
|
1297
|
+
/**
|
|
1298
|
+
* Generate a slug from a string
|
|
1299
|
+
* @param str - The string to slugify
|
|
1300
|
+
* @returns The slugified string
|
|
1258
1301
|
*/
|
|
1259
1302
|
static slug(str) {
|
|
1260
1303
|
return str.toLowerCase().replace(/\W+/g, '-').replace(/^-+|-+$/g, '');
|
|
1261
1304
|
}
|
|
1262
|
-
/**
|
|
1263
|
-
* Pluralize the given word
|
|
1305
|
+
/**
|
|
1306
|
+
* Pluralize the given word
|
|
1264
1307
|
*/
|
|
1265
1308
|
static pluralize(word) {
|
|
1266
1309
|
if (word.endsWith('ies') || word.endsWith('es') || word.endsWith('s') && !word.endsWith('us') && !word.endsWith('is') && !word.endsWith('ss')) {
|
|
@@ -1293,8 +1336,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1293
1336
|
value: true
|
|
1294
1337
|
}));
|
|
1295
1338
|
exports.mintWindow = void 0;
|
|
1296
|
-
/**
|
|
1297
|
-
* Functions related to the browser window.
|
|
1339
|
+
/**
|
|
1340
|
+
* Functions related to the browser window.
|
|
1298
1341
|
*/
|
|
1299
1342
|
class mintWindow {}
|
|
1300
1343
|
exports.mintWindow = mintWindow;
|
|
@@ -1311,10 +1354,10 @@ exports["default"] = mintWindow;
|
|
|
1311
1354
|
|
|
1312
1355
|
|
|
1313
1356
|
|
|
1314
|
-
/**
|
|
1315
|
-
* A library for building responsive web applications.
|
|
1316
|
-
*
|
|
1317
|
-
* @packageDocumentation
|
|
1357
|
+
/**
|
|
1358
|
+
* A library for building responsive web applications.
|
|
1359
|
+
*
|
|
1360
|
+
* @packageDocumentation
|
|
1318
1361
|
*/
|
|
1319
1362
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
1320
1363
|
return mod && mod.__esModule ? mod : {
|
|
@@ -1325,8 +1368,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1325
1368
|
value: true
|
|
1326
1369
|
}));
|
|
1327
1370
|
exports["default"] = exports.mintUtil = exports.mintSettings = exports.mintSelectors = exports.mintWindow = exports.mintText = exports.mintObject = exports.mintMath = exports.mintList = exports.mintIcon = exports.mintEvent = exports.mintDisplay = exports.mintItem = exports.mintColor = exports.mintHeader = exports.mintSide = void 0;
|
|
1328
|
-
/**
|
|
1329
|
-
* Exports
|
|
1371
|
+
/**
|
|
1372
|
+
* Exports
|
|
1330
1373
|
*/
|
|
1331
1374
|
// Enums
|
|
1332
1375
|
var enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts");
|
|
@@ -1464,29 +1507,29 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1464
1507
|
value: true
|
|
1465
1508
|
}));
|
|
1466
1509
|
exports.mintUtil = void 0;
|
|
1467
|
-
/**
|
|
1468
|
-
* Imports
|
|
1510
|
+
/**
|
|
1511
|
+
* Imports
|
|
1469
1512
|
*/
|
|
1470
1513
|
const enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts");
|
|
1471
1514
|
const settings_1 = __importDefault(__webpack_require__(/*! ./imports/util/settings */ "./src/ts/imports/util/settings.ts"));
|
|
1472
|
-
/**
|
|
1473
|
-
* Utility functions
|
|
1474
|
-
* @public
|
|
1515
|
+
/**
|
|
1516
|
+
* Utility functions
|
|
1517
|
+
* @public
|
|
1475
1518
|
*/
|
|
1476
1519
|
class mintUtil {
|
|
1477
|
-
/**
|
|
1478
|
-
* Returns the width of the window, including fractional pixels
|
|
1479
|
-
* @returns the width of the window
|
|
1520
|
+
/**
|
|
1521
|
+
* Returns the width of the window, including fractional pixels
|
|
1522
|
+
* @returns the width of the window
|
|
1480
1523
|
*/
|
|
1481
1524
|
static windowWidth() {
|
|
1482
1525
|
const decimal = document.body.getBoundingClientRect().width % 1;
|
|
1483
1526
|
return window.innerWidth + decimal;
|
|
1484
1527
|
}
|
|
1485
|
-
/**
|
|
1486
|
-
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1487
|
-
* @param func - the function to debounce
|
|
1488
|
-
* @param wait - the amount of time to wait before running the function
|
|
1489
|
-
* @returns - the debounced function
|
|
1528
|
+
/**
|
|
1529
|
+
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1530
|
+
* @param func - the function to debounce
|
|
1531
|
+
* @param wait - the amount of time to wait before running the function
|
|
1532
|
+
* @returns - the debounced function
|
|
1490
1533
|
*/
|
|
1491
1534
|
static debounce(func) {
|
|
1492
1535
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1498,22 +1541,22 @@ class mintUtil {
|
|
|
1498
1541
|
timer = setTimeout(func, wait, e);
|
|
1499
1542
|
};
|
|
1500
1543
|
}
|
|
1501
|
-
/**
|
|
1502
|
-
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1503
|
-
* @param func - the function to debounce
|
|
1504
|
-
* @param wait - the amount of time to wait before running the function
|
|
1505
|
-
* @returns - the debounced function as an EventListener
|
|
1544
|
+
/**
|
|
1545
|
+
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1546
|
+
* @param func - the function to debounce
|
|
1547
|
+
* @param wait - the amount of time to wait before running the function
|
|
1548
|
+
* @returns - the debounced function as an EventListener
|
|
1506
1549
|
*/
|
|
1507
1550
|
static debounceEvent(func) {
|
|
1508
1551
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
1509
1552
|
return mintUtil.debounce(func, wait);
|
|
1510
1553
|
}
|
|
1511
|
-
/**
|
|
1512
|
-
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1513
|
-
* @param func - the function to throttle
|
|
1514
|
-
* @param wait - the amount of time between function calls
|
|
1515
|
-
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1516
|
-
* @returns - the throttled function
|
|
1554
|
+
/**
|
|
1555
|
+
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1556
|
+
* @param func - the function to throttle
|
|
1557
|
+
* @param wait - the amount of time between function calls
|
|
1558
|
+
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1559
|
+
* @returns - the throttled function
|
|
1517
1560
|
*/
|
|
1518
1561
|
static throttle(func) {
|
|
1519
1562
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1556,23 +1599,23 @@ class mintUtil {
|
|
|
1556
1599
|
};
|
|
1557
1600
|
return throttled;
|
|
1558
1601
|
}
|
|
1559
|
-
/**
|
|
1560
|
-
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1561
|
-
* @param func - the function to throttle
|
|
1562
|
-
* @param wait - the amount of time between function calls
|
|
1563
|
-
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1564
|
-
* @returns - the throttled function as an EventListener
|
|
1602
|
+
/**
|
|
1603
|
+
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1604
|
+
* @param func - the function to throttle
|
|
1605
|
+
* @param wait - the amount of time between function calls
|
|
1606
|
+
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1607
|
+
* @returns - the throttled function as an EventListener
|
|
1565
1608
|
*/
|
|
1566
1609
|
static throttleEvent(func) {
|
|
1567
1610
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
1568
1611
|
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
1569
1612
|
return mintUtil.throttle(func, wait, options);
|
|
1570
1613
|
}
|
|
1571
|
-
/**
|
|
1572
|
-
* Sets the element's height to its `innerHeight`, then to `auto` after a delay
|
|
1573
|
-
* @param el - the element whose height will be set
|
|
1574
|
-
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1575
|
-
* @param from - the side that the element is animating from
|
|
1614
|
+
/**
|
|
1615
|
+
* Sets the element's height to its `innerHeight`, then to `auto` after a delay
|
|
1616
|
+
* @param el - the element whose height will be set
|
|
1617
|
+
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1618
|
+
* @param from - the side that the element is animating from
|
|
1576
1619
|
*/
|
|
1577
1620
|
static show(el) {
|
|
1578
1621
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1595,11 +1638,11 @@ class mintUtil {
|
|
|
1595
1638
|
});
|
|
1596
1639
|
}
|
|
1597
1640
|
}
|
|
1598
|
-
/**
|
|
1599
|
-
* Sets the element's height to 0
|
|
1600
|
-
* @param el - the element whose height will be set
|
|
1601
|
-
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1602
|
-
* @param from - the side that the element is animating from
|
|
1641
|
+
/**
|
|
1642
|
+
* Sets the element's height to 0
|
|
1643
|
+
* @param el - the element whose height will be set
|
|
1644
|
+
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1645
|
+
* @param from - the side that the element is animating from
|
|
1603
1646
|
*/
|
|
1604
1647
|
static hide(el) {
|
|
1605
1648
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1629,10 +1672,10 @@ class mintUtil {
|
|
|
1629
1672
|
}, delay);
|
|
1630
1673
|
}
|
|
1631
1674
|
}
|
|
1632
|
-
/**
|
|
1633
|
-
* Copies the provided text to the clipboard
|
|
1634
|
-
* @param text - the text to copy
|
|
1635
|
-
* @returns - true if the text was successfully copied to the clipboard; else false
|
|
1675
|
+
/**
|
|
1676
|
+
* Copies the provided text to the clipboard
|
|
1677
|
+
* @param text - the text to copy
|
|
1678
|
+
* @returns - true if the text was successfully copied to the clipboard; else false
|
|
1636
1679
|
*/
|
|
1637
1680
|
static copyText(text) {
|
|
1638
1681
|
let textArea = document.createElement('textarea');
|
|
@@ -1655,11 +1698,11 @@ class mintUtil {
|
|
|
1655
1698
|
document.body.removeChild(textArea);
|
|
1656
1699
|
return true;
|
|
1657
1700
|
}
|
|
1658
|
-
/**
|
|
1659
|
-
* Tests the validity of an email address
|
|
1660
|
-
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
|
|
1661
|
-
* @param text - the string to test
|
|
1662
|
-
* @returns - true if the given string is an email address; false if not
|
|
1701
|
+
/**
|
|
1702
|
+
* Tests the validity of an email address
|
|
1703
|
+
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
|
|
1704
|
+
* @param text - the string to test
|
|
1705
|
+
* @returns - true if the given string is an email address; false if not
|
|
1663
1706
|
*/
|
|
1664
1707
|
static isEmail(text) {
|
|
1665
1708
|
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])+)\])/);
|