@appartmint/mint 0.13.3 → 0.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/css/mint.css +3 -1
- 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 +1 -1
- package/src/scss/imports/_index.scss +8 -8
- package/src/scss/imports/components/_embed.scss +63 -63
- package/src/scss/imports/components/_header.scss +1 -0
- package/src/scss/imports/components/_index.scss +7 -7
- package/src/scss/imports/global/_icons.scss +6 -6
- package/src/scss/imports/global/_structure.scss +2 -1
- package/src/scss/imports/util/_index.scss +8 -8
- package/src/ts/imports/enum.ts +9 -9
- package/src/ts/imports/models/color.ts +96 -96
- package/src/ts/imports/util/display.ts +6 -6
- package/src/ts/imports/util/event.ts +7 -7
- package/src/ts/imports/util/list.ts +19 -19
- package/src/ts/imports/util/math.ts +17 -17
- package/src/ts/imports/util/window.ts +6 -6
- package/src/ts/index.ts +33 -33
package/dist/js/util.js
CHANGED
|
@@ -24,8 +24,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
24
24
|
value: true
|
|
25
25
|
}));
|
|
26
26
|
exports.mintSide = void 0;
|
|
27
|
-
/**
|
|
28
|
-
* Side Enum
|
|
27
|
+
/**
|
|
28
|
+
* Side Enum
|
|
29
29
|
*/
|
|
30
30
|
var mintSide;
|
|
31
31
|
(function (mintSide) {
|
|
@@ -51,85 +51,85 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
51
51
|
value: true
|
|
52
52
|
}));
|
|
53
53
|
exports.mintSelectors = void 0;
|
|
54
|
-
/**
|
|
55
|
-
* CSS-selector helpers
|
|
56
|
-
* @public
|
|
54
|
+
/**
|
|
55
|
+
* CSS-selector helpers
|
|
56
|
+
* @public
|
|
57
57
|
*/
|
|
58
58
|
class mintSelectors {
|
|
59
|
-
/**
|
|
60
|
-
* Adds the library prefix to the beginning of the provided string
|
|
61
|
-
* @param base - the string to be prefixed
|
|
62
|
-
* @returns - the provided string prefixed with the library name
|
|
59
|
+
/**
|
|
60
|
+
* Adds the library prefix to the beginning of the provided string
|
|
61
|
+
* @param base - the string to be prefixed
|
|
62
|
+
* @returns - the provided string prefixed with the library name
|
|
63
63
|
*/
|
|
64
64
|
static prefix(base) {
|
|
65
65
|
base = base.toLowerCase();
|
|
66
66
|
return base.startsWith(this.pre) ? base : `${this.pre}${base}`;
|
|
67
67
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Adds two dashes to the beginning of the provided string
|
|
70
|
-
* @param base - the string to be prefixed
|
|
71
|
-
* @returns - the provided string prefixed with two dashes
|
|
68
|
+
/**
|
|
69
|
+
* Adds two dashes to the beginning of the provided string
|
|
70
|
+
* @param base - the string to be prefixed
|
|
71
|
+
* @returns - the provided string prefixed with two dashes
|
|
72
72
|
*/
|
|
73
73
|
static cssPrefix(base) {
|
|
74
74
|
return `--${this.prefix(base.replace(/^-+/, ''))}`;
|
|
75
75
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Turns the provided string into a CSS variable call
|
|
78
|
-
* @param base - the name of the CSS variable to call
|
|
79
|
-
* @returns - the CSS variable call for the provided string
|
|
76
|
+
/**
|
|
77
|
+
* Turns the provided string into a CSS variable call
|
|
78
|
+
* @param base - the name of the CSS variable to call
|
|
79
|
+
* @returns - the CSS variable call for the provided string
|
|
80
80
|
*/
|
|
81
81
|
static cssVar(base) {
|
|
82
82
|
return `var(${this.cssPrefix(base)})`;
|
|
83
83
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Negates the provided CSS selector
|
|
86
|
-
* @param base - the CSS selector to negate
|
|
87
|
-
* @returns - the negated CSS selector
|
|
84
|
+
/**
|
|
85
|
+
* Negates the provided CSS selector
|
|
86
|
+
* @param base - the CSS selector to negate
|
|
87
|
+
* @returns - the negated CSS selector
|
|
88
88
|
*/
|
|
89
89
|
static neg(base) {
|
|
90
90
|
return `:not(${base})`;
|
|
91
91
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Generates a class CSS selector
|
|
94
|
-
* @param base - the name of the class to generate
|
|
95
|
-
* @returns - the generated CSS selector
|
|
92
|
+
/**
|
|
93
|
+
* Generates a class CSS selector
|
|
94
|
+
* @param base - the name of the class to generate
|
|
95
|
+
* @returns - the generated CSS selector
|
|
96
96
|
*/
|
|
97
97
|
static class(base) {
|
|
98
98
|
return `.${this.prefix(base)}`;
|
|
99
99
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Generates an id CSS selector
|
|
102
|
-
* @param base - the name of the id to generate
|
|
103
|
-
* @returns - the generated CSS selector
|
|
100
|
+
/**
|
|
101
|
+
* Generates an id CSS selector
|
|
102
|
+
* @param base - the name of the id to generate
|
|
103
|
+
* @returns - the generated CSS selector
|
|
104
104
|
*/
|
|
105
105
|
static id(base) {
|
|
106
106
|
return `#${this.prefix(base)}`;
|
|
107
107
|
}
|
|
108
|
-
/**
|
|
109
|
-
* Generates an aria-controls CSS selector
|
|
110
|
-
* @param id - the id of the controlled element
|
|
111
|
-
* @returns - the generated CSS selector
|
|
108
|
+
/**
|
|
109
|
+
* Generates an aria-controls CSS selector
|
|
110
|
+
* @param id - the id of the controlled element
|
|
111
|
+
* @returns - the generated CSS selector
|
|
112
112
|
*/
|
|
113
113
|
static controls(id) {
|
|
114
114
|
return id ? `[aria-controls="${this.prefix(id)}"]` : this.hasControls;
|
|
115
115
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Generates an aria-expanded CSS selector
|
|
118
|
-
* @param bool - whether the element is expanded or not
|
|
119
|
-
* @returns - the generated CSS selector
|
|
116
|
+
/**
|
|
117
|
+
* Generates an aria-expanded CSS selector
|
|
118
|
+
* @param bool - whether the element is expanded or not
|
|
119
|
+
* @returns - the generated CSS selector
|
|
120
120
|
*/
|
|
121
121
|
static expanded(bool) {
|
|
122
122
|
return typeof bool === 'boolean' ? `[aria-expanded="${bool}"]` : this.hasExpanded;
|
|
123
123
|
}
|
|
124
|
-
/**
|
|
125
|
-
* Returns the id of the requested element
|
|
124
|
+
/**
|
|
125
|
+
* Returns the id of the requested element
|
|
126
126
|
*/
|
|
127
127
|
static getId(id) {
|
|
128
128
|
var _b;
|
|
129
129
|
return (_b = this.ids[id !== null && id !== void 0 ? id : -1]) !== null && _b !== void 0 ? _b : '';
|
|
130
130
|
}
|
|
131
|
-
/**
|
|
132
|
-
* Returns the class of the requested element
|
|
131
|
+
/**
|
|
132
|
+
* Returns the class of the requested element
|
|
133
133
|
*/
|
|
134
134
|
static getClass(className, classGroup) {
|
|
135
135
|
var _b, _c;
|
|
@@ -139,10 +139,10 @@ class mintSelectors {
|
|
|
139
139
|
}
|
|
140
140
|
return (_c = this.classes[className !== null && className !== void 0 ? className : -1]) !== null && _c !== void 0 ? _c : '';
|
|
141
141
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Returns a NodeList of HTMLElements within the given element that are focusable
|
|
144
|
-
* @param el - the element whose focusable children will be returned
|
|
145
|
-
* @returns - the elements within the given element that are focusable
|
|
142
|
+
/**
|
|
143
|
+
* Returns a NodeList of HTMLElements within the given element that are focusable
|
|
144
|
+
* @param el - the element whose focusable children will be returned
|
|
145
|
+
* @returns - the elements within the given element that are focusable
|
|
146
146
|
*/
|
|
147
147
|
static getFocusables(el) {
|
|
148
148
|
let focusables;
|
|
@@ -153,12 +153,12 @@ class mintSelectors {
|
|
|
153
153
|
}
|
|
154
154
|
return focusables.filter(el => this.isFocusable(el));
|
|
155
155
|
}
|
|
156
|
-
/**
|
|
157
|
-
* Returns true if an element is focusable and false if not,
|
|
158
|
-
* based on styles (i.e. a parent has display: none;)
|
|
159
|
-
* NOTE: Still need to determine what other styles may make an element un-focusable
|
|
160
|
-
* @param el - the element
|
|
161
|
-
* @returns - true if the element is focusable; false if not
|
|
156
|
+
/**
|
|
157
|
+
* Returns true if an element is focusable and false if not,
|
|
158
|
+
* based on styles (i.e. a parent has display: none;)
|
|
159
|
+
* NOTE: Still need to determine what other styles may make an element un-focusable
|
|
160
|
+
* @param el - the element
|
|
161
|
+
* @returns - true if the element is focusable; false if not
|
|
162
162
|
*/
|
|
163
163
|
static isFocusable(el) {
|
|
164
164
|
let current = el;
|
|
@@ -173,48 +173,48 @@ class mintSelectors {
|
|
|
173
173
|
}
|
|
174
174
|
exports.mintSelectors = mintSelectors;
|
|
175
175
|
_a = mintSelectors;
|
|
176
|
-
/**
|
|
177
|
-
* The library name that will be added as a prefix
|
|
176
|
+
/**
|
|
177
|
+
* The library name that will be added as a prefix
|
|
178
178
|
*/
|
|
179
179
|
mintSelectors.lib = 'mint';
|
|
180
|
-
/**
|
|
181
|
-
* The prefix built from the library name
|
|
180
|
+
/**
|
|
181
|
+
* The prefix built from the library name
|
|
182
182
|
*/
|
|
183
183
|
mintSelectors.pre = `${_a.lib}-`;
|
|
184
|
-
/**
|
|
185
|
-
* CSS-selector for disabled elements
|
|
184
|
+
/**
|
|
185
|
+
* CSS-selector for disabled elements
|
|
186
186
|
*/
|
|
187
187
|
mintSelectors.disabled = '[disabled]';
|
|
188
|
-
/**
|
|
189
|
-
* CSS-selector for elements with an aria-controls attribute
|
|
188
|
+
/**
|
|
189
|
+
* CSS-selector for elements with an aria-controls attribute
|
|
190
190
|
*/
|
|
191
191
|
mintSelectors.hasControls = '[aria-controls]';
|
|
192
|
-
/**
|
|
193
|
-
* CSS-selector for elements with an aria-expanded attribute
|
|
192
|
+
/**
|
|
193
|
+
* CSS-selector for elements with an aria-expanded attribute
|
|
194
194
|
*/
|
|
195
195
|
mintSelectors.hasExpanded = '[aria-expanded]';
|
|
196
|
-
/**
|
|
197
|
-
* CSS-selector for elements with an href attribute
|
|
196
|
+
/**
|
|
197
|
+
* CSS-selector for elements with an href attribute
|
|
198
198
|
*/
|
|
199
199
|
mintSelectors.hasLink = '[href]';
|
|
200
|
-
/**
|
|
201
|
-
* CSS-selector for elements with a routerLink attribute
|
|
200
|
+
/**
|
|
201
|
+
* CSS-selector for elements with a routerLink attribute
|
|
202
202
|
*/
|
|
203
203
|
mintSelectors.hasRouterLink = '[routerLink]';
|
|
204
|
-
/**
|
|
205
|
-
* CSS-selector for elements with an id attribute
|
|
204
|
+
/**
|
|
205
|
+
* CSS-selector for elements with an id attribute
|
|
206
206
|
*/
|
|
207
207
|
mintSelectors.hasId = '[id]';
|
|
208
|
-
/**
|
|
209
|
-
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
|
|
208
|
+
/**
|
|
209
|
+
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
|
|
210
210
|
*/
|
|
211
211
|
mintSelectors.notTabbable = '[tabindex^="-"]';
|
|
212
|
-
/**
|
|
213
|
-
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
|
|
212
|
+
/**
|
|
213
|
+
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
|
|
214
214
|
*/
|
|
215
215
|
mintSelectors.tabbable = `[tabindex]${_a.neg(_a.notTabbable)}`;
|
|
216
|
-
/**
|
|
217
|
-
* CSS-selector for elements that can receive focus
|
|
216
|
+
/**
|
|
217
|
+
* CSS-selector for elements that can receive focus
|
|
218
218
|
*/
|
|
219
219
|
mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
220
220
|
select${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
@@ -224,16 +224,16 @@ mintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)},
|
|
|
224
224
|
a${_a.hasLink}, a${_a.hasRouterLink},
|
|
225
225
|
area${_a.hasLink},
|
|
226
226
|
${_a.tabbable}`.replace(/\s/g, '');
|
|
227
|
-
/**
|
|
228
|
-
* CSS-selector for submenu buttons
|
|
227
|
+
/**
|
|
228
|
+
* CSS-selector for submenu buttons
|
|
229
229
|
*/
|
|
230
230
|
mintSelectors.subMenuButtons = `button${_a.hasControls}`;
|
|
231
|
-
/**
|
|
232
|
-
* CSS-selector for submenus
|
|
231
|
+
/**
|
|
232
|
+
* CSS-selector for submenus
|
|
233
233
|
*/
|
|
234
234
|
mintSelectors.subMenu = `${_a.subMenuButtons} + ul${_a.hasId}`;
|
|
235
|
-
/**
|
|
236
|
-
* Frequently-used ids
|
|
235
|
+
/**
|
|
236
|
+
* Frequently-used ids
|
|
237
237
|
*/
|
|
238
238
|
mintSelectors.ids = {
|
|
239
239
|
header: _a.prefix('header'),
|
|
@@ -241,8 +241,8 @@ mintSelectors.ids = {
|
|
|
241
241
|
wrapper: _a.prefix('wrapper'),
|
|
242
242
|
mainContent: _a.prefix('main-content')
|
|
243
243
|
};
|
|
244
|
-
/**
|
|
245
|
-
* Classes
|
|
244
|
+
/**
|
|
245
|
+
* Classes
|
|
246
246
|
*/
|
|
247
247
|
mintSelectors.classes = {
|
|
248
248
|
sides: {
|
|
@@ -274,19 +274,19 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
274
274
|
value: true
|
|
275
275
|
}));
|
|
276
276
|
exports.mintSettings = void 0;
|
|
277
|
-
/**
|
|
278
|
-
* Imports
|
|
277
|
+
/**
|
|
278
|
+
* Imports
|
|
279
279
|
*/
|
|
280
280
|
const enum_1 = __webpack_require__(/*! ../enum */ "./src/ts/imports/enum.ts");
|
|
281
281
|
const selectors_1 = __webpack_require__(/*! ./selectors */ "./src/ts/imports/util/selectors.ts");
|
|
282
|
-
/**
|
|
283
|
-
* Settings management
|
|
284
|
-
* @public
|
|
282
|
+
/**
|
|
283
|
+
* Settings management
|
|
284
|
+
* @public
|
|
285
285
|
*/
|
|
286
286
|
class mintSettings {
|
|
287
|
-
/**
|
|
288
|
-
* Update the provided settings variables
|
|
289
|
-
* @param settings - Object of settings variables to update
|
|
287
|
+
/**
|
|
288
|
+
* Update the provided settings variables
|
|
289
|
+
* @param settings - Object of settings variables to update
|
|
290
290
|
*/
|
|
291
291
|
static set(settings) {
|
|
292
292
|
let newDelay = false;
|
|
@@ -313,8 +313,8 @@ class mintSettings {
|
|
|
313
313
|
this.setFixed(settings.fixed);
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
/**
|
|
317
|
-
* Updates the delay variables based on `this.delayBase` and `this.delayStep`
|
|
316
|
+
/**
|
|
317
|
+
* Updates the delay variables based on `this.delayBase` and `this.delayStep`
|
|
318
318
|
*/
|
|
319
319
|
static setDelay() {
|
|
320
320
|
this.delay = {
|
|
@@ -326,8 +326,8 @@ class mintSettings {
|
|
|
326
326
|
slow: this.delayBase + this.delayStep * 5
|
|
327
327
|
};
|
|
328
328
|
}
|
|
329
|
-
/**
|
|
330
|
-
* Updates the direction the navbar enters from
|
|
329
|
+
/**
|
|
330
|
+
* Updates the direction the navbar enters from
|
|
331
331
|
*/
|
|
332
332
|
static setFrom(from) {
|
|
333
333
|
if (this.from !== from) {
|
|
@@ -337,8 +337,8 @@ class mintSettings {
|
|
|
337
337
|
header === null || header === void 0 ? void 0 : header.classList.add(selectors_1.mintSelectors.getClass(enum_1.mintSide[this.from].toLowerCase(), 'sides'));
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
/**
|
|
341
|
-
* Updates whether or not the navbar is fixed
|
|
340
|
+
/**
|
|
341
|
+
* Updates whether or not the navbar is fixed
|
|
342
342
|
*/
|
|
343
343
|
static setFixed(fixed) {
|
|
344
344
|
if (this.fixed !== fixed) {
|
|
@@ -355,16 +355,16 @@ class mintSettings {
|
|
|
355
355
|
}
|
|
356
356
|
exports.mintSettings = mintSettings;
|
|
357
357
|
_a = mintSettings;
|
|
358
|
-
/**
|
|
359
|
-
* Value added to all delay variables
|
|
358
|
+
/**
|
|
359
|
+
* Value added to all delay variables
|
|
360
360
|
*/
|
|
361
361
|
mintSettings.delayBase = 0;
|
|
362
|
-
/**
|
|
363
|
-
* Value multiplied by delay variable index
|
|
362
|
+
/**
|
|
363
|
+
* Value multiplied by delay variable index
|
|
364
364
|
*/
|
|
365
365
|
mintSettings.delayStep = 100;
|
|
366
|
-
/**
|
|
367
|
-
* Delay variables
|
|
366
|
+
/**
|
|
367
|
+
* Delay variables
|
|
368
368
|
*/
|
|
369
369
|
mintSettings.delay = {
|
|
370
370
|
instant: _a.delayBase + _a.delayStep * 0,
|
|
@@ -396,29 +396,29 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
396
396
|
value: true
|
|
397
397
|
}));
|
|
398
398
|
exports.mintUtil = void 0;
|
|
399
|
-
/**
|
|
400
|
-
* Imports
|
|
399
|
+
/**
|
|
400
|
+
* Imports
|
|
401
401
|
*/
|
|
402
402
|
const enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts");
|
|
403
403
|
const settings_1 = __importDefault(__webpack_require__(/*! ./imports/util/settings */ "./src/ts/imports/util/settings.ts"));
|
|
404
|
-
/**
|
|
405
|
-
* Utility functions
|
|
406
|
-
* @public
|
|
404
|
+
/**
|
|
405
|
+
* Utility functions
|
|
406
|
+
* @public
|
|
407
407
|
*/
|
|
408
408
|
class mintUtil {
|
|
409
|
-
/**
|
|
410
|
-
* Returns the width of the window, including fractional pixels
|
|
411
|
-
* @returns the width of the window
|
|
409
|
+
/**
|
|
410
|
+
* Returns the width of the window, including fractional pixels
|
|
411
|
+
* @returns the width of the window
|
|
412
412
|
*/
|
|
413
413
|
static windowWidth() {
|
|
414
414
|
const decimal = document.body.getBoundingClientRect().width % 1;
|
|
415
415
|
return window.innerWidth + decimal;
|
|
416
416
|
}
|
|
417
|
-
/**
|
|
418
|
-
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
419
|
-
* @param func - the function to debounce
|
|
420
|
-
* @param wait - the amount of time to wait before running the function
|
|
421
|
-
* @returns - the debounced function
|
|
417
|
+
/**
|
|
418
|
+
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
419
|
+
* @param func - the function to debounce
|
|
420
|
+
* @param wait - the amount of time to wait before running the function
|
|
421
|
+
* @returns - the debounced function
|
|
422
422
|
*/
|
|
423
423
|
static debounce(func) {
|
|
424
424
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -430,22 +430,22 @@ class mintUtil {
|
|
|
430
430
|
timer = setTimeout(func, wait, e);
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
|
-
/**
|
|
434
|
-
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
435
|
-
* @param func - the function to debounce
|
|
436
|
-
* @param wait - the amount of time to wait before running the function
|
|
437
|
-
* @returns - the debounced function as an EventListener
|
|
433
|
+
/**
|
|
434
|
+
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
435
|
+
* @param func - the function to debounce
|
|
436
|
+
* @param wait - the amount of time to wait before running the function
|
|
437
|
+
* @returns - the debounced function as an EventListener
|
|
438
438
|
*/
|
|
439
439
|
static debounceEvent(func) {
|
|
440
440
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
441
441
|
return mintUtil.debounce(func, wait);
|
|
442
442
|
}
|
|
443
|
-
/**
|
|
444
|
-
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
445
|
-
* @param func - the function to throttle
|
|
446
|
-
* @param wait - the amount of time between function calls
|
|
447
|
-
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
448
|
-
* @returns - the throttled function
|
|
443
|
+
/**
|
|
444
|
+
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
445
|
+
* @param func - the function to throttle
|
|
446
|
+
* @param wait - the amount of time between function calls
|
|
447
|
+
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
448
|
+
* @returns - the throttled function
|
|
449
449
|
*/
|
|
450
450
|
static throttle(func) {
|
|
451
451
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -488,23 +488,23 @@ class mintUtil {
|
|
|
488
488
|
};
|
|
489
489
|
return throttled;
|
|
490
490
|
}
|
|
491
|
-
/**
|
|
492
|
-
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
493
|
-
* @param func - the function to throttle
|
|
494
|
-
* @param wait - the amount of time between function calls
|
|
495
|
-
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
496
|
-
* @returns - the throttled function as an EventListener
|
|
491
|
+
/**
|
|
492
|
+
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
493
|
+
* @param func - the function to throttle
|
|
494
|
+
* @param wait - the amount of time between function calls
|
|
495
|
+
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
496
|
+
* @returns - the throttled function as an EventListener
|
|
497
497
|
*/
|
|
498
498
|
static throttleEvent(func) {
|
|
499
499
|
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
500
500
|
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
501
501
|
return mintUtil.throttle(func, wait, options);
|
|
502
502
|
}
|
|
503
|
-
/**
|
|
504
|
-
* Sets the element's height to its `innerHeight`, then to `auto` after a delay
|
|
505
|
-
* @param el - the element whose height will be set
|
|
506
|
-
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
507
|
-
* @param from - the side that the element is animating from
|
|
503
|
+
/**
|
|
504
|
+
* Sets the element's height to its `innerHeight`, then to `auto` after a delay
|
|
505
|
+
* @param el - the element whose height will be set
|
|
506
|
+
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
507
|
+
* @param from - the side that the element is animating from
|
|
508
508
|
*/
|
|
509
509
|
static show(el) {
|
|
510
510
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -527,11 +527,11 @@ class mintUtil {
|
|
|
527
527
|
});
|
|
528
528
|
}
|
|
529
529
|
}
|
|
530
|
-
/**
|
|
531
|
-
* Sets the element's height to 0
|
|
532
|
-
* @param el - the element whose height will be set
|
|
533
|
-
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
534
|
-
* @param from - the side that the element is animating from
|
|
530
|
+
/**
|
|
531
|
+
* Sets the element's height to 0
|
|
532
|
+
* @param el - the element whose height will be set
|
|
533
|
+
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
534
|
+
* @param from - the side that the element is animating from
|
|
535
535
|
*/
|
|
536
536
|
static hide(el) {
|
|
537
537
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default;
|
|
@@ -561,10 +561,10 @@ class mintUtil {
|
|
|
561
561
|
}, delay);
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
|
-
/**
|
|
565
|
-
* Copies the provided text to the clipboard
|
|
566
|
-
* @param text - the text to copy
|
|
567
|
-
* @returns - true if the text was successfully copied to the clipboard; else false
|
|
564
|
+
/**
|
|
565
|
+
* Copies the provided text to the clipboard
|
|
566
|
+
* @param text - the text to copy
|
|
567
|
+
* @returns - true if the text was successfully copied to the clipboard; else false
|
|
568
568
|
*/
|
|
569
569
|
static copyText(text) {
|
|
570
570
|
let textArea = document.createElement('textarea');
|
|
@@ -587,11 +587,11 @@ class mintUtil {
|
|
|
587
587
|
document.body.removeChild(textArea);
|
|
588
588
|
return true;
|
|
589
589
|
}
|
|
590
|
-
/**
|
|
591
|
-
* Tests the validity of an email address
|
|
592
|
-
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
|
|
593
|
-
* @param text - the string to test
|
|
594
|
-
* @returns - true if the given string is an email address; false if not
|
|
590
|
+
/**
|
|
591
|
+
* Tests the validity of an email address
|
|
592
|
+
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
|
|
593
|
+
* @param text - the string to test
|
|
594
|
+
* @returns - true if the given string is an email address; false if not
|
|
595
595
|
*/
|
|
596
596
|
static isEmail(text) {
|
|
597
597
|
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])+)\])/);
|