@appartmint/mint 0.14.2 → 0.14.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/css/mint.css +14 -2
- package/dist/css/mint.css.map +1 -1
- package/dist/css/mint.min.css +1 -1
- package/dist/css/mint.min.css.map +1 -1
- package/dist/js/imports/components/header.d.ts +124 -124
- package/dist/js/imports/enum.d.ts +9 -9
- package/dist/js/imports/models/color.d.ts +31 -31
- package/dist/js/imports/models/item.d.ts +69 -69
- package/dist/js/imports/util/display.d.ts +6 -6
- package/dist/js/imports/util/event.d.ts +6 -6
- package/dist/js/imports/util/icon.d.ts +28 -28
- package/dist/js/imports/util/list.d.ts +12 -12
- package/dist/js/imports/util/math.d.ts +13 -13
- package/dist/js/imports/util/object.d.ts +65 -65
- package/dist/js/imports/util/scroll.d.ts +19 -0
- package/dist/js/imports/util/scroll.d.ts.map +1 -0
- package/dist/js/imports/util/selectors.d.ts +121 -121
- package/dist/js/imports/util/settings.d.ts +38 -38
- package/dist/js/imports/util/text.d.ts +16 -16
- package/dist/js/imports/util/window.d.ts +6 -6
- package/dist/js/index.d.ts +24 -23
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +384 -323
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.min.js +1 -1
- package/dist/js/index.min.js.map +1 -1
- package/dist/js/util.d.ts +77 -77
- package/dist/js/util.js +67 -67
- package/dist/js/util.js.map +1 -1
- package/dist/js/util.min.js.map +1 -1
- package/package.json +1 -1
- package/src/scss/imports/_index.scss +8 -8
- package/src/scss/imports/components/_cards.scss +25 -18
- package/src/scss/imports/components/_index.scss +7 -7
- package/src/scss/imports/global/_global.scss +1 -0
- package/src/scss/imports/global/_icons.scss +6 -6
- package/src/scss/imports/global/_text.scss +4 -0
- package/src/scss/imports/global/_texture.scss +6 -1
- package/src/scss/imports/util/_index.scss +8 -8
- package/src/ts/imports/enum.ts +9 -9
- package/src/ts/imports/models/color.ts +96 -96
- package/src/ts/imports/util/display.ts +6 -6
- package/src/ts/imports/util/event.ts +7 -7
- package/src/ts/imports/util/list.ts +19 -19
- package/src/ts/imports/util/math.ts +17 -17
- package/src/ts/imports/util/scroll.ts +39 -0
- package/src/ts/imports/util/window.ts +6 -6
- package/src/ts/index.ts +34 -33
package/src/ts/imports/enum.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Side Enum
|
|
3
|
-
*/
|
|
4
|
-
export enum mintSide {
|
|
5
|
-
Top,
|
|
6
|
-
Right,
|
|
7
|
-
Bottom,
|
|
8
|
-
Left
|
|
9
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Side Enum
|
|
3
|
+
*/
|
|
4
|
+
export enum mintSide {
|
|
5
|
+
Top,
|
|
6
|
+
Right,
|
|
7
|
+
Bottom,
|
|
8
|
+
Left
|
|
9
|
+
};
|
|
@@ -1,96 +1,96 @@
|
|
|
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
|
+
/**
|
|
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,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Handles the display of elements
|
|
3
|
-
*/
|
|
4
|
-
export abstract class mintDisplay {
|
|
5
|
-
|
|
6
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Handles the display of elements
|
|
3
|
+
*/
|
|
4
|
+
export abstract class mintDisplay {
|
|
5
|
+
|
|
6
|
+
};
|
|
7
7
|
export default mintDisplay;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event helper functions
|
|
3
|
-
*/
|
|
4
|
-
export abstract class mintEvent {
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
export default mintEvent;
|
|
1
|
+
/**
|
|
2
|
+
* Event helper functions
|
|
3
|
+
*/
|
|
4
|
+
export abstract class mintEvent {
|
|
5
|
+
|
|
6
|
+
};
|
|
7
|
+
export default mintEvent;
|
|
@@ -1,19 +1,19 @@
|
|
|
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 shuffle (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
|
-
export default mintList;
|
|
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 shuffle (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
|
+
export default mintList;
|
|
@@ -1,17 +1,17 @@
|
|
|
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;
|
|
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;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scroll functions
|
|
3
|
+
*/
|
|
4
|
+
export abstract class mintScroll {
|
|
5
|
+
/**
|
|
6
|
+
* Scroll to the top of the page
|
|
7
|
+
*/
|
|
8
|
+
static toTop(): void {
|
|
9
|
+
window.scrollTo(0, 0);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Scroll to the bottom of the page
|
|
14
|
+
*/
|
|
15
|
+
static toBottom(): void {
|
|
16
|
+
window.scrollTo(0, document.body.scrollHeight);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Show visible elements
|
|
21
|
+
*/
|
|
22
|
+
static showElements(): void {
|
|
23
|
+
let elements = document.querySelectorAll('.mint-fall-in:not(.mint-show)'),
|
|
24
|
+
elementsToShow: Element[] = [];
|
|
25
|
+
for (let i = 0; i < elements.length; i++) {
|
|
26
|
+
if (elements[i].getBoundingClientRect().top < 0) {
|
|
27
|
+
elements[i].classList.add('mint-show');
|
|
28
|
+
} else if (elements[i].getBoundingClientRect().top < window.innerHeight * 3 / 4) {
|
|
29
|
+
elementsToShow.push(elements[i]);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
for (let i = 0; i < elementsToShow.length; i++) {
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
elementsToShow[i].classList.add('mint-show');
|
|
35
|
+
}, i * 200 + i * i * 20);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export default mintScroll;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Functions related to the browser window.
|
|
3
|
-
*/
|
|
4
|
-
export abstract class mintWindow {
|
|
5
|
-
|
|
6
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Functions related to the browser window.
|
|
3
|
+
*/
|
|
4
|
+
export abstract class mintWindow {
|
|
5
|
+
|
|
6
|
+
};
|
|
7
7
|
export default mintWindow;
|
package/src/ts/index.ts
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A library for building responsive web applications.
|
|
3
|
-
*
|
|
4
|
-
* @packageDocumentation
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Exports
|
|
9
|
-
*/
|
|
10
|
-
// Enums
|
|
11
|
-
export { mintSide } from './imports/enum';
|
|
12
|
-
|
|
13
|
-
// Components
|
|
14
|
-
export { mintHeader } from './imports/components/header';
|
|
15
|
-
|
|
16
|
-
// Models
|
|
17
|
-
export { mintColor } from './imports/models/color';
|
|
18
|
-
export { mintItem } from './imports/models/item';
|
|
19
|
-
|
|
20
|
-
// Utilities
|
|
21
|
-
export { mintDisplay } from './imports/util/display';
|
|
22
|
-
export { mintEvent } from './imports/util/event';
|
|
23
|
-
export { mintIcon } from './imports/util/icon';
|
|
24
|
-
export { mintList } from './imports/util/list';
|
|
25
|
-
export { mintMath } from './imports/util/math';
|
|
26
|
-
export { mintObject } from './imports/util/object';
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export {
|
|
33
|
-
export {
|
|
1
|
+
/**
|
|
2
|
+
* A library for building responsive web applications.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Exports
|
|
9
|
+
*/
|
|
10
|
+
// Enums
|
|
11
|
+
export { mintSide } from './imports/enum';
|
|
12
|
+
|
|
13
|
+
// Components
|
|
14
|
+
export { mintHeader } from './imports/components/header';
|
|
15
|
+
|
|
16
|
+
// Models
|
|
17
|
+
export { mintColor } from './imports/models/color';
|
|
18
|
+
export { mintItem } from './imports/models/item';
|
|
19
|
+
|
|
20
|
+
// Utilities
|
|
21
|
+
export { mintDisplay } from './imports/util/display';
|
|
22
|
+
export { mintEvent } from './imports/util/event';
|
|
23
|
+
export { mintIcon } from './imports/util/icon';
|
|
24
|
+
export { mintList } from './imports/util/list';
|
|
25
|
+
export { mintMath } from './imports/util/math';
|
|
26
|
+
export { mintObject } from './imports/util/object';
|
|
27
|
+
export { mintScroll } from './imports/util/scroll';
|
|
28
|
+
export { mintText } from './imports/util/text';
|
|
29
|
+
export { mintWindow } from './imports/util/window';
|
|
30
|
+
|
|
31
|
+
// Objects
|
|
32
|
+
export { mintSelectors } from './imports/util/selectors';
|
|
33
|
+
export { mintSettings } from './imports/util/settings';
|
|
34
|
+
export { mintUtil, default } from './util';
|