@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.
Files changed (106) hide show
  1. package/README.md +1 -1
  2. package/build/api/gist.d.ts.map +1 -1
  3. package/build/api/gist.js +0 -1
  4. package/build/api/index.d.ts.map +1 -1
  5. package/build/api/index.js +0 -1
  6. package/build/api/pin.d.ts.map +1 -1
  7. package/build/api/pin.js +0 -1
  8. package/build/api/top-langs.d.ts.map +1 -1
  9. package/build/api/top-langs.js +0 -1
  10. package/build/api/wakatime.d.ts.map +1 -1
  11. package/build/api/wakatime.js +0 -1
  12. package/build/cards/gist.d.ts.map +1 -1
  13. package/build/cards/gist.js +0 -1
  14. package/build/cards/repo.d.ts.map +1 -1
  15. package/build/cards/repo.js +0 -1
  16. package/build/cards/stats.d.ts.map +1 -1
  17. package/build/cards/stats.js +0 -1
  18. package/build/cards/top-languages.d.ts.map +1 -1
  19. package/build/cards/top-languages.js +0 -1
  20. package/build/cards/wakatime.d.ts.map +1 -1
  21. package/build/cards/wakatime.js +0 -1
  22. package/build/common/Card.d.ts +48 -60
  23. package/build/common/Card.d.ts.map +1 -1
  24. package/build/common/Card.js +49 -50
  25. package/build/common/I18n.d.ts +13 -14
  26. package/build/common/I18n.d.ts.map +1 -1
  27. package/build/common/I18n.js +13 -12
  28. package/build/common/color.d.ts +30 -40
  29. package/build/common/color.d.ts.map +1 -1
  30. package/build/common/color.js +30 -42
  31. package/build/common/config.d.ts +18 -2
  32. package/build/common/config.d.ts.map +1 -1
  33. package/build/common/config.js +17 -26
  34. package/build/common/constants.d.ts +2 -2
  35. package/build/common/constants.d.ts.map +1 -1
  36. package/build/common/constants.js +5 -3
  37. package/build/common/error.d.ts +36 -29
  38. package/build/common/error.d.ts.map +1 -1
  39. package/build/common/error.js +14 -10
  40. package/build/common/fmt.d.ts +14 -13
  41. package/build/common/fmt.d.ts.map +1 -1
  42. package/build/common/fmt.js +19 -15
  43. package/build/common/html.d.ts +2 -4
  44. package/build/common/html.d.ts.map +1 -1
  45. package/build/common/html.js +1 -5
  46. package/build/common/http.d.ts.map +1 -1
  47. package/build/common/http.js +0 -1
  48. package/build/common/icons.d.ts +22 -21
  49. package/build/common/icons.d.ts.map +1 -1
  50. package/build/common/icons.js +4 -5
  51. package/build/common/languageColors.json +2 -0
  52. package/build/common/ops.d.ts.map +1 -1
  53. package/build/common/ops.js +0 -1
  54. package/build/common/render.d.ts.map +1 -1
  55. package/build/common/render.js +0 -1
  56. package/build/common/retryer.d.ts +18 -15
  57. package/build/common/retryer.d.ts.map +1 -1
  58. package/build/common/retryer.js +21 -30
  59. package/build/fetchers/gist.d.ts.map +1 -1
  60. package/build/fetchers/gist.js +0 -1
  61. package/build/fetchers/repo.d.ts.map +1 -1
  62. package/build/fetchers/repo.js +3 -6
  63. package/build/fetchers/stats.d.ts.map +1 -1
  64. package/build/fetchers/stats.js +3 -6
  65. package/build/fetchers/top-languages.d.ts.map +1 -1
  66. package/build/fetchers/top-languages.js +0 -1
  67. package/build/fetchers/wakatime.d.ts.map +1 -1
  68. package/build/fetchers/wakatime.js +0 -1
  69. package/build/translations.d.ts +627 -24
  70. package/build/translations.d.ts.map +1 -1
  71. package/build/translations.js +7 -8
  72. package/package.json +5 -5
  73. package/src/api/gist.js +0 -2
  74. package/src/api/index.js +0 -2
  75. package/src/api/pin.js +0 -2
  76. package/src/api/top-langs.js +0 -2
  77. package/src/api/wakatime.js +0 -2
  78. package/src/cards/gist.js +0 -2
  79. package/src/cards/repo.js +0 -2
  80. package/src/cards/stats.js +0 -2
  81. package/src/cards/top-languages.js +0 -2
  82. package/src/cards/wakatime.js +0 -2
  83. package/src/common/{Card.js → Card.ts} +89 -61
  84. package/src/common/I18n.ts +49 -0
  85. package/src/common/{color.js → color.ts} +55 -51
  86. package/src/common/config.ts +83 -0
  87. package/src/common/constants.ts +10 -0
  88. package/src/common/{error.js → error.ts} +20 -14
  89. package/src/common/{fmt.js → fmt.ts} +27 -19
  90. package/src/common/{html.js → html.ts} +3 -8
  91. package/src/common/http.js +0 -2
  92. package/src/common/{icons.js → icons.ts} +9 -7
  93. package/src/common/languageColors.json +2 -0
  94. package/src/common/ops.js +0 -2
  95. package/src/common/render.js +0 -2
  96. package/src/common/{retryer.js → retryer.ts} +45 -32
  97. package/src/fetchers/gist.js +0 -2
  98. package/src/fetchers/repo.js +3 -7
  99. package/src/fetchers/stats.js +3 -7
  100. package/src/fetchers/top-languages.js +0 -2
  101. package/src/fetchers/types.d.ts +1 -1
  102. package/src/fetchers/wakatime.js +0 -2
  103. package/src/{translations.js → translations.ts} +14 -10
  104. package/src/common/I18n.js +0 -42
  105. package/src/common/config.js +0 -78
  106. 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/readme-tools/github-readme-stats-action).
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).
@@ -1 +1 @@
1
- {"version":3,"file":"gist.d.ts","sourceRoot":"","sources":["../../src/api/gist.js"],"names":[],"mappings":"AAae;;;;;;;;;;;;;;;;GAqFd"}
1
+ {"version":3,"file":"gist.d.ts","sourceRoot":"","sources":["../../src/api/gist.js"],"names":[],"mappings":"AAWe;;;;;;;;;;;;;;;;GAqFd"}
package/build/api/gist.js CHANGED
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { renderGistCard } from "../cards/gist.js";
3
2
  import { MissingParamError, retrieveSecondaryMessage, } from "../common/error.js";
4
3
  import { parseBoolean } from "../common/ops.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.js"],"names":[],"mappings":"AAae;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2Kd"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.js"],"names":[],"mappings":"AAWe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2Kd"}
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { renderStatsCard } from "../cards/stats.js";
3
2
  import { MissingParamError, retrieveSecondaryMessage, } from "../common/error.js";
4
3
  import { parseArray, parseBoolean } from "../common/ops.js";
@@ -1 +1 @@
1
- {"version":3,"file":"pin.d.ts","sourceRoot":"","sources":["../../src/api/pin.js"],"names":[],"mappings":"AAae;;;;;;;;;;;;;;;;;;;;;;;;GAoId"}
1
+ {"version":3,"file":"pin.d.ts","sourceRoot":"","sources":["../../src/api/pin.js"],"names":[],"mappings":"AAWe;;;;;;;;;;;;;;;;;;;;;;;;GAoId"}
package/build/api/pin.js CHANGED
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { renderRepoCard } from "../cards/repo.js";
3
2
  import { MissingParamError, retrieveSecondaryMessage, } from "../common/error.js";
4
3
  import { parseArray, parseBoolean } from "../common/ops.js";
@@ -1 +1 @@
1
- {"version":3,"file":"top-langs.d.ts","sourceRoot":"","sources":["../../src/api/top-langs.js"],"names":[],"mappings":"AAae;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0Jd"}
1
+ {"version":3,"file":"top-langs.d.ts","sourceRoot":"","sources":["../../src/api/top-langs.js"],"names":[],"mappings":"AAWe;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0Jd"}
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { renderTopLanguages } from "../cards/top-languages.js";
3
2
  import { MissingParamError, retrieveSecondaryMessage, } from "../common/error.js";
4
3
  import { parseArray, parseBoolean } from "../common/ops.js";
@@ -1 +1 @@
1
- {"version":3,"file":"wakatime.d.ts","sourceRoot":"","sources":["../../src/api/wakatime.js"],"names":[],"mappings":"AAae;;;;;;;;;;;;;;;;;;;;;;;;;GAmGd"}
1
+ {"version":3,"file":"wakatime.d.ts","sourceRoot":"","sources":["../../src/api/wakatime.js"],"names":[],"mappings":"AAWe;;;;;;;;;;;;;;;;;;;;;;;;;GAmGd"}
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { renderWakatimeCard } from "../cards/wakatime.js";
3
2
  import { MissingParamError, retrieveSecondaryMessage, } from "../common/error.js";
4
3
  import { parseArray, parseBoolean } from "../common/ops.js";
@@ -1 +1 @@
1
- {"version":3,"file":"gist.d.ts","sourceRoot":"","sources":["../../src/cards/gist.js"],"names":[],"mappings":";;;;;;;;AA4BA;;;GAGG;AAEH;;;;;;GAMG;AACH,yCAJW,QAAQ,YACR,OAAO,CAAC,eAAe,CAAC,GACtB,MAAM,CAkJlB"}
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"}
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { default as Card } from "../common/Card.js";
3
2
  import { getCardColors } from "../common/color.js";
4
3
  import { kFormatter, wrapTextMultiline } from "../common/fmt.js";
@@ -1 +1 @@
1
- {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/cards/repo.js"],"names":[],"mappings":";;;;;;;;AAmDA;;;GAGG;AAEH;;;;;;GAMG;AACH,qCAJW,cAAc,YACd,OAAO,CAAC,eAAe,CAAC,GACtB,MAAM,CA6SlB"}
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"}
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { Card } from "../common/Card.js";
3
2
  import { I18n } from "../common/I18n.js";
4
3
  import { getCardColors } from "../common/color.js";
@@ -1 +1 @@
1
- {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/cards/stats.js"],"names":[],"mappings":";;AA8PA;;;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"}
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"}
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { Card } from "../common/Card.js";
3
2
  import { I18n } from "../common/I18n.js";
4
3
  import { getCardColors } from "../common/color.js";
@@ -1 +1 @@
1
- {"version":3,"file":"top-languages.d.ts","sourceRoot":"","sources":["../../src/cards/top-languages.js"],"names":[],"mappings":";;qBAswBa,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
+ {"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,4 +1,3 @@
1
- // @ts-check
2
1
  import { Card } from "../common/Card.js";
3
2
  import { I18n } from "../common/I18n.js";
4
3
  import { fallbackColor, getCardColors } from "../common/color.js";
@@ -1 +1 @@
1
- {"version":3,"file":"wakatime.d.ts","sourceRoot":"","sources":["../../src/cards/wakatime.js"],"names":[],"mappings":";;;AA+NA;;;GAGG;AAEH;;;;;;GAMG;AACH,2CAJW,OAAO,CAAC,YAAY,CAAC,YACrB,OAAO,CAAC,eAAe,CAAC,GACtB,MAAM,CA2OlB"}
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"}
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { Card } from "../common/Card.js";
3
2
  import { I18n } from "../common/I18n.js";
4
3
  import { getCardColors } from "../common/color.js";
@@ -1,49 +1,22 @@
1
- export default Card;
2
- export class Card {
3
- /**
4
- * Creates a new card instance.
5
- *
6
- * @param {object} args Card arguments.
7
- * @param {number=} args.width Card width.
8
- * @param {number=} args.height Card height.
9
- * @param {number=} args.border_radius Card border radius.
10
- * @param {string=} args.customTitle Card custom title.
11
- * @param {string=} args.defaultTitle Card default title.
12
- * @param {string=} args.titlePrefixIcon Card title prefix icon.
13
- * @param {object} [args.colors={}] Card colors arguments.
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
- * @returns {void}
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 {Object} props The props object.
61
- * @param {string} props.title Accessibility title.
62
- * @param {string} props.desc Accessibility description.
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 {string} value The CSS to add to the card.
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 {boolean} value Whether to hide the border or not.
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 {boolean} value Whether to hide the title or not.
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 {string} text The title to set.
86
- * @returns {void}
72
+ * @param text The title to set.
87
73
  */
88
74
  setTitle(text: string): void;
89
75
  /**
90
- * @returns {string} The rendered card title.
76
+ * @returns The rendered card title.
91
77
  */
92
78
  renderTitle(): string;
93
79
  /**
94
- * @returns {string} The rendered card gradient.
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 {string} Animation css.
86
+ * @returns Animation css.
101
87
  */
102
88
  getAnimations: () => string;
103
89
  /**
104
- * @param {string} body The inner body of the card.
105
- * @returns {string} The rendered card.
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.js"],"names":[],"mappings":";AAKA;IACE;;;;;;;;;;;;;;;;OAgBG;IACH,mGAbG;QAAsB,KAAK,GAAnB,MAAM,YAAC;QACO,MAAM,GAApB,MAAM,YAAC;QACO,aAAa,GAA3B,MAAM,YAAC;QACO,WAAW,GAAzB,MAAM,YAAC;QACO,YAAY,GAA1B,MAAM,YAAC;QACO,eAAe,GAA7B,MAAM,YAAC;QACO,MAAM;yBACpB,MAAM,YAAC;wBACP,MAAM,YAAC;wBACP,MAAM,YAAC;sBACP,CAAA,MAAM,GAAC,MAAM,EAAE,aAAC;0BAChB,MAAM,YAAC;;KACjB,EAiCA;IAvBC,cAAkB;IAClB,eAAoB;IAEpB,oBAAuB;IACvB,mBAAsB;IAEtB,sBAAkC;IAGlC;qBAxBS,MAAM,YAAC;oBACP,MAAM,YAAC;oBACP,MAAM,YAAC;kBACP,CAAA,MAAM,GAAC,MAAM,EAAE,aAAC;sBAChB,MAAM,YAAC;MAoBI;IACpB,cAG6B;IAE7B,YAAa;IAEb,iBAAkB;IAClB,iBAAkB;IAClB,oCAAsC;IACtC,oBAAsB;IACtB,kBAAmB;IACnB,iBAAkB;IAGpB;;OAEG;IACH,qBAFa,IAAI,CAIhB;IAED;;;;;OAKG;IACH,uCAJG;QAAsB,KAAK,EAAnB,MAAM;QACQ,IAAI,EAAlB,MAAM;KACd,GAAU,IAAI,CAKhB;IAED;;;OAGG;IACH,cAHW,MAAM,GACJ,IAAI,CAIhB;IAED;;;OAGG;IACH,qBAHW,OAAO,GACL,IAAI,CAIhB;IAED;;;OAGG;IACH,oBAHW,OAAO,GACL,IAAI,CAOhB;IAED;;;OAGG;IACH,eAHW,MAAM,GACJ,IAAI,CAIhB;IAED;;OAEG;IACH,eAFa,MAAM,CAoClB;IAED;;OAEG;IACH,kBAFa,MAAM,CAwBlB;IAED;;;;OAIG;IACH,qBAFa,MAAM,CAsBjB;IAEF;;;OAGG;IACH,aAHW,MAAM,GACJ,MAAM,CAiElB;CACF"}
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"}
@@ -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 {object} args Card arguments.
9
- * @param {number=} args.width Card width.
10
- * @param {number=} args.height Card height.
11
- * @param {number=} args.border_radius Card border radius.
12
- * @param {string=} args.customTitle Card custom title.
13
- * @param {string=} args.defaultTitle Card default title.
14
- * @param {string=} args.titlePrefixIcon Card title prefix icon.
15
- * @param {object} [args.colors={}] Card colors arguments.
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 {Object} props The props object.
50
- * @param {string} props.title Accessibility title.
51
- * @param {string} props.desc Accessibility description.
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 {string} value The CSS to add to the card.
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 {boolean} value Whether to hide the border or not.
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 {boolean} value Whether to hide the title or not.
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 {string} text The title to set.
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 {string} The rendered card title.
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 {string} The rendered card gradient.
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.map((grad, index) => {
143
- let offset = (index * 100) / (gradients.length - 1);
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 {string} Animation css.
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 {string} body The inner body of the card.
179
- * @returns {string} The rendered card.
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 === false
208
- ? `* { animation-duration: 0s !important; animation-delay: 0s !important; }`
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
 
@@ -1,26 +1,25 @@
1
1
  /**
2
2
  * I18n translation class.
3
3
  */
4
- export class I18n {
4
+ declare class I18n<Translations extends Record<string, Record<string, string>>> {
5
+ locale: string;
6
+ translations: Translations;
5
7
  /**
6
- * Constructor.
7
- *
8
- * @param {Object} options Options.
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 | undefined;
14
- translations: any;
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 {string} str String to translate.
22
- * @returns {string} Translated string.
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.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IACE;;;;;;OAMG;IACH,sCAHG;QAAyB,MAAM,GAAvB,MAAM,YAAC;QACM,YAAY,EAAzB,GAAG;KACb,EAIA;IAFC,eAAuC;IACvC,kBAAgC;IAGlC;;;;;OAKG;IACH,OAHW,MAAM,GACJ,MAAM,CAclB;CACF"}
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"}
@@ -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 {Object} options Options.
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 {string} str String to translate.
22
- * @returns {string} Translated string.
20
+ * @param str String to translate.
21
+ * @returns Translated string.
23
22
  */
24
23
  t(str) {
25
- if (!this.translations[str]) {
24
+ const translation = this.translations[str];
25
+ if (!translation) {
26
26
  throw new Error(`${str} Translation string not found`);
27
27
  }
28
- if (!this.translations[str][this.locale]) {
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 this.translations[str][this.locale];
32
+ return localized;
32
33
  }
33
34
  }
34
35
  export { I18n };