@appartmint/mint 1.2.12 → 1.3.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/package.json +4 -3
- package/src/scss/imports/_index.scss +0 -10
- package/src/scss/imports/components/_backgrounds.scss +0 -38
- package/src/scss/imports/components/_buttons.scss +0 -243
- package/src/scss/imports/components/_cards.scss +0 -259
- package/src/scss/imports/components/_embed.scss +0 -75
- package/src/scss/imports/components/_footer.scss +0 -134
- package/src/scss/imports/components/_header.scss +0 -512
- package/src/scss/imports/components/_image.scss +0 -37
- package/src/scss/imports/components/_index.scss +0 -16
- package/src/scss/imports/components/_recaptcha.scss +0 -17
- package/src/scss/imports/components/_tables.scss +0 -29
- package/src/scss/imports/global/_animations.scss +0 -79
- package/src/scss/imports/global/_aspect.scss +0 -54
- package/src/scss/imports/global/_flex.scss +0 -7
- package/src/scss/imports/global/_global.scss +0 -208
- package/src/scss/imports/global/_grid.scss +0 -153
- package/src/scss/imports/global/_icons.scss +0 -6
- package/src/scss/imports/global/_index.scss +0 -12
- package/src/scss/imports/global/_inputs.scss +0 -135
- package/src/scss/imports/global/_structure.scss +0 -89
- package/src/scss/imports/global/_text.scss +0 -62
- package/src/scss/imports/global/_texture.scss +0 -124
- package/src/scss/imports/global/_themes.scss +0 -174
- package/src/scss/imports/overrides/_amplify.scss +0 -48
- package/src/scss/imports/overrides/_full-calendar.scss +0 -46
- package/src/scss/imports/overrides/_index.scss +0 -11
- package/src/scss/imports/overrides/_material.scss +0 -24
- package/src/scss/imports/overrides/_swiper.scss +0 -55
- package/src/scss/imports/util/_index.scss +0 -9
- package/src/scss/imports/util/_util.scss +0 -1034
- package/src/scss/imports/util/_vars.scss +0 -262
- package/src/scss/mint.scss +0 -7
- package/src/scss/noscript.scss +0 -14
- package/src/ts/imports/components/header.ts +0 -408
- package/src/ts/imports/components/index.ts +0 -4
- package/src/ts/imports/enums/index.ts +0 -4
- package/src/ts/imports/enums/side.ts +0 -9
- package/src/ts/imports/index.ts +0 -7
- package/src/ts/imports/models/color.ts +0 -96
- package/src/ts/imports/models/file.ts +0 -16
- package/src/ts/imports/models/index.ts +0 -9
- package/src/ts/imports/models/item.ts +0 -72
- package/src/ts/imports/models/minify.ts +0 -11
- package/src/ts/imports/models/page.ts +0 -19
- package/src/ts/imports/models/recaptcha.ts +0 -8
- package/src/ts/imports/util/async.ts +0 -12
- package/src/ts/imports/util/display.ts +0 -72
- package/src/ts/imports/util/event.ts +0 -93
- package/src/ts/imports/util/icon.ts +0 -67
- package/src/ts/imports/util/index.ts +0 -15
- package/src/ts/imports/util/list.ts +0 -39
- package/src/ts/imports/util/math.ts +0 -17
- package/src/ts/imports/util/object.ts +0 -234
- package/src/ts/imports/util/scroll.ts +0 -53
- package/src/ts/imports/util/selectors.ts +0 -185
- package/src/ts/imports/util/settings.ts +0 -85
- package/src/ts/imports/util/text.ts +0 -151
- package/src/ts/imports/util/window.ts +0 -14
- package/src/ts/index.ts +0 -10
package/src/ts/imports/index.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Color
|
|
3
|
-
*/
|
|
4
|
-
export class mintColor {
|
|
5
|
-
protected static hexBase: number = 16;
|
|
6
|
-
protected static hexMax: string = 'FF';
|
|
7
|
-
public r: number;
|
|
8
|
-
public g: number;
|
|
9
|
-
public b: number;
|
|
10
|
-
public a: number;
|
|
11
|
-
|
|
12
|
-
constructor (args: {[key: string]: number | string}) {
|
|
13
|
-
this.r = typeof args.r === 'number' ? Math.max(Math.min(args.r, mintColor.hexBase ** 2 - 1), 0) : 0;
|
|
14
|
-
this.g = typeof args.g === 'number' ? Math.max(Math.min(args.g, mintColor.hexBase ** 2 - 1), 0) : 0;
|
|
15
|
-
this.b = typeof args.b === 'number' ? Math.max(Math.min(args.b, mintColor.hexBase ** 2 - 1), 0) : 0;
|
|
16
|
-
this.a = typeof args.a === 'number' ? Math.max(Math.min(args.a, 1), 0) : 1;
|
|
17
|
-
if (typeof args.color === 'string') {
|
|
18
|
-
this.stringConstructor(args.color);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Constructor from a string argument
|
|
24
|
-
*/
|
|
25
|
-
protected stringConstructor (str: string) : void {
|
|
26
|
-
if (str.startsWith('#')) {
|
|
27
|
-
this.hexConstructor(str);
|
|
28
|
-
} else {
|
|
29
|
-
if (~str.indexOf('linear-gradient')) {
|
|
30
|
-
str = str.substring(str.indexOf('linear-gradient'), str.length);
|
|
31
|
-
}
|
|
32
|
-
this.rgbConstructor(str);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Constructor from a hex argument
|
|
38
|
-
*/
|
|
39
|
-
protected hexConstructor (hex: string) : void {
|
|
40
|
-
switch (hex.length) {
|
|
41
|
-
case 1:
|
|
42
|
-
case 5:
|
|
43
|
-
case 6:
|
|
44
|
-
return;
|
|
45
|
-
case 2:
|
|
46
|
-
hex = '#' + hex[1] + hex[1] + hex[1] + hex[1] + hex[1] + hex[1] + mintColor.hexMax;
|
|
47
|
-
break;
|
|
48
|
-
case 3:
|
|
49
|
-
hex = '#' + hex[1] + hex[1] + hex[1] + hex[2] + hex[2] + hex[2] + mintColor.hexMax;
|
|
50
|
-
break;
|
|
51
|
-
case 4:
|
|
52
|
-
hex = '#' + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3] + mintColor.hexMax;
|
|
53
|
-
break;
|
|
54
|
-
case 7:
|
|
55
|
-
hex += mintColor.hexMax;
|
|
56
|
-
break;
|
|
57
|
-
case 8:
|
|
58
|
-
hex += hex[hex.length - 1];
|
|
59
|
-
break;
|
|
60
|
-
default:
|
|
61
|
-
hex = hex.substring(0, 9);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
this.r = parseInt(hex.substring(1, 3), mintColor.hexBase);
|
|
65
|
-
this.g = parseInt(hex.substring(3, 5), mintColor.hexBase);
|
|
66
|
-
this.b = parseInt(hex.substring(5, 7), mintColor.hexBase);
|
|
67
|
-
this.a = parseInt(hex.substring(7, 9), mintColor.hexBase) / mintColor.hexBase ** 2;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Constructor from an rgba argument
|
|
72
|
-
*/
|
|
73
|
-
protected rgbConstructor (rgb: string) : void {
|
|
74
|
-
let match: RegExpMatchArray | null = rgb.match(/rgba?\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)?(?:, ?(\d(?:\.\d*)?)\))?/);
|
|
75
|
-
if (match) {
|
|
76
|
-
this.r = parseInt(match[1]);
|
|
77
|
-
this.g = parseInt(match[2]);
|
|
78
|
-
this.b = parseInt(match[3]);
|
|
79
|
-
this.a = parseFloat(match[4]);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Returns the perceived brightness of the color
|
|
85
|
-
*/
|
|
86
|
-
getBrightness () : number {
|
|
87
|
-
if (this.a === 0) {
|
|
88
|
-
return 262;
|
|
89
|
-
}
|
|
90
|
-
if (!isNaN(this.r) && !isNaN(this.g) && !isNaN(this.b)) {
|
|
91
|
-
return Math.round((this.r * 299 + this.g * 587 + this.b * 144) / 1000);
|
|
92
|
-
}
|
|
93
|
-
return -1;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
export default mintColor;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File model for Amplify Storage
|
|
3
|
-
*/
|
|
4
|
-
export interface IMintFile {
|
|
5
|
-
path?: string;
|
|
6
|
-
eTag?: string;
|
|
7
|
-
lastModified?: string;
|
|
8
|
-
size?: number;
|
|
9
|
-
progress?: number;
|
|
10
|
-
error?: boolean;
|
|
11
|
-
fetched?: boolean;
|
|
12
|
-
empty?: boolean;
|
|
13
|
-
files?: { [key: string]: IMintFile }
|
|
14
|
-
metadata?: { [key: string]: string }
|
|
15
|
-
}
|
|
16
|
-
export default IMintFile;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A generic item
|
|
3
|
-
* @note - this class must be convertable with JSON
|
|
4
|
-
* - only add strings, numbers, booleans, arrays, and objects
|
|
5
|
-
*/
|
|
6
|
-
export class MintItem {
|
|
7
|
-
/**
|
|
8
|
-
* Item settings
|
|
9
|
-
*/
|
|
10
|
-
version?: number = 0;
|
|
11
|
-
priority?: number = 0;
|
|
12
|
-
price?: number = 0;
|
|
13
|
-
level?: number = 0;
|
|
14
|
-
size?: number = 0;
|
|
15
|
-
num?: number = 0;
|
|
16
|
-
width?: number = 0;
|
|
17
|
-
height?: number = 0;
|
|
18
|
-
|
|
19
|
-
active?: boolean = false;
|
|
20
|
-
centered?: boolean = false;
|
|
21
|
-
disabled?: boolean = false;
|
|
22
|
-
private?: boolean = false;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Item properties
|
|
26
|
-
*/
|
|
27
|
-
id?: string;
|
|
28
|
-
slug?: string;
|
|
29
|
-
name?: string;
|
|
30
|
-
title?: string;
|
|
31
|
-
subtitle?: string;
|
|
32
|
-
description?: string;
|
|
33
|
-
category?: string;
|
|
34
|
-
type?: string;
|
|
35
|
-
unit?: string;
|
|
36
|
-
logo?: MintItem;
|
|
37
|
-
icon?: string;
|
|
38
|
-
position?: string;
|
|
39
|
-
transform?: string;
|
|
40
|
-
date?: string;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Item links
|
|
44
|
-
*/
|
|
45
|
-
src?: string;
|
|
46
|
-
href?: string;
|
|
47
|
-
target?: string;
|
|
48
|
-
routerLink?: string[];
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Item data
|
|
52
|
-
*/
|
|
53
|
-
attr?: { [key: string]: string } = {};
|
|
54
|
-
params?: { [key: string]: string } = {};
|
|
55
|
-
options?: { [key: string]: string } = {};
|
|
56
|
-
lists?: { [key: string]: string[] } = {};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Item lists
|
|
60
|
-
*/
|
|
61
|
-
paragraphs?: string[] = [];
|
|
62
|
-
classes?: string[] = [];
|
|
63
|
-
items?: MintItem[] = [];
|
|
64
|
-
images?: MintItem[] = [];
|
|
65
|
-
buttons?: MintItem[] = [];
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Item functions
|
|
69
|
-
*/
|
|
70
|
-
click?: Function;
|
|
71
|
-
};
|
|
72
|
-
export default MintItem;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Imports
|
|
3
|
-
*/
|
|
4
|
-
import MintItem from "./item";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Page Interface
|
|
9
|
-
*/
|
|
10
|
-
export interface IMintPage {
|
|
11
|
-
slug: string;
|
|
12
|
-
title?: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
image?: string;
|
|
15
|
-
items?: MintItem[];
|
|
16
|
-
createdAt?: string;
|
|
17
|
-
updatedAt?: string;
|
|
18
|
-
}
|
|
19
|
-
export default IMintPage;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Handles asynchronous operations
|
|
3
|
-
*/
|
|
4
|
-
export abstract class MintAsync {
|
|
5
|
-
/**
|
|
6
|
-
* Wait n milliseconds
|
|
7
|
-
*/
|
|
8
|
-
static wait(ms: number): Promise<void> {
|
|
9
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
export default MintAsync;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Imports
|
|
3
|
-
*/
|
|
4
|
-
import { EMintSide } from '../enums';
|
|
5
|
-
import { MintSettings } from './settings';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Handles the display of elements
|
|
9
|
-
*/
|
|
10
|
-
export abstract class MintDisplay {
|
|
11
|
-
/**
|
|
12
|
-
* Sets the element's height to its `innerHeight`, then to `auto` after a delay
|
|
13
|
-
* @param el - the element whose height will be set
|
|
14
|
-
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
15
|
-
* @param from - the side that the element is animating from
|
|
16
|
-
*/
|
|
17
|
-
static show (el?: HTMLElement | null, delay: number = MintSettings.delay.default, from: EMintSide = EMintSide.Top) : void {
|
|
18
|
-
if (el) {
|
|
19
|
-
el.style.display = '';
|
|
20
|
-
requestAnimationFrame(() => {
|
|
21
|
-
if (from === EMintSide.Top || from === EMintSide.Bottom) {
|
|
22
|
-
el.style.height = `${el.scrollHeight}px`;
|
|
23
|
-
} else {
|
|
24
|
-
el.style.width = `${el.scrollWidth}px`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
setTimeout(() => {
|
|
28
|
-
if (from === EMintSide.Top || from === EMintSide.Bottom) {
|
|
29
|
-
el.style.height = 'auto';
|
|
30
|
-
} else {
|
|
31
|
-
el.style.width = 'auto';
|
|
32
|
-
}
|
|
33
|
-
}, delay);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Sets the element's height to 0
|
|
40
|
-
* @param el - the element whose height will be set
|
|
41
|
-
* @param delay - the amount of time in milliseconds that the show animation will be active
|
|
42
|
-
* @param from - the side that the element is animating from
|
|
43
|
-
*/
|
|
44
|
-
static hide (el?: HTMLElement | null, delay: number = MintSettings.delay.default, from: EMintSide = EMintSide.Top) : void {
|
|
45
|
-
if (el) {
|
|
46
|
-
let height = el.scrollHeight,
|
|
47
|
-
width = el.scrollWidth,
|
|
48
|
-
transition = el.style.transition;
|
|
49
|
-
el.style.transition = '';
|
|
50
|
-
requestAnimationFrame(() => {
|
|
51
|
-
if (from === EMintSide.Top || from === EMintSide.Bottom) {
|
|
52
|
-
el.style.height = `${height}px`;
|
|
53
|
-
} else {
|
|
54
|
-
el.style.width = `${width}px`;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
el.style.transition = transition;
|
|
58
|
-
requestAnimationFrame(() => {
|
|
59
|
-
if (from === EMintSide.Top || from === EMintSide.Bottom) {
|
|
60
|
-
el.style.height = '0';
|
|
61
|
-
} else {
|
|
62
|
-
el.style.width = '0';
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
setTimeout(() => {
|
|
67
|
-
el.style.display = 'none';
|
|
68
|
-
}, delay);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
export default MintDisplay;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import MintSettings from "./settings";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Event helper functions
|
|
5
|
-
*/
|
|
6
|
-
export abstract class MintEvent {
|
|
7
|
-
/**
|
|
8
|
-
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
9
|
-
* @param func - the function to debounce
|
|
10
|
-
* @param wait - the amount of time to wait before running the function
|
|
11
|
-
* @returns - the debounced function
|
|
12
|
-
*/
|
|
13
|
-
static debounce (func: Function, wait: number = MintSettings.delay.default) : Function {
|
|
14
|
-
let timer: number;
|
|
15
|
-
return function (e: any) {
|
|
16
|
-
if (timer) {
|
|
17
|
-
clearTimeout(timer);
|
|
18
|
-
}
|
|
19
|
-
timer = setTimeout(func, wait, e);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Ensures that a function `func` is run only after not being called for `wait` milliseconds
|
|
25
|
-
* @param func - the function to debounce
|
|
26
|
-
* @param wait - the amount of time to wait before running the function
|
|
27
|
-
* @returns - the debounced function as an EventListener
|
|
28
|
-
*/
|
|
29
|
-
static debounceEvent (func: Function, wait: number = MintSettings.delay.default) : EventListener {
|
|
30
|
-
return MintEvent.debounce(func, wait) as EventListener;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
35
|
-
* @param func - the function to throttle
|
|
36
|
-
* @param wait - the amount of time between function calls
|
|
37
|
-
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
38
|
-
* @returns - the throttled function
|
|
39
|
-
*/
|
|
40
|
-
static throttle (func: Function,
|
|
41
|
-
wait: number = MintSettings.delay.default,
|
|
42
|
-
options?: {[key: string]: boolean}) : Function {
|
|
43
|
-
let context: any, args: any, result: any,
|
|
44
|
-
timeout: number, previous: number = 0,
|
|
45
|
-
later: Function = function () {
|
|
46
|
-
previous = options?.leading === false ? 0 : new Date().getTime();
|
|
47
|
-
timeout = 0;
|
|
48
|
-
result = func.apply(context, args);
|
|
49
|
-
if (!timeout) {
|
|
50
|
-
context = args = null;
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
throttled: Function = function (this: any): any {
|
|
54
|
-
let now: number = new Date().getTime();
|
|
55
|
-
if (!previous && options?.leading === false) {
|
|
56
|
-
previous = now;
|
|
57
|
-
}
|
|
58
|
-
let remaining: number = wait - now + previous;
|
|
59
|
-
context = this;
|
|
60
|
-
args = arguments;
|
|
61
|
-
if (remaining <= 0 || remaining > wait) {
|
|
62
|
-
if (timeout) {
|
|
63
|
-
clearTimeout(timeout);
|
|
64
|
-
timeout = 0;
|
|
65
|
-
}
|
|
66
|
-
previous = now;
|
|
67
|
-
result = func.apply(context, args);
|
|
68
|
-
if (!timeout) {
|
|
69
|
-
context = args = null;
|
|
70
|
-
}
|
|
71
|
-
} else if (!timeout && options?.trailing !== false) {
|
|
72
|
-
timeout = window.setTimeout(later, remaining);
|
|
73
|
-
}
|
|
74
|
-
return result;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return throttled;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls
|
|
82
|
-
* @param func - the function to throttle
|
|
83
|
-
* @param wait - the amount of time between function calls
|
|
84
|
-
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \}
|
|
85
|
-
* @returns - the throttled function as an EventListener
|
|
86
|
-
*/
|
|
87
|
-
static throttleEvent (func: Function,
|
|
88
|
-
wait: number = MintSettings.delay.default,
|
|
89
|
-
options?: {[key: string]: boolean}) : EventListener {
|
|
90
|
-
return MintEvent.throttle(func, wait, options) as EventListener;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
export default MintEvent;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Imports
|
|
3
|
-
*/
|
|
4
|
-
import mintObject from "./object";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Icon helper functions
|
|
8
|
-
*/
|
|
9
|
-
export abstract class MintIcon {
|
|
10
|
-
/**
|
|
11
|
-
* Default icons
|
|
12
|
-
*/
|
|
13
|
-
static icons: {[key: string]: string} = {
|
|
14
|
-
'a[href^="mailto:"]': 'far fa-envelope',
|
|
15
|
-
'a[href^="tel:"]': 'fas fa-phone-flip',
|
|
16
|
-
'a[href^="sms:"]': 'far fa-message',
|
|
17
|
-
'a[href^="https://maps"]': 'fas fa-map-location-dot',
|
|
18
|
-
'a[href^="http"]': 'fas fa-up-right-from-square'
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Appends the given icon to the given selector if there is not already an icon appended
|
|
23
|
-
*/
|
|
24
|
-
static append (icon: string, selector: string): void {
|
|
25
|
-
let items: NodeListOf<HTMLElement> = document.querySelectorAll(selector);
|
|
26
|
-
items.forEach((item: HTMLElement) => {
|
|
27
|
-
let iconElement: HTMLElement = document.createElement('i');
|
|
28
|
-
iconElement.classList.add(...icon.split(' '));
|
|
29
|
-
if (!item.querySelector('i')) {
|
|
30
|
-
item.appendChild(iconElement);
|
|
31
|
-
}
|
|
32
|
-
if (iconElement.classList.contains('fa-up-right-from-square')) {
|
|
33
|
-
item.setAttribute('target', '_blank');
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Updates the icons
|
|
40
|
-
* @param icons - the icons to update
|
|
41
|
-
*/
|
|
42
|
-
static update (icons?: {[key: string]: string | false}): void {
|
|
43
|
-
let activeIcons: {[key: string]: string} = mintObject.removeValues({
|
|
44
|
-
...this.icons,
|
|
45
|
-
...icons
|
|
46
|
-
}, [false]);
|
|
47
|
-
|
|
48
|
-
Object.keys(activeIcons).forEach((selector: string) => {
|
|
49
|
-
this.append(activeIcons[selector], selector);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Removes the given icon from the given selector
|
|
55
|
-
* @param icon - the icon to remove
|
|
56
|
-
*/
|
|
57
|
-
static remove (icon: string, selector: string): void {
|
|
58
|
-
let items: NodeListOf<HTMLElement> = document.querySelectorAll(selector);
|
|
59
|
-
items.forEach((item: HTMLElement) => {
|
|
60
|
-
let iconElement: HTMLElement | null = item.querySelector('i');
|
|
61
|
-
if (iconElement) {
|
|
62
|
-
iconElement.remove();
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
export default MintIcon;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Forward all exports from the util directory
|
|
3
|
-
*/
|
|
4
|
-
export * from './async';
|
|
5
|
-
export * from './display';
|
|
6
|
-
export * from './event';
|
|
7
|
-
export * from './icon';
|
|
8
|
-
export * from './list';
|
|
9
|
-
export * from './math';
|
|
10
|
-
export * from './object';
|
|
11
|
-
export * from './scroll';
|
|
12
|
-
export * from './selectors';
|
|
13
|
-
export * from './settings';
|
|
14
|
-
export * from './text';
|
|
15
|
-
export * from './window';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* List functions for the util library
|
|
3
|
-
*/
|
|
4
|
-
export abstract class MintList {
|
|
5
|
-
/**
|
|
6
|
-
* Returns a copy of the provided list with the items in random order
|
|
7
|
-
* @param list - the list to shuffle
|
|
8
|
-
* @returns - the shuffled list
|
|
9
|
-
*/
|
|
10
|
-
static shuffleCopy (list: any[]): any[] {
|
|
11
|
-
let copy = [...list];
|
|
12
|
-
for (let i = copy.length - 1; i > 0; i--) {
|
|
13
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
14
|
-
[copy[i], copy[j]] = [copy[j], copy[i]];
|
|
15
|
-
}
|
|
16
|
-
return copy;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Filters the array in place based on a test condition and returns the filtered array.
|
|
21
|
-
* This method modifies the original array by removing elements that do not pass the test implemented by the provided function.
|
|
22
|
-
*
|
|
23
|
-
* @template T The type of elements in the array.
|
|
24
|
-
* @param {T[]} list The array to filter, which will be modified in place.
|
|
25
|
-
* @param {(item: T) => boolean} test A function that tests each element of the array. Return `true` to keep the element, `false` otherwise.
|
|
26
|
-
* @returns {T[]} The original array with only the elements that passed the test.
|
|
27
|
-
*/
|
|
28
|
-
static filter<T> (list: T[], test: (item: T) => boolean): T[] {
|
|
29
|
-
let newLength = 0;
|
|
30
|
-
for (let i = 0; i < list.length; i++) {
|
|
31
|
-
if (test(list[i])) {
|
|
32
|
-
list[newLength++] = list[i];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
list.length = newLength;
|
|
36
|
-
return list;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export default MintList;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Math functions for the util library
|
|
3
|
-
*/
|
|
4
|
-
export abstract class MintMath {
|
|
5
|
-
/**
|
|
6
|
-
* Get a random integer between min and max
|
|
7
|
-
* @param max Maximum value to return
|
|
8
|
-
* @param min Minimum value to return (default is 0)
|
|
9
|
-
* @returns a random integer between min and max
|
|
10
|
-
*/
|
|
11
|
-
static randomInt (max: number, min: number = 0): number {
|
|
12
|
-
min = Math.ceil(min);
|
|
13
|
-
max = Math.floor(max);
|
|
14
|
-
return Math.floor(Math.random() * (max - min) + min);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
export default MintMath;
|