@appartmint/mint 0.13.3 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/css/mint.css +55 -9
- 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 -122
- package/dist/js/imports/components/header.d.ts.map +1 -1
- 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 +121 -145
- package/dist/js/imports/util/selectors.d.ts.map +1 -1
- package/dist/js/imports/util/settings.d.ts +38 -52
- package/dist/js/imports/util/settings.d.ts.map +1 -1
- 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 +381 -422
- 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 +81 -325
- package/dist/js/util.js.map +1 -1
- package/dist/js/util.min.js +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 +12 -1
- package/src/scss/imports/components/_embed.scss +75 -63
- package/src/scss/imports/components/_header.scss +60 -13
- package/src/scss/imports/components/_index.scss +7 -7
- package/src/scss/imports/global/_aspect.scss +1 -1
- package/src/scss/imports/global/_icons.scss +6 -6
- package/src/scss/imports/global/_structure.scss +2 -1
- package/src/scss/imports/global/_texture.scss +27 -2
- package/src/scss/imports/util/_index.scss +8 -8
- package/src/scss/imports/util/_vars.scss +8 -0
- package/src/ts/imports/components/header.ts +60 -35
- 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/selectors.ts +0 -45
- package/src/ts/imports/util/settings.ts +13 -47
- package/src/ts/imports/util/window.ts +6 -6
- package/src/ts/index.ts +33 -33
package/dist/js/index.js
CHANGED
|
@@ -29,57 +29,55 @@ 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
|
-
*
|
|
48
|
+
/**
|
|
49
|
+
* Navbar settings
|
|
50
50
|
*/
|
|
51
|
-
this.
|
|
52
|
-
/**
|
|
53
|
-
* Frequently-referenced elements
|
|
54
|
-
*/
|
|
55
|
-
this.el = {};
|
|
56
|
-
let defaultSettings = {
|
|
51
|
+
this.settings = {
|
|
57
52
|
from: enum_1.mintSide.Top,
|
|
58
53
|
fixed: true
|
|
59
54
|
};
|
|
60
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Frequently-referenced elements
|
|
57
|
+
*/
|
|
58
|
+
this.el = {};
|
|
59
|
+
this.settings = Object.assign(Object.assign({}, this.settings), settings);
|
|
61
60
|
this.attachElements();
|
|
62
61
|
this.attachEvents();
|
|
63
62
|
this.addClasses();
|
|
64
|
-
this.setMobileMenu();
|
|
65
63
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Adds elements to {@link el | `this.el`}
|
|
64
|
+
/**
|
|
65
|
+
* Adds elements to {@link el | `this.el`}
|
|
68
66
|
*/
|
|
69
67
|
attachElements() {
|
|
70
68
|
var _a;
|
|
71
69
|
this.el.html = document.querySelector('html');
|
|
72
70
|
this.el.body = document.querySelector('body');
|
|
73
|
-
this.el.header = document.getElementById(
|
|
74
|
-
this.el.mobileButton = ((_a = this.el.header) === null || _a === void 0 ? void 0 : _a.querySelector(selectors_1.default.controls(
|
|
75
|
-
this.el.wrapper = document.getElementById(
|
|
71
|
+
this.el.header = document.getElementById('mint-header');
|
|
72
|
+
this.el.mobileButton = ((_a = this.el.header) === null || _a === void 0 ? void 0 : _a.querySelector(selectors_1.default.controls('mint-wrapper'))) || null;
|
|
73
|
+
this.el.wrapper = document.getElementById('mint-wrapper');
|
|
76
74
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Adds events to the dom
|
|
75
|
+
/**
|
|
76
|
+
* Adds events to the dom
|
|
79
77
|
*/
|
|
80
78
|
attachEvents() {
|
|
81
79
|
var _a, _b, _c, _d;
|
|
82
|
-
|
|
80
|
+
window.addEventListener('resize', util_1.default.throttleEvent(this.eHandleResize.bind(this), settings_1.default.delay.default));
|
|
83
81
|
window.addEventListener('scroll', util_1.default.throttleEvent(this.eHandleScroll.bind(this), settings_1.default.delay.default, {
|
|
84
82
|
trailing: false
|
|
85
83
|
}));
|
|
@@ -89,7 +87,7 @@ class mintHeader {
|
|
|
89
87
|
focusables === null || focusables === void 0 ? void 0 : focusables.forEach(focusable => {
|
|
90
88
|
focusable.addEventListener('keydown', util_1.default.throttleEvent(this.eHandleKeypress.bind(this)));
|
|
91
89
|
});
|
|
92
|
-
let menuButtons = (_b = this.el.
|
|
90
|
+
let menuButtons = (_b = this.el.wrapper) === null || _b === void 0 ? void 0 : _b.querySelectorAll(selectors_1.default.controls());
|
|
93
91
|
menuButtons === null || menuButtons === void 0 ? void 0 : menuButtons.forEach(menuButton => {
|
|
94
92
|
menuButton.addEventListener('click', util_1.default.throttleEvent(this.eToggleMenu.bind(this), settings_1.default.delay.slow, {
|
|
95
93
|
trailing: false
|
|
@@ -100,18 +98,23 @@ class mintHeader {
|
|
|
100
98
|
}));
|
|
101
99
|
(_d = this.el.wrapper) === null || _d === void 0 ? void 0 : _d.addEventListener('transitionend', this.eTransitionEnd.bind(this));
|
|
102
100
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Adds classes that inform the styles
|
|
101
|
+
/**
|
|
102
|
+
* Adds classes that inform the styles based on settings
|
|
105
103
|
*/
|
|
106
104
|
addClasses() {
|
|
107
|
-
var _a;
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
var _a, _b, _c, _d, _e;
|
|
106
|
+
(_a = this.el.header) === null || _a === void 0 ? void 0 : _a.classList.remove('mint-top', 'mint-right', 'mint-bottom', 'mint-left');
|
|
107
|
+
(_b = this.el.header) === null || _b === void 0 ? void 0 : _b.classList.add(`mint-${enum_1.mintSide[(_c = this.settings.from) !== null && _c !== void 0 ? _c : 0].toLowerCase()}`);
|
|
108
|
+
if (this.settings.fixed) {
|
|
109
|
+
(_d = this.el.body) === null || _d === void 0 ? void 0 : _d.classList.add('mint-fixed');
|
|
110
|
+
}
|
|
111
|
+
if (this.settings.tray) {
|
|
112
|
+
(_e = this.el.header) === null || _e === void 0 ? void 0 : _e.classList.add('mint-tray');
|
|
110
113
|
}
|
|
111
114
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Sets the state of the mobile menu
|
|
114
|
-
* @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
|
|
115
118
|
*/
|
|
116
119
|
setMobileMenu() {
|
|
117
120
|
let open = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
@@ -124,7 +127,7 @@ class mintHeader {
|
|
|
124
127
|
(_a = this.el.mobileButton) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-label', ariaLabel);
|
|
125
128
|
}, settings_1.default.delay.fast);
|
|
126
129
|
if (open) {
|
|
127
|
-
if (
|
|
130
|
+
if (this.settings.fixed !== true) {
|
|
128
131
|
window.scroll({
|
|
129
132
|
top: 0,
|
|
130
133
|
left: 0,
|
|
@@ -133,15 +136,24 @@ class mintHeader {
|
|
|
133
136
|
}
|
|
134
137
|
setTimeout(() => {
|
|
135
138
|
if (this.el.html) {
|
|
136
|
-
|
|
139
|
+
let isMobile = util_1.default.windowWidth() <= settings_1.default.break.sm,
|
|
140
|
+
overflow = 'auto';
|
|
141
|
+
if (this.settings.tray) {
|
|
142
|
+
if (isMobile) {
|
|
143
|
+
overflow = 'hidden';
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
overflow = 'hidden';
|
|
147
|
+
}
|
|
148
|
+
this.el.html.style.overflow = overflow;
|
|
137
149
|
}
|
|
138
|
-
},
|
|
150
|
+
}, this.settings.from === enum_1.mintSide.Left ? settings_1.default.delay.default : settings_1.default.delay.instant);
|
|
139
151
|
if (this.el.wrapper) {
|
|
140
152
|
this.el.wrapper.style.display = 'flex';
|
|
141
153
|
}
|
|
142
154
|
requestAnimationFrame(() => {
|
|
143
155
|
var _a;
|
|
144
|
-
(_a = this.el.wrapper) === null || _a === void 0 ? void 0 : _a.classList.add(
|
|
156
|
+
(_a = this.el.wrapper) === null || _a === void 0 ? void 0 : _a.classList.add('mint-open');
|
|
145
157
|
});
|
|
146
158
|
} else {
|
|
147
159
|
if (this.el.html) {
|
|
@@ -149,22 +161,22 @@ class mintHeader {
|
|
|
149
161
|
}
|
|
150
162
|
requestAnimationFrame(() => {
|
|
151
163
|
var _a;
|
|
152
|
-
(_a = this.el.wrapper) === null || _a === void 0 ? void 0 : _a.classList.remove(
|
|
164
|
+
(_a = this.el.wrapper) === null || _a === void 0 ? void 0 : _a.classList.remove('mint-open');
|
|
153
165
|
});
|
|
154
166
|
this.closeAllMenus();
|
|
155
167
|
}
|
|
156
168
|
}
|
|
157
|
-
/**
|
|
158
|
-
* Toggles the state of the mobile menu
|
|
169
|
+
/**
|
|
170
|
+
* Toggles the state of the mobile menu
|
|
159
171
|
*/
|
|
160
172
|
toggleMobileMenu() {
|
|
161
173
|
var _a, _b;
|
|
162
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');
|
|
163
175
|
}
|
|
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
|
|
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
|
|
168
180
|
*/
|
|
169
181
|
setMenu(button) {
|
|
170
182
|
let open = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -180,17 +192,17 @@ class mintHeader {
|
|
|
180
192
|
}
|
|
181
193
|
}
|
|
182
194
|
}
|
|
183
|
-
/**
|
|
184
|
-
* Toggles the state of the provided button's menu
|
|
185
|
-
* @param button - Button element to toggle
|
|
195
|
+
/**
|
|
196
|
+
* Toggles the state of the provided button's menu
|
|
197
|
+
* @param button - Button element to toggle
|
|
186
198
|
*/
|
|
187
199
|
toggleMenu(button) {
|
|
188
200
|
var _a;
|
|
189
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');
|
|
190
202
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Closes all submenus of the provided button's menu
|
|
193
|
-
* @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
|
|
194
206
|
*/
|
|
195
207
|
closeSubMenus(button) {
|
|
196
208
|
let menu = button === null || button === void 0 ? void 0 : button.nextElementSibling,
|
|
@@ -203,9 +215,9 @@ class mintHeader {
|
|
|
203
215
|
}
|
|
204
216
|
});
|
|
205
217
|
}
|
|
206
|
-
/**
|
|
207
|
-
* Closes all sibling menus of the provided button's menu
|
|
208
|
-
* @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
|
|
209
221
|
*/
|
|
210
222
|
closeSiblingMenus(button) {
|
|
211
223
|
var _a;
|
|
@@ -217,8 +229,8 @@ class mintHeader {
|
|
|
217
229
|
}
|
|
218
230
|
});
|
|
219
231
|
}
|
|
220
|
-
/**
|
|
221
|
-
* Closes all submenus of the n4vbar
|
|
232
|
+
/**
|
|
233
|
+
* Closes all submenus of the n4vbar
|
|
222
234
|
*/
|
|
223
235
|
closeAllMenus() {
|
|
224
236
|
var _a;
|
|
@@ -227,15 +239,15 @@ class mintHeader {
|
|
|
227
239
|
this.setMenu(menuButton);
|
|
228
240
|
});
|
|
229
241
|
}
|
|
230
|
-
/**
|
|
231
|
-
* Opens the menu closest to the document's focus
|
|
242
|
+
/**
|
|
243
|
+
* Opens the menu closest to the document's focus
|
|
232
244
|
*/
|
|
233
245
|
openClosestMenu() {
|
|
234
246
|
var _a;
|
|
235
247
|
let activeButton = document.activeElement,
|
|
236
248
|
activeMenu = activeButton === null || activeButton === void 0 ? void 0 : activeButton.nextElementSibling,
|
|
237
249
|
showing = ((_a = activeButton === null || activeButton === void 0 ? void 0 : activeButton.getAttribute('aria-expanded')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
|
|
238
|
-
if ((activeButton === null || activeButton === void 0 ? void 0 : activeButton.getAttribute('aria-controls')) ===
|
|
250
|
+
if ((activeButton === null || activeButton === void 0 ? void 0 : activeButton.getAttribute('aria-controls')) === 'mint-wrapper') {
|
|
239
251
|
activeMenu = this.el.wrapper;
|
|
240
252
|
}
|
|
241
253
|
if ((activeButton === null || activeButton === void 0 ? void 0 : activeButton.getAttribute('aria-controls')) && activeMenu && !showing) {
|
|
@@ -244,8 +256,8 @@ class mintHeader {
|
|
|
244
256
|
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
|
245
257
|
}
|
|
246
258
|
}
|
|
247
|
-
/**
|
|
248
|
-
* Closes the menu closest to the document's focus
|
|
259
|
+
/**
|
|
260
|
+
* Closes the menu closest to the document's focus
|
|
249
261
|
*/
|
|
250
262
|
closeClosestMenu() {
|
|
251
263
|
var _a, _b;
|
|
@@ -260,8 +272,8 @@ class mintHeader {
|
|
|
260
272
|
activeButton === null || activeButton === void 0 ? void 0 : activeButton.focus();
|
|
261
273
|
}
|
|
262
274
|
}
|
|
263
|
-
/**
|
|
264
|
-
* Toggles the menu closest to the document's focus
|
|
275
|
+
/**
|
|
276
|
+
* Toggles the menu closest to the document's focus
|
|
265
277
|
*/
|
|
266
278
|
toggleClosestMenu() {
|
|
267
279
|
var _a, _b;
|
|
@@ -271,25 +283,36 @@ class mintHeader {
|
|
|
271
283
|
this.openClosestMenu();
|
|
272
284
|
}
|
|
273
285
|
}
|
|
274
|
-
/**
|
|
275
|
-
* Closes the mobile menu when the window resizes
|
|
286
|
+
/**
|
|
287
|
+
* Closes the mobile menu when the window resizes
|
|
276
288
|
*/
|
|
277
|
-
eHandleResize(
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
289
|
+
eHandleResize() {
|
|
290
|
+
var _a, _b;
|
|
291
|
+
let isOpen = ((_b = (_a = this.el.mobileButton) === null || _a === void 0 ? void 0 : _a.getAttribute('aria-expanded')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'true',
|
|
292
|
+
isMobile = util_1.default.windowWidth() <= settings_1.default.break.sm,
|
|
293
|
+
overflow = 'auto';
|
|
294
|
+
if (isOpen) {
|
|
295
|
+
if (this.settings.tray) {
|
|
296
|
+
if (isMobile) {
|
|
297
|
+
overflow = 'hidden';
|
|
298
|
+
}
|
|
299
|
+
} else {
|
|
300
|
+
overflow = 'hidden';
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
if (this.el.html) {
|
|
304
|
+
this.el.html.style.overflow = overflow;
|
|
281
305
|
}
|
|
282
|
-
this.lastWidth = util_1.default.windowWidth();
|
|
283
306
|
}
|
|
284
|
-
/**
|
|
285
|
-
* Closes all submenus when the page is scrolled
|
|
307
|
+
/**
|
|
308
|
+
* Closes all submenus when the page is scrolled
|
|
286
309
|
*/
|
|
287
310
|
eHandleScroll() {
|
|
288
311
|
this.closeAllMenus();
|
|
289
312
|
}
|
|
290
|
-
/**
|
|
291
|
-
* Sends the focus to the menu button after tabbing past the last menu item
|
|
292
|
-
* @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
|
|
293
316
|
*/
|
|
294
317
|
eWrapTab(e) {
|
|
295
318
|
var _a;
|
|
@@ -300,9 +323,9 @@ class mintHeader {
|
|
|
300
323
|
}
|
|
301
324
|
}
|
|
302
325
|
}
|
|
303
|
-
/**
|
|
304
|
-
* Handles keypresses on n4vbar buttons
|
|
305
|
-
* @param e - Keyboard event
|
|
326
|
+
/**
|
|
327
|
+
* Handles keypresses on n4vbar buttons
|
|
328
|
+
* @param e - Keyboard event
|
|
306
329
|
*/
|
|
307
330
|
eHandleButtonKeypress(e) {
|
|
308
331
|
var _a;
|
|
@@ -310,7 +333,7 @@ class mintHeader {
|
|
|
310
333
|
subMenu = target === null || target === void 0 ? void 0 : target.closest('li');
|
|
311
334
|
switch (e.key.toLowerCase()) {
|
|
312
335
|
case 'escape':
|
|
313
|
-
if (subMenu === null || subMenu === void 0 ? void 0 : subMenu.classList.contains(
|
|
336
|
+
if (subMenu === null || subMenu === void 0 ? void 0 : subMenu.classList.contains('mint-open')) {
|
|
314
337
|
this.setMenu(subMenu);
|
|
315
338
|
} else {
|
|
316
339
|
this.setMobileMenu();
|
|
@@ -329,9 +352,9 @@ class mintHeader {
|
|
|
329
352
|
break;
|
|
330
353
|
}
|
|
331
354
|
}
|
|
332
|
-
/**
|
|
333
|
-
* Handles keypresses on n4vbar links
|
|
334
|
-
* @param e - Keyboard event
|
|
355
|
+
/**
|
|
356
|
+
* Handles keypresses on n4vbar links
|
|
357
|
+
* @param e - Keyboard event
|
|
335
358
|
*/
|
|
336
359
|
eHandleLinkKeypress(e) {
|
|
337
360
|
let target = e.target;
|
|
@@ -349,9 +372,9 @@ class mintHeader {
|
|
|
349
372
|
break;
|
|
350
373
|
}
|
|
351
374
|
}
|
|
352
|
-
/**
|
|
353
|
-
* Handles keypresses on the n4vbar
|
|
354
|
-
* @param e - Keyboard event
|
|
375
|
+
/**
|
|
376
|
+
* Handles keypresses on the n4vbar
|
|
377
|
+
* @param e - Keyboard event
|
|
355
378
|
*/
|
|
356
379
|
eHandleKeypress(e) {
|
|
357
380
|
if (e.key.toLowerCase() !== 'tab') {
|
|
@@ -367,27 +390,27 @@ class mintHeader {
|
|
|
367
390
|
break;
|
|
368
391
|
}
|
|
369
392
|
}
|
|
370
|
-
/**
|
|
371
|
-
* Toggles the mobile menu
|
|
393
|
+
/**
|
|
394
|
+
* Toggles the mobile menu
|
|
372
395
|
*/
|
|
373
396
|
eToggleMobileMenu() {
|
|
374
397
|
this.toggleMobileMenu();
|
|
375
398
|
}
|
|
376
|
-
/**
|
|
377
|
-
* Toggles the clicked submenu
|
|
378
|
-
* @param e - Mouse event
|
|
399
|
+
/**
|
|
400
|
+
* Toggles the clicked submenu
|
|
401
|
+
* @param e - Mouse event
|
|
379
402
|
*/
|
|
380
403
|
eToggleMenu(e) {
|
|
381
404
|
let target = e.target;
|
|
382
405
|
this.closeSiblingMenus(target);
|
|
383
406
|
this.toggleMenu(target);
|
|
384
407
|
}
|
|
385
|
-
/**
|
|
386
|
-
* Runs after the mobile menu transitions
|
|
408
|
+
/**
|
|
409
|
+
* Runs after the mobile menu transitions
|
|
387
410
|
*/
|
|
388
411
|
eTransitionEnd() {
|
|
389
412
|
var _a;
|
|
390
|
-
if (((_a = this.el.wrapper) === null || _a === void 0 ? void 0 : _a.classList.contains(
|
|
413
|
+
if (((_a = this.el.wrapper) === null || _a === void 0 ? void 0 : _a.classList.contains('mint-open')) === false) {
|
|
391
414
|
this.el.wrapper.style.display = 'none';
|
|
392
415
|
}
|
|
393
416
|
}
|
|
@@ -409,8 +432,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
409
432
|
value: true
|
|
410
433
|
}));
|
|
411
434
|
exports.mintSide = void 0;
|
|
412
|
-
/**
|
|
413
|
-
* Side Enum
|
|
435
|
+
/**
|
|
436
|
+
* Side Enum
|
|
414
437
|
*/
|
|
415
438
|
var mintSide;
|
|
416
439
|
(function (mintSide) {
|
|
@@ -435,8 +458,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
435
458
|
value: true
|
|
436
459
|
}));
|
|
437
460
|
exports.mintColor = void 0;
|
|
438
|
-
/**
|
|
439
|
-
* Color
|
|
461
|
+
/**
|
|
462
|
+
* Color
|
|
440
463
|
*/
|
|
441
464
|
class mintColor {
|
|
442
465
|
constructor(args) {
|
|
@@ -448,8 +471,8 @@ class mintColor {
|
|
|
448
471
|
this.stringConstructor(args.color);
|
|
449
472
|
}
|
|
450
473
|
}
|
|
451
|
-
/**
|
|
452
|
-
* Constructor from a string argument
|
|
474
|
+
/**
|
|
475
|
+
* Constructor from a string argument
|
|
453
476
|
*/
|
|
454
477
|
stringConstructor(str) {
|
|
455
478
|
if (str.startsWith('#')) {
|
|
@@ -461,8 +484,8 @@ class mintColor {
|
|
|
461
484
|
this.rgbConstructor(str);
|
|
462
485
|
}
|
|
463
486
|
}
|
|
464
|
-
/**
|
|
465
|
-
* Constructor from a hex argument
|
|
487
|
+
/**
|
|
488
|
+
* Constructor from a hex argument
|
|
466
489
|
*/
|
|
467
490
|
hexConstructor(hex) {
|
|
468
491
|
switch (hex.length) {
|
|
@@ -493,8 +516,8 @@ class mintColor {
|
|
|
493
516
|
this.b = parseInt(hex.substring(5, 7), mintColor.hexBase);
|
|
494
517
|
this.a = parseInt(hex.substring(7, 9), mintColor.hexBase) / mintColor.hexBase ** 2;
|
|
495
518
|
}
|
|
496
|
-
/**
|
|
497
|
-
* Constructor from an rgba argument
|
|
519
|
+
/**
|
|
520
|
+
* Constructor from an rgba argument
|
|
498
521
|
*/
|
|
499
522
|
rgbConstructor(rgb) {
|
|
500
523
|
let match = rgb.match(/rgba?\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)?(?:, ?(\d(?:\.\d*)?)\))?/);
|
|
@@ -505,8 +528,8 @@ class mintColor {
|
|
|
505
528
|
this.a = parseFloat(match[4]);
|
|
506
529
|
}
|
|
507
530
|
}
|
|
508
|
-
/**
|
|
509
|
-
* Returns the perceived brightness of the color
|
|
531
|
+
/**
|
|
532
|
+
* Returns the perceived brightness of the color
|
|
510
533
|
*/
|
|
511
534
|
getBrightness() {
|
|
512
535
|
if (this.a === 0) {
|
|
@@ -537,15 +560,15 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
537
560
|
value: true
|
|
538
561
|
}));
|
|
539
562
|
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
|
|
563
|
+
/**
|
|
564
|
+
* A generic item
|
|
565
|
+
* @note - this class must be convertable with JSON
|
|
566
|
+
* - only add strings, numbers, booleans, arrays, and objects
|
|
544
567
|
*/
|
|
545
568
|
class mintItem {
|
|
546
569
|
constructor() {
|
|
547
|
-
/**
|
|
548
|
-
* Item settings
|
|
570
|
+
/**
|
|
571
|
+
* Item settings
|
|
549
572
|
*/
|
|
550
573
|
this.version = 0;
|
|
551
574
|
this.priority = 0;
|
|
@@ -558,15 +581,15 @@ class mintItem {
|
|
|
558
581
|
this.centered = false;
|
|
559
582
|
this.disabled = false;
|
|
560
583
|
this.private = false;
|
|
561
|
-
/**
|
|
562
|
-
* Item data
|
|
584
|
+
/**
|
|
585
|
+
* Item data
|
|
563
586
|
*/
|
|
564
587
|
this.attr = {};
|
|
565
588
|
this.params = {};
|
|
566
589
|
this.options = {};
|
|
567
590
|
this.lists = {};
|
|
568
|
-
/**
|
|
569
|
-
* Item lists
|
|
591
|
+
/**
|
|
592
|
+
* Item lists
|
|
570
593
|
*/
|
|
571
594
|
this.paragraphs = [];
|
|
572
595
|
this.classes = [];
|
|
@@ -593,8 +616,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
593
616
|
value: true
|
|
594
617
|
}));
|
|
595
618
|
exports.mintDisplay = void 0;
|
|
596
|
-
/**
|
|
597
|
-
* Handles the display of elements
|
|
619
|
+
/**
|
|
620
|
+
* Handles the display of elements
|
|
598
621
|
*/
|
|
599
622
|
class mintDisplay {}
|
|
600
623
|
exports.mintDisplay = mintDisplay;
|
|
@@ -615,8 +638,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
615
638
|
value: true
|
|
616
639
|
}));
|
|
617
640
|
exports.mintEvent = void 0;
|
|
618
|
-
/**
|
|
619
|
-
* Event helper functions
|
|
641
|
+
/**
|
|
642
|
+
* Event helper functions
|
|
620
643
|
*/
|
|
621
644
|
class mintEvent {}
|
|
622
645
|
exports.mintEvent = mintEvent;
|
|
@@ -642,16 +665,16 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
642
665
|
value: true
|
|
643
666
|
}));
|
|
644
667
|
exports.mintIcon = void 0;
|
|
645
|
-
/**
|
|
646
|
-
* Imports
|
|
668
|
+
/**
|
|
669
|
+
* Imports
|
|
647
670
|
*/
|
|
648
671
|
const object_1 = __importDefault(__webpack_require__(/*! ./object */ "./src/ts/imports/util/object.ts"));
|
|
649
|
-
/**
|
|
650
|
-
* Icon helper functions
|
|
672
|
+
/**
|
|
673
|
+
* Icon helper functions
|
|
651
674
|
*/
|
|
652
675
|
class mintIcon {
|
|
653
|
-
/**
|
|
654
|
-
* 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
|
|
655
678
|
*/
|
|
656
679
|
static append(icon, selector) {
|
|
657
680
|
let items = document.querySelectorAll(selector);
|
|
@@ -666,9 +689,9 @@ class mintIcon {
|
|
|
666
689
|
}
|
|
667
690
|
});
|
|
668
691
|
}
|
|
669
|
-
/**
|
|
670
|
-
* Updates the icons
|
|
671
|
-
* @param icons - the icons to update
|
|
692
|
+
/**
|
|
693
|
+
* Updates the icons
|
|
694
|
+
* @param icons - the icons to update
|
|
672
695
|
*/
|
|
673
696
|
static update(icons) {
|
|
674
697
|
let activeIcons = object_1.default.removeValues(Object.assign(Object.assign({}, this.icons), icons), [false]);
|
|
@@ -676,9 +699,9 @@ class mintIcon {
|
|
|
676
699
|
this.append(activeIcons[selector], selector);
|
|
677
700
|
});
|
|
678
701
|
}
|
|
679
|
-
/**
|
|
680
|
-
* Removes the given icon from the given selector
|
|
681
|
-
* @param icon - the icon to remove
|
|
702
|
+
/**
|
|
703
|
+
* Removes the given icon from the given selector
|
|
704
|
+
* @param icon - the icon to remove
|
|
682
705
|
*/
|
|
683
706
|
static remove(icon, selector) {
|
|
684
707
|
let items = document.querySelectorAll(selector);
|
|
@@ -691,8 +714,8 @@ class mintIcon {
|
|
|
691
714
|
}
|
|
692
715
|
}
|
|
693
716
|
exports.mintIcon = mintIcon;
|
|
694
|
-
/**
|
|
695
|
-
* Default icons
|
|
717
|
+
/**
|
|
718
|
+
* Default icons
|
|
696
719
|
*/
|
|
697
720
|
mintIcon.icons = {
|
|
698
721
|
'a[href^="mailto:"]': 'far fa-envelope',
|
|
@@ -718,14 +741,14 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
718
741
|
value: true
|
|
719
742
|
}));
|
|
720
743
|
exports.mintList = void 0;
|
|
721
|
-
/**
|
|
722
|
-
* List functions for the util library
|
|
744
|
+
/**
|
|
745
|
+
* List functions for the util library
|
|
723
746
|
*/
|
|
724
747
|
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
|
|
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
|
|
729
752
|
*/
|
|
730
753
|
static shuffle(list) {
|
|
731
754
|
let copy = [...list];
|
|
@@ -754,15 +777,15 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
754
777
|
value: true
|
|
755
778
|
}));
|
|
756
779
|
exports.mintMath = void 0;
|
|
757
|
-
/**
|
|
758
|
-
* Math functions for the util library
|
|
780
|
+
/**
|
|
781
|
+
* Math functions for the util library
|
|
759
782
|
*/
|
|
760
783
|
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
|
|
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
|
|
766
789
|
*/
|
|
767
790
|
static randomInt(max) {
|
|
768
791
|
let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -789,12 +812,12 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
789
812
|
value: true
|
|
790
813
|
}));
|
|
791
814
|
exports.mintObject = void 0;
|
|
792
|
-
/**
|
|
793
|
-
* Object functions for the util library
|
|
815
|
+
/**
|
|
816
|
+
* Object functions for the util library
|
|
794
817
|
*/
|
|
795
818
|
class mintObject {
|
|
796
|
-
/**
|
|
797
|
-
* Returns true if the provided objects have the same entries
|
|
819
|
+
/**
|
|
820
|
+
* Returns true if the provided objects have the same entries
|
|
798
821
|
*/
|
|
799
822
|
static isSimilar(obj1, obj2) {
|
|
800
823
|
let keys = Object.keys(obj1);
|
|
@@ -809,13 +832,13 @@ class mintObject {
|
|
|
809
832
|
});
|
|
810
833
|
return isSimilar;
|
|
811
834
|
}
|
|
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
|
|
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
|
|
819
842
|
*/
|
|
820
843
|
static isSuperset(superset, subset) {
|
|
821
844
|
let isSuperset = true;
|
|
@@ -843,19 +866,19 @@ class mintObject {
|
|
|
843
866
|
});
|
|
844
867
|
return isSuperset;
|
|
845
868
|
}
|
|
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
|
|
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
|
|
851
874
|
*/
|
|
852
875
|
static remove(object, keys) {
|
|
853
876
|
return this.removeKeys(object, keys);
|
|
854
877
|
}
|
|
855
|
-
/**
|
|
856
|
-
* Removes object entries by key
|
|
857
|
-
* @param object - the object to remove entries from
|
|
858
|
-
* @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
|
|
859
882
|
*/
|
|
860
883
|
static removeKeys(object, keys) {
|
|
861
884
|
return Object.keys(object).reduce((obj, key) => {
|
|
@@ -865,8 +888,8 @@ class mintObject {
|
|
|
865
888
|
return obj;
|
|
866
889
|
}, {});
|
|
867
890
|
}
|
|
868
|
-
/**
|
|
869
|
-
* Removes object entries by value
|
|
891
|
+
/**
|
|
892
|
+
* Removes object entries by value
|
|
870
893
|
*/
|
|
871
894
|
static removeValues(object, values) {
|
|
872
895
|
return Object.keys(object).reduce((obj, key) => {
|
|
@@ -876,8 +899,8 @@ class mintObject {
|
|
|
876
899
|
return obj;
|
|
877
900
|
}, {});
|
|
878
901
|
}
|
|
879
|
-
/**
|
|
880
|
-
* Sorts an object's entries alphabetically by key
|
|
902
|
+
/**
|
|
903
|
+
* Sorts an object's entries alphabetically by key
|
|
881
904
|
*/
|
|
882
905
|
static sort(object) {
|
|
883
906
|
return Object.keys(object).sort().reduce((obj, key) => {
|
|
@@ -885,17 +908,17 @@ class mintObject {
|
|
|
885
908
|
return obj;
|
|
886
909
|
}, {});
|
|
887
910
|
}
|
|
888
|
-
/**
|
|
889
|
-
* @alias mintObject.filterKeys
|
|
911
|
+
/**
|
|
912
|
+
* @alias mintObject.filterKeys
|
|
890
913
|
*/
|
|
891
914
|
static filter(object, keys) {
|
|
892
915
|
return this.filterKeys(object, keys);
|
|
893
916
|
}
|
|
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
|
|
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
|
|
899
922
|
*/
|
|
900
923
|
static filterKeys(object, keys) {
|
|
901
924
|
return keys.reduce((obj, key) => {
|
|
@@ -903,11 +926,11 @@ class mintObject {
|
|
|
903
926
|
return obj;
|
|
904
927
|
}, {});
|
|
905
928
|
}
|
|
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
|
|
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
|
|
911
934
|
*/
|
|
912
935
|
static filterValues(object, values) {
|
|
913
936
|
return Object.keys(object).reduce((obj, key) => {
|
|
@@ -937,98 +960,80 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
937
960
|
value: true
|
|
938
961
|
}));
|
|
939
962
|
exports.mintSelectors = void 0;
|
|
940
|
-
/**
|
|
941
|
-
* CSS-selector helpers
|
|
942
|
-
* @public
|
|
963
|
+
/**
|
|
964
|
+
* CSS-selector helpers
|
|
965
|
+
* @public
|
|
943
966
|
*/
|
|
944
967
|
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
|
|
968
|
+
/**
|
|
969
|
+
* Adds the library prefix to the beginning of the provided string
|
|
970
|
+
* @param base - the string to be prefixed
|
|
971
|
+
* @returns - the provided string prefixed with the library name
|
|
949
972
|
*/
|
|
950
973
|
static prefix(base) {
|
|
951
974
|
base = base.toLowerCase();
|
|
952
975
|
return base.startsWith(this.pre) ? base : `${this.pre}${base}`;
|
|
953
976
|
}
|
|
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
|
|
977
|
+
/**
|
|
978
|
+
* Adds two dashes to the beginning of the provided string
|
|
979
|
+
* @param base - the string to be prefixed
|
|
980
|
+
* @returns - the provided string prefixed with two dashes
|
|
958
981
|
*/
|
|
959
982
|
static cssPrefix(base) {
|
|
960
983
|
return `--${this.prefix(base.replace(/^-+/, ''))}`;
|
|
961
984
|
}
|
|
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
|
|
985
|
+
/**
|
|
986
|
+
* Turns the provided string into a CSS variable call
|
|
987
|
+
* @param base - the name of the CSS variable to call
|
|
988
|
+
* @returns - the CSS variable call for the provided string
|
|
966
989
|
*/
|
|
967
990
|
static cssVar(base) {
|
|
968
991
|
return `var(${this.cssPrefix(base)})`;
|
|
969
992
|
}
|
|
970
|
-
/**
|
|
971
|
-
* Negates the provided CSS selector
|
|
972
|
-
* @param base - the CSS selector to negate
|
|
973
|
-
* @returns - the negated CSS selector
|
|
993
|
+
/**
|
|
994
|
+
* Negates the provided CSS selector
|
|
995
|
+
* @param base - the CSS selector to negate
|
|
996
|
+
* @returns - the negated CSS selector
|
|
974
997
|
*/
|
|
975
998
|
static neg(base) {
|
|
976
999
|
return `:not(${base})`;
|
|
977
1000
|
}
|
|
978
|
-
/**
|
|
979
|
-
* Generates a class CSS selector
|
|
980
|
-
* @param base - the name of the class to generate
|
|
981
|
-
* @returns - the generated CSS selector
|
|
1001
|
+
/**
|
|
1002
|
+
* Generates a class CSS selector
|
|
1003
|
+
* @param base - the name of the class to generate
|
|
1004
|
+
* @returns - the generated CSS selector
|
|
982
1005
|
*/
|
|
983
1006
|
static class(base) {
|
|
984
1007
|
return `.${this.prefix(base)}`;
|
|
985
1008
|
}
|
|
986
|
-
/**
|
|
987
|
-
* Generates an id CSS selector
|
|
988
|
-
* @param base - the name of the id to generate
|
|
989
|
-
* @returns - the generated CSS selector
|
|
1009
|
+
/**
|
|
1010
|
+
* Generates an id CSS selector
|
|
1011
|
+
* @param base - the name of the id to generate
|
|
1012
|
+
* @returns - the generated CSS selector
|
|
990
1013
|
*/
|
|
991
1014
|
static id(base) {
|
|
992
1015
|
return `#${this.prefix(base)}`;
|
|
993
1016
|
}
|
|
994
|
-
/**
|
|
995
|
-
* Generates an aria-controls CSS selector
|
|
996
|
-
* @param id - the id of the controlled element
|
|
997
|
-
* @returns - the generated CSS selector
|
|
1017
|
+
/**
|
|
1018
|
+
* Generates an aria-controls CSS selector
|
|
1019
|
+
* @param id - the id of the controlled element
|
|
1020
|
+
* @returns - the generated CSS selector
|
|
998
1021
|
*/
|
|
999
1022
|
static controls(id) {
|
|
1000
1023
|
return id ? `[aria-controls="${this.prefix(id)}"]` : this.hasControls;
|
|
1001
1024
|
}
|
|
1002
|
-
/**
|
|
1003
|
-
* Generates an aria-expanded CSS selector
|
|
1004
|
-
* @param bool - whether the element is expanded or not
|
|
1005
|
-
* @returns - the generated CSS selector
|
|
1025
|
+
/**
|
|
1026
|
+
* Generates an aria-expanded CSS selector
|
|
1027
|
+
* @param bool - whether the element is expanded or not
|
|
1028
|
+
* @returns - the generated CSS selector
|
|
1006
1029
|
*/
|
|
1007
1030
|
static expanded(bool) {
|
|
1008
1031
|
return typeof bool === 'boolean' ? `[aria-expanded="${bool}"]` : this.hasExpanded;
|
|
1009
1032
|
}
|
|
1010
|
-
/**
|
|
1011
|
-
* Returns
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
var _b;
|
|
1015
|
-
return (_b = this.ids[id !== null && id !== void 0 ? id : -1]) !== null && _b !== void 0 ? _b : '';
|
|
1016
|
-
}
|
|
1017
|
-
/**
|
|
1018
|
-
* Returns the class of the requested element
|
|
1019
|
-
*/
|
|
1020
|
-
static getClass(className, classGroup) {
|
|
1021
|
-
var _b, _c;
|
|
1022
|
-
if (classGroup) {
|
|
1023
|
-
let group = this.classes[classGroup];
|
|
1024
|
-
return (_b = group[className !== null && className !== void 0 ? className : -1]) !== null && _b !== void 0 ? _b : '';
|
|
1025
|
-
}
|
|
1026
|
-
return (_c = this.classes[className !== null && className !== void 0 ? className : -1]) !== null && _c !== void 0 ? _c : '';
|
|
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
|
|
1033
|
+
/**
|
|
1034
|
+
* Returns a NodeList of HTMLElements within the given element that are focusable
|
|
1035
|
+
* @param el - the element whose focusable children will be returned
|
|
1036
|
+
* @returns - the elements within the given element that are focusable
|
|
1032
1037
|
*/
|
|
1033
1038
|
static getFocusables(el) {
|
|
1034
1039
|
let focusables;
|
|
@@ -1039,12 +1044,12 @@ class mintSelectors {
|
|
|
1039
1044
|
}
|
|
1040
1045
|
return focusables.filter(el => this.isFocusable(el));
|
|
1041
1046
|
}
|
|
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
|
|
1047
|
+
/**
|
|
1048
|
+
* Returns true if an element is focusable and false if not,
|
|
1049
|
+
* based on styles (i.e. a parent has display: none;)
|
|
1050
|
+
* NOTE: Still need to determine what other styles may make an element un-focusable
|
|
1051
|
+
* @param el - the element
|
|
1052
|
+
* @returns - true if the element is focusable; false if not
|
|
1048
1053
|
*/
|
|
1049
1054
|
static isFocusable(el) {
|
|
1050
1055
|
let current = el;
|
|
@@ -1059,48 +1064,48 @@ class mintSelectors {
|
|
|
1059
1064
|
}
|
|
1060
1065
|
exports.mintSelectors = mintSelectors;
|
|
1061
1066
|
_a = mintSelectors;
|
|
1062
|
-
/**
|
|
1063
|
-
* The library name that will be added as a prefix
|
|
1067
|
+
/**
|
|
1068
|
+
* The library name that will be added as a prefix
|
|
1064
1069
|
*/
|
|
1065
1070
|
mintSelectors.lib = 'mint';
|
|
1066
|
-
/**
|
|
1067
|
-
* The prefix built from the library name
|
|
1071
|
+
/**
|
|
1072
|
+
* The prefix built from the library name
|
|
1068
1073
|
*/
|
|
1069
1074
|
mintSelectors.pre = `${_a.lib}-`;
|
|
1070
|
-
/**
|
|
1071
|
-
* CSS-selector for disabled elements
|
|
1075
|
+
/**
|
|
1076
|
+
* CSS-selector for disabled elements
|
|
1072
1077
|
*/
|
|
1073
1078
|
mintSelectors.disabled = '[disabled]';
|
|
1074
|
-
/**
|
|
1075
|
-
* CSS-selector for elements with an aria-controls attribute
|
|
1079
|
+
/**
|
|
1080
|
+
* CSS-selector for elements with an aria-controls attribute
|
|
1076
1081
|
*/
|
|
1077
1082
|
mintSelectors.hasControls = '[aria-controls]';
|
|
1078
|
-
/**
|
|
1079
|
-
* CSS-selector for elements with an aria-expanded attribute
|
|
1083
|
+
/**
|
|
1084
|
+
* CSS-selector for elements with an aria-expanded attribute
|
|
1080
1085
|
*/
|
|
1081
1086
|
mintSelectors.hasExpanded = '[aria-expanded]';
|
|
1082
|
-
/**
|
|
1083
|
-
* CSS-selector for elements with an href attribute
|
|
1087
|
+
/**
|
|
1088
|
+
* CSS-selector for elements with an href attribute
|
|
1084
1089
|
*/
|
|
1085
1090
|
mintSelectors.hasLink = '[href]';
|
|
1086
|
-
/**
|
|
1087
|
-
* CSS-selector for elements with a routerLink attribute
|
|
1091
|
+
/**
|
|
1092
|
+
* CSS-selector for elements with a routerLink attribute
|
|
1088
1093
|
*/
|
|
1089
1094
|
mintSelectors.hasRouterLink = '[routerLink]';
|
|
1090
|
-
/**
|
|
1091
|
-
* CSS-selector for elements with an id attribute
|
|
1095
|
+
/**
|
|
1096
|
+
* CSS-selector for elements with an id attribute
|
|
1092
1097
|
*/
|
|
1093
1098
|
mintSelectors.hasId = '[id]';
|
|
1094
|
-
/**
|
|
1095
|
-
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
|
|
1099
|
+
/**
|
|
1100
|
+
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
|
|
1096
1101
|
*/
|
|
1097
1102
|
mintSelectors.notTabbable = '[tabindex^="-"]';
|
|
1098
|
-
/**
|
|
1099
|
-
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
|
|
1103
|
+
/**
|
|
1104
|
+
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
|
|
1100
1105
|
*/
|
|
1101
1106
|
mintSelectors.tabbable = `[tabindex]${_a.neg(_a.notTabbable)}`;
|
|
1102
|
-
/**
|
|
1103
|
-
* CSS-selector for elements that can receive focus
|
|
1107
|
+
/**
|
|
1108
|
+
* CSS-selector for elements that can receive focus
|
|
1104
1109
|
*/
|
|
1105
1110
|
mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
1106
1111
|
select${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
@@ -1110,39 +1115,14 @@ mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
|
1110
1115
|
a${_a.hasLink}, a${_a.hasRouterLink},
|
|
1111
1116
|
area${_a.hasLink},
|
|
1112
1117
|
${_a.tabbable}`.replace(/\s/g, '');
|
|
1113
|
-
/**
|
|
1114
|
-
* CSS-selector for submenu buttons
|
|
1118
|
+
/**
|
|
1119
|
+
* CSS-selector for submenu buttons
|
|
1115
1120
|
*/
|
|
1116
1121
|
mintSelectors.subMenuButtons = `button${_a.hasControls}`;
|
|
1117
|
-
/**
|
|
1118
|
-
* CSS-selector for submenus
|
|
1122
|
+
/**
|
|
1123
|
+
* CSS-selector for submenus
|
|
1119
1124
|
*/
|
|
1120
1125
|
mintSelectors.subMenu = `${_a.subMenuButtons} + ul${_a.hasId}`;
|
|
1121
|
-
/**
|
|
1122
|
-
* Frequently-used ids
|
|
1123
|
-
*/
|
|
1124
|
-
mintSelectors.ids = {
|
|
1125
|
-
header: _a.prefix('header'),
|
|
1126
|
-
logo: _a.prefix('logo'),
|
|
1127
|
-
wrapper: _a.prefix('wrapper'),
|
|
1128
|
-
mainContent: _a.prefix('main-content')
|
|
1129
|
-
};
|
|
1130
|
-
/**
|
|
1131
|
-
* Classes
|
|
1132
|
-
*/
|
|
1133
|
-
mintSelectors.classes = {
|
|
1134
|
-
sides: {
|
|
1135
|
-
top: _a.prefix('top'),
|
|
1136
|
-
right: _a.prefix('right'),
|
|
1137
|
-
bottom: _a.prefix('bottom'),
|
|
1138
|
-
left: _a.prefix('left')
|
|
1139
|
-
},
|
|
1140
|
-
srOnly: _a.prefix('sr-only'),
|
|
1141
|
-
js: _a.prefix('js'),
|
|
1142
|
-
ready: _a.prefix('ready'),
|
|
1143
|
-
fixed: _a.prefix('fixed'),
|
|
1144
|
-
open: _a.prefix('open')
|
|
1145
|
-
};
|
|
1146
1126
|
exports["default"] = mintSelectors;
|
|
1147
1127
|
|
|
1148
1128
|
/***/ }),
|
|
@@ -1151,7 +1131,7 @@ exports["default"] = mintSelectors;
|
|
|
1151
1131
|
/*!*****************************************!*\
|
|
1152
1132
|
!*** ./src/ts/imports/util/settings.ts ***!
|
|
1153
1133
|
\*****************************************/
|
|
1154
|
-
/***/ ((__unused_webpack_module, exports
|
|
1134
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1155
1135
|
|
|
1156
1136
|
|
|
1157
1137
|
|
|
@@ -1160,19 +1140,14 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1160
1140
|
value: true
|
|
1161
1141
|
}));
|
|
1162
1142
|
exports.mintSettings = void 0;
|
|
1163
|
-
/**
|
|
1164
|
-
*
|
|
1165
|
-
|
|
1166
|
-
const enum_1 = __webpack_require__(/*! ../enum */ "./src/ts/imports/enum.ts");
|
|
1167
|
-
const selectors_1 = __webpack_require__(/*! ./selectors */ "./src/ts/imports/util/selectors.ts");
|
|
1168
|
-
/**
|
|
1169
|
-
* Settings management
|
|
1170
|
-
* @public
|
|
1143
|
+
/**
|
|
1144
|
+
* Settings management
|
|
1145
|
+
* @public
|
|
1171
1146
|
*/
|
|
1172
1147
|
class mintSettings {
|
|
1173
|
-
/**
|
|
1174
|
-
* Update the provided settings variables
|
|
1175
|
-
* @param settings - Object of settings variables to update
|
|
1148
|
+
/**
|
|
1149
|
+
* Update the provided settings variables
|
|
1150
|
+
* @param settings - Object of settings variables to update
|
|
1176
1151
|
*/
|
|
1177
1152
|
static set(settings) {
|
|
1178
1153
|
let newDelay = false;
|
|
@@ -1192,15 +1167,14 @@ class mintSettings {
|
|
|
1192
1167
|
this.delay = Object.assign(Object.assign({}, this.delay), settings.delay);
|
|
1193
1168
|
}
|
|
1194
1169
|
}
|
|
1195
|
-
if (
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
this.setFixed(settings.fixed);
|
|
1170
|
+
if (settings.break && Object.keys(settings.break).length) {
|
|
1171
|
+
if (Object.values(settings.break).reduce((prev, next) => prev && typeof next === 'number', true)) {
|
|
1172
|
+
this.break = Object.assign(Object.assign({}, this.break), settings.break);
|
|
1173
|
+
}
|
|
1200
1174
|
}
|
|
1201
1175
|
}
|
|
1202
|
-
/**
|
|
1203
|
-
* Updates the delay variables based on `this.delayBase` and `this.delayStep`
|
|
1176
|
+
/**
|
|
1177
|
+
* Updates the delay variables based on `this.delayBase` and `this.delayStep`
|
|
1204
1178
|
*/
|
|
1205
1179
|
static setDelay() {
|
|
1206
1180
|
this.delay = {
|
|
@@ -1212,45 +1186,19 @@ class mintSettings {
|
|
|
1212
1186
|
slow: this.delayBase + this.delayStep * 5
|
|
1213
1187
|
};
|
|
1214
1188
|
}
|
|
1215
|
-
/**
|
|
1216
|
-
* Updates the direction the navbar enters from
|
|
1217
|
-
*/
|
|
1218
|
-
static setFrom(from) {
|
|
1219
|
-
if (this.from !== from) {
|
|
1220
|
-
this.from = from;
|
|
1221
|
-
let header = document.getElementById(selectors_1.mintSelectors.getId('header'));
|
|
1222
|
-
header === null || header === void 0 ? void 0 : header.classList.remove(...Object.values(selectors_1.mintSelectors.classes.sides));
|
|
1223
|
-
header === null || header === void 0 ? void 0 : header.classList.add(selectors_1.mintSelectors.getClass(enum_1.mintSide[this.from].toLowerCase(), 'sides'));
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
/**
|
|
1227
|
-
* Updates whether or not the navbar is fixed
|
|
1228
|
-
*/
|
|
1229
|
-
static setFixed(fixed) {
|
|
1230
|
-
if (this.fixed !== fixed) {
|
|
1231
|
-
this.fixed = fixed;
|
|
1232
|
-
let header = document.getElementById(selectors_1.mintSelectors.getId('header')),
|
|
1233
|
-
fixedClass = selectors_1.mintSelectors.getClass('fixed');
|
|
1234
|
-
if (this.fixed) {
|
|
1235
|
-
header === null || header === void 0 ? void 0 : header.classList.add(fixedClass);
|
|
1236
|
-
} else {
|
|
1237
|
-
header === null || header === void 0 ? void 0 : header.classList.remove(fixedClass);
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
1189
|
}
|
|
1242
1190
|
exports.mintSettings = mintSettings;
|
|
1243
1191
|
_a = mintSettings;
|
|
1244
|
-
/**
|
|
1245
|
-
* Value added to all delay variables
|
|
1192
|
+
/**
|
|
1193
|
+
* Value added to all delay variables
|
|
1246
1194
|
*/
|
|
1247
1195
|
mintSettings.delayBase = 0;
|
|
1248
|
-
/**
|
|
1249
|
-
* Value multiplied by delay variable index
|
|
1196
|
+
/**
|
|
1197
|
+
* Value multiplied by delay variable index
|
|
1250
1198
|
*/
|
|
1251
1199
|
mintSettings.delayStep = 100;
|
|
1252
|
-
/**
|
|
1253
|
-
* Delay variables
|
|
1200
|
+
/**
|
|
1201
|
+
* Delay variables
|
|
1254
1202
|
*/
|
|
1255
1203
|
mintSettings.delay = {
|
|
1256
1204
|
instant: _a.delayBase + _a.delayStep * 0,
|
|
@@ -1260,6 +1208,17 @@ mintSettings.delay = {
|
|
|
1260
1208
|
medSlow: _a.delayBase + _a.delayStep * 4,
|
|
1261
1209
|
slow: _a.delayBase + _a.delayStep * 5
|
|
1262
1210
|
};
|
|
1211
|
+
/**
|
|
1212
|
+
* Breakpoint variables
|
|
1213
|
+
*/
|
|
1214
|
+
mintSettings.break = {
|
|
1215
|
+
z: 0,
|
|
1216
|
+
xs: 480,
|
|
1217
|
+
sm: 768,
|
|
1218
|
+
md: 1024,
|
|
1219
|
+
lg: 1200,
|
|
1220
|
+
xl: 1440
|
|
1221
|
+
};
|
|
1263
1222
|
;
|
|
1264
1223
|
exports["default"] = mintSettings;
|
|
1265
1224
|
|
|
@@ -1277,31 +1236,31 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1277
1236
|
value: true
|
|
1278
1237
|
}));
|
|
1279
1238
|
exports.mintText = void 0;
|
|
1280
|
-
/**
|
|
1281
|
-
* Functions for analyzing and manipulating text.
|
|
1239
|
+
/**
|
|
1240
|
+
* Functions for analyzing and manipulating text.
|
|
1282
1241
|
*/
|
|
1283
1242
|
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
|
-
}
|
|
1243
|
+
/*static fitContainer () {
|
|
1244
|
+
let $warning: JQuery<HTMLElement> = $(warningSelector);
|
|
1245
|
+
$warning.css({
|
|
1246
|
+
overflow: 'scroll',
|
|
1247
|
+
fontSize: ''
|
|
1248
|
+
});
|
|
1249
|
+
while (($warning?.[0].scrollHeight ?? Number.MIN_SAFE_INTEGER) > ($warning?.innerHeight() ?? Number.MAX_SAFE_INTEGER)) {
|
|
1250
|
+
let fontSize: number = parseInt($warning.css('font-size')) - 1;
|
|
1251
|
+
$warning.css('font-size', fontSize + 'px');
|
|
1252
|
+
}
|
|
1294
1253
|
}*/
|
|
1295
|
-
/**
|
|
1296
|
-
* Generate a slug from a string
|
|
1297
|
-
* @param str - The string to slugify
|
|
1298
|
-
* @returns The slugified string
|
|
1254
|
+
/**
|
|
1255
|
+
* Generate a slug from a string
|
|
1256
|
+
* @param str - The string to slugify
|
|
1257
|
+
* @returns The slugified string
|
|
1299
1258
|
*/
|
|
1300
1259
|
static slug(str) {
|
|
1301
1260
|
return str.toLowerCase().replace(/\W+/g, '-').replace(/^-+|-+$/g, '');
|
|
1302
1261
|
}
|
|
1303
|
-
/**
|
|
1304
|
-
* Pluralize the given word
|
|
1262
|
+
/**
|
|
1263
|
+
* Pluralize the given word
|
|
1305
1264
|
*/
|
|
1306
1265
|
static pluralize(word) {
|
|
1307
1266
|
if (word.endsWith('ies') || word.endsWith('es') || word.endsWith('s') && !word.endsWith('us') && !word.endsWith('is') && !word.endsWith('ss')) {
|
|
@@ -1334,8 +1293,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1334
1293
|
value: true
|
|
1335
1294
|
}));
|
|
1336
1295
|
exports.mintWindow = void 0;
|
|
1337
|
-
/**
|
|
1338
|
-
* Functions related to the browser window.
|
|
1296
|
+
/**
|
|
1297
|
+
* Functions related to the browser window.
|
|
1339
1298
|
*/
|
|
1340
1299
|
class mintWindow {}
|
|
1341
1300
|
exports.mintWindow = mintWindow;
|
|
@@ -1352,10 +1311,10 @@ exports["default"] = mintWindow;
|
|
|
1352
1311
|
|
|
1353
1312
|
|
|
1354
1313
|
|
|
1355
|
-
/**
|
|
1356
|
-
* A library for building responsive web applications.
|
|
1357
|
-
*
|
|
1358
|
-
* @packageDocumentation
|
|
1314
|
+
/**
|
|
1315
|
+
* A library for building responsive web applications.
|
|
1316
|
+
*
|
|
1317
|
+
* @packageDocumentation
|
|
1359
1318
|
*/
|
|
1360
1319
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
1361
1320
|
return mod && mod.__esModule ? mod : {
|
|
@@ -1366,8 +1325,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1366
1325
|
value: true
|
|
1367
1326
|
}));
|
|
1368
1327
|
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
|
|
1328
|
+
/**
|
|
1329
|
+
* Exports
|
|
1371
1330
|
*/
|
|
1372
1331
|
// Enums
|
|
1373
1332
|
var enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts");
|
|
@@ -1505,29 +1464,29 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1505
1464
|
value: true
|
|
1506
1465
|
}));
|
|
1507
1466
|
exports.mintUtil = void 0;
|
|
1508
|
-
/**
|
|
1509
|
-
* Imports
|
|
1467
|
+
/**
|
|
1468
|
+
* Imports
|
|
1510
1469
|
*/
|
|
1511
1470
|
const enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts");
|
|
1512
1471
|
const settings_1 = __importDefault(__webpack_require__(/*! ./imports/util/settings */ "./src/ts/imports/util/settings.ts"));
|
|
1513
|
-
/**
|
|
1514
|
-
* Utility functions
|
|
1515
|
-
* @public
|
|
1472
|
+
/**
|
|
1473
|
+
* Utility functions
|
|
1474
|
+
* @public
|
|
1516
1475
|
*/
|
|
1517
1476
|
class mintUtil {
|
|
1518
|
-
/**
|
|
1519
|
-
* Returns the width of the window, including fractional pixels
|
|
1520
|
-
* @returns the width of the window
|
|
1477
|
+
/**
|
|
1478
|
+
* Returns the width of the window, including fractional pixels
|
|
1479
|
+
* @returns the width of the window
|
|
1521
1480
|
*/
|
|
1522
1481
|
static windowWidth() {
|
|
1523
1482
|
const decimal = document.body.getBoundingClientRect().width % 1;
|
|
1524
1483
|
return window.innerWidth + decimal;
|
|
1525
1484
|
}
|
|
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
|
|
1485
|
+
/**
|
|
1486
|
+
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1487
|
+
* @param func - the function to debounce
|
|
1488
|
+
* @param wait - the amount of time to wait before running the function
|
|
1489
|
+
* @returns - the debounced function
|
|
1531
1490
|
*/
|
|
1532
1491
|
static debounce(func) {
|
|
1533
1492
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1539,22 +1498,22 @@ class mintUtil {
|
|
|
1539
1498
|
timer = setTimeout(func, wait, e);
|
|
1540
1499
|
};
|
|
1541
1500
|
}
|
|
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
|
|
1501
|
+
/**
|
|
1502
|
+
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
1503
|
+
* @param func - the function to debounce
|
|
1504
|
+
* @param wait - the amount of time to wait before running the function
|
|
1505
|
+
* @returns - the debounced function as an EventListener
|
|
1547
1506
|
*/
|
|
1548
1507
|
static debounceEvent(func) {
|
|
1549
1508
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
1550
1509
|
return mintUtil.debounce(func, wait);
|
|
1551
1510
|
}
|
|
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
|
|
1511
|
+
/**
|
|
1512
|
+
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1513
|
+
* @param func - the function to throttle
|
|
1514
|
+
* @param wait - the amount of time between function calls
|
|
1515
|
+
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1516
|
+
* @returns - the throttled function
|
|
1558
1517
|
*/
|
|
1559
1518
|
static throttle(func) {
|
|
1560
1519
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1597,23 +1556,23 @@ class mintUtil {
|
|
|
1597
1556
|
};
|
|
1598
1557
|
return throttled;
|
|
1599
1558
|
}
|
|
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
|
|
1559
|
+
/**
|
|
1560
|
+
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
1561
|
+
* @param func - the function to throttle
|
|
1562
|
+
* @param wait - the amount of time between function calls
|
|
1563
|
+
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
1564
|
+
* @returns - the throttled function as an EventListener
|
|
1606
1565
|
*/
|
|
1607
1566
|
static throttleEvent(func) {
|
|
1608
1567
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
1609
1568
|
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
1610
1569
|
return mintUtil.throttle(func, wait, options);
|
|
1611
1570
|
}
|
|
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
|
|
1571
|
+
/**
|
|
1572
|
+
* Sets the element's height to its `innerHeight`, then to `auto` after a delay
|
|
1573
|
+
* @param el - the element whose height will be set
|
|
1574
|
+
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1575
|
+
* @param from - the side that the element is animating from
|
|
1617
1576
|
*/
|
|
1618
1577
|
static show(el) {
|
|
1619
1578
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1636,11 +1595,11 @@ class mintUtil {
|
|
|
1636
1595
|
});
|
|
1637
1596
|
}
|
|
1638
1597
|
}
|
|
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
|
|
1598
|
+
/**
|
|
1599
|
+
* Sets the element's height to 0
|
|
1600
|
+
* @param el - the element whose height will be set
|
|
1601
|
+
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
1602
|
+
* @param from - the side that the element is animating from
|
|
1644
1603
|
*/
|
|
1645
1604
|
static hide(el) {
|
|
1646
1605
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -1670,10 +1629,10 @@ class mintUtil {
|
|
|
1670
1629
|
}, delay);
|
|
1671
1630
|
}
|
|
1672
1631
|
}
|
|
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
|
|
1632
|
+
/**
|
|
1633
|
+
* Copies the provided text to the clipboard
|
|
1634
|
+
* @param text - the text to copy
|
|
1635
|
+
* @returns - true if the text was successfully copied to the clipboard; else false
|
|
1677
1636
|
*/
|
|
1678
1637
|
static copyText(text) {
|
|
1679
1638
|
let textArea = document.createElement('textarea');
|
|
@@ -1696,11 +1655,11 @@ class mintUtil {
|
|
|
1696
1655
|
document.body.removeChild(textArea);
|
|
1697
1656
|
return true;
|
|
1698
1657
|
}
|
|
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
|
|
1658
|
+
/**
|
|
1659
|
+
* Tests the validity of an email address
|
|
1660
|
+
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
|
|
1661
|
+
* @param text - the string to test
|
|
1662
|
+
* @returns - true if the given string is an email address; false if not
|
|
1704
1663
|
*/
|
|
1705
1664
|
static isEmail(text) {
|
|
1706
1665
|
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])+)\])/);
|