@stats-organization/github-readme-stats-core 2.1.2 → 2.1.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 +1 -1
- package/build/api/gist.d.ts.map +1 -1
- package/build/api/gist.js +0 -1
- package/build/api/index.d.ts.map +1 -1
- package/build/api/index.js +0 -1
- package/build/api/pin.d.ts.map +1 -1
- package/build/api/pin.js +0 -1
- package/build/api/top-langs.d.ts.map +1 -1
- package/build/api/top-langs.js +0 -1
- package/build/api/wakatime.d.ts.map +1 -1
- package/build/api/wakatime.js +0 -1
- package/build/cards/gist.d.ts.map +1 -1
- package/build/cards/gist.js +0 -1
- package/build/cards/repo.d.ts.map +1 -1
- package/build/cards/repo.js +0 -1
- package/build/cards/stats.d.ts.map +1 -1
- package/build/cards/stats.js +0 -1
- package/build/cards/top-languages.d.ts.map +1 -1
- package/build/cards/top-languages.js +0 -1
- package/build/cards/wakatime.d.ts.map +1 -1
- package/build/cards/wakatime.js +0 -1
- package/build/common/Card.d.ts +48 -60
- package/build/common/Card.d.ts.map +1 -1
- package/build/common/Card.js +49 -50
- package/build/common/I18n.d.ts +13 -14
- package/build/common/I18n.d.ts.map +1 -1
- package/build/common/I18n.js +13 -12
- package/build/common/color.d.ts +30 -40
- package/build/common/color.d.ts.map +1 -1
- package/build/common/color.js +30 -42
- package/build/common/config.d.ts +18 -2
- package/build/common/config.d.ts.map +1 -1
- package/build/common/config.js +17 -26
- package/build/common/constants.d.ts +2 -2
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +5 -3
- package/build/common/error.d.ts +36 -29
- package/build/common/error.d.ts.map +1 -1
- package/build/common/error.js +14 -10
- package/build/common/fmt.d.ts +14 -13
- package/build/common/fmt.d.ts.map +1 -1
- package/build/common/fmt.js +19 -15
- package/build/common/html.d.ts +2 -4
- package/build/common/html.d.ts.map +1 -1
- package/build/common/html.js +1 -5
- package/build/common/http.d.ts.map +1 -1
- package/build/common/http.js +0 -1
- package/build/common/icons.d.ts +22 -21
- package/build/common/icons.d.ts.map +1 -1
- package/build/common/icons.js +4 -5
- package/build/common/languageColors.json +2 -0
- package/build/common/ops.d.ts.map +1 -1
- package/build/common/ops.js +0 -1
- package/build/common/render.d.ts.map +1 -1
- package/build/common/render.js +0 -1
- package/build/common/retryer.d.ts +18 -15
- package/build/common/retryer.d.ts.map +1 -1
- package/build/common/retryer.js +21 -30
- package/build/fetchers/gist.d.ts.map +1 -1
- package/build/fetchers/gist.js +0 -1
- package/build/fetchers/repo.d.ts.map +1 -1
- package/build/fetchers/repo.js +3 -6
- package/build/fetchers/stats.d.ts.map +1 -1
- package/build/fetchers/stats.js +3 -6
- package/build/fetchers/top-languages.d.ts.map +1 -1
- package/build/fetchers/top-languages.js +0 -1
- package/build/fetchers/wakatime.d.ts.map +1 -1
- package/build/fetchers/wakatime.js +0 -1
- package/build/translations.d.ts +627 -24
- package/build/translations.d.ts.map +1 -1
- package/build/translations.js +7 -8
- package/package.json +5 -5
- package/src/api/gist.js +0 -2
- package/src/api/index.js +0 -2
- package/src/api/pin.js +0 -2
- package/src/api/top-langs.js +0 -2
- package/src/api/wakatime.js +0 -2
- package/src/cards/gist.js +0 -2
- package/src/cards/repo.js +0 -2
- package/src/cards/stats.js +0 -2
- package/src/cards/top-languages.js +0 -2
- package/src/cards/wakatime.js +0 -2
- package/src/common/{Card.js → Card.ts} +89 -61
- package/src/common/I18n.ts +49 -0
- package/src/common/{color.js → color.ts} +55 -51
- package/src/common/config.ts +83 -0
- package/src/common/constants.ts +10 -0
- package/src/common/{error.js → error.ts} +20 -14
- package/src/common/{fmt.js → fmt.ts} +27 -19
- package/src/common/{html.js → html.ts} +3 -8
- package/src/common/http.js +0 -2
- package/src/common/{icons.js → icons.ts} +9 -7
- package/src/common/languageColors.json +2 -0
- package/src/common/ops.js +0 -2
- package/src/common/render.js +0 -2
- package/src/common/{retryer.js → retryer.ts} +45 -32
- package/src/fetchers/gist.js +0 -2
- package/src/fetchers/repo.js +3 -7
- package/src/fetchers/stats.js +3 -7
- package/src/fetchers/top-languages.js +0 -2
- package/src/fetchers/types.d.ts +1 -1
- package/src/fetchers/wakatime.js +0 -2
- package/src/{translations.js → translations.ts} +14 -10
- package/src/common/I18n.js +0 -42
- package/src/common/config.js +0 -78
- package/src/common/constants.js +0 -9
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Core library powering [GitHub Stats Extended](https://github.com/stats-organization/github-stats-extended) and [GitHub Readme Stats Action](https://github.com/
|
|
1
|
+
Core library powering [GitHub Stats Extended](https://github.com/stats-organization/github-stats-extended) and [GitHub Readme Stats Action](https://github.com/stats-organization/github-readme-stats-action).
|
package/build/api/gist.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gist.d.ts","sourceRoot":"","sources":["../../src/api/gist.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gist.d.ts","sourceRoot":"","sources":["../../src/api/gist.js"],"names":[],"mappings":"AAWe;;;;;;;;;;;;;;;;GAqFd"}
|
package/build/api/gist.js
CHANGED
package/build/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.js"],"names":[],"mappings":"AAWe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2Kd"}
|
package/build/api/index.js
CHANGED
package/build/api/pin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pin.d.ts","sourceRoot":"","sources":["../../src/api/pin.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pin.d.ts","sourceRoot":"","sources":["../../src/api/pin.js"],"names":[],"mappings":"AAWe;;;;;;;;;;;;;;;;;;;;;;;;GAoId"}
|
package/build/api/pin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"top-langs.d.ts","sourceRoot":"","sources":["../../src/api/top-langs.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"top-langs.d.ts","sourceRoot":"","sources":["../../src/api/top-langs.js"],"names":[],"mappings":"AAWe;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0Jd"}
|
package/build/api/top-langs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wakatime.d.ts","sourceRoot":"","sources":["../../src/api/wakatime.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wakatime.d.ts","sourceRoot":"","sources":["../../src/api/wakatime.js"],"names":[],"mappings":"AAWe;;;;;;;;;;;;;;;;;;;;;;;;;GAmGd"}
|
package/build/api/wakatime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gist.d.ts","sourceRoot":"","sources":["../../src/cards/gist.js"],"names":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"gist.d.ts","sourceRoot":"","sources":["../../src/cards/gist.js"],"names":[],"mappings":";;;;;;;;AA0BA;;;GAGG;AAEH;;;;;;GAMG;AACH,yCAJW,QAAQ,YACR,OAAO,CAAC,eAAe,CAAC,GACtB,MAAM,CAkJlB"}
|
package/build/cards/gist.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/cards/repo.js"],"names":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/cards/repo.js"],"names":[],"mappings":";;;;;;;;AAiDA;;;GAGG;AAEH;;;;;;GAMG;AACH,qCAJW,cAAc,YACd,OAAO,CAAC,eAAe,CAAC,GACtB,MAAM,CA6SlB"}
|
package/build/cards/repo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/cards/stats.js"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/cards/stats.js"],"names":[],"mappings":";;AA4PA;;;GAGG;AAEH;;;;;;GAMG;AACH,uCAJW,SAAS,WACT,OAAO,CAAC,eAAe,CAAC,+CACtB,MAAM,CAsZlB;AAzmBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,kKAfG;IAAuB,IAAI,EAAnB,MAAM;IACS,KAAK,EAApB,MAAM;IACS,KAAK,EAApB,MAAM;IACS,EAAE,EAAjB,MAAM;IACU,UAAU,GAA1B,MAAM,YAAC;IACQ,KAAK,EAApB,MAAM;IACU,SAAS,EAAzB,OAAO;IACQ,aAAa,EAA5B,MAAM;IACU,IAAI,EAApB,OAAO;IACQ,YAAY,EAA3B,MAAM;IACU,eAAe,GAA/B,MAAM,YAAC;IACQ,IAAI,EAAnB,MAAM;IACS,YAAY,EAA3B,MAAM;CACd,GAAU,MAAM,CAuDlB"}
|
package/build/cards/stats.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"top-languages.d.ts","sourceRoot":"","sources":["../../src/cards/top-languages.js"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"top-languages.d.ts","sourceRoot":"","sources":["../../src/cards/top-languages.js"],"names":[],"mappings":";;qBAowBa,cAAc,CAAC,QAAQ,CAAC;;AA3uBrC;;GAEG;AAEH;;;;;GAKG;AACH,oCAHW,IAAI,EAAE,GACJ;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAOvD;AAEH;;;;;GAKG;AACH,iDAHW,MAAM,GACJ,MAAM,CAE4D;AAE/E;;;;;GAKG;AACH,iDAHW,MAAM,GACJ,MAAM,CAE4D;AAE/E;;;;;;;;GAQG;AACH,0CANW,MAAM,WACN,MAAM,UACN,MAAM,kBACN,MAAM,GACJ;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAC,CAQlC;AAED;;;;;;;;GAQG;AACH,0CANW,MAAM,WACN,MAAM,KACN,MAAM,KACN,MAAM,GACJ;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAC,CASpD;AAED;;;;;GAKG;AACH,wCAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;GAKG;AACH,yDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;GAKG;AACH,wDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;GAKG;AACH,uDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;GAKG;AACH,+DAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;GAKG;AACH,qDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;GAIG;AACH,mDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;GAOG;AACH,2CALW,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,eACpB,MAAM,SACN,MAAM,EAAE,YAAC,GACP;IAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,CA4BxD;AA0mBD;;GAEG;AAEH;;;;;;GAMG;AACH,6CAJW,WAAW,YACX,OAAO,CAAC,cAAc,CAAC,GACrB,MAAM,CAkLlB;AA59BD,6BAAuB,GAAG,CAAC;AA2wB3B;;;;;;;GAOG;AACH,4EAJG;IAAuB,MAAM,GAArB,MAAM,YAAC;IACS,aAAa,GAA7B,OAAO,YAAC;CAChB,GAAU,MAAM,CAclB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wakatime.d.ts","sourceRoot":"","sources":["../../src/cards/wakatime.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"wakatime.d.ts","sourceRoot":"","sources":["../../src/cards/wakatime.js"],"names":[],"mappings":";;;AA6NA;;;GAGG;AAEH;;;;;;GAMG;AACH,2CAJW,OAAO,CAAC,YAAY,CAAC,YACrB,OAAO,CAAC,eAAe,CAAC,GACtB,MAAM,CA2OlB"}
|
package/build/cards/wakatime.js
CHANGED
package/build/common/Card.d.ts
CHANGED
|
@@ -1,49 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* @param {string=} args.colors.titleColor Card title color.
|
|
15
|
-
* @param {string=} args.colors.textColor Card text color.
|
|
16
|
-
* @param {string=} args.colors.iconColor Card icon color.
|
|
17
|
-
* @param {string|string[]=} args.colors.bgColor Card background color.
|
|
18
|
-
* @param {string=} args.colors.borderColor Card border color.
|
|
19
|
-
*/
|
|
20
|
-
constructor({ width, height, border_radius, colors, customTitle, defaultTitle, titlePrefixIcon, }: {
|
|
21
|
-
width?: number | undefined;
|
|
22
|
-
height?: number | undefined;
|
|
23
|
-
border_radius?: number | undefined;
|
|
24
|
-
customTitle?: string | undefined;
|
|
25
|
-
defaultTitle?: string | undefined;
|
|
26
|
-
titlePrefixIcon?: string | undefined;
|
|
27
|
-
colors?: {
|
|
28
|
-
titleColor?: string | undefined;
|
|
29
|
-
textColor?: string | undefined;
|
|
30
|
-
iconColor?: string | undefined;
|
|
31
|
-
bgColor?: (string | string[]) | undefined;
|
|
32
|
-
borderColor?: string | undefined;
|
|
33
|
-
} | undefined;
|
|
34
|
-
});
|
|
1
|
+
interface CardColors {
|
|
2
|
+
/** Card title color. */
|
|
3
|
+
titleColor?: string;
|
|
4
|
+
/** Card text color. */
|
|
5
|
+
textColor?: string;
|
|
6
|
+
/** Card icon color. */
|
|
7
|
+
iconColor?: string;
|
|
8
|
+
/** Card background color. */
|
|
9
|
+
bgColor?: string | Array<string>;
|
|
10
|
+
/** Card border color. */
|
|
11
|
+
borderColor?: string;
|
|
12
|
+
}
|
|
13
|
+
declare class Card {
|
|
35
14
|
width: number;
|
|
36
15
|
height: number;
|
|
37
16
|
hideBorder: boolean;
|
|
38
17
|
hideTitle: boolean;
|
|
39
18
|
border_radius: number;
|
|
40
|
-
colors:
|
|
41
|
-
titleColor?: string | undefined;
|
|
42
|
-
textColor?: string | undefined;
|
|
43
|
-
iconColor?: string | undefined;
|
|
44
|
-
bgColor?: (string | string[]) | undefined;
|
|
45
|
-
borderColor?: string | undefined;
|
|
46
|
-
};
|
|
19
|
+
colors: CardColors;
|
|
47
20
|
title: string;
|
|
48
21
|
css: string;
|
|
49
22
|
paddingX: number;
|
|
@@ -53,57 +26,72 @@ export class Card {
|
|
|
53
26
|
a11yTitle: string;
|
|
54
27
|
a11yDesc: string;
|
|
55
28
|
/**
|
|
56
|
-
*
|
|
29
|
+
* Creates a new card instance.
|
|
30
|
+
*
|
|
31
|
+
* @param props Card arguments.
|
|
32
|
+
* @param props.width Card width.
|
|
33
|
+
* @param props.height Card height.
|
|
34
|
+
* @param props.border_radius Card border radius.
|
|
35
|
+
* @param props.colors Card colors arguments.
|
|
36
|
+
* @param props.customTitle Card custom title.
|
|
37
|
+
* @param props.defaultTitle Card default title.
|
|
38
|
+
* @param props.titlePrefixIcon Card title prefix icon.
|
|
57
39
|
*/
|
|
40
|
+
constructor({ width, height, border_radius, colors, customTitle, defaultTitle, titlePrefixIcon, }: {
|
|
41
|
+
width?: number;
|
|
42
|
+
height?: number;
|
|
43
|
+
border_radius?: number;
|
|
44
|
+
colors?: CardColors;
|
|
45
|
+
customTitle?: string;
|
|
46
|
+
defaultTitle?: string;
|
|
47
|
+
titlePrefixIcon?: string;
|
|
48
|
+
});
|
|
58
49
|
disableAnimations(): void;
|
|
59
50
|
/**
|
|
60
|
-
* @param
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
63
|
-
* @returns {void}
|
|
51
|
+
* @param props The props object.
|
|
52
|
+
* @param props.title Accessibility title.
|
|
53
|
+
* @param props.desc Accessibility description.
|
|
64
54
|
*/
|
|
65
|
-
setAccessibilityLabel({ title, desc }: {
|
|
55
|
+
setAccessibilityLabel({ title, desc, }: {
|
|
66
56
|
title: string;
|
|
67
57
|
desc: string;
|
|
68
58
|
}): void;
|
|
69
59
|
/**
|
|
70
|
-
* @param
|
|
71
|
-
* @returns {void}
|
|
60
|
+
* @param value The CSS to add to the card.
|
|
72
61
|
*/
|
|
73
62
|
setCSS(value: string): void;
|
|
74
63
|
/**
|
|
75
|
-
* @param
|
|
76
|
-
* @returns {void}
|
|
64
|
+
* @param value Whether to hide the border or not.
|
|
77
65
|
*/
|
|
78
66
|
setHideBorder(value: boolean): void;
|
|
79
67
|
/**
|
|
80
|
-
* @param
|
|
81
|
-
* @returns {void}
|
|
68
|
+
* @param value Whether to hide the title or not.
|
|
82
69
|
*/
|
|
83
70
|
setHideTitle(value: boolean): void;
|
|
84
71
|
/**
|
|
85
|
-
* @param
|
|
86
|
-
* @returns {void}
|
|
72
|
+
* @param text The title to set.
|
|
87
73
|
*/
|
|
88
74
|
setTitle(text: string): void;
|
|
89
75
|
/**
|
|
90
|
-
* @returns
|
|
76
|
+
* @returns The rendered card title.
|
|
91
77
|
*/
|
|
92
78
|
renderTitle(): string;
|
|
93
79
|
/**
|
|
94
|
-
* @returns
|
|
80
|
+
* @returns The rendered card gradient.
|
|
95
81
|
*/
|
|
96
82
|
renderGradient(): string;
|
|
97
83
|
/**
|
|
98
84
|
* Retrieves css animations for a card.
|
|
99
85
|
*
|
|
100
|
-
* @returns
|
|
86
|
+
* @returns Animation css.
|
|
101
87
|
*/
|
|
102
88
|
getAnimations: () => string;
|
|
103
89
|
/**
|
|
104
|
-
* @param
|
|
105
|
-
* @returns
|
|
90
|
+
* @param body The inner body of the card.
|
|
91
|
+
* @returns The rendered card.
|
|
106
92
|
*/
|
|
107
93
|
render(body: string): string;
|
|
108
94
|
}
|
|
95
|
+
export { Card };
|
|
96
|
+
export default Card;
|
|
109
97
|
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/common/Card.
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/common/Card.ts"],"names":[],"mappings":"AAGA,UAAU,UAAU;IAClB,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,cAAM,IAAI;IACR,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;OAWG;gBACS,EACV,KAAW,EACX,MAAY,EACZ,aAAmB,EACnB,MAAW,EACX,WAAW,EACX,YAAiB,EACjB,eAAe,GAChB,EAAE;QACD,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,MAAM,CAAC,EAAE,UAAU,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;IAyBD,iBAAiB,IAAI,IAAI;IAIzB;;;;OAIG;IACH,qBAAqB,CAAC,EACpB,KAAK,EACL,IAAI,GACL,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,IAAI;IAKR;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI3B;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAInC;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAOlC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI5B;;OAEG;IACH,WAAW,IAAI,MAAM;IAoCrB;;OAEG;IACH,cAAc,IAAI,MAAM;IA0BxB;;;;OAIG;IACH,aAAa,QAAO,MAAM,CAoBxB;IAEF;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAgE7B;AAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,eAAe,IAAI,CAAC"}
|
package/build/common/Card.js
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
import { encodeHTML } from "./html.js";
|
|
3
2
|
import { flexLayout } from "./render.js";
|
|
4
3
|
class Card {
|
|
4
|
+
width;
|
|
5
|
+
height;
|
|
6
|
+
hideBorder;
|
|
7
|
+
hideTitle;
|
|
8
|
+
border_radius;
|
|
9
|
+
colors;
|
|
10
|
+
title;
|
|
11
|
+
css;
|
|
12
|
+
paddingX;
|
|
13
|
+
paddingY;
|
|
14
|
+
titlePrefixIcon;
|
|
15
|
+
animations;
|
|
16
|
+
a11yTitle;
|
|
17
|
+
a11yDesc;
|
|
5
18
|
/**
|
|
6
19
|
* Creates a new card instance.
|
|
7
20
|
*
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
16
|
-
* @param {string=} args.colors.titleColor Card title color.
|
|
17
|
-
* @param {string=} args.colors.textColor Card text color.
|
|
18
|
-
* @param {string=} args.colors.iconColor Card icon color.
|
|
19
|
-
* @param {string|string[]=} args.colors.bgColor Card background color.
|
|
20
|
-
* @param {string=} args.colors.borderColor Card border color.
|
|
21
|
+
* @param props Card arguments.
|
|
22
|
+
* @param props.width Card width.
|
|
23
|
+
* @param props.height Card height.
|
|
24
|
+
* @param props.border_radius Card border radius.
|
|
25
|
+
* @param props.colors Card colors arguments.
|
|
26
|
+
* @param props.customTitle Card custom title.
|
|
27
|
+
* @param props.defaultTitle Card default title.
|
|
28
|
+
* @param props.titlePrefixIcon Card title prefix icon.
|
|
21
29
|
*/
|
|
22
30
|
constructor({ width = 100, height = 100, border_radius = 4.5, colors = {}, customTitle, defaultTitle = "", titlePrefixIcon, }) {
|
|
23
31
|
this.width = width;
|
|
@@ -27,10 +35,7 @@ class Card {
|
|
|
27
35
|
this.border_radius = border_radius;
|
|
28
36
|
// returns theme based colors with proper overrides and defaults
|
|
29
37
|
this.colors = colors;
|
|
30
|
-
this.title =
|
|
31
|
-
customTitle === undefined
|
|
32
|
-
? encodeHTML(defaultTitle)
|
|
33
|
-
: encodeHTML(customTitle);
|
|
38
|
+
this.title = encodeHTML(customTitle === undefined ? defaultTitle : customTitle);
|
|
34
39
|
this.css = "";
|
|
35
40
|
this.paddingX = 25;
|
|
36
41
|
this.paddingY = 35;
|
|
@@ -39,39 +44,32 @@ class Card {
|
|
|
39
44
|
this.a11yTitle = "";
|
|
40
45
|
this.a11yDesc = "";
|
|
41
46
|
}
|
|
42
|
-
/**
|
|
43
|
-
* @returns {void}
|
|
44
|
-
*/
|
|
45
47
|
disableAnimations() {
|
|
46
48
|
this.animations = false;
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @returns {void}
|
|
51
|
+
* @param props The props object.
|
|
52
|
+
* @param props.title Accessibility title.
|
|
53
|
+
* @param props.desc Accessibility description.
|
|
53
54
|
*/
|
|
54
|
-
setAccessibilityLabel({ title, desc }) {
|
|
55
|
+
setAccessibilityLabel({ title, desc, }) {
|
|
55
56
|
this.a11yTitle = title;
|
|
56
57
|
this.a11yDesc = desc;
|
|
57
58
|
}
|
|
58
59
|
/**
|
|
59
|
-
* @param
|
|
60
|
-
* @returns {void}
|
|
60
|
+
* @param value The CSS to add to the card.
|
|
61
61
|
*/
|
|
62
62
|
setCSS(value) {
|
|
63
63
|
this.css = value;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* @param
|
|
67
|
-
* @returns {void}
|
|
66
|
+
* @param value Whether to hide the border or not.
|
|
68
67
|
*/
|
|
69
68
|
setHideBorder(value) {
|
|
70
69
|
this.hideBorder = value;
|
|
71
70
|
}
|
|
72
71
|
/**
|
|
73
|
-
* @param
|
|
74
|
-
* @returns {void}
|
|
72
|
+
* @param value Whether to hide the title or not.
|
|
75
73
|
*/
|
|
76
74
|
setHideTitle(value) {
|
|
77
75
|
this.hideTitle = value;
|
|
@@ -80,14 +78,13 @@ class Card {
|
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
80
|
/**
|
|
83
|
-
* @param
|
|
84
|
-
* @returns {void}
|
|
81
|
+
* @param text The title to set.
|
|
85
82
|
*/
|
|
86
83
|
setTitle(text) {
|
|
87
84
|
this.title = text;
|
|
88
85
|
}
|
|
89
86
|
/**
|
|
90
|
-
* @returns
|
|
87
|
+
* @returns The rendered card title.
|
|
91
88
|
*/
|
|
92
89
|
renderTitle() {
|
|
93
90
|
const titleText = `
|
|
@@ -108,7 +105,7 @@ class Card {
|
|
|
108
105
|
width="16"
|
|
109
106
|
height="16"
|
|
110
107
|
>
|
|
111
|
-
${this.titlePrefixIcon}
|
|
108
|
+
${String(this.titlePrefixIcon)}
|
|
112
109
|
</svg>
|
|
113
110
|
`;
|
|
114
111
|
return `
|
|
@@ -124,7 +121,7 @@ class Card {
|
|
|
124
121
|
`;
|
|
125
122
|
}
|
|
126
123
|
/**
|
|
127
|
-
* @returns
|
|
124
|
+
* @returns The rendered card gradient.
|
|
128
125
|
*/
|
|
129
126
|
renderGradient() {
|
|
130
127
|
if (typeof this.colors.bgColor !== "object") {
|
|
@@ -136,13 +133,15 @@ class Card {
|
|
|
136
133
|
<defs>
|
|
137
134
|
<linearGradient
|
|
138
135
|
id="gradient"
|
|
139
|
-
gradientTransform="rotate(${this.colors.bgColor[0]})"
|
|
136
|
+
gradientTransform="rotate(${String(this.colors.bgColor[0])})"
|
|
140
137
|
gradientUnits="userSpaceOnUse"
|
|
141
138
|
>
|
|
142
|
-
${gradients
|
|
143
|
-
|
|
139
|
+
${gradients
|
|
140
|
+
.map((grad, index) => {
|
|
141
|
+
const offset = (index * 100) / (gradients.length - 1);
|
|
144
142
|
return `<stop offset="${offset}%" stop-color="#${grad}" />`;
|
|
145
|
-
})
|
|
143
|
+
})
|
|
144
|
+
.join(",")}
|
|
146
145
|
</linearGradient>
|
|
147
146
|
</defs>
|
|
148
147
|
`
|
|
@@ -151,7 +150,7 @@ class Card {
|
|
|
151
150
|
/**
|
|
152
151
|
* Retrieves css animations for a card.
|
|
153
152
|
*
|
|
154
|
-
* @returns
|
|
153
|
+
* @returns Animation css.
|
|
155
154
|
*/
|
|
156
155
|
getAnimations = () => {
|
|
157
156
|
return `
|
|
@@ -175,8 +174,8 @@ class Card {
|
|
|
175
174
|
`;
|
|
176
175
|
};
|
|
177
176
|
/**
|
|
178
|
-
* @param
|
|
179
|
-
* @returns
|
|
177
|
+
* @param body The inner body of the card.
|
|
178
|
+
* @returns The rendered card.
|
|
180
179
|
*/
|
|
181
180
|
render(body) {
|
|
182
181
|
return `
|
|
@@ -194,7 +193,7 @@ class Card {
|
|
|
194
193
|
<style>
|
|
195
194
|
.header {
|
|
196
195
|
font: 600 18px 'Segoe UI', Ubuntu, Sans-Serif;
|
|
197
|
-
fill: ${this.colors.titleColor};
|
|
196
|
+
fill: ${String(this.colors.titleColor)};
|
|
198
197
|
animation: fadeInAnimation 0.8s ease-in-out forwards;
|
|
199
198
|
}
|
|
200
199
|
@supports(-moz-appearance: auto) {
|
|
@@ -204,9 +203,9 @@ class Card {
|
|
|
204
203
|
${this.css}
|
|
205
204
|
|
|
206
205
|
${this.getAnimations()}
|
|
207
|
-
${this.animations
|
|
208
|
-
?
|
|
209
|
-
:
|
|
206
|
+
${this.animations
|
|
207
|
+
? ""
|
|
208
|
+
: `* { animation-duration: 0s !important; animation-delay: 0s !important; }`}
|
|
210
209
|
</style>
|
|
211
210
|
|
|
212
211
|
${this.renderGradient()}
|
|
@@ -217,11 +216,11 @@ class Card {
|
|
|
217
216
|
y="0.5"
|
|
218
217
|
rx="${this.border_radius}"
|
|
219
218
|
height="99%"
|
|
220
|
-
stroke="${this.colors.borderColor}"
|
|
219
|
+
stroke="${String(this.colors.borderColor)}"
|
|
221
220
|
width="${this.width - 1}"
|
|
222
221
|
fill="${typeof this.colors.bgColor === "object"
|
|
223
222
|
? "url(#gradient)"
|
|
224
|
-
: this.colors.bgColor}"
|
|
223
|
+
: String(this.colors.bgColor)}"
|
|
225
224
|
stroke-opacity="${this.hideBorder ? 0 : 1}"
|
|
226
225
|
/>
|
|
227
226
|
|
package/build/common/I18n.d.ts
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* I18n translation class.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
declare class I18n<Translations extends Record<string, Record<string, string>>> {
|
|
5
|
+
locale: string;
|
|
6
|
+
translations: Translations;
|
|
5
7
|
/**
|
|
6
|
-
* Constructor.
|
|
7
|
-
*
|
|
8
|
-
* @param
|
|
9
|
-
* @param {string=} options.locale Locale.
|
|
10
|
-
* @param {any} options.translations Translations.
|
|
8
|
+
* @param props Constructor arguments.
|
|
9
|
+
* @param props.locale Locale.
|
|
10
|
+
* @param props.translations Translations.
|
|
11
11
|
*/
|
|
12
|
-
constructor({ locale, translations }: {
|
|
13
|
-
locale?: string
|
|
14
|
-
translations:
|
|
12
|
+
constructor({ locale, translations, }: {
|
|
13
|
+
locale?: string;
|
|
14
|
+
translations: Translations;
|
|
15
15
|
});
|
|
16
|
-
locale: string;
|
|
17
|
-
translations: any;
|
|
18
16
|
/**
|
|
19
17
|
* Get translation.
|
|
20
18
|
*
|
|
21
|
-
* @param
|
|
22
|
-
* @returns
|
|
19
|
+
* @param str String to translate.
|
|
20
|
+
* @returns Translated string.
|
|
23
21
|
*/
|
|
24
|
-
t(str: string): string;
|
|
22
|
+
t(str: keyof Translations & string): string;
|
|
25
23
|
}
|
|
24
|
+
export { I18n };
|
|
26
25
|
//# sourceMappingURL=I18n.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I18n.d.ts","sourceRoot":"","sources":["../../src/common/I18n.
|
|
1
|
+
{"version":3,"file":"I18n.d.ts","sourceRoot":"","sources":["../../src/common/I18n.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,cAAM,IAAI,CAAC,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,YAAY,CAAC;IAE3B;;;;OAIG;gBACS,EACV,MAAM,EACN,YAAY,GACb,EAAE;QACD,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,YAAY,CAAC;KAC5B;IAKD;;;;;OAKG;IACH,CAAC,CAAC,GAAG,EAAE,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM;CAe5C;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
package/build/common/I18n.js
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
const FALLBACK_LOCALE = "en";
|
|
3
2
|
/**
|
|
4
3
|
* I18n translation class.
|
|
5
4
|
*/
|
|
6
5
|
class I18n {
|
|
6
|
+
locale;
|
|
7
|
+
translations;
|
|
7
8
|
/**
|
|
8
|
-
* Constructor.
|
|
9
|
-
*
|
|
10
|
-
* @param
|
|
11
|
-
* @param {string=} options.locale Locale.
|
|
12
|
-
* @param {any} options.translations Translations.
|
|
9
|
+
* @param props Constructor arguments.
|
|
10
|
+
* @param props.locale Locale.
|
|
11
|
+
* @param props.translations Translations.
|
|
13
12
|
*/
|
|
14
|
-
constructor({ locale, translations }) {
|
|
13
|
+
constructor({ locale, translations, }) {
|
|
15
14
|
this.locale = locale || FALLBACK_LOCALE;
|
|
16
15
|
this.translations = translations;
|
|
17
16
|
}
|
|
18
17
|
/**
|
|
19
18
|
* Get translation.
|
|
20
19
|
*
|
|
21
|
-
* @param
|
|
22
|
-
* @returns
|
|
20
|
+
* @param str String to translate.
|
|
21
|
+
* @returns Translated string.
|
|
23
22
|
*/
|
|
24
23
|
t(str) {
|
|
25
|
-
|
|
24
|
+
const translation = this.translations[str];
|
|
25
|
+
if (!translation) {
|
|
26
26
|
throw new Error(`${str} Translation string not found`);
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
const localized = translation[this.locale];
|
|
29
|
+
if (!localized) {
|
|
29
30
|
throw new Error(`'${str}' translation not found for locale '${this.locale}'`);
|
|
30
31
|
}
|
|
31
|
-
return
|
|
32
|
+
return localized;
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
export { I18n };
|