@stats-forge/github-stats-forge-core 0.0.1 → 0.1.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/README.md +0 -10
- package/build/api/api-result.d.ts +6 -7
- package/build/api/api-result.d.ts.map +1 -1
- package/build/api/api-result.js +4 -5
- package/build/api/gist.d.ts +3 -10
- package/build/api/gist.d.ts.map +1 -1
- package/build/api/gist.js +4 -11
- package/build/api/index.d.ts +12 -12
- package/build/api/params.d.ts +11 -8
- package/build/api/params.d.ts.map +1 -1
- package/build/api/params.js +16 -14
- package/build/api/pin.d.ts +3 -19
- package/build/api/pin.d.ts.map +1 -1
- package/build/api/pin.js +6 -22
- package/build/api/stats.d.ts +10 -4
- package/build/api/stats.d.ts.map +1 -1
- package/build/api/stats.js +6 -32
- package/build/api/top-langs.d.ts +12 -6
- package/build/api/top-langs.d.ts.map +1 -1
- package/build/api/top-langs.js +6 -26
- package/build/api/wakatime.d.ts +13 -5
- package/build/api/wakatime.d.ts.map +1 -1
- package/build/api/wakatime.js +4 -21
- package/build/calculateRank.d.ts +0 -9
- package/build/calculateRank.d.ts.map +1 -1
- package/build/calculateRank.js +12 -17
- package/build/cards/gist.d.ts +2 -4
- package/build/cards/gist.d.ts.map +1 -1
- package/build/cards/gist.js +27 -36
- package/build/cards/options.d.ts +1 -1
- package/build/cards/repo.d.ts +2 -4
- package/build/cards/repo.d.ts.map +1 -1
- package/build/cards/repo.js +61 -93
- package/build/cards/stats.d.ts +3 -8
- package/build/cards/stats.d.ts.map +1 -1
- package/build/cards/stats.js +119 -165
- package/build/cards/top-languages.d.ts +5 -31
- package/build/cards/top-languages.d.ts.map +1 -1
- package/build/cards/top-languages.js +176 -384
- package/build/cards/wakatime.d.ts +4 -6
- package/build/cards/wakatime.d.ts.map +1 -1
- package/build/cards/wakatime.js +118 -185
- package/build/common/Card.d.ts +14 -62
- package/build/common/Card.d.ts.map +1 -1
- package/build/common/Card.js +97 -199
- package/build/common/I18n.d.ts +0 -6
- package/build/common/I18n.d.ts.map +1 -1
- package/build/common/I18n.js +3 -6
- package/build/common/color.d.ts +4 -17
- package/build/common/color.d.ts.map +1 -1
- package/build/common/color.js +67 -49
- package/build/common/config.d.ts +4 -14
- package/build/common/config.d.ts.map +1 -1
- package/build/common/config.js +3 -16
- package/build/common/constants.d.ts +4 -2
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +3 -1
- package/build/common/date.d.ts +0 -2
- package/build/common/date.d.ts.map +1 -1
- package/build/common/date.js +0 -2
- package/build/common/emojiMap.d.ts +8 -0
- package/build/common/emojiMap.d.ts.map +1 -0
- package/build/common/emojiMap.js +10 -0
- package/build/common/emojiMap.json +1915 -0
- package/build/common/error.d.ts +1 -10
- package/build/common/error.d.ts.map +1 -1
- package/build/common/error.js +1 -10
- package/build/common/fmt.d.ts +3 -15
- package/build/common/fmt.d.ts.map +1 -1
- package/build/common/fmt.js +7 -35
- package/build/common/http.d.ts +2 -7
- package/build/common/http.d.ts.map +1 -1
- package/build/common/http.js +8 -17
- package/build/common/icons.d.ts +18 -20
- package/build/common/icons.d.ts.map +1 -1
- package/build/common/icons.js +103 -67
- package/build/common/languageColors.d.ts +0 -1
- package/build/common/languageColors.d.ts.map +1 -1
- package/build/common/languageColors.js +1 -4
- package/build/common/languageColors.json +18 -2
- package/build/common/ops.d.ts +3 -14
- package/build/common/ops.d.ts.map +1 -1
- package/build/common/ops.js +19 -30
- package/build/common/render.d.ts +28 -82
- package/build/common/render.d.ts.map +1 -1
- package/build/common/render.js +175 -211
- package/build/common/retryer.d.ts +2 -7
- package/build/common/retryer.d.ts.map +1 -1
- package/build/common/retryer.js +4 -11
- package/build/fetchers/gist.d.ts +2 -5
- package/build/fetchers/gist.d.ts.map +1 -1
- package/build/fetchers/gist.js +1 -5
- package/build/fetchers/index.d.ts +12 -12
- package/build/fetchers/repo.d.ts +2 -11
- package/build/fetchers/repo.d.ts.map +1 -1
- package/build/fetchers/repo.js +20 -33
- package/build/fetchers/stats.d.ts +2 -32
- package/build/fetchers/stats.d.ts.map +1 -1
- package/build/fetchers/stats.js +27 -86
- package/build/fetchers/top-languages.d.ts +2 -9
- package/build/fetchers/top-languages.d.ts.map +1 -1
- package/build/fetchers/top-languages.js +15 -31
- package/build/fetchers/types.d.ts +1 -1
- package/build/fetchers/wakatime.d.ts +2 -6
- package/build/fetchers/wakatime.d.ts.map +1 -1
- package/build/fetchers/wakatime.js +1 -5
- package/build/graphql/contributionsDocument.d.ts +3 -3
- package/build/graphql/contributionsDocument.d.ts.map +1 -1
- package/build/graphql/contributionsDocument.js +0 -1
- package/build/graphql/generated/gist.d.ts +1 -1
- package/build/graphql/generated/repo.d.ts +1 -1
- package/build/graphql/generated/stats.d.ts +3 -3
- package/build/graphql/generated/top-languages.d.ts +2 -2
- package/build/graphql/graphqlDocument.d.ts +0 -1
- package/build/graphql/graphqlDocument.d.ts.map +1 -1
- package/build/graphql/graphqlDocument.js +0 -1
- package/build/graphql/reposContributedToDocument.d.ts +4 -5
- package/build/graphql/reposContributedToDocument.d.ts.map +1 -1
- package/build/graphql/reposContributedToDocument.js +0 -2
- package/build/markup/css.d.ts +35 -0
- package/build/markup/css.d.ts.map +1 -0
- package/build/markup/css.js +64 -0
- package/build/markup/element.d.ts +41 -0
- package/build/markup/element.d.ts.map +1 -0
- package/build/markup/element.js +127 -0
- package/build/markup/html.d.ts +13 -0
- package/build/markup/html.d.ts.map +1 -0
- package/build/markup/html.js +27 -0
- package/build/markup/index.d.ts +9 -0
- package/build/markup/index.d.ts.map +1 -0
- package/build/markup/index.js +6 -0
- package/build/markup/serialize.d.ts +16 -0
- package/build/markup/serialize.d.ts.map +1 -0
- package/build/markup/serialize.js +17 -0
- package/build/themes/index.d.ts +332 -333
- package/build/themes/index.d.ts.map +1 -1
- package/build/themes/index.js +1 -1
- package/build/translations.d.ts +2 -6
- package/build/translations.d.ts.map +1 -1
- package/build/translations.js +621 -628
- package/package.json +17 -26
- package/src/api/api-result.ts +10 -9
- package/src/api/gist.ts +11 -18
- package/src/api/index.ts +12 -12
- package/src/api/params.ts +27 -21
- package/src/api/pin.ts +13 -28
- package/src/api/stats.ts +13 -39
- package/src/api/top-langs.ts +13 -33
- package/src/api/wakatime.ts +11 -28
- package/src/calculateRank.ts +12 -23
- package/src/cards/gist.ts +40 -43
- package/src/cards/options.ts +1 -1
- package/src/cards/repo.ts +97 -107
- package/src/cards/stats.ts +165 -184
- package/src/cards/top-languages.ts +297 -413
- package/src/cards/wakatime.ts +193 -221
- package/src/common/Card.ts +165 -217
- package/src/common/I18n.ts +3 -6
- package/src/common/color.ts +80 -57
- package/src/common/config.ts +5 -18
- package/src/common/constants.ts +5 -2
- package/src/common/date.ts +0 -2
- package/src/common/emojiMap.json +1915 -0
- package/src/common/emojiMap.ts +13 -0
- package/src/common/error.ts +2 -11
- package/src/common/fmt.ts +7 -44
- package/src/common/http.ts +9 -15
- package/src/common/icons.ts +117 -42
- package/src/common/languageColors.json +18 -2
- package/src/common/languageColors.ts +1 -4
- package/src/common/ops.ts +26 -34
- package/src/common/render.ts +279 -232
- package/src/common/retryer.ts +8 -15
- package/src/fetchers/gist.ts +8 -12
- package/src/fetchers/index.ts +12 -12
- package/src/fetchers/repo.ts +27 -40
- package/src/fetchers/stats.ts +44 -102
- package/src/fetchers/top-languages.ts +26 -40
- package/src/fetchers/types.ts +1 -1
- package/src/fetchers/wakatime.ts +5 -9
- package/src/graphql/contributionsDocument.ts +7 -5
- package/src/graphql/generated/gist.ts +1 -1
- package/src/graphql/generated/repo.ts +1 -1
- package/src/graphql/generated/stats.ts +2 -2
- package/src/graphql/generated/top-languages.ts +2 -2
- package/src/graphql/graphqlDocument.ts +0 -1
- package/src/graphql/reposContributedToDocument.ts +6 -7
- package/src/markup/css.ts +118 -0
- package/src/markup/element.ts +246 -0
- package/src/markup/html.ts +34 -0
- package/src/markup/index.ts +9 -0
- package/src/markup/serialize.ts +27 -0
- package/src/themes/index.ts +1 -1
- package/src/translations.ts +622 -629
- package/build/cards/index.d.ts +0 -11
- package/build/cards/index.d.ts.map +0 -1
- package/build/cards/index.js +0 -7
- package/build/common/html.d.ts +0 -8
- package/build/common/html.d.ts.map +0 -1
- package/build/common/html.js +0 -14
- package/build/index.d.ts +0 -15
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -10
- package/src/_emoji-name-map.d.ts +0 -10
- package/src/_github-username-regex.d.ts +0 -4
- package/src/cards/index.ts +0 -21
- package/src/common/html.ts +0 -17
- package/src/index.ts +0 -18
package/build/common/error.d.ts
CHANGED
|
@@ -39,27 +39,19 @@ declare class CardError extends Error {
|
|
|
39
39
|
readonly code: ErrorCode;
|
|
40
40
|
readonly secondaryMessage: string | undefined;
|
|
41
41
|
readonly param: string | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* @param message First line of the error card.
|
|
44
|
-
* @param init Why it failed, and what to draw under the message.
|
|
45
|
-
*/
|
|
46
42
|
constructor(message: string, init: CardErrorInit);
|
|
47
43
|
/** Whether repeating the request could produce a different answer. */
|
|
48
44
|
get retryable(): boolean;
|
|
49
45
|
/**
|
|
50
46
|
* A param the endpoint cannot render with.
|
|
51
47
|
*
|
|
52
|
-
* @param param Name of the param.
|
|
53
|
-
* @param secondaryMessage What is wrong with it.
|
|
54
48
|
* @returns The error.
|
|
55
49
|
*/
|
|
56
50
|
static invalidParam(param: string, secondaryMessage: string): CardError;
|
|
57
51
|
/**
|
|
58
52
|
* A param the endpoint cannot render without.
|
|
53
|
+
* `param` carries the first; the message names them all.
|
|
59
54
|
*
|
|
60
|
-
* @param params Names of the missing params.
|
|
61
|
-
* `param` carries the first; the message names them all.
|
|
62
|
-
* @param secondaryMessage Where to pass them, when the endpoint can say.
|
|
63
55
|
* @returns The error.
|
|
64
56
|
*/
|
|
65
57
|
static missingParam(params: Array<string>, secondaryMessage?: string): CardError;
|
|
@@ -67,7 +59,6 @@ declare class CardError extends Error {
|
|
|
67
59
|
* Anything thrown that is not already a `CardError`:
|
|
68
60
|
* an upstream failure, since the query itself got this far.
|
|
69
61
|
*
|
|
70
|
-
* @param err Whatever was thrown.
|
|
71
62
|
* @returns The error, unchanged when it already was one.
|
|
72
63
|
*/
|
|
73
64
|
static from(err: unknown): CardError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/common/error.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,wDAAwD;AACxD,QAAA,MAAM,eAAe,2BAA2B,CAAC;AAEjD,4BAA4B;AAC5B,KAAK,SAAS;AACZ,2EAA2E;AACzE,eAAe;AACjB,uEAAuE;GACrE,eAAe;AACjB,mDAAmD;GACjD,WAAW;AACb,iDAAiD;GAC/C,WAAW;AACb,mCAAmC;GACjC,cAAc;AAChB,2DAA2D;GACzD,UAAU,CAAC;AAef,sDAAsD;AACtD,QAAA,MAAM,wBAAwB,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAKhE,CAAC;AAEF,wDAAwD;AACxD,UAAU,aAAa;IACrB,qBAAqB;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,sCAAsC;AACtC,cAAM,SAAU,SAAQ,KAAK;IAC3B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/common/error.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,wDAAwD;AACxD,QAAA,MAAM,eAAe,2BAA2B,CAAC;AAEjD,4BAA4B;AAC5B,KAAK,SAAS;AACZ,2EAA2E;AACzE,eAAe;AACjB,uEAAuE;GACrE,eAAe;AACjB,mDAAmD;GACjD,WAAW;AACb,iDAAiD;GAC/C,WAAW;AACb,mCAAmC;GACjC,cAAc;AAChB,2DAA2D;GACzD,UAAU,CAAC;AAef,sDAAsD;AACtD,QAAA,MAAM,wBAAwB,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAKhE,CAAC;AAEF,wDAAwD;AACxD,UAAU,aAAa;IACrB,qBAAqB;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,sCAAsC;AACtC,cAAM,SAAU,SAAQ,KAAK;IAC3B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC,YAAY,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAM/C;IAED,sEAAsE;IACtE,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAMtE;IAED;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAO/E;IAED;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,CAQnC;CACF;AAED,qEAAqE;AACrE,QAAA,MAAM,mBAAmB,QAEtB,CAAC;AAEJ,0DAA0D;AAC1D,QAAA,MAAM,uBAAuB,iDAAiD,CAAC;AAE/E,yEAAyE;AACzE,QAAA,MAAM,cAAc,2DAA2D,CAAC;AAEhF,2EAA2E;AAC3E,QAAA,MAAM,cAAc,+DAA+D,CAAC;AAEpF,0CAA0C;AAC1C,QAAA,MAAM,cAAc,8CAA8C,CAAC;AAEnE,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,OAAO,EACL,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,cAAc,EACd,uBAAuB,GACxB,CAAC"}
|
package/build/common/error.js
CHANGED
|
@@ -33,10 +33,6 @@ class CardError extends Error {
|
|
|
33
33
|
code;
|
|
34
34
|
secondaryMessage;
|
|
35
35
|
param;
|
|
36
|
-
/**
|
|
37
|
-
* @param message First line of the error card.
|
|
38
|
-
* @param init Why it failed, and what to draw under the message.
|
|
39
|
-
*/
|
|
40
36
|
constructor(message, init) {
|
|
41
37
|
super(message);
|
|
42
38
|
this.name = 'CardError';
|
|
@@ -51,8 +47,6 @@ class CardError extends Error {
|
|
|
51
47
|
/**
|
|
52
48
|
* A param the endpoint cannot render with.
|
|
53
49
|
*
|
|
54
|
-
* @param param Name of the param.
|
|
55
|
-
* @param secondaryMessage What is wrong with it.
|
|
56
50
|
* @returns The error.
|
|
57
51
|
*/
|
|
58
52
|
static invalidParam(param, secondaryMessage) {
|
|
@@ -64,10 +58,8 @@ class CardError extends Error {
|
|
|
64
58
|
}
|
|
65
59
|
/**
|
|
66
60
|
* A param the endpoint cannot render without.
|
|
61
|
+
* `param` carries the first; the message names them all.
|
|
67
62
|
*
|
|
68
|
-
* @param params Names of the missing params.
|
|
69
|
-
* `param` carries the first; the message names them all.
|
|
70
|
-
* @param secondaryMessage Where to pass them, when the endpoint can say.
|
|
71
63
|
* @returns The error.
|
|
72
64
|
*/
|
|
73
65
|
static missingParam(params, secondaryMessage) {
|
|
@@ -82,7 +74,6 @@ class CardError extends Error {
|
|
|
82
74
|
* Anything thrown that is not already a `CardError`:
|
|
83
75
|
* an upstream failure, since the query itself got this far.
|
|
84
76
|
*
|
|
85
|
-
* @param err Whatever was thrown.
|
|
86
77
|
* @returns The error, unchanged when it already was one.
|
|
87
78
|
*/
|
|
88
79
|
static from(err) {
|
package/build/common/fmt.d.ts
CHANGED
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Retrieves num with suffix k(thousands) precise to given decimal places.
|
|
3
3
|
*
|
|
4
|
-
* @param num The number to format.
|
|
5
|
-
* @param precision The number of decimal places to include.
|
|
6
4
|
* @returns The formatted number.
|
|
7
5
|
*/
|
|
8
6
|
declare const kFormatter: (num: number, precision?: number) => string | number;
|
|
9
7
|
/**
|
|
10
8
|
* Convert bytes to a human-readable string representation.
|
|
11
9
|
*
|
|
12
|
-
* @param bytes The number of bytes to convert.
|
|
13
|
-
* @returns The human-readable representation of bytes.
|
|
14
10
|
* @throws {Error} If bytes is negative or too large.
|
|
15
|
-
*/
|
|
16
|
-
declare const formatBytes: (bytes: number) => string;
|
|
17
|
-
/**
|
|
18
|
-
* Split text over multiple lines based on the card width.
|
|
19
11
|
*
|
|
20
|
-
* @
|
|
21
|
-
* @param width Available wrap width in px.
|
|
22
|
-
* @param fontSize Font size in px.
|
|
23
|
-
* @param maxLines Maximum number of lines.
|
|
24
|
-
* @returns Array of lines.
|
|
12
|
+
* @returns The human-readable representation of bytes.
|
|
25
13
|
*/
|
|
26
|
-
declare const
|
|
27
|
-
export { kFormatter, formatBytes
|
|
14
|
+
declare const formatBytes: (bytes: number) => string;
|
|
15
|
+
export { kFormatter, formatBytes };
|
|
28
16
|
//# sourceMappingURL=fmt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fmt.d.ts","sourceRoot":"","sources":["../../src/common/fmt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fmt.d.ts","sourceRoot":"","sources":["../../src/common/fmt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,QAAA,MAAM,UAAU,QAAS,MAAM,cAAc,MAAM,KAAG,MAAM,GAAG,MAa9D,CAAC;AAEF;;;;;;GAMG;AACH,QAAA,MAAM,WAAW,UAAW,MAAM,KAAG,MAmBpC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC"}
|
package/build/common/fmt.js
CHANGED
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
import { encodeHTML } from './html.js';
|
|
2
|
-
import { splitWrappedText } from './render.js';
|
|
3
1
|
/**
|
|
4
2
|
* Retrieves num with suffix k(thousands) precise to given decimal places.
|
|
5
3
|
*
|
|
6
|
-
* @param num The number to format.
|
|
7
|
-
* @param precision The number of decimal places to include.
|
|
8
4
|
* @returns The formatted number.
|
|
9
5
|
*/
|
|
10
6
|
const kFormatter = (num, precision) => {
|
|
11
7
|
const abs = Math.abs(num);
|
|
12
8
|
const sign = Math.sign(num);
|
|
13
|
-
if (typeof precision === 'number' && !isNaN(precision)) {
|
|
14
|
-
return (sign * (abs / 1000)).toFixed(precision)
|
|
9
|
+
if (typeof precision === 'number' && !Number.isNaN(precision)) {
|
|
10
|
+
return `${(sign * (abs / 1000)).toFixed(precision)}k`;
|
|
15
11
|
}
|
|
16
12
|
if (abs < 1000) {
|
|
17
13
|
return sign * abs;
|
|
18
14
|
}
|
|
19
|
-
return `${sign * parseFloat((abs / 1000).toFixed(1))}k`;
|
|
15
|
+
return `${sign * Number.parseFloat((abs / 1000).toFixed(1))}k`;
|
|
20
16
|
};
|
|
21
17
|
/**
|
|
22
18
|
* Convert bytes to a human-readable string representation.
|
|
23
19
|
*
|
|
24
|
-
* @param bytes The number of bytes to convert.
|
|
25
|
-
* @returns The human-readable representation of bytes.
|
|
26
20
|
* @throws {Error} If bytes is negative or too large.
|
|
21
|
+
*
|
|
22
|
+
* @returns The human-readable representation of bytes.
|
|
27
23
|
*/
|
|
28
24
|
const formatBytes = (bytes) => {
|
|
29
25
|
if (bytes < 0) {
|
|
@@ -39,30 +35,6 @@ const formatBytes = (bytes) => {
|
|
|
39
35
|
if (unit === undefined) {
|
|
40
36
|
throw new Error('Bytes is too large to convert to a human-readable string');
|
|
41
37
|
}
|
|
42
|
-
return `${(bytes /
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Split text over multiple lines based on the card width.
|
|
46
|
-
*
|
|
47
|
-
* @param text Text to split.
|
|
48
|
-
* @param width Available wrap width in px.
|
|
49
|
-
* @param fontSize Font size in px.
|
|
50
|
-
* @param maxLines Maximum number of lines.
|
|
51
|
-
* @returns Array of lines.
|
|
52
|
-
*/
|
|
53
|
-
const wrapTextMultiline = (text, width, fontSize, maxLines = 3) => {
|
|
54
|
-
const wrapped = splitWrappedText(text, fontSize, width);
|
|
55
|
-
const lines = wrapped.map((line) => encodeHTML(line.trim())).slice(0, maxLines); // Only consider maxLines lines
|
|
56
|
-
// Add "..." to the last line if the text exceeds maxLines
|
|
57
|
-
if (wrapped.length > maxLines) {
|
|
58
|
-
const lastIndex = maxLines - 1;
|
|
59
|
-
const lastLine = lines[lastIndex];
|
|
60
|
-
if (lastLine !== undefined) {
|
|
61
|
-
lines[lastIndex] = `${lastLine}...`;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
// Remove empty lines if text fits in less than maxLines lines
|
|
65
|
-
const multiLineText = lines.filter(Boolean);
|
|
66
|
-
return multiLineText;
|
|
38
|
+
return `${(bytes / base ** i).toFixed(1)} ${unit}`;
|
|
67
39
|
};
|
|
68
|
-
export { kFormatter, formatBytes
|
|
40
|
+
export { kFormatter, formatBytes };
|
package/build/common/http.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GraphQLDocument } from '../graphql/graphqlDocument.
|
|
1
|
+
import type { GraphQLDocument } from '../graphql/graphqlDocument.ts';
|
|
2
2
|
/**
|
|
3
3
|
* The slice of `fetch` this library calls.
|
|
4
4
|
* A host substitutes it through `CardConfig` to mock, cache or proxy every request core makes.
|
|
@@ -28,9 +28,6 @@ interface FetcherContext {
|
|
|
28
28
|
retries: number;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* @param fetchImpl Transport to send the request with.
|
|
32
|
-
* @param url Absolute URL to request.
|
|
33
|
-
* @param init Request init forwarded to the transport.
|
|
34
31
|
* @returns The response; a JSON body parsed, anything else left as text.
|
|
35
32
|
*/
|
|
36
33
|
declare const httpRequest: <TData>(fetchImpl: FetchLike, url: string, init?: RequestInit) => Promise<HttpResponse<TData>>;
|
|
@@ -43,11 +40,9 @@ type GraphQLResponse<TResult> = HttpResponse<{
|
|
|
43
40
|
}>;
|
|
44
41
|
}>;
|
|
45
42
|
/**
|
|
46
|
-
* @param document Generated query document.
|
|
47
|
-
* @param scheme `Authorization` scheme for the token.
|
|
48
43
|
* @returns A fetcher `retryer` can drive.
|
|
49
44
|
*/
|
|
50
|
-
declare const createGraphQLFetcher: <TResult, TVariables>(document: GraphQLDocument<TResult, TVariables>, scheme:
|
|
45
|
+
declare const createGraphQLFetcher: <TResult, TVariables>(document: GraphQLDocument<TResult, TVariables>, scheme: 'bearer' | 'token') => (variables: TVariables, token: string, { fetch }: FetcherContext) => Promise<GraphQLResponse<TResult>>;
|
|
51
46
|
export { createGraphQLFetcher, defaultFetch, httpRequest };
|
|
52
47
|
export type { FetcherContext, FetchLike, GraphQLResponse, HttpResponse };
|
|
53
48
|
//# sourceMappingURL=http.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/common/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAIrE;;;GAGG;AACH,KAAK,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE1E;;;GAGG;AACH,QAAA,MAAM,YAAY,EAAE,SAA+C,CAAC;AAEpE;;;;GAIG;AACH,UAAU,YAAY,CAAC,KAAK;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,KAAK,CAAC;CACb;AAED,wDAAwD;AACxD,UAAU,cAAc;IACtB,0CAA0C;IAC1C,KAAK,EAAE,SAAS,CAAC;IACjB,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/common/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAIrE;;;GAGG;AACH,KAAK,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE1E;;;GAGG;AACH,QAAA,MAAM,YAAY,EAAE,SAA+C,CAAC;AAEpE;;;;GAIG;AACH,UAAU,YAAY,CAAC,KAAK;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,KAAK,CAAC;CACb;AAED,wDAAwD;AACxD,UAAU,cAAc;IACtB,0CAA0C;IAC1C,KAAK,EAAE,SAAS,CAAC;IACjB,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,QAAA,MAAM,WAAW,GAAU,KAAK,aACnB,SAAS,OACf,MAAM,SACJ,WAAW,KACjB,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAiB7B,CAAC;AAEF,gFAAgF;AAChF,KAAK,eAAe,CAAC,OAAO,IAAI,YAAY,CAAC;IAC3C,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrD,CAAC,CAAC;AAEH;;GAEG;AACH,QAAA,MAAM,oBAAoB,GACvB,OAAO,EAAE,UAAU,YACR,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,UACtC,QAAQ,GAAG,OAAO,iBAGf,UAAU,SACd,MAAM,aACF,cAAc,KACxB,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAQ/B,CAAC;AAEP,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC"}
|
package/build/common/http.js
CHANGED
|
@@ -5,9 +5,6 @@ const GITHUB_GRAPHQL_API = 'https://api.github.com/graphql';
|
|
|
5
5
|
*/
|
|
6
6
|
const defaultFetch = (input, init) => fetch(input, init);
|
|
7
7
|
/**
|
|
8
|
-
* @param fetchImpl Transport to send the request with.
|
|
9
|
-
* @param url Absolute URL to request.
|
|
10
|
-
* @param init Request init forwarded to the transport.
|
|
11
8
|
* @returns The response; a JSON body parsed, anything else left as text.
|
|
12
9
|
*/
|
|
13
10
|
const httpRequest = async (fetchImpl, url, init) => {
|
|
@@ -28,20 +25,14 @@ const httpRequest = async (fetchImpl, url, init) => {
|
|
|
28
25
|
};
|
|
29
26
|
};
|
|
30
27
|
/**
|
|
31
|
-
* @param document Generated query document.
|
|
32
|
-
* @param scheme `Authorization` scheme for the token.
|
|
33
28
|
* @returns A fetcher `retryer` can drive.
|
|
34
29
|
*/
|
|
35
|
-
const createGraphQLFetcher = (document, scheme) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
body: JSON.stringify({ query: document.text, variables }),
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
};
|
|
30
|
+
const createGraphQLFetcher = (document, scheme) => (variables, token, { fetch }) => httpRequest(fetch, GITHUB_GRAPHQL_API, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: {
|
|
33
|
+
Authorization: `${scheme} ${token}`,
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify({ query: document.text, variables }),
|
|
37
|
+
});
|
|
47
38
|
export { createGraphQLFetcher, defaultFetch, httpRequest };
|
package/build/common/icons.d.ts
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
|
+
import type { Child } from '../markup/index.ts';
|
|
1
2
|
declare const icons: {
|
|
2
|
-
star:
|
|
3
|
-
commits:
|
|
4
|
-
prs:
|
|
5
|
-
prs_merged:
|
|
6
|
-
prs_merged_percentage:
|
|
7
|
-
issues:
|
|
8
|
-
icon:
|
|
9
|
-
contribs:
|
|
10
|
-
fork:
|
|
11
|
-
reviews:
|
|
12
|
-
discussions_started:
|
|
13
|
-
discussions_answered:
|
|
14
|
-
comments:
|
|
15
|
-
contributions:
|
|
16
|
-
gist:
|
|
3
|
+
star: import("../markup/element.ts").MarkupElement;
|
|
4
|
+
commits: import("../markup/element.ts").MarkupElement;
|
|
5
|
+
prs: import("../markup/element.ts").MarkupElement;
|
|
6
|
+
prs_merged: import("../markup/element.ts").MarkupElement;
|
|
7
|
+
prs_merged_percentage: import("../markup/element.ts").MarkupElement;
|
|
8
|
+
issues: import("../markup/element.ts").MarkupElement;
|
|
9
|
+
icon: import("../markup/element.ts").MarkupElement;
|
|
10
|
+
contribs: import("../markup/element.ts").MarkupElement;
|
|
11
|
+
fork: import("../markup/element.ts").MarkupElement;
|
|
12
|
+
reviews: import("../markup/element.ts").MarkupElement;
|
|
13
|
+
discussions_started: import("../markup/element.ts").MarkupElement;
|
|
14
|
+
discussions_answered: import("../markup/element.ts").MarkupElement;
|
|
15
|
+
comments: import("../markup/element.ts").MarkupElement;
|
|
16
|
+
contributions: import("../markup/element.ts").MarkupElement;
|
|
17
|
+
gist: import("../markup/element.ts").MarkupElement;
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
19
20
|
* Get rank icon
|
|
20
21
|
*
|
|
21
|
-
* @
|
|
22
|
-
* @param rankLevel - The rank level.
|
|
23
|
-
* @param percentile - The rank percentile.
|
|
24
|
-
* @returns The SVG code of the rank icon
|
|
22
|
+
* @returns The rank icon.
|
|
25
23
|
*/
|
|
26
|
-
declare const rankIcon: (
|
|
24
|
+
declare const rankIcon: (kind: string, rankLevel: string, percentile: number) => Child;
|
|
27
25
|
export { icons, rankIcon };
|
|
28
26
|
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/common/icons.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/common/icons.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGhD,QAAA,MAAM,KAAK;IACT,IAAI;IAIJ,OAAO;IAIP,GAAG;IAIH,UAAU;IAIV,qBAAqB;IAIrB,MAAM;IAIN,IAAI;IAIJ,QAAQ;IAIR,IAAI;IAIJ,OAAO;IAIP,mBAAmB;IAInB,oBAAoB;IAIpB,QAAQ;IAGR,aAAa;IAGb,IAAI;CAIL,CAAC;AAUF;;;;GAIG;AACH,QAAA,MAAM,QAAQ,SAAU,MAAM,aAAa,MAAM,cAAc,MAAM,KAAG,KAkDvE,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC"}
|
package/build/common/icons.js
CHANGED
|
@@ -1,77 +1,113 @@
|
|
|
1
|
-
|
|
2
|
-
The icons in this file are based on https://github.com/primer/octicons which is released under the MIT license:
|
|
3
|
-
|
|
4
|
-
MIT License
|
|
5
|
-
|
|
6
|
-
Copyright (c) 2026 GitHub Inc.
|
|
7
|
-
|
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
in the Software without restriction, including without limitation the rights
|
|
11
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
furnished to do so, subject to the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
-
SOFTWARE.
|
|
25
|
-
*/
|
|
1
|
+
import { el } from '../markup/index.js';
|
|
26
2
|
const icons = {
|
|
27
|
-
star:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
3
|
+
star: el('path', {
|
|
4
|
+
'fill-rule': 'evenodd',
|
|
5
|
+
d: 'M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z',
|
|
6
|
+
}),
|
|
7
|
+
commits: el('path', {
|
|
8
|
+
'fill-rule': 'evenodd',
|
|
9
|
+
d: 'M1.643 3.143L.427 1.927A.25.25 0 000 2.104V5.75c0 .138.112.25.25.25h3.646a.25.25 0 00.177-.427L2.715 4.215a6.5 6.5 0 11-1.18 4.458.75.75 0 10-1.493.154 8.001 8.001 0 101.6-5.684zM7.75 4a.75.75 0 01.75.75v2.992l2.028.812a.75.75 0 01-.557 1.392l-2.5-1A.75.75 0 017 8.25v-3.5A.75.75 0 017.75 4z',
|
|
10
|
+
}),
|
|
11
|
+
prs: el('path', {
|
|
12
|
+
'fill-rule': 'evenodd',
|
|
13
|
+
d: 'M7.177 3.073L9.573.677A.25.25 0 0110 .854v4.792a.25.25 0 01-.427.177L7.177 3.427a.25.25 0 010-.354zM3.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122v5.256a2.251 2.251 0 11-1.5 0V5.372A2.25 2.25 0 011.5 3.25zM11 2.5h-1V4h1a1 1 0 011 1v5.628a2.251 2.251 0 101.5 0V5A2.5 2.5 0 0011 2.5zm1 10.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0zM3.75 12a.75.75 0 100 1.5.75.75 0 000-1.5z',
|
|
14
|
+
}),
|
|
15
|
+
prs_merged: el('path', {
|
|
16
|
+
'fill-rule': 'evenodd',
|
|
17
|
+
d: 'M5.45 5.154A4.25 4.25 0 0 0 9.25 7.5h1.378a2.251 2.251 0 1 1 0 1.5H9.25A5.734 5.734 0 0 1 5 7.123v3.505a2.25 2.25 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.95-.218ZM4.25 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm8.5-4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM5 3.25a.75.75 0 1 0 0 .005V3.25Z',
|
|
18
|
+
}),
|
|
19
|
+
prs_merged_percentage: el('path', {
|
|
20
|
+
'fill-rule': 'evenodd',
|
|
21
|
+
d: 'M13.442 2.558a.625.625 0 0 1 0 .884l-10 10a.625.625 0 1 1-.884-.884l10-10a.625.625 0 0 1 .884 0zM4.5 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zm7 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z',
|
|
22
|
+
}),
|
|
23
|
+
issues: el('path', {
|
|
24
|
+
'fill-rule': 'evenodd',
|
|
25
|
+
d: 'M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9 3a1 1 0 11-2 0 1 1 0 012 0zm-.25-6.25a.75.75 0 00-1.5 0v3.5a.75.75 0 001.5 0v-3.5z',
|
|
26
|
+
}),
|
|
27
|
+
icon: el('path', {
|
|
28
|
+
'fill-rule': 'evenodd',
|
|
29
|
+
d: 'M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z',
|
|
30
|
+
}),
|
|
31
|
+
contribs: el('path', {
|
|
32
|
+
'fill-rule': 'evenodd',
|
|
33
|
+
d: 'M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z',
|
|
34
|
+
}),
|
|
35
|
+
fork: el('path', {
|
|
36
|
+
'fill-rule': 'evenodd',
|
|
37
|
+
d: 'M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z',
|
|
38
|
+
}),
|
|
39
|
+
reviews: el('path', {
|
|
40
|
+
'fill-rule': 'evenodd',
|
|
41
|
+
d: 'M8 2c1.981 0 3.671.992 4.933 2.078 1.27 1.091 2.187 2.345 2.637 3.023a1.62 1.62 0 0 1 0 1.798c-.45.678-1.367 1.932-2.637 3.023C11.67 13.008 9.981 14 8 14c-1.981 0-3.671-.992-4.933-2.078C1.797 10.83.88 9.576.43 8.898a1.62 1.62 0 0 1 0-1.798c.45-.677 1.367-1.931 2.637-3.022C4.33 2.992 6.019 2 8 2ZM1.679 7.932a.12.12 0 0 0 0 .136c.411.622 1.241 1.75 2.366 2.717C5.176 11.758 6.527 12.5 8 12.5c1.473 0 2.825-.742 3.955-1.715 1.124-.967 1.954-2.096 2.366-2.717a.12.12 0 0 0 0-.136c-.412-.621-1.242-1.75-2.366-2.717C10.824 4.242 9.473 3.5 8 3.5c-1.473 0-2.825.742-3.955 1.715-1.124.967-1.954 2.096-2.366 2.717ZM8 10a2 2 0 1 1-.001-3.999A2 2 0 0 1 8 10Z',
|
|
42
|
+
}),
|
|
43
|
+
discussions_started: el('path', {
|
|
44
|
+
'fill-rule': 'evenodd',
|
|
45
|
+
d: 'M1.75 1h8.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 10.25 10H7.061l-2.574 2.573A1.458 1.458 0 0 1 2 11.543V10h-.25A1.75 1.75 0 0 1 0 8.25v-5.5C0 1.784.784 1 1.75 1ZM1.5 2.75v5.5c0 .138.112.25.25.25h1a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h3.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm13 2a.25.25 0 0 0-.25-.25h-.5a.75.75 0 0 1 0-1.5h.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 14.25 12H14v1.543a1.458 1.458 0 0 1-2.487 1.03L9.22 12.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.22 2.22v-2.19a.75.75 0 0 1 .75-.75h1a.25.25 0 0 0 .25-.25Z',
|
|
46
|
+
}),
|
|
47
|
+
discussions_answered: el('path', {
|
|
48
|
+
'fill-rule': 'evenodd',
|
|
49
|
+
d: 'M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z',
|
|
50
|
+
}),
|
|
51
|
+
comments: el('path', {
|
|
52
|
+
d: 'M1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 13.25 12H9.06l-2.573 2.573A1.458 1.458 0 0 1 4 13.543V12H2.75A1.75 1.75 0 0 1 1 10.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h4.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z',
|
|
53
|
+
}),
|
|
54
|
+
contributions: el('path', {
|
|
55
|
+
d: 'M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm7.25-3.25v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5a.75.75 0 0 1 1.5 0Z',
|
|
56
|
+
}),
|
|
57
|
+
gist: el('path', {
|
|
58
|
+
'fill-rule': 'evenodd',
|
|
59
|
+
d: 'M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25Zm7.47 3.97a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L10.69 8 9.22 6.53a.75.75 0 0 1 0-1.06ZM6.78 6.53 5.31 8l1.47 1.47a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-2-2a.75.75 0 0 1 0-1.06l2-2a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z',
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
62
|
+
/** Attributes every rank glyph shares, so the three variants differ only where they mean to. */
|
|
63
|
+
const RANK_TEXT = {
|
|
64
|
+
x: -5,
|
|
65
|
+
'alignment-baseline': 'central',
|
|
66
|
+
'dominant-baseline': 'central',
|
|
67
|
+
'text-anchor': 'middle',
|
|
42
68
|
};
|
|
43
69
|
/**
|
|
44
70
|
* Get rank icon
|
|
45
71
|
*
|
|
46
|
-
* @
|
|
47
|
-
* @param rankLevel - The rank level.
|
|
48
|
-
* @param percentile - The rank percentile.
|
|
49
|
-
* @returns The SVG code of the rank icon
|
|
72
|
+
* @returns The rank icon.
|
|
50
73
|
*/
|
|
51
|
-
const rankIcon = (
|
|
52
|
-
switch (
|
|
53
|
-
case 'github':
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
const rankIcon = (kind, rankLevel, percentile) => {
|
|
75
|
+
switch (kind) {
|
|
76
|
+
case 'github': {
|
|
77
|
+
return el('svg', {
|
|
78
|
+
x: -38,
|
|
79
|
+
y: -30,
|
|
80
|
+
height: 66,
|
|
81
|
+
width: 66,
|
|
82
|
+
'aria-hidden': 'true',
|
|
83
|
+
viewBox: '0 0 16 16',
|
|
84
|
+
version: '1.1',
|
|
85
|
+
'data-view-component': 'true',
|
|
86
|
+
'data-testid': 'github-rank-icon',
|
|
87
|
+
}, el('path', {
|
|
88
|
+
d: 'M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z',
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
case 'percentile': {
|
|
92
|
+
return [
|
|
93
|
+
el('text', {
|
|
94
|
+
...RANK_TEXT,
|
|
95
|
+
y: -12,
|
|
96
|
+
'data-testid': 'percentile-top-header',
|
|
97
|
+
class: 'rank-percentile-header',
|
|
98
|
+
}, 'Top'),
|
|
99
|
+
el('text', {
|
|
100
|
+
...RANK_TEXT,
|
|
101
|
+
y: 12,
|
|
102
|
+
'data-testid': 'percentile-rank-value',
|
|
103
|
+
class: 'rank-percentile-text',
|
|
104
|
+
}, `${percentile.toFixed(1)}%`),
|
|
105
|
+
];
|
|
106
|
+
}
|
|
68
107
|
case 'default':
|
|
69
|
-
default:
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
${rankLevel}
|
|
73
|
-
</text>
|
|
74
|
-
`;
|
|
108
|
+
default: {
|
|
109
|
+
return el('text', { ...RANK_TEXT, y: 3, 'data-testid': 'level-rank-icon' }, rankLevel);
|
|
110
|
+
}
|
|
75
111
|
}
|
|
76
112
|
};
|
|
77
113
|
export { icons, rankIcon };
|
|
@@ -3,7 +3,6 @@ declare const DEFAULT_LANG_COLOR = "#858585";
|
|
|
3
3
|
/**
|
|
4
4
|
* Resolves a language's brand color from the generated table.
|
|
5
5
|
*
|
|
6
|
-
* @param name Language name as GitHub spells it.
|
|
7
6
|
* @returns The language's hex color, or the default gray when it is unknown.
|
|
8
7
|
*/
|
|
9
8
|
declare const getLanguageColor: (name: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"languageColors.d.ts","sourceRoot":"","sources":["../../src/common/languageColors.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,QAAA,MAAM,kBAAkB,YAAY,CAAC;AAKrC
|
|
1
|
+
{"version":3,"file":"languageColors.d.ts","sourceRoot":"","sources":["../../src/common/languageColors.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,QAAA,MAAM,kBAAkB,YAAY,CAAC;AAKrC;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,SAAU,MAAM,KAAG,MAAoD,CAAC;AAE9F,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -6,10 +6,7 @@ const languageColors = languageColorsJson;
|
|
|
6
6
|
/**
|
|
7
7
|
* Resolves a language's brand color from the generated table.
|
|
8
8
|
*
|
|
9
|
-
* @param name Language name as GitHub spells it.
|
|
10
9
|
* @returns The language's hex color, or the default gray when it is unknown.
|
|
11
10
|
*/
|
|
12
|
-
const getLanguageColor = (name) =>
|
|
13
|
-
return languageColors[name] ?? DEFAULT_LANG_COLOR;
|
|
14
|
-
};
|
|
11
|
+
const getLanguageColor = (name) => languageColors[name] ?? DEFAULT_LANG_COLOR;
|
|
15
12
|
export { DEFAULT_LANG_COLOR, getLanguageColor };
|