@appartmint/mint 0.14.2 → 0.14.5
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 +14 -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 +12 -12
- package/dist/js/imports/util/math.d.ts +13 -13
- package/dist/js/imports/util/object.d.ts +65 -65
- package/dist/js/imports/util/scroll.d.ts +19 -0
- package/dist/js/imports/util/scroll.d.ts.map +1 -0
- 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 +24 -23
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +384 -323
- 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/_cards.scss +25 -18
- package/src/scss/imports/components/_index.scss +7 -7
- package/src/scss/imports/global/_global.scss +1 -0
- package/src/scss/imports/global/_icons.scss +6 -6
- package/src/scss/imports/global/_text.scss +4 -0
- package/src/scss/imports/global/_texture.scss +6 -1
- 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/scroll.ts +39 -0
- package/src/ts/imports/util/window.ts +6 -6
- package/src/ts/index.ts +34 -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,11 +940,11 @@ 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
|
|
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
948
|
*/
|
|
949
949
|
static updateArray(original, update) {
|
|
950
950
|
let key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';
|
|
@@ -990,6 +990,60 @@ exports["default"] = mintObject;
|
|
|
990
990
|
|
|
991
991
|
/***/ }),
|
|
992
992
|
|
|
993
|
+
/***/ "./src/ts/imports/util/scroll.ts":
|
|
994
|
+
/*!***************************************!*\
|
|
995
|
+
!*** ./src/ts/imports/util/scroll.ts ***!
|
|
996
|
+
\***************************************/
|
|
997
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1002
|
+
value: true
|
|
1003
|
+
}));
|
|
1004
|
+
exports.mintScroll = void 0;
|
|
1005
|
+
/**
|
|
1006
|
+
* Scroll functions
|
|
1007
|
+
*/
|
|
1008
|
+
class mintScroll {
|
|
1009
|
+
/**
|
|
1010
|
+
* Scroll to the top of the page
|
|
1011
|
+
*/
|
|
1012
|
+
static toTop() {
|
|
1013
|
+
window.scrollTo(0, 0);
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Scroll to the bottom of the page
|
|
1017
|
+
*/
|
|
1018
|
+
static toBottom() {
|
|
1019
|
+
window.scrollTo(0, document.body.scrollHeight);
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Show visible elements
|
|
1023
|
+
*/
|
|
1024
|
+
static showElements() {
|
|
1025
|
+
let elements = document.querySelectorAll('.mint-fall-in:not(.mint-show)'),
|
|
1026
|
+
elementsToShow = [];
|
|
1027
|
+
for (let i = 0; i < elements.length; i++) {
|
|
1028
|
+
if (elements[i].getBoundingClientRect().top < 0) {
|
|
1029
|
+
elements[i].classList.add('mint-show');
|
|
1030
|
+
} else if (elements[i].getBoundingClientRect().top < window.innerHeight * 3 / 4) {
|
|
1031
|
+
elementsToShow.push(elements[i]);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
for (let i = 0; i < elementsToShow.length; i++) {
|
|
1035
|
+
setTimeout(() => {
|
|
1036
|
+
elementsToShow[i].classList.add('mint-show');
|
|
1037
|
+
}, i * 200 + i * i * 20);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
exports.mintScroll = mintScroll;
|
|
1042
|
+
;
|
|
1043
|
+
exports["default"] = mintScroll;
|
|
1044
|
+
|
|
1045
|
+
/***/ }),
|
|
1046
|
+
|
|
993
1047
|
/***/ "./src/ts/imports/util/selectors.ts":
|
|
994
1048
|
/*!******************************************!*\
|
|
995
1049
|
!*** ./src/ts/imports/util/selectors.ts ***!
|
|
@@ -1003,80 +1057,80 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1003
1057
|
value: true
|
|
1004
1058
|
}));
|
|
1005
1059
|
exports.mintSelectors = void 0;
|
|
1006
|
-
/**
|
|
1007
|
-
* CSS-selector helpers
|
|
1008
|
-
* @public
|
|
1060
|
+
/**
|
|
1061
|
+
* CSS-selector helpers
|
|
1062
|
+
* @public
|
|
1009
1063
|
*/
|
|
1010
1064
|
class mintSelectors {
|
|
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
|
|
1065
|
+
/**
|
|
1066
|
+
* Adds the library prefix to the beginning of the provided string
|
|
1067
|
+
* @param base - the string to be prefixed
|
|
1068
|
+
* @returns - the provided string prefixed with the library name
|
|
1015
1069
|
*/
|
|
1016
1070
|
static prefix(base) {
|
|
1017
1071
|
base = base.toLowerCase();
|
|
1018
1072
|
return base.startsWith(this.pre) ? base : `${this.pre}${base}`;
|
|
1019
1073
|
}
|
|
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
|
|
1074
|
+
/**
|
|
1075
|
+
* Adds two dashes to the beginning of the provided string
|
|
1076
|
+
* @param base - the string to be prefixed
|
|
1077
|
+
* @returns - the provided string prefixed with two dashes
|
|
1024
1078
|
*/
|
|
1025
1079
|
static cssPrefix(base) {
|
|
1026
1080
|
return `--${this.prefix(base.replace(/^-+/, ''))}`;
|
|
1027
1081
|
}
|
|
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
|
|
1082
|
+
/**
|
|
1083
|
+
* Turns the provided string into a CSS variable call
|
|
1084
|
+
* @param base - the name of the CSS variable to call
|
|
1085
|
+
* @returns - the CSS variable call for the provided string
|
|
1032
1086
|
*/
|
|
1033
1087
|
static cssVar(base) {
|
|
1034
1088
|
return `var(${this.cssPrefix(base)})`;
|
|
1035
1089
|
}
|
|
1036
|
-
/**
|
|
1037
|
-
* Negates the provided CSS selector
|
|
1038
|
-
* @param base - the CSS selector to negate
|
|
1039
|
-
* @returns - the negated CSS selector
|
|
1090
|
+
/**
|
|
1091
|
+
* Negates the provided CSS selector
|
|
1092
|
+
* @param base - the CSS selector to negate
|
|
1093
|
+
* @returns - the negated CSS selector
|
|
1040
1094
|
*/
|
|
1041
1095
|
static neg(base) {
|
|
1042
1096
|
return `:not(${base})`;
|
|
1043
1097
|
}
|
|
1044
|
-
/**
|
|
1045
|
-
* Generates a class CSS selector
|
|
1046
|
-
* @param base - the name of the class to generate
|
|
1047
|
-
* @returns - the generated CSS selector
|
|
1098
|
+
/**
|
|
1099
|
+
* Generates a class CSS selector
|
|
1100
|
+
* @param base - the name of the class to generate
|
|
1101
|
+
* @returns - the generated CSS selector
|
|
1048
1102
|
*/
|
|
1049
1103
|
static class(base) {
|
|
1050
1104
|
return `.${this.prefix(base)}`;
|
|
1051
1105
|
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Generates an id CSS selector
|
|
1054
|
-
* @param base - the name of the id to generate
|
|
1055
|
-
* @returns - the generated CSS selector
|
|
1106
|
+
/**
|
|
1107
|
+
* Generates an id CSS selector
|
|
1108
|
+
* @param base - the name of the id to generate
|
|
1109
|
+
* @returns - the generated CSS selector
|
|
1056
1110
|
*/
|
|
1057
1111
|
static id(base) {
|
|
1058
1112
|
return `#${this.prefix(base)}`;
|
|
1059
1113
|
}
|
|
1060
|
-
/**
|
|
1061
|
-
* Generates an aria-controls CSS selector
|
|
1062
|
-
* @param id - the id of the controlled element
|
|
1063
|
-
* @returns - the generated CSS selector
|
|
1114
|
+
/**
|
|
1115
|
+
* Generates an aria-controls CSS selector
|
|
1116
|
+
* @param id - the id of the controlled element
|
|
1117
|
+
* @returns - the generated CSS selector
|
|
1064
1118
|
*/
|
|
1065
1119
|
static controls(id) {
|
|
1066
1120
|
return id ? `[aria-controls="${this.prefix(id)}"]` : this.hasControls;
|
|
1067
1121
|
}
|
|
1068
|
-
/**
|
|
1069
|
-
* Generates an aria-expanded CSS selector
|
|
1070
|
-
* @param bool - whether the element is expanded or not
|
|
1071
|
-
* @returns - the generated CSS selector
|
|
1122
|
+
/**
|
|
1123
|
+
* Generates an aria-expanded CSS selector
|
|
1124
|
+
* @param bool - whether the element is expanded or not
|
|
1125
|
+
* @returns - the generated CSS selector
|
|
1072
1126
|
*/
|
|
1073
1127
|
static expanded(bool) {
|
|
1074
1128
|
return typeof bool === 'boolean' ? `[aria-expanded="${bool}"]` : this.hasExpanded;
|
|
1075
1129
|
}
|
|
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
|
|
1130
|
+
/**
|
|
1131
|
+
* Returns a NodeList of HTMLElements within the given element that are focusable
|
|
1132
|
+
* @param el - the element whose focusable children will be returned
|
|
1133
|
+
* @returns - the elements within the given element that are focusable
|
|
1080
1134
|
*/
|
|
1081
1135
|
static getFocusables(el) {
|
|
1082
1136
|
let focusables;
|
|
@@ -1087,12 +1141,12 @@ class mintSelectors {
|
|
|
1087
1141
|
}
|
|
1088
1142
|
return focusables.filter(el => this.isFocusable(el));
|
|
1089
1143
|
}
|
|
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
|
|
1144
|
+
/**
|
|
1145
|
+
* Returns true if an element is focusable and false if not,
|
|
1146
|
+
* based on styles (i.e. a parent has display: none;)
|
|
1147
|
+
* NOTE: Still need to determine what other styles may make an element un-focusable
|
|
1148
|
+
* @param el - the element
|
|
1149
|
+
* @returns - true if the element is focusable; false if not
|
|
1096
1150
|
*/
|
|
1097
1151
|
static isFocusable(el) {
|
|
1098
1152
|
let current = el;
|
|
@@ -1107,48 +1161,48 @@ class mintSelectors {
|
|
|
1107
1161
|
}
|
|
1108
1162
|
exports.mintSelectors = mintSelectors;
|
|
1109
1163
|
_a = mintSelectors;
|
|
1110
|
-
/**
|
|
1111
|
-
* The library name that will be added as a prefix
|
|
1164
|
+
/**
|
|
1165
|
+
* The library name that will be added as a prefix
|
|
1112
1166
|
*/
|
|
1113
1167
|
mintSelectors.lib = 'mint';
|
|
1114
|
-
/**
|
|
1115
|
-
* The prefix built from the library name
|
|
1168
|
+
/**
|
|
1169
|
+
* The prefix built from the library name
|
|
1116
1170
|
*/
|
|
1117
1171
|
mintSelectors.pre = `${_a.lib}-`;
|
|
1118
|
-
/**
|
|
1119
|
-
* CSS-selector for disabled elements
|
|
1172
|
+
/**
|
|
1173
|
+
* CSS-selector for disabled elements
|
|
1120
1174
|
*/
|
|
1121
1175
|
mintSelectors.disabled = '[disabled]';
|
|
1122
|
-
/**
|
|
1123
|
-
* CSS-selector for elements with an aria-controls attribute
|
|
1176
|
+
/**
|
|
1177
|
+
* CSS-selector for elements with an aria-controls attribute
|
|
1124
1178
|
*/
|
|
1125
1179
|
mintSelectors.hasControls = '[aria-controls]';
|
|
1126
|
-
/**
|
|
1127
|
-
* CSS-selector for elements with an aria-expanded attribute
|
|
1180
|
+
/**
|
|
1181
|
+
* CSS-selector for elements with an aria-expanded attribute
|
|
1128
1182
|
*/
|
|
1129
1183
|
mintSelectors.hasExpanded = '[aria-expanded]';
|
|
1130
|
-
/**
|
|
1131
|
-
* CSS-selector for elements with an href attribute
|
|
1184
|
+
/**
|
|
1185
|
+
* CSS-selector for elements with an href attribute
|
|
1132
1186
|
*/
|
|
1133
1187
|
mintSelectors.hasLink = '[href]';
|
|
1134
|
-
/**
|
|
1135
|
-
* CSS-selector for elements with a routerLink attribute
|
|
1188
|
+
/**
|
|
1189
|
+
* CSS-selector for elements with a routerLink attribute
|
|
1136
1190
|
*/
|
|
1137
1191
|
mintSelectors.hasRouterLink = '[routerLink]';
|
|
1138
|
-
/**
|
|
1139
|
-
* CSS-selector for elements with an id attribute
|
|
1192
|
+
/**
|
|
1193
|
+
* CSS-selector for elements with an id attribute
|
|
1140
1194
|
*/
|
|
1141
1195
|
mintSelectors.hasId = '[id]';
|
|
1142
|
-
/**
|
|
1143
|
-
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
|
|
1196
|
+
/**
|
|
1197
|
+
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
|
|
1144
1198
|
*/
|
|
1145
1199
|
mintSelectors.notTabbable = '[tabindex^="-"]';
|
|
1146
|
-
/**
|
|
1147
|
-
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
|
|
1200
|
+
/**
|
|
1201
|
+
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
|
|
1148
1202
|
*/
|
|
1149
1203
|
mintSelectors.tabbable = `[tabindex]${_a.neg(_a.notTabbable)}`;
|
|
1150
|
-
/**
|
|
1151
|
-
* CSS-selector for elements that can receive focus
|
|
1204
|
+
/**
|
|
1205
|
+
* CSS-selector for elements that can receive focus
|
|
1152
1206
|
*/
|
|
1153
1207
|
mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
1154
1208
|
select${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
@@ -1158,12 +1212,12 @@ mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
|
1158
1212
|
a${_a.hasLink}, a${_a.hasRouterLink},
|
|
1159
1213
|
area${_a.hasLink},
|
|
1160
1214
|
${_a.tabbable}`.replace(/\s/g, '');
|
|
1161
|
-
/**
|
|
1162
|
-
* CSS-selector for submenu buttons
|
|
1215
|
+
/**
|
|
1216
|
+
* CSS-selector for submenu buttons
|
|
1163
1217
|
*/
|
|
1164
1218
|
mintSelectors.subMenuButtons = `button${_a.hasControls}`;
|
|
1165
|
-
/**
|
|
1166
|
-
* CSS-selector for submenus
|
|
1219
|
+
/**
|
|
1220
|
+
* CSS-selector for submenus
|
|
1167
1221
|
*/
|
|
1168
1222
|
mintSelectors.subMenu = `${_a.subMenuButtons} + ul${_a.hasId}`;
|
|
1169
1223
|
exports["default"] = mintSelectors;
|
|
@@ -1183,14 +1237,14 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1183
1237
|
value: true
|
|
1184
1238
|
}));
|
|
1185
1239
|
exports.mintSettings = void 0;
|
|
1186
|
-
/**
|
|
1187
|
-
* Settings management
|
|
1188
|
-
* @public
|
|
1240
|
+
/**
|
|
1241
|
+
* Settings management
|
|
1242
|
+
* @public
|
|
1189
1243
|
*/
|
|
1190
1244
|
class mintSettings {
|
|
1191
|
-
/**
|
|
1192
|
-
* Update the provided settings variables
|
|
1193
|
-
* @param settings - Object of settings variables to update
|
|
1245
|
+
/**
|
|
1246
|
+
* Update the provided settings variables
|
|
1247
|
+
* @param settings - Object of settings variables to update
|
|
1194
1248
|
*/
|
|
1195
1249
|
static set(settings) {
|
|
1196
1250
|
let newDelay = false;
|
|
@@ -1216,8 +1270,8 @@ class mintSettings {
|
|
|
1216
1270
|
}
|
|
1217
1271
|
}
|
|
1218
1272
|
}
|
|
1219
|
-
/**
|
|
1220
|
-
* Updates the delay variables based on `this.delayBase` and `this.delayStep`
|
|
1273
|
+
/**
|
|
1274
|
+
* Updates the delay variables based on `this.delayBase` and `this.delayStep`
|
|
1221
1275
|
*/
|
|
1222
1276
|
static setDelay() {
|
|
1223
1277
|
this.delay = {
|
|
@@ -1232,16 +1286,16 @@ class mintSettings {
|
|
|
1232
1286
|
}
|
|
1233
1287
|
exports.mintSettings = mintSettings;
|
|
1234
1288
|
_a = mintSettings;
|
|
1235
|
-
/**
|
|
1236
|
-
* Value added to all delay variables
|
|
1289
|
+
/**
|
|
1290
|
+
* Value added to all delay variables
|
|
1237
1291
|
*/
|
|
1238
1292
|
mintSettings.delayBase = 0;
|
|
1239
|
-
/**
|
|
1240
|
-
* Value multiplied by delay variable index
|
|
1293
|
+
/**
|
|
1294
|
+
* Value multiplied by delay variable index
|
|
1241
1295
|
*/
|
|
1242
1296
|
mintSettings.delayStep = 100;
|
|
1243
|
-
/**
|
|
1244
|
-
* Delay variables
|
|
1297
|
+
/**
|
|
1298
|
+
* Delay variables
|
|
1245
1299
|
*/
|
|
1246
1300
|
mintSettings.delay = {
|
|
1247
1301
|
instant: _a.delayBase + _a.delayStep * 0,
|
|
@@ -1251,8 +1305,8 @@ mintSettings.delay = {
|
|
|
1251
1305
|
medSlow: _a.delayBase + _a.delayStep * 4,
|
|
1252
1306
|
slow: _a.delayBase + _a.delayStep * 5
|
|
1253
1307
|
};
|
|
1254
|
-
/**
|
|
1255
|
-
* Breakpoint variables
|
|
1308
|
+
/**
|
|
1309
|
+
* Breakpoint variables
|
|
1256
1310
|
*/
|
|
1257
1311
|
mintSettings.break = {
|
|
1258
1312
|
z: 0,
|
|
@@ -1279,31 +1333,31 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1279
1333
|
value: true
|
|
1280
1334
|
}));
|
|
1281
1335
|
exports.mintText = void 0;
|
|
1282
|
-
/**
|
|
1283
|
-
* Functions for analyzing and manipulating text.
|
|
1336
|
+
/**
|
|
1337
|
+
* Functions for analyzing and manipulating text.
|
|
1284
1338
|
*/
|
|
1285
1339
|
class mintText {
|
|
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
|
-
}
|
|
1340
|
+
/*static fitContainer () {
|
|
1341
|
+
let $warning: JQuery<HTMLElement> = $(warningSelector);
|
|
1342
|
+
$warning.css({
|
|
1343
|
+
overflow: 'scroll',
|
|
1344
|
+
fontSize: ''
|
|
1345
|
+
});
|
|
1346
|
+
while (($warning?.[0].scrollHeight ?? Number.MIN_SAFE_INTEGER) > ($warning?.innerHeight() ?? Number.MAX_SAFE_INTEGER)) {
|
|
1347
|
+
let fontSize: number = parseInt($warning.css('font-size')) - 1;
|
|
1348
|
+
$warning.css('font-size', fontSize + 'px');
|
|
1349
|
+
}
|
|
1296
1350
|
}*/
|
|
1297
|
-
/**
|
|
1298
|
-
* Generate a slug from a string
|
|
1299
|
-
* @param str - The string to slugify
|
|
1300
|
-
* @returns The slugified string
|
|
1351
|
+
/**
|
|
1352
|
+
* Generate a slug from a string
|
|
1353
|
+
* @param str - The string to slugify
|
|
1354
|
+
* @returns The slugified string
|
|
1301
1355
|
*/
|
|
1302
1356
|
static slug(str) {
|
|
1303
1357
|
return str.toLowerCase().replace(/\W+/g, '-').replace(/^-+|-+$/g, '');
|
|
1304
1358
|
}
|
|
1305
|
-
/**
|
|
1306
|
-
* Pluralize the given word
|
|
1359
|
+
/**
|
|
1360
|
+
* Pluralize the given word
|
|
1307
1361
|
*/
|
|
1308
1362
|
static pluralize(word) {
|
|
1309
1363
|
if (word.endsWith('ies') || word.endsWith('es') || word.endsWith('s') && !word.endsWith('us') && !word.endsWith('is') && !word.endsWith('ss')) {
|
|
@@ -1336,8 +1390,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1336
1390
|
value: true
|
|
1337
1391
|
}));
|
|
1338
1392
|
exports.mintWindow = void 0;
|
|
1339
|
-
/**
|
|
1340
|
-
* Functions related to the browser window.
|
|
1393
|
+
/**
|
|
1394
|
+
* Functions related to the browser window.
|
|
1341
1395
|
*/
|
|
1342
1396
|
class mintWindow {}
|
|
1343
1397
|
exports.mintWindow = mintWindow;
|
|
@@ -1354,10 +1408,10 @@ exports["default"] = mintWindow;
|
|
|
1354
1408
|
|
|
1355
1409
|
|
|
1356
1410
|
|
|
1357
|
-
/**
|
|
1358
|
-
* A library for building responsive web applications.
|
|
1359
|
-
*
|
|
1360
|
-
* @packageDocumentation
|
|
1411
|
+
/**
|
|
1412
|
+
* A library for building responsive web applications.
|
|
1413
|
+
*
|
|
1414
|
+
* @packageDocumentation
|
|
1361
1415
|
*/
|
|
1362
1416
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
1363
1417
|
return mod && mod.__esModule ? mod : {
|
|
@@ -1367,9 +1421,9 @@ var __importDefault = this && this.__importDefault || function (mod) {
|
|
|
1367
1421
|
Object.defineProperty(exports, "__esModule", ({
|
|
1368
1422
|
value: true
|
|
1369
1423
|
}));
|
|
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;
|
|
1371
|
-
/**
|
|
1372
|
-
* Exports
|
|
1424
|
+
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;
|
|
1425
|
+
/**
|
|
1426
|
+
* Exports
|
|
1373
1427
|
*/
|
|
1374
1428
|
// Enums
|
|
1375
1429
|
var enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts");
|
|
@@ -1445,6 +1499,13 @@ Object.defineProperty(exports, "mintObject", ({
|
|
|
1445
1499
|
return object_1.mintObject;
|
|
1446
1500
|
}
|
|
1447
1501
|
}));
|
|
1502
|
+
var scroll_1 = __webpack_require__(/*! ./imports/util/scroll */ "./src/ts/imports/util/scroll.ts");
|
|
1503
|
+
Object.defineProperty(exports, "mintScroll", ({
|
|
1504
|
+
enumerable: true,
|
|
1505
|
+
get: function () {
|
|
1506
|
+
return scroll_1.mintScroll;
|
|
1507
|
+
}
|
|
1508
|
+
}));
|
|
1448
1509
|
var text_1 = __webpack_require__(/*! ./imports/util/text */ "./src/ts/imports/util/text.ts");
|
|
1449
1510
|
Object.defineProperty(exports, "mintText", ({
|
|
1450
1511
|
enumerable: true,
|
|
@@ -1507,29 +1568,29 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1507
1568
|
value: true
|
|
1508
1569
|
}));
|
|
1509
1570
|
exports.mintUtil = void 0;
|
|
1510
|
-
/**
|
|
1511
|
-
* Imports
|
|
1571
|
+
/**
|
|
1572
|
+
* Imports
|
|
1512
1573
|
*/
|
|
1513
1574
|
const enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts");
|
|
1514
1575
|
const settings_1 = __importDefault(__webpack_require__(/*! ./imports/util/settings */ "./src/ts/imports/util/settings.ts"));
|
|
1515
|
-
/**
|
|
1516
|
-
* Utility functions
|
|
1517
|
-
* @public
|
|
1576
|
+
/**
|
|
1577
|
+
* Utility functions
|
|
1578
|
+
* @public
|
|
1518
1579
|
*/
|
|
1519
1580
|
class mintUtil {
|
|
1520
|
-
/**
|
|
1521
|
-
* Returns the width of the window, including fractional pixels
|
|
1522
|
-
* @returns the width of the window
|
|
1581
|
+
/**
|
|
1582
|
+
* Returns the width of the window, including fractional pixels
|
|
1583
|
+
* @returns the width of the window
|
|
1523
1584
|
*/
|
|
1524
1585
|
static windowWidth() {
|
|
1525
1586
|
const decimal = document.body.getBoundingClientRect().width % 1;
|
|
1526
1587
|
return window.innerWidth + decimal;
|
|
1527
1588
|
}
|
|
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
|
|
1589
|
+
/**
|
|
1590
|
+
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1591
|
+
* @param func - the function to debounce
|
|
1592
|
+
* @param wait - the amount of time to wait before running the function
|
|
1593
|
+
* @returns - the debounced function
|
|
1533
1594
|
*/
|
|
1534
1595
|
static debounce(func) {
|
|
1535
1596
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1541,22 +1602,22 @@ class mintUtil {
|
|
|
1541
1602
|
timer = setTimeout(func, wait, e);
|
|
1542
1603
|
};
|
|
1543
1604
|
}
|
|
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
|
|
1605
|
+
/**
|
|
1606
|
+
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1607
|
+
* @param func - the function to debounce
|
|
1608
|
+
* @param wait - the amount of time to wait before running the function
|
|
1609
|
+
* @returns - the debounced function as an EventListener
|
|
1549
1610
|
*/
|
|
1550
1611
|
static debounceEvent(func) {
|
|
1551
1612
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
1552
1613
|
return mintUtil.debounce(func, wait);
|
|
1553
1614
|
}
|
|
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
|
|
1615
|
+
/**
|
|
1616
|
+
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1617
|
+
* @param func - the function to throttle
|
|
1618
|
+
* @param wait - the amount of time between function calls
|
|
1619
|
+
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1620
|
+
* @returns - the throttled function
|
|
1560
1621
|
*/
|
|
1561
1622
|
static throttle(func) {
|
|
1562
1623
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1599,23 +1660,23 @@ class mintUtil {
|
|
|
1599
1660
|
};
|
|
1600
1661
|
return throttled;
|
|
1601
1662
|
}
|
|
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
|
|
1663
|
+
/**
|
|
1664
|
+
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1665
|
+
* @param func - the function to throttle
|
|
1666
|
+
* @param wait - the amount of time between function calls
|
|
1667
|
+
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1668
|
+
* @returns - the throttled function as an EventListener
|
|
1608
1669
|
*/
|
|
1609
1670
|
static throttleEvent(func) {
|
|
1610
1671
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
1611
1672
|
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
1612
1673
|
return mintUtil.throttle(func, wait, options);
|
|
1613
1674
|
}
|
|
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
|
|
1675
|
+
/**
|
|
1676
|
+
* Sets the element's height to its `innerHeight`, then to `auto` after a delay
|
|
1677
|
+
* @param el - the element whose height will be set
|
|
1678
|
+
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1679
|
+
* @param from - the side that the element is animating from
|
|
1619
1680
|
*/
|
|
1620
1681
|
static show(el) {
|
|
1621
1682
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1638,11 +1699,11 @@ class mintUtil {
|
|
|
1638
1699
|
});
|
|
1639
1700
|
}
|
|
1640
1701
|
}
|
|
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
|
|
1702
|
+
/**
|
|
1703
|
+
* Sets the element's height to 0
|
|
1704
|
+
* @param el - the element whose height will be set
|
|
1705
|
+
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1706
|
+
* @param from - the side that the element is animating from
|
|
1646
1707
|
*/
|
|
1647
1708
|
static hide(el) {
|
|
1648
1709
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1672,10 +1733,10 @@ class mintUtil {
|
|
|
1672
1733
|
}, delay);
|
|
1673
1734
|
}
|
|
1674
1735
|
}
|
|
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
|
|
1736
|
+
/**
|
|
1737
|
+
* Copies the provided text to the clipboard
|
|
1738
|
+
* @param text - the text to copy
|
|
1739
|
+
* @returns - true if the text was successfully copied to the clipboard; else false
|
|
1679
1740
|
*/
|
|
1680
1741
|
static copyText(text) {
|
|
1681
1742
|
let textArea = document.createElement('textarea');
|
|
@@ -1698,11 +1759,11 @@ class mintUtil {
|
|
|
1698
1759
|
document.body.removeChild(textArea);
|
|
1699
1760
|
return true;
|
|
1700
1761
|
}
|
|
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
|
|
1762
|
+
/**
|
|
1763
|
+
* Tests the validity of an email address
|
|
1764
|
+
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
|
|
1765
|
+
* @param text - the string to test
|
|
1766
|
+
* @returns - true if the given string is an email address; false if not
|
|
1706
1767
|
*/
|
|
1707
1768
|
static isEmail(text) {
|
|
1708
1769
|
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])+)\])/);
|