@appartmint/mint 0.13.1 → 0.13.3
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 +1 -0
- 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 +122 -122
- 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 +58 -58
- package/dist/js/imports/util/selectors.d.ts +145 -145
- package/dist/js/imports/util/settings.d.ts +52 -52
- 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 +329 -329
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.min.js.map +1 -1
- package/dist/js/util.d.ts +77 -77
- package/dist/js/util.js +150 -150
- package/dist/js/util.js.map +1 -1
- package/dist/js/util.min.js.map +1 -1
- package/package.json +2 -2
- package/src/scss/imports/_index.scss +8 -8
- package/src/scss/imports/components/_backgrounds.scss +1 -0
- package/src/scss/imports/components/_embed.scss +63 -63
- package/src/scss/imports/components/_index.scss +7 -7
- package/src/scss/imports/global/_icons.scss +6 -6
- 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/window.ts +6 -6
- package/src/ts/index.ts +33 -33
package/dist/js/index.js
CHANGED
|
@@ -29,28 +29,28 @@ 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
|
-
* Last-logged window width
|
|
48
|
+
/**
|
|
49
|
+
* Last-logged window width
|
|
50
50
|
*/
|
|
51
51
|
this.lastWidth = util_1.default.windowWidth();
|
|
52
|
-
/**
|
|
53
|
-
* Frequently-referenced elements
|
|
52
|
+
/**
|
|
53
|
+
* Frequently-referenced elements
|
|
54
54
|
*/
|
|
55
55
|
this.el = {};
|
|
56
56
|
let defaultSettings = {
|
|
@@ -63,8 +63,8 @@ class mintHeader {
|
|
|
63
63
|
this.addClasses();
|
|
64
64
|
this.setMobileMenu();
|
|
65
65
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Adds elements to {@link el | `this.el`}
|
|
66
|
+
/**
|
|
67
|
+
* Adds elements to {@link el | `this.el`}
|
|
68
68
|
*/
|
|
69
69
|
attachElements() {
|
|
70
70
|
var _a;
|
|
@@ -74,8 +74,8 @@ class mintHeader {
|
|
|
74
74
|
this.el.mobileButton = ((_a = this.el.header) === null || _a === void 0 ? void 0 : _a.querySelector(selectors_1.default.controls(selectors_1.default.getId('wrapper')))) || null;
|
|
75
75
|
this.el.wrapper = document.getElementById(selectors_1.default.getId('wrapper'));
|
|
76
76
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Adds events to the dom
|
|
77
|
+
/**
|
|
78
|
+
* Adds events to the dom
|
|
79
79
|
*/
|
|
80
80
|
attachEvents() {
|
|
81
81
|
var _a, _b, _c, _d;
|
|
@@ -100,8 +100,8 @@ class mintHeader {
|
|
|
100
100
|
}));
|
|
101
101
|
(_d = this.el.wrapper) === null || _d === void 0 ? void 0 : _d.addEventListener('transitionend', this.eTransitionEnd.bind(this));
|
|
102
102
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Adds classes that inform the styles
|
|
103
|
+
/**
|
|
104
|
+
* Adds classes that inform the styles
|
|
105
105
|
*/
|
|
106
106
|
addClasses() {
|
|
107
107
|
var _a;
|
|
@@ -109,9 +109,9 @@ class mintHeader {
|
|
|
109
109
|
(_a = this.el.body) === null || _a === void 0 ? void 0 : _a.classList.add(selectors_1.default.getClass('fixed'));
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Sets the state of the mobile menu
|
|
114
|
-
* @param open - `true` to open the menu or `false` to close it
|
|
112
|
+
/**
|
|
113
|
+
* Sets the state of the mobile menu
|
|
114
|
+
* @param open - `true` to open the menu or `false` to close it
|
|
115
115
|
*/
|
|
116
116
|
setMobileMenu() {
|
|
117
117
|
let open = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
@@ -154,17 +154,17 @@ class mintHeader {
|
|
|
154
154
|
this.closeAllMenus();
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
/**
|
|
158
|
-
* Toggles the state of the mobile menu
|
|
157
|
+
/**
|
|
158
|
+
* Toggles the state of the mobile menu
|
|
159
159
|
*/
|
|
160
160
|
toggleMobileMenu() {
|
|
161
161
|
var _a, _b;
|
|
162
162
|
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');
|
|
163
163
|
}
|
|
164
|
-
/**
|
|
165
|
-
* Sets the state of the provided button's menu
|
|
166
|
-
* @param button - Button element to set
|
|
167
|
-
* @param open - `true` to open the menu or `false` to close it
|
|
164
|
+
/**
|
|
165
|
+
* Sets the state of the provided button's menu
|
|
166
|
+
* @param button - Button element to set
|
|
167
|
+
* @param open - `true` to open the menu or `false` to close it
|
|
168
168
|
*/
|
|
169
169
|
setMenu(button) {
|
|
170
170
|
let open = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -180,17 +180,17 @@ class mintHeader {
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
/**
|
|
184
|
-
* Toggles the state of the provided button's menu
|
|
185
|
-
* @param button - Button element to toggle
|
|
183
|
+
/**
|
|
184
|
+
* Toggles the state of the provided button's menu
|
|
185
|
+
* @param button - Button element to toggle
|
|
186
186
|
*/
|
|
187
187
|
toggleMenu(button) {
|
|
188
188
|
var _a;
|
|
189
189
|
this.setMenu(button, ((_a = button === null || button === void 0 ? void 0 : button.getAttribute('aria-expanded')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== 'true');
|
|
190
190
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Closes all submenus of the provided button's menu
|
|
193
|
-
* @param button - Button element of the parent menu
|
|
191
|
+
/**
|
|
192
|
+
* Closes all submenus of the provided button's menu
|
|
193
|
+
* @param button - Button element of the parent menu
|
|
194
194
|
*/
|
|
195
195
|
closeSubMenus(button) {
|
|
196
196
|
let menu = button === null || button === void 0 ? void 0 : button.nextElementSibling,
|
|
@@ -203,9 +203,9 @@ class mintHeader {
|
|
|
203
203
|
}
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
/**
|
|
207
|
-
* Closes all sibling menus of the provided button's menu
|
|
208
|
-
* @param button - Button element of the sibling menus
|
|
206
|
+
/**
|
|
207
|
+
* Closes all sibling menus of the provided button's menu
|
|
208
|
+
* @param button - Button element of the sibling menus
|
|
209
209
|
*/
|
|
210
210
|
closeSiblingMenus(button) {
|
|
211
211
|
var _a;
|
|
@@ -217,8 +217,8 @@ class mintHeader {
|
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
|
-
/**
|
|
221
|
-
* Closes all submenus of the n4vbar
|
|
220
|
+
/**
|
|
221
|
+
* Closes all submenus of the n4vbar
|
|
222
222
|
*/
|
|
223
223
|
closeAllMenus() {
|
|
224
224
|
var _a;
|
|
@@ -227,8 +227,8 @@ class mintHeader {
|
|
|
227
227
|
this.setMenu(menuButton);
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
|
-
/**
|
|
231
|
-
* Opens the menu closest to the document's focus
|
|
230
|
+
/**
|
|
231
|
+
* Opens the menu closest to the document's focus
|
|
232
232
|
*/
|
|
233
233
|
openClosestMenu() {
|
|
234
234
|
var _a;
|
|
@@ -244,8 +244,8 @@ class mintHeader {
|
|
|
244
244
|
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
/**
|
|
248
|
-
* Closes the menu closest to the document's focus
|
|
247
|
+
/**
|
|
248
|
+
* Closes the menu closest to the document's focus
|
|
249
249
|
*/
|
|
250
250
|
closeClosestMenu() {
|
|
251
251
|
var _a, _b;
|
|
@@ -260,8 +260,8 @@ class mintHeader {
|
|
|
260
260
|
activeButton === null || activeButton === void 0 ? void 0 : activeButton.focus();
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
/**
|
|
264
|
-
* Toggles the menu closest to the document's focus
|
|
263
|
+
/**
|
|
264
|
+
* Toggles the menu closest to the document's focus
|
|
265
265
|
*/
|
|
266
266
|
toggleClosestMenu() {
|
|
267
267
|
var _a, _b;
|
|
@@ -271,8 +271,8 @@ class mintHeader {
|
|
|
271
271
|
this.openClosestMenu();
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
|
-
/**
|
|
275
|
-
* Closes the mobile menu when the window resizes
|
|
274
|
+
/**
|
|
275
|
+
* Closes the mobile menu when the window resizes
|
|
276
276
|
*/
|
|
277
277
|
eHandleResize(e) {
|
|
278
278
|
// Also check if resized from mobile to desktop
|
|
@@ -281,15 +281,15 @@ class mintHeader {
|
|
|
281
281
|
}
|
|
282
282
|
this.lastWidth = util_1.default.windowWidth();
|
|
283
283
|
}
|
|
284
|
-
/**
|
|
285
|
-
* Closes all submenus when the page is scrolled
|
|
284
|
+
/**
|
|
285
|
+
* Closes all submenus when the page is scrolled
|
|
286
286
|
*/
|
|
287
287
|
eHandleScroll() {
|
|
288
288
|
this.closeAllMenus();
|
|
289
289
|
}
|
|
290
|
-
/**
|
|
291
|
-
* Sends the focus to the menu button after tabbing past the last menu item
|
|
292
|
-
* @param e - Keyboard event
|
|
290
|
+
/**
|
|
291
|
+
* Sends the focus to the menu button after tabbing past the last menu item
|
|
292
|
+
* @param e - Keyboard event
|
|
293
293
|
*/
|
|
294
294
|
eWrapTab(e) {
|
|
295
295
|
var _a;
|
|
@@ -300,9 +300,9 @@ class mintHeader {
|
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
/**
|
|
304
|
-
* Handles keypresses on n4vbar buttons
|
|
305
|
-
* @param e - Keyboard event
|
|
303
|
+
/**
|
|
304
|
+
* Handles keypresses on n4vbar buttons
|
|
305
|
+
* @param e - Keyboard event
|
|
306
306
|
*/
|
|
307
307
|
eHandleButtonKeypress(e) {
|
|
308
308
|
var _a;
|
|
@@ -329,9 +329,9 @@ class mintHeader {
|
|
|
329
329
|
break;
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
/**
|
|
333
|
-
* Handles keypresses on n4vbar links
|
|
334
|
-
* @param e - Keyboard event
|
|
332
|
+
/**
|
|
333
|
+
* Handles keypresses on n4vbar links
|
|
334
|
+
* @param e - Keyboard event
|
|
335
335
|
*/
|
|
336
336
|
eHandleLinkKeypress(e) {
|
|
337
337
|
let target = e.target;
|
|
@@ -349,9 +349,9 @@ class mintHeader {
|
|
|
349
349
|
break;
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
/**
|
|
353
|
-
* Handles keypresses on the n4vbar
|
|
354
|
-
* @param e - Keyboard event
|
|
352
|
+
/**
|
|
353
|
+
* Handles keypresses on the n4vbar
|
|
354
|
+
* @param e - Keyboard event
|
|
355
355
|
*/
|
|
356
356
|
eHandleKeypress(e) {
|
|
357
357
|
if (e.key.toLowerCase() !== 'tab') {
|
|
@@ -367,23 +367,23 @@ class mintHeader {
|
|
|
367
367
|
break;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
/**
|
|
371
|
-
* Toggles the mobile menu
|
|
370
|
+
/**
|
|
371
|
+
* Toggles the mobile menu
|
|
372
372
|
*/
|
|
373
373
|
eToggleMobileMenu() {
|
|
374
374
|
this.toggleMobileMenu();
|
|
375
375
|
}
|
|
376
|
-
/**
|
|
377
|
-
* Toggles the clicked submenu
|
|
378
|
-
* @param e - Mouse event
|
|
376
|
+
/**
|
|
377
|
+
* Toggles the clicked submenu
|
|
378
|
+
* @param e - Mouse event
|
|
379
379
|
*/
|
|
380
380
|
eToggleMenu(e) {
|
|
381
381
|
let target = e.target;
|
|
382
382
|
this.closeSiblingMenus(target);
|
|
383
383
|
this.toggleMenu(target);
|
|
384
384
|
}
|
|
385
|
-
/**
|
|
386
|
-
* Runs after the mobile menu transitions
|
|
385
|
+
/**
|
|
386
|
+
* Runs after the mobile menu transitions
|
|
387
387
|
*/
|
|
388
388
|
eTransitionEnd() {
|
|
389
389
|
var _a;
|
|
@@ -409,8 +409,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
409
409
|
value: true
|
|
410
410
|
}));
|
|
411
411
|
exports.mintSide = void 0;
|
|
412
|
-
/**
|
|
413
|
-
* Side Enum
|
|
412
|
+
/**
|
|
413
|
+
* Side Enum
|
|
414
414
|
*/
|
|
415
415
|
var mintSide;
|
|
416
416
|
(function (mintSide) {
|
|
@@ -435,8 +435,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
435
435
|
value: true
|
|
436
436
|
}));
|
|
437
437
|
exports.mintColor = void 0;
|
|
438
|
-
/**
|
|
439
|
-
* Color
|
|
438
|
+
/**
|
|
439
|
+
* Color
|
|
440
440
|
*/
|
|
441
441
|
class mintColor {
|
|
442
442
|
constructor(args) {
|
|
@@ -448,8 +448,8 @@ class mintColor {
|
|
|
448
448
|
this.stringConstructor(args.color);
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
/**
|
|
452
|
-
* Constructor from a string argument
|
|
451
|
+
/**
|
|
452
|
+
* Constructor from a string argument
|
|
453
453
|
*/
|
|
454
454
|
stringConstructor(str) {
|
|
455
455
|
if (str.startsWith('#')) {
|
|
@@ -461,8 +461,8 @@ class mintColor {
|
|
|
461
461
|
this.rgbConstructor(str);
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
/**
|
|
465
|
-
* Constructor from a hex argument
|
|
464
|
+
/**
|
|
465
|
+
* Constructor from a hex argument
|
|
466
466
|
*/
|
|
467
467
|
hexConstructor(hex) {
|
|
468
468
|
switch (hex.length) {
|
|
@@ -493,8 +493,8 @@ class mintColor {
|
|
|
493
493
|
this.b = parseInt(hex.substring(5, 7), mintColor.hexBase);
|
|
494
494
|
this.a = parseInt(hex.substring(7, 9), mintColor.hexBase) / mintColor.hexBase ** 2;
|
|
495
495
|
}
|
|
496
|
-
/**
|
|
497
|
-
* Constructor from an rgba argument
|
|
496
|
+
/**
|
|
497
|
+
* Constructor from an rgba argument
|
|
498
498
|
*/
|
|
499
499
|
rgbConstructor(rgb) {
|
|
500
500
|
let match = rgb.match(/rgba?\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)?(?:, ?(\d(?:\.\d*)?)\))?/);
|
|
@@ -505,8 +505,8 @@ class mintColor {
|
|
|
505
505
|
this.a = parseFloat(match[4]);
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
/**
|
|
509
|
-
* Returns the perceived brightness of the color
|
|
508
|
+
/**
|
|
509
|
+
* Returns the perceived brightness of the color
|
|
510
510
|
*/
|
|
511
511
|
getBrightness() {
|
|
512
512
|
if (this.a === 0) {
|
|
@@ -537,15 +537,15 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
537
537
|
value: true
|
|
538
538
|
}));
|
|
539
539
|
exports.mintItem = void 0;
|
|
540
|
-
/**
|
|
541
|
-
* A generic item
|
|
542
|
-
* @note - this class must be convertable with JSON
|
|
543
|
-
* - only add strings, numbers, booleans, arrays, and objects
|
|
540
|
+
/**
|
|
541
|
+
* A generic item
|
|
542
|
+
* @note - this class must be convertable with JSON
|
|
543
|
+
* - only add strings, numbers, booleans, arrays, and objects
|
|
544
544
|
*/
|
|
545
545
|
class mintItem {
|
|
546
546
|
constructor() {
|
|
547
|
-
/**
|
|
548
|
-
* Item settings
|
|
547
|
+
/**
|
|
548
|
+
* Item settings
|
|
549
549
|
*/
|
|
550
550
|
this.version = 0;
|
|
551
551
|
this.priority = 0;
|
|
@@ -558,15 +558,15 @@ class mintItem {
|
|
|
558
558
|
this.centered = false;
|
|
559
559
|
this.disabled = false;
|
|
560
560
|
this.private = false;
|
|
561
|
-
/**
|
|
562
|
-
* Item data
|
|
561
|
+
/**
|
|
562
|
+
* Item data
|
|
563
563
|
*/
|
|
564
564
|
this.attr = {};
|
|
565
565
|
this.params = {};
|
|
566
566
|
this.options = {};
|
|
567
567
|
this.lists = {};
|
|
568
|
-
/**
|
|
569
|
-
* Item lists
|
|
568
|
+
/**
|
|
569
|
+
* Item lists
|
|
570
570
|
*/
|
|
571
571
|
this.paragraphs = [];
|
|
572
572
|
this.classes = [];
|
|
@@ -593,8 +593,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
593
593
|
value: true
|
|
594
594
|
}));
|
|
595
595
|
exports.mintDisplay = void 0;
|
|
596
|
-
/**
|
|
597
|
-
* Handles the display of elements
|
|
596
|
+
/**
|
|
597
|
+
* Handles the display of elements
|
|
598
598
|
*/
|
|
599
599
|
class mintDisplay {}
|
|
600
600
|
exports.mintDisplay = mintDisplay;
|
|
@@ -615,8 +615,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
615
615
|
value: true
|
|
616
616
|
}));
|
|
617
617
|
exports.mintEvent = void 0;
|
|
618
|
-
/**
|
|
619
|
-
* Event helper functions
|
|
618
|
+
/**
|
|
619
|
+
* Event helper functions
|
|
620
620
|
*/
|
|
621
621
|
class mintEvent {}
|
|
622
622
|
exports.mintEvent = mintEvent;
|
|
@@ -642,16 +642,16 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
642
642
|
value: true
|
|
643
643
|
}));
|
|
644
644
|
exports.mintIcon = void 0;
|
|
645
|
-
/**
|
|
646
|
-
* Imports
|
|
645
|
+
/**
|
|
646
|
+
* Imports
|
|
647
647
|
*/
|
|
648
648
|
const object_1 = __importDefault(__webpack_require__(/*! ./object */ "./src/ts/imports/util/object.ts"));
|
|
649
|
-
/**
|
|
650
|
-
* Icon helper functions
|
|
649
|
+
/**
|
|
650
|
+
* Icon helper functions
|
|
651
651
|
*/
|
|
652
652
|
class mintIcon {
|
|
653
|
-
/**
|
|
654
|
-
* Appends the given icon to the given selector if there is not already an icon appended
|
|
653
|
+
/**
|
|
654
|
+
* Appends the given icon to the given selector if there is not already an icon appended
|
|
655
655
|
*/
|
|
656
656
|
static append(icon, selector) {
|
|
657
657
|
let items = document.querySelectorAll(selector);
|
|
@@ -666,9 +666,9 @@ class mintIcon {
|
|
|
666
666
|
}
|
|
667
667
|
});
|
|
668
668
|
}
|
|
669
|
-
/**
|
|
670
|
-
* Updates the icons
|
|
671
|
-
* @param icons - the icons to update
|
|
669
|
+
/**
|
|
670
|
+
* Updates the icons
|
|
671
|
+
* @param icons - the icons to update
|
|
672
672
|
*/
|
|
673
673
|
static update(icons) {
|
|
674
674
|
let activeIcons = object_1.default.removeValues(Object.assign(Object.assign({}, this.icons), icons), [false]);
|
|
@@ -676,9 +676,9 @@ class mintIcon {
|
|
|
676
676
|
this.append(activeIcons[selector], selector);
|
|
677
677
|
});
|
|
678
678
|
}
|
|
679
|
-
/**
|
|
680
|
-
* Removes the given icon from the given selector
|
|
681
|
-
* @param icon - the icon to remove
|
|
679
|
+
/**
|
|
680
|
+
* Removes the given icon from the given selector
|
|
681
|
+
* @param icon - the icon to remove
|
|
682
682
|
*/
|
|
683
683
|
static remove(icon, selector) {
|
|
684
684
|
let items = document.querySelectorAll(selector);
|
|
@@ -691,8 +691,8 @@ class mintIcon {
|
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
exports.mintIcon = mintIcon;
|
|
694
|
-
/**
|
|
695
|
-
* Default icons
|
|
694
|
+
/**
|
|
695
|
+
* Default icons
|
|
696
696
|
*/
|
|
697
697
|
mintIcon.icons = {
|
|
698
698
|
'a[href^="mailto:"]': 'far fa-envelope',
|
|
@@ -718,14 +718,14 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
718
718
|
value: true
|
|
719
719
|
}));
|
|
720
720
|
exports.mintList = void 0;
|
|
721
|
-
/**
|
|
722
|
-
* List functions for the util library
|
|
721
|
+
/**
|
|
722
|
+
* List functions for the util library
|
|
723
723
|
*/
|
|
724
724
|
class mintList {
|
|
725
|
-
/**
|
|
726
|
-
* Returns a copy of the provided list with the items in random order
|
|
727
|
-
* @param list - the list to shuffle
|
|
728
|
-
* @returns - the shuffled list
|
|
725
|
+
/**
|
|
726
|
+
* Returns a copy of the provided list with the items in random order
|
|
727
|
+
* @param list - the list to shuffle
|
|
728
|
+
* @returns - the shuffled list
|
|
729
729
|
*/
|
|
730
730
|
static shuffle(list) {
|
|
731
731
|
let copy = [...list];
|
|
@@ -754,15 +754,15 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
754
754
|
value: true
|
|
755
755
|
}));
|
|
756
756
|
exports.mintMath = void 0;
|
|
757
|
-
/**
|
|
758
|
-
* Math functions for the util library
|
|
757
|
+
/**
|
|
758
|
+
* Math functions for the util library
|
|
759
759
|
*/
|
|
760
760
|
class mintMath {
|
|
761
|
-
/**
|
|
762
|
-
* Get a random integer between min and max
|
|
763
|
-
* @param max Maximum value to return
|
|
764
|
-
* @param min Minimum value to return (default is 0)
|
|
765
|
-
* @returns a random integer between min and max
|
|
761
|
+
/**
|
|
762
|
+
* Get a random integer between min and max
|
|
763
|
+
* @param max Maximum value to return
|
|
764
|
+
* @param min Minimum value to return (default is 0)
|
|
765
|
+
* @returns a random integer between min and max
|
|
766
766
|
*/
|
|
767
767
|
static randomInt(max) {
|
|
768
768
|
let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -789,12 +789,12 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
789
789
|
value: true
|
|
790
790
|
}));
|
|
791
791
|
exports.mintObject = void 0;
|
|
792
|
-
/**
|
|
793
|
-
* Object functions for the util library
|
|
792
|
+
/**
|
|
793
|
+
* Object functions for the util library
|
|
794
794
|
*/
|
|
795
795
|
class mintObject {
|
|
796
|
-
/**
|
|
797
|
-
* Returns true if the provided objects have the same entries
|
|
796
|
+
/**
|
|
797
|
+
* Returns true if the provided objects have the same entries
|
|
798
798
|
*/
|
|
799
799
|
static isSimilar(obj1, obj2) {
|
|
800
800
|
let keys = Object.keys(obj1);
|
|
@@ -809,13 +809,13 @@ class mintObject {
|
|
|
809
809
|
});
|
|
810
810
|
return isSimilar;
|
|
811
811
|
}
|
|
812
|
-
/**
|
|
813
|
-
* Returns true if the first object has at least the same
|
|
814
|
-
* entries as the second object
|
|
815
|
-
* @param superset - the object to check
|
|
816
|
-
* @param subset - the object whose entries are required
|
|
817
|
-
* @returns - true if the first object is a superset of the second
|
|
818
|
-
* @recursive
|
|
812
|
+
/**
|
|
813
|
+
* Returns true if the first object has at least the same
|
|
814
|
+
* entries as the second object
|
|
815
|
+
* @param superset - the object to check
|
|
816
|
+
* @param subset - the object whose entries are required
|
|
817
|
+
* @returns - true if the first object is a superset of the second
|
|
818
|
+
* @recursive
|
|
819
819
|
*/
|
|
820
820
|
static isSuperset(superset, subset) {
|
|
821
821
|
let isSuperset = true;
|
|
@@ -843,19 +843,19 @@ class mintObject {
|
|
|
843
843
|
});
|
|
844
844
|
return isSuperset;
|
|
845
845
|
}
|
|
846
|
-
/**
|
|
847
|
-
* Removes object entries by key
|
|
848
|
-
* @alias mintObject.removeKeys
|
|
849
|
-
* @param object - the object to remove entries from
|
|
850
|
-
* @param keys - the keys to remove
|
|
846
|
+
/**
|
|
847
|
+
* Removes object entries by key
|
|
848
|
+
* @alias mintObject.removeKeys
|
|
849
|
+
* @param object - the object to remove entries from
|
|
850
|
+
* @param keys - the keys to remove
|
|
851
851
|
*/
|
|
852
852
|
static remove(object, keys) {
|
|
853
853
|
return this.removeKeys(object, keys);
|
|
854
854
|
}
|
|
855
|
-
/**
|
|
856
|
-
* Removes object entries by key
|
|
857
|
-
* @param object - the object to remove entries from
|
|
858
|
-
* @param keys - the keys to remove
|
|
855
|
+
/**
|
|
856
|
+
* Removes object entries by key
|
|
857
|
+
* @param object - the object to remove entries from
|
|
858
|
+
* @param keys - the keys to remove
|
|
859
859
|
*/
|
|
860
860
|
static removeKeys(object, keys) {
|
|
861
861
|
return Object.keys(object).reduce((obj, key) => {
|
|
@@ -865,8 +865,8 @@ class mintObject {
|
|
|
865
865
|
return obj;
|
|
866
866
|
}, {});
|
|
867
867
|
}
|
|
868
|
-
/**
|
|
869
|
-
* Removes object entries by value
|
|
868
|
+
/**
|
|
869
|
+
* Removes object entries by value
|
|
870
870
|
*/
|
|
871
871
|
static removeValues(object, values) {
|
|
872
872
|
return Object.keys(object).reduce((obj, key) => {
|
|
@@ -876,8 +876,8 @@ class mintObject {
|
|
|
876
876
|
return obj;
|
|
877
877
|
}, {});
|
|
878
878
|
}
|
|
879
|
-
/**
|
|
880
|
-
* Sorts an object's entries alphabetically by key
|
|
879
|
+
/**
|
|
880
|
+
* Sorts an object's entries alphabetically by key
|
|
881
881
|
*/
|
|
882
882
|
static sort(object) {
|
|
883
883
|
return Object.keys(object).sort().reduce((obj, key) => {
|
|
@@ -885,17 +885,17 @@ class mintObject {
|
|
|
885
885
|
return obj;
|
|
886
886
|
}, {});
|
|
887
887
|
}
|
|
888
|
-
/**
|
|
889
|
-
* @alias mintObject.filterKeys
|
|
888
|
+
/**
|
|
889
|
+
* @alias mintObject.filterKeys
|
|
890
890
|
*/
|
|
891
891
|
static filter(object, keys) {
|
|
892
892
|
return this.filterKeys(object, keys);
|
|
893
893
|
}
|
|
894
|
-
/**
|
|
895
|
-
* Filters an object by its keys
|
|
896
|
-
* @param object - the object to filter
|
|
897
|
-
* @param keys - the keys to keep
|
|
898
|
-
* @returns - the filtered object
|
|
894
|
+
/**
|
|
895
|
+
* Filters an object by its keys
|
|
896
|
+
* @param object - the object to filter
|
|
897
|
+
* @param keys - the keys to keep
|
|
898
|
+
* @returns - the filtered object
|
|
899
899
|
*/
|
|
900
900
|
static filterKeys(object, keys) {
|
|
901
901
|
return keys.reduce((obj, key) => {
|
|
@@ -903,11 +903,11 @@ class mintObject {
|
|
|
903
903
|
return obj;
|
|
904
904
|
}, {});
|
|
905
905
|
}
|
|
906
|
-
/**
|
|
907
|
-
* Filters an object by its values
|
|
908
|
-
* @param object - the object to filter
|
|
909
|
-
* @param values - the values to keep
|
|
910
|
-
* @returns - the filtered object
|
|
906
|
+
/**
|
|
907
|
+
* Filters an object by its values
|
|
908
|
+
* @param object - the object to filter
|
|
909
|
+
* @param values - the values to keep
|
|
910
|
+
* @returns - the filtered object
|
|
911
911
|
*/
|
|
912
912
|
static filterValues(object, values) {
|
|
913
913
|
return Object.keys(object).reduce((obj, key) => {
|
|
@@ -937,85 +937,85 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
937
937
|
value: true
|
|
938
938
|
}));
|
|
939
939
|
exports.mintSelectors = void 0;
|
|
940
|
-
/**
|
|
941
|
-
* CSS-selector helpers
|
|
942
|
-
* @public
|
|
940
|
+
/**
|
|
941
|
+
* CSS-selector helpers
|
|
942
|
+
* @public
|
|
943
943
|
*/
|
|
944
944
|
class mintSelectors {
|
|
945
|
-
/**
|
|
946
|
-
* Adds the library prefix to the beginning of the provided string
|
|
947
|
-
* @param base - the string to be prefixed
|
|
948
|
-
* @returns - the provided string prefixed with the library name
|
|
945
|
+
/**
|
|
946
|
+
* Adds the library prefix to the beginning of the provided string
|
|
947
|
+
* @param base - the string to be prefixed
|
|
948
|
+
* @returns - the provided string prefixed with the library name
|
|
949
949
|
*/
|
|
950
950
|
static prefix(base) {
|
|
951
951
|
base = base.toLowerCase();
|
|
952
952
|
return base.startsWith(this.pre) ? base : `${this.pre}${base}`;
|
|
953
953
|
}
|
|
954
|
-
/**
|
|
955
|
-
* Adds two dashes to the beginning of the provided string
|
|
956
|
-
* @param base - the string to be prefixed
|
|
957
|
-
* @returns - the provided string prefixed with two dashes
|
|
954
|
+
/**
|
|
955
|
+
* Adds two dashes to the beginning of the provided string
|
|
956
|
+
* @param base - the string to be prefixed
|
|
957
|
+
* @returns - the provided string prefixed with two dashes
|
|
958
958
|
*/
|
|
959
959
|
static cssPrefix(base) {
|
|
960
960
|
return `--${this.prefix(base.replace(/^-+/, ''))}`;
|
|
961
961
|
}
|
|
962
|
-
/**
|
|
963
|
-
* Turns the provided string into a CSS variable call
|
|
964
|
-
* @param base - the name of the CSS variable to call
|
|
965
|
-
* @returns - the CSS variable call for the provided string
|
|
962
|
+
/**
|
|
963
|
+
* Turns the provided string into a CSS variable call
|
|
964
|
+
* @param base - the name of the CSS variable to call
|
|
965
|
+
* @returns - the CSS variable call for the provided string
|
|
966
966
|
*/
|
|
967
967
|
static cssVar(base) {
|
|
968
968
|
return `var(${this.cssPrefix(base)})`;
|
|
969
969
|
}
|
|
970
|
-
/**
|
|
971
|
-
* Negates the provided CSS selector
|
|
972
|
-
* @param base - the CSS selector to negate
|
|
973
|
-
* @returns - the negated CSS selector
|
|
970
|
+
/**
|
|
971
|
+
* Negates the provided CSS selector
|
|
972
|
+
* @param base - the CSS selector to negate
|
|
973
|
+
* @returns - the negated CSS selector
|
|
974
974
|
*/
|
|
975
975
|
static neg(base) {
|
|
976
976
|
return `:not(${base})`;
|
|
977
977
|
}
|
|
978
|
-
/**
|
|
979
|
-
* Generates a class CSS selector
|
|
980
|
-
* @param base - the name of the class to generate
|
|
981
|
-
* @returns - the generated CSS selector
|
|
978
|
+
/**
|
|
979
|
+
* Generates a class CSS selector
|
|
980
|
+
* @param base - the name of the class to generate
|
|
981
|
+
* @returns - the generated CSS selector
|
|
982
982
|
*/
|
|
983
983
|
static class(base) {
|
|
984
984
|
return `.${this.prefix(base)}`;
|
|
985
985
|
}
|
|
986
|
-
/**
|
|
987
|
-
* Generates an id CSS selector
|
|
988
|
-
* @param base - the name of the id to generate
|
|
989
|
-
* @returns - the generated CSS selector
|
|
986
|
+
/**
|
|
987
|
+
* Generates an id CSS selector
|
|
988
|
+
* @param base - the name of the id to generate
|
|
989
|
+
* @returns - the generated CSS selector
|
|
990
990
|
*/
|
|
991
991
|
static id(base) {
|
|
992
992
|
return `#${this.prefix(base)}`;
|
|
993
993
|
}
|
|
994
|
-
/**
|
|
995
|
-
* Generates an aria-controls CSS selector
|
|
996
|
-
* @param id - the id of the controlled element
|
|
997
|
-
* @returns - the generated CSS selector
|
|
994
|
+
/**
|
|
995
|
+
* Generates an aria-controls CSS selector
|
|
996
|
+
* @param id - the id of the controlled element
|
|
997
|
+
* @returns - the generated CSS selector
|
|
998
998
|
*/
|
|
999
999
|
static controls(id) {
|
|
1000
1000
|
return id ? `[aria-controls="${this.prefix(id)}"]` : this.hasControls;
|
|
1001
1001
|
}
|
|
1002
|
-
/**
|
|
1003
|
-
* Generates an aria-expanded CSS selector
|
|
1004
|
-
* @param bool - whether the element is expanded or not
|
|
1005
|
-
* @returns - the generated CSS selector
|
|
1002
|
+
/**
|
|
1003
|
+
* Generates an aria-expanded CSS selector
|
|
1004
|
+
* @param bool - whether the element is expanded or not
|
|
1005
|
+
* @returns - the generated CSS selector
|
|
1006
1006
|
*/
|
|
1007
1007
|
static expanded(bool) {
|
|
1008
1008
|
return typeof bool === 'boolean' ? `[aria-expanded="${bool}"]` : this.hasExpanded;
|
|
1009
1009
|
}
|
|
1010
|
-
/**
|
|
1011
|
-
* Returns the id of the requested element
|
|
1010
|
+
/**
|
|
1011
|
+
* Returns the id of the requested element
|
|
1012
1012
|
*/
|
|
1013
1013
|
static getId(id) {
|
|
1014
1014
|
var _b;
|
|
1015
1015
|
return (_b = this.ids[id !== null && id !== void 0 ? id : -1]) !== null && _b !== void 0 ? _b : '';
|
|
1016
1016
|
}
|
|
1017
|
-
/**
|
|
1018
|
-
* Returns the class of the requested element
|
|
1017
|
+
/**
|
|
1018
|
+
* Returns the class of the requested element
|
|
1019
1019
|
*/
|
|
1020
1020
|
static getClass(className, classGroup) {
|
|
1021
1021
|
var _b, _c;
|
|
@@ -1025,10 +1025,10 @@ class mintSelectors {
|
|
|
1025
1025
|
}
|
|
1026
1026
|
return (_c = this.classes[className !== null && className !== void 0 ? className : -1]) !== null && _c !== void 0 ? _c : '';
|
|
1027
1027
|
}
|
|
1028
|
-
/**
|
|
1029
|
-
* Returns a NodeList of HTMLElements within the given element that are focusable
|
|
1030
|
-
* @param el - the element whose focusable children will be returned
|
|
1031
|
-
* @returns - the elements within the given element that are focusable
|
|
1028
|
+
/**
|
|
1029
|
+
* Returns a NodeList of HTMLElements within the given element that are focusable
|
|
1030
|
+
* @param el - the element whose focusable children will be returned
|
|
1031
|
+
* @returns - the elements within the given element that are focusable
|
|
1032
1032
|
*/
|
|
1033
1033
|
static getFocusables(el) {
|
|
1034
1034
|
let focusables;
|
|
@@ -1039,12 +1039,12 @@ class mintSelectors {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
return focusables.filter(el => this.isFocusable(el));
|
|
1041
1041
|
}
|
|
1042
|
-
/**
|
|
1043
|
-
* Returns true if an element is focusable and false if not,
|
|
1044
|
-
* based on styles (i.e. a parent has display: none;)
|
|
1045
|
-
* NOTE: Still need to determine what other styles may make an element un-focusable
|
|
1046
|
-
* @param el - the element
|
|
1047
|
-
* @returns - true if the element is focusable; false if not
|
|
1042
|
+
/**
|
|
1043
|
+
* Returns true if an element is focusable and false if not,
|
|
1044
|
+
* based on styles (i.e. a parent has display: none;)
|
|
1045
|
+
* NOTE: Still need to determine what other styles may make an element un-focusable
|
|
1046
|
+
* @param el - the element
|
|
1047
|
+
* @returns - true if the element is focusable; false if not
|
|
1048
1048
|
*/
|
|
1049
1049
|
static isFocusable(el) {
|
|
1050
1050
|
let current = el;
|
|
@@ -1059,48 +1059,48 @@ class mintSelectors {
|
|
|
1059
1059
|
}
|
|
1060
1060
|
exports.mintSelectors = mintSelectors;
|
|
1061
1061
|
_a = mintSelectors;
|
|
1062
|
-
/**
|
|
1063
|
-
* The library name that will be added as a prefix
|
|
1062
|
+
/**
|
|
1063
|
+
* The library name that will be added as a prefix
|
|
1064
1064
|
*/
|
|
1065
1065
|
mintSelectors.lib = 'mint';
|
|
1066
|
-
/**
|
|
1067
|
-
* The prefix built from the library name
|
|
1066
|
+
/**
|
|
1067
|
+
* The prefix built from the library name
|
|
1068
1068
|
*/
|
|
1069
1069
|
mintSelectors.pre = `${_a.lib}-`;
|
|
1070
|
-
/**
|
|
1071
|
-
* CSS-selector for disabled elements
|
|
1070
|
+
/**
|
|
1071
|
+
* CSS-selector for disabled elements
|
|
1072
1072
|
*/
|
|
1073
1073
|
mintSelectors.disabled = '[disabled]';
|
|
1074
|
-
/**
|
|
1075
|
-
* CSS-selector for elements with an aria-controls attribute
|
|
1074
|
+
/**
|
|
1075
|
+
* CSS-selector for elements with an aria-controls attribute
|
|
1076
1076
|
*/
|
|
1077
1077
|
mintSelectors.hasControls = '[aria-controls]';
|
|
1078
|
-
/**
|
|
1079
|
-
* CSS-selector for elements with an aria-expanded attribute
|
|
1078
|
+
/**
|
|
1079
|
+
* CSS-selector for elements with an aria-expanded attribute
|
|
1080
1080
|
*/
|
|
1081
1081
|
mintSelectors.hasExpanded = '[aria-expanded]';
|
|
1082
|
-
/**
|
|
1083
|
-
* CSS-selector for elements with an href attribute
|
|
1082
|
+
/**
|
|
1083
|
+
* CSS-selector for elements with an href attribute
|
|
1084
1084
|
*/
|
|
1085
1085
|
mintSelectors.hasLink = '[href]';
|
|
1086
|
-
/**
|
|
1087
|
-
* CSS-selector for elements with a routerLink attribute
|
|
1086
|
+
/**
|
|
1087
|
+
* CSS-selector for elements with a routerLink attribute
|
|
1088
1088
|
*/
|
|
1089
1089
|
mintSelectors.hasRouterLink = '[routerLink]';
|
|
1090
|
-
/**
|
|
1091
|
-
* CSS-selector for elements with an id attribute
|
|
1090
|
+
/**
|
|
1091
|
+
* CSS-selector for elements with an id attribute
|
|
1092
1092
|
*/
|
|
1093
1093
|
mintSelectors.hasId = '[id]';
|
|
1094
|
-
/**
|
|
1095
|
-
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
|
|
1094
|
+
/**
|
|
1095
|
+
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
|
|
1096
1096
|
*/
|
|
1097
1097
|
mintSelectors.notTabbable = '[tabindex^="-"]';
|
|
1098
|
-
/**
|
|
1099
|
-
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
|
|
1098
|
+
/**
|
|
1099
|
+
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
|
|
1100
1100
|
*/
|
|
1101
1101
|
mintSelectors.tabbable = `[tabindex]${_a.neg(_a.notTabbable)}`;
|
|
1102
|
-
/**
|
|
1103
|
-
* CSS-selector for elements that can receive focus
|
|
1102
|
+
/**
|
|
1103
|
+
* CSS-selector for elements that can receive focus
|
|
1104
1104
|
*/
|
|
1105
1105
|
mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
1106
1106
|
select${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
@@ -1110,16 +1110,16 @@ mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
|
1110
1110
|
a${_a.hasLink}, a${_a.hasRouterLink},
|
|
1111
1111
|
area${_a.hasLink},
|
|
1112
1112
|
${_a.tabbable}`.replace(/\s/g, '');
|
|
1113
|
-
/**
|
|
1114
|
-
* CSS-selector for submenu buttons
|
|
1113
|
+
/**
|
|
1114
|
+
* CSS-selector for submenu buttons
|
|
1115
1115
|
*/
|
|
1116
1116
|
mintSelectors.subMenuButtons = `button${_a.hasControls}`;
|
|
1117
|
-
/**
|
|
1118
|
-
* CSS-selector for submenus
|
|
1117
|
+
/**
|
|
1118
|
+
* CSS-selector for submenus
|
|
1119
1119
|
*/
|
|
1120
1120
|
mintSelectors.subMenu = `${_a.subMenuButtons} + ul${_a.hasId}`;
|
|
1121
|
-
/**
|
|
1122
|
-
* Frequently-used ids
|
|
1121
|
+
/**
|
|
1122
|
+
* Frequently-used ids
|
|
1123
1123
|
*/
|
|
1124
1124
|
mintSelectors.ids = {
|
|
1125
1125
|
header: _a.prefix('header'),
|
|
@@ -1127,8 +1127,8 @@ mintSelectors.ids = {
|
|
|
1127
1127
|
wrapper: _a.prefix('wrapper'),
|
|
1128
1128
|
mainContent: _a.prefix('main-content')
|
|
1129
1129
|
};
|
|
1130
|
-
/**
|
|
1131
|
-
* Classes
|
|
1130
|
+
/**
|
|
1131
|
+
* Classes
|
|
1132
1132
|
*/
|
|
1133
1133
|
mintSelectors.classes = {
|
|
1134
1134
|
sides: {
|
|
@@ -1160,19 +1160,19 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1160
1160
|
value: true
|
|
1161
1161
|
}));
|
|
1162
1162
|
exports.mintSettings = void 0;
|
|
1163
|
-
/**
|
|
1164
|
-
* Imports
|
|
1163
|
+
/**
|
|
1164
|
+
* Imports
|
|
1165
1165
|
*/
|
|
1166
1166
|
const enum_1 = __webpack_require__(/*! ../enum */ "./src/ts/imports/enum.ts");
|
|
1167
1167
|
const selectors_1 = __webpack_require__(/*! ./selectors */ "./src/ts/imports/util/selectors.ts");
|
|
1168
|
-
/**
|
|
1169
|
-
* Settings management
|
|
1170
|
-
* @public
|
|
1168
|
+
/**
|
|
1169
|
+
* Settings management
|
|
1170
|
+
* @public
|
|
1171
1171
|
*/
|
|
1172
1172
|
class mintSettings {
|
|
1173
|
-
/**
|
|
1174
|
-
* Update the provided settings variables
|
|
1175
|
-
* @param settings - Object of settings variables to update
|
|
1173
|
+
/**
|
|
1174
|
+
* Update the provided settings variables
|
|
1175
|
+
* @param settings - Object of settings variables to update
|
|
1176
1176
|
*/
|
|
1177
1177
|
static set(settings) {
|
|
1178
1178
|
let newDelay = false;
|
|
@@ -1199,8 +1199,8 @@ class mintSettings {
|
|
|
1199
1199
|
this.setFixed(settings.fixed);
|
|
1200
1200
|
}
|
|
1201
1201
|
}
|
|
1202
|
-
/**
|
|
1203
|
-
* Updates the delay variables based on `this.delayBase` and `this.delayStep`
|
|
1202
|
+
/**
|
|
1203
|
+
* Updates the delay variables based on `this.delayBase` and `this.delayStep`
|
|
1204
1204
|
*/
|
|
1205
1205
|
static setDelay() {
|
|
1206
1206
|
this.delay = {
|
|
@@ -1212,8 +1212,8 @@ class mintSettings {
|
|
|
1212
1212
|
slow: this.delayBase + this.delayStep * 5
|
|
1213
1213
|
};
|
|
1214
1214
|
}
|
|
1215
|
-
/**
|
|
1216
|
-
* Updates the direction the navbar enters from
|
|
1215
|
+
/**
|
|
1216
|
+
* Updates the direction the navbar enters from
|
|
1217
1217
|
*/
|
|
1218
1218
|
static setFrom(from) {
|
|
1219
1219
|
if (this.from !== from) {
|
|
@@ -1223,8 +1223,8 @@ class mintSettings {
|
|
|
1223
1223
|
header === null || header === void 0 ? void 0 : header.classList.add(selectors_1.mintSelectors.getClass(enum_1.mintSide[this.from].toLowerCase(), 'sides'));
|
|
1224
1224
|
}
|
|
1225
1225
|
}
|
|
1226
|
-
/**
|
|
1227
|
-
* Updates whether or not the navbar is fixed
|
|
1226
|
+
/**
|
|
1227
|
+
* Updates whether or not the navbar is fixed
|
|
1228
1228
|
*/
|
|
1229
1229
|
static setFixed(fixed) {
|
|
1230
1230
|
if (this.fixed !== fixed) {
|
|
@@ -1241,16 +1241,16 @@ class mintSettings {
|
|
|
1241
1241
|
}
|
|
1242
1242
|
exports.mintSettings = mintSettings;
|
|
1243
1243
|
_a = mintSettings;
|
|
1244
|
-
/**
|
|
1245
|
-
* Value added to all delay variables
|
|
1244
|
+
/**
|
|
1245
|
+
* Value added to all delay variables
|
|
1246
1246
|
*/
|
|
1247
1247
|
mintSettings.delayBase = 0;
|
|
1248
|
-
/**
|
|
1249
|
-
* Value multiplied by delay variable index
|
|
1248
|
+
/**
|
|
1249
|
+
* Value multiplied by delay variable index
|
|
1250
1250
|
*/
|
|
1251
1251
|
mintSettings.delayStep = 100;
|
|
1252
|
-
/**
|
|
1253
|
-
* Delay variables
|
|
1252
|
+
/**
|
|
1253
|
+
* Delay variables
|
|
1254
1254
|
*/
|
|
1255
1255
|
mintSettings.delay = {
|
|
1256
1256
|
instant: _a.delayBase + _a.delayStep * 0,
|
|
@@ -1277,31 +1277,31 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1277
1277
|
value: true
|
|
1278
1278
|
}));
|
|
1279
1279
|
exports.mintText = void 0;
|
|
1280
|
-
/**
|
|
1281
|
-
* Functions for analyzing and manipulating text.
|
|
1280
|
+
/**
|
|
1281
|
+
* Functions for analyzing and manipulating text.
|
|
1282
1282
|
*/
|
|
1283
1283
|
class mintText {
|
|
1284
|
-
/*static fitContainer () {
|
|
1285
|
-
let $warning: JQuery<HTMLElement> = $(warningSelector);
|
|
1286
|
-
$warning.css({
|
|
1287
|
-
overflow: 'scroll',
|
|
1288
|
-
fontSize: ''
|
|
1289
|
-
});
|
|
1290
|
-
while (($warning?.[0].scrollHeight ?? Number.MIN_SAFE_INTEGER) > ($warning?.innerHeight() ?? Number.MAX_SAFE_INTEGER)) {
|
|
1291
|
-
let fontSize: number = parseInt($warning.css('font-size')) - 1;
|
|
1292
|
-
$warning.css('font-size', fontSize + 'px');
|
|
1293
|
-
}
|
|
1284
|
+
/*static fitContainer () {
|
|
1285
|
+
let $warning: JQuery<HTMLElement> = $(warningSelector);
|
|
1286
|
+
$warning.css({
|
|
1287
|
+
overflow: 'scroll',
|
|
1288
|
+
fontSize: ''
|
|
1289
|
+
});
|
|
1290
|
+
while (($warning?.[0].scrollHeight ?? Number.MIN_SAFE_INTEGER) > ($warning?.innerHeight() ?? Number.MAX_SAFE_INTEGER)) {
|
|
1291
|
+
let fontSize: number = parseInt($warning.css('font-size')) - 1;
|
|
1292
|
+
$warning.css('font-size', fontSize + 'px');
|
|
1293
|
+
}
|
|
1294
1294
|
}*/
|
|
1295
|
-
/**
|
|
1296
|
-
* Generate a slug from a string
|
|
1297
|
-
* @param str - The string to slugify
|
|
1298
|
-
* @returns The slugified string
|
|
1295
|
+
/**
|
|
1296
|
+
* Generate a slug from a string
|
|
1297
|
+
* @param str - The string to slugify
|
|
1298
|
+
* @returns The slugified string
|
|
1299
1299
|
*/
|
|
1300
1300
|
static slug(str) {
|
|
1301
1301
|
return str.toLowerCase().replace(/\W+/g, '-').replace(/^-+|-+$/g, '');
|
|
1302
1302
|
}
|
|
1303
|
-
/**
|
|
1304
|
-
* Pluralize the given word
|
|
1303
|
+
/**
|
|
1304
|
+
* Pluralize the given word
|
|
1305
1305
|
*/
|
|
1306
1306
|
static pluralize(word) {
|
|
1307
1307
|
if (word.endsWith('ies') || word.endsWith('es') || word.endsWith('s') && !word.endsWith('us') && !word.endsWith('is') && !word.endsWith('ss')) {
|
|
@@ -1334,8 +1334,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1334
1334
|
value: true
|
|
1335
1335
|
}));
|
|
1336
1336
|
exports.mintWindow = void 0;
|
|
1337
|
-
/**
|
|
1338
|
-
* Functions related to the browser window.
|
|
1337
|
+
/**
|
|
1338
|
+
* Functions related to the browser window.
|
|
1339
1339
|
*/
|
|
1340
1340
|
class mintWindow {}
|
|
1341
1341
|
exports.mintWindow = mintWindow;
|
|
@@ -1352,10 +1352,10 @@ exports["default"] = mintWindow;
|
|
|
1352
1352
|
|
|
1353
1353
|
|
|
1354
1354
|
|
|
1355
|
-
/**
|
|
1356
|
-
* A library for building responsive web applications.
|
|
1357
|
-
*
|
|
1358
|
-
* @packageDocumentation
|
|
1355
|
+
/**
|
|
1356
|
+
* A library for building responsive web applications.
|
|
1357
|
+
*
|
|
1358
|
+
* @packageDocumentation
|
|
1359
1359
|
*/
|
|
1360
1360
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
1361
1361
|
return mod && mod.__esModule ? mod : {
|
|
@@ -1366,8 +1366,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1366
1366
|
value: true
|
|
1367
1367
|
}));
|
|
1368
1368
|
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;
|
|
1369
|
-
/**
|
|
1370
|
-
* Exports
|
|
1369
|
+
/**
|
|
1370
|
+
* Exports
|
|
1371
1371
|
*/
|
|
1372
1372
|
// Enums
|
|
1373
1373
|
var enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts");
|
|
@@ -1505,29 +1505,29 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1505
1505
|
value: true
|
|
1506
1506
|
}));
|
|
1507
1507
|
exports.mintUtil = void 0;
|
|
1508
|
-
/**
|
|
1509
|
-
* Imports
|
|
1508
|
+
/**
|
|
1509
|
+
* Imports
|
|
1510
1510
|
*/
|
|
1511
1511
|
const enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts");
|
|
1512
1512
|
const settings_1 = __importDefault(__webpack_require__(/*! ./imports/util/settings */ "./src/ts/imports/util/settings.ts"));
|
|
1513
|
-
/**
|
|
1514
|
-
* Utility functions
|
|
1515
|
-
* @public
|
|
1513
|
+
/**
|
|
1514
|
+
* Utility functions
|
|
1515
|
+
* @public
|
|
1516
1516
|
*/
|
|
1517
1517
|
class mintUtil {
|
|
1518
|
-
/**
|
|
1519
|
-
* Returns the width of the window, including fractional pixels
|
|
1520
|
-
* @returns the width of the window
|
|
1518
|
+
/**
|
|
1519
|
+
* Returns the width of the window, including fractional pixels
|
|
1520
|
+
* @returns the width of the window
|
|
1521
1521
|
*/
|
|
1522
1522
|
static windowWidth() {
|
|
1523
1523
|
const decimal = document.body.getBoundingClientRect().width % 1;
|
|
1524
1524
|
return window.innerWidth + decimal;
|
|
1525
1525
|
}
|
|
1526
|
-
/**
|
|
1527
|
-
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1528
|
-
* @param func - the function to debounce
|
|
1529
|
-
* @param wait - the amount of time to wait before running the function
|
|
1530
|
-
* @returns - the debounced function
|
|
1526
|
+
/**
|
|
1527
|
+
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1528
|
+
* @param func - the function to debounce
|
|
1529
|
+
* @param wait - the amount of time to wait before running the function
|
|
1530
|
+
* @returns - the debounced function
|
|
1531
1531
|
*/
|
|
1532
1532
|
static debounce(func) {
|
|
1533
1533
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1539,22 +1539,22 @@ class mintUtil {
|
|
|
1539
1539
|
timer = setTimeout(func, wait, e);
|
|
1540
1540
|
};
|
|
1541
1541
|
}
|
|
1542
|
-
/**
|
|
1543
|
-
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1544
|
-
* @param func - the function to debounce
|
|
1545
|
-
* @param wait - the amount of time to wait before running the function
|
|
1546
|
-
* @returns - the debounced function as an EventListener
|
|
1542
|
+
/**
|
|
1543
|
+
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1544
|
+
* @param func - the function to debounce
|
|
1545
|
+
* @param wait - the amount of time to wait before running the function
|
|
1546
|
+
* @returns - the debounced function as an EventListener
|
|
1547
1547
|
*/
|
|
1548
1548
|
static debounceEvent(func) {
|
|
1549
1549
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
1550
1550
|
return mintUtil.debounce(func, wait);
|
|
1551
1551
|
}
|
|
1552
|
-
/**
|
|
1553
|
-
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1554
|
-
* @param func - the function to throttle
|
|
1555
|
-
* @param wait - the amount of time between function calls
|
|
1556
|
-
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1557
|
-
* @returns - the throttled function
|
|
1552
|
+
/**
|
|
1553
|
+
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1554
|
+
* @param func - the function to throttle
|
|
1555
|
+
* @param wait - the amount of time between function calls
|
|
1556
|
+
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1557
|
+
* @returns - the throttled function
|
|
1558
1558
|
*/
|
|
1559
1559
|
static throttle(func) {
|
|
1560
1560
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1597,23 +1597,23 @@ class mintUtil {
|
|
|
1597
1597
|
};
|
|
1598
1598
|
return throttled;
|
|
1599
1599
|
}
|
|
1600
|
-
/**
|
|
1601
|
-
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1602
|
-
* @param func - the function to throttle
|
|
1603
|
-
* @param wait - the amount of time between function calls
|
|
1604
|
-
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1605
|
-
* @returns - the throttled function as an EventListener
|
|
1600
|
+
/**
|
|
1601
|
+
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1602
|
+
* @param func - the function to throttle
|
|
1603
|
+
* @param wait - the amount of time between function calls
|
|
1604
|
+
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1605
|
+
* @returns - the throttled function as an EventListener
|
|
1606
1606
|
*/
|
|
1607
1607
|
static throttleEvent(func) {
|
|
1608
1608
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
1609
1609
|
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
1610
1610
|
return mintUtil.throttle(func, wait, options);
|
|
1611
1611
|
}
|
|
1612
|
-
/**
|
|
1613
|
-
* Sets the element's height to its `innerHeight`, then to `auto` after a delay
|
|
1614
|
-
* @param el - the element whose height will be set
|
|
1615
|
-
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1616
|
-
* @param from - the side that the element is animating from
|
|
1612
|
+
/**
|
|
1613
|
+
* Sets the element's height to its `innerHeight`, then to `auto` after a delay
|
|
1614
|
+
* @param el - the element whose height will be set
|
|
1615
|
+
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1616
|
+
* @param from - the side that the element is animating from
|
|
1617
1617
|
*/
|
|
1618
1618
|
static show(el) {
|
|
1619
1619
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1636,11 +1636,11 @@ class mintUtil {
|
|
|
1636
1636
|
});
|
|
1637
1637
|
}
|
|
1638
1638
|
}
|
|
1639
|
-
/**
|
|
1640
|
-
* Sets the element's height to 0
|
|
1641
|
-
* @param el - the element whose height will be set
|
|
1642
|
-
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1643
|
-
* @param from - the side that the element is animating from
|
|
1639
|
+
/**
|
|
1640
|
+
* Sets the element's height to 0
|
|
1641
|
+
* @param el - the element whose height will be set
|
|
1642
|
+
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1643
|
+
* @param from - the side that the element is animating from
|
|
1644
1644
|
*/
|
|
1645
1645
|
static hide(el) {
|
|
1646
1646
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1670,10 +1670,10 @@ class mintUtil {
|
|
|
1670
1670
|
}, delay);
|
|
1671
1671
|
}
|
|
1672
1672
|
}
|
|
1673
|
-
/**
|
|
1674
|
-
* Copies the provided text to the clipboard
|
|
1675
|
-
* @param text - the text to copy
|
|
1676
|
-
* @returns - true if the text was successfully copied to the clipboard; else false
|
|
1673
|
+
/**
|
|
1674
|
+
* Copies the provided text to the clipboard
|
|
1675
|
+
* @param text - the text to copy
|
|
1676
|
+
* @returns - true if the text was successfully copied to the clipboard; else false
|
|
1677
1677
|
*/
|
|
1678
1678
|
static copyText(text) {
|
|
1679
1679
|
let textArea = document.createElement('textarea');
|
|
@@ -1696,11 +1696,11 @@ class mintUtil {
|
|
|
1696
1696
|
document.body.removeChild(textArea);
|
|
1697
1697
|
return true;
|
|
1698
1698
|
}
|
|
1699
|
-
/**
|
|
1700
|
-
* Tests the validity of an email address
|
|
1701
|
-
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
|
|
1702
|
-
* @param text - the string to test
|
|
1703
|
-
* @returns - true if the given string is an email address; false if not
|
|
1699
|
+
/**
|
|
1700
|
+
* Tests the validity of an email address
|
|
1701
|
+
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
|
|
1702
|
+
* @param text - the string to test
|
|
1703
|
+
* @returns - true if the given string is an email address; false if not
|
|
1704
1704
|
*/
|
|
1705
1705
|
static isEmail(text) {
|
|
1706
1706
|
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])+)\])/);
|