@shiinasaku/github-card 2.0.0 → 4.2.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 +159 -261
- package/dist/card.d.ts +16 -0
- package/dist/lib.d.ts +13 -0
- package/dist/lib.js +1347 -0
- package/dist/types.d.ts +37 -0
- package/dist/utils/colors.d.ts +2 -0
- package/dist/utils/font.d.ts +4 -0
- package/dist/utils/format.d.ts +10 -0
- package/dist/utils/icons.d.ts +11 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/languages.d.ts +2 -0
- package/dist/utils/themes.d.ts +16 -0
- package/package.json +30 -20
- package/src/card.ts +537 -113
- package/src/env.d.ts +4 -0
- package/src/github.ts +406 -480
- package/src/index.ts +148 -134
- package/src/input.css +1 -0
- package/src/lib.ts +1 -1
- package/src/tailwind.css +3837 -0
- package/src/types.ts +1 -0
- package/src/utils/colors.ts +85 -0
- package/src/utils/font.ts +5 -19
- package/src/utils/format.ts +54 -16
- package/src/utils/github-client.ts +198 -0
- package/src/utils/icons.ts +27 -9
- package/src/utils/index.ts +2 -1
- package/src/utils/themes.ts +154 -19
- package/fonts/Roboto-subset.woff2 +0 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface UserProfile {
|
|
2
|
+
login: string;
|
|
3
|
+
name: string | null;
|
|
4
|
+
avatarUrl: string;
|
|
5
|
+
bio: string | null;
|
|
6
|
+
pronouns: string | null;
|
|
7
|
+
twitter: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface UserStats {
|
|
10
|
+
stars: number;
|
|
11
|
+
repos: number;
|
|
12
|
+
prs: number;
|
|
13
|
+
issues: number;
|
|
14
|
+
commits: number;
|
|
15
|
+
}
|
|
16
|
+
export interface LanguageStat {
|
|
17
|
+
name: string;
|
|
18
|
+
size: number;
|
|
19
|
+
color: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ProfileData {
|
|
22
|
+
user: UserProfile;
|
|
23
|
+
stats: UserStats;
|
|
24
|
+
languages: LanguageStat[];
|
|
25
|
+
}
|
|
26
|
+
export interface CardOptions {
|
|
27
|
+
theme?: string;
|
|
28
|
+
title_color?: string;
|
|
29
|
+
text_color?: string;
|
|
30
|
+
icon_color?: string;
|
|
31
|
+
bg_color?: string;
|
|
32
|
+
border_color?: string;
|
|
33
|
+
hide_border?: boolean;
|
|
34
|
+
compact?: boolean;
|
|
35
|
+
hide?: string[];
|
|
36
|
+
animate?: boolean;
|
|
37
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** System font stack — no shipped font, respects the user's OS. */
|
|
2
|
+
export declare const FONT_FAMILY = "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"";
|
|
3
|
+
/** @deprecated No shipped font — kept for API backwards compatibility. */
|
|
4
|
+
export declare const FONT_FACE = "";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function kFormat(num: number): string;
|
|
2
|
+
/**
|
|
3
|
+
* Approximate rendered width of a string in SVG user units for the default
|
|
4
|
+
* sans-serif stack. Widths are per-character averages tuned to the card's
|
|
5
|
+
* font sizes and weights, so layout can reserve enough space without relying
|
|
6
|
+
* on browser text measurement (which is unavailable server-side).
|
|
7
|
+
*/
|
|
8
|
+
export declare function measureText(text: string, size: number, weight?: number): number;
|
|
9
|
+
export declare function escapeXml(str: string): string;
|
|
10
|
+
export declare function wrapText(input: string, maxLen: number, maxLines: number): string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const icons: {
|
|
2
|
+
star: string;
|
|
3
|
+
commit: string;
|
|
4
|
+
pr: string;
|
|
5
|
+
issue: string;
|
|
6
|
+
repo: string;
|
|
7
|
+
x: string;
|
|
8
|
+
};
|
|
9
|
+
type IconName = keyof typeof icons;
|
|
10
|
+
export declare function icon(name: IconName, color: string, size?: number): string;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { resolveColors, themes, type Theme } from "./themes";
|
|
2
|
+
export { kFormat, escapeXml, wrapText, measureText } from "./format";
|
|
3
|
+
export { getLangColor } from "./languages";
|
|
4
|
+
export { icons, icon } from "./icons";
|
|
5
|
+
export { FONT_FACE, FONT_FAMILY } from "./font";
|
|
6
|
+
export * from "./colors";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type Theme = {
|
|
2
|
+
bg: string;
|
|
3
|
+
title: string;
|
|
4
|
+
text: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
border: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const themes: Record<string, Theme>;
|
|
9
|
+
export declare function resolveColors(opts: {
|
|
10
|
+
theme?: string;
|
|
11
|
+
bg_color?: string;
|
|
12
|
+
title_color?: string;
|
|
13
|
+
text_color?: string;
|
|
14
|
+
icon_color?: string;
|
|
15
|
+
border_color?: string;
|
|
16
|
+
}): Theme;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shiinasaku/github-card",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Beautiful GitHub stats SVG cards. Embed in README, use as API, or render programmatically.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"badge",
|
|
@@ -23,31 +23,39 @@
|
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "https://github.com/ShiinaSaku/Github-Card.git"
|
|
26
|
+
"url": "git+https://github.com/ShiinaSaku/Github-Card.git"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
+
"dist",
|
|
29
30
|
"src",
|
|
30
|
-
"fonts",
|
|
31
31
|
"README.md",
|
|
32
32
|
"LICENSE"
|
|
33
33
|
],
|
|
34
34
|
"type": "module",
|
|
35
|
-
"main": "./
|
|
36
|
-
"module": "./
|
|
37
|
-
"types": "./
|
|
35
|
+
"main": "./dist/lib.js",
|
|
36
|
+
"module": "./dist/lib.js",
|
|
37
|
+
"types": "./dist/lib.d.ts",
|
|
38
38
|
"exports": {
|
|
39
39
|
".": {
|
|
40
|
-
"types": "./
|
|
41
|
-
"
|
|
40
|
+
"types": "./dist/lib.d.ts",
|
|
41
|
+
"bun": "./src/lib.ts",
|
|
42
|
+
"import": "./dist/lib.js",
|
|
43
|
+
"default": "./dist/lib.js"
|
|
42
44
|
},
|
|
43
45
|
"./server": {
|
|
44
46
|
"types": "./src/index.ts",
|
|
45
47
|
"import": "./src/index.ts"
|
|
46
|
-
}
|
|
48
|
+
},
|
|
49
|
+
"./package.json": "./package.json"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public",
|
|
53
|
+
"provenance": true
|
|
47
54
|
},
|
|
48
55
|
"scripts": {
|
|
49
56
|
"dev": "bun run --watch src/index.ts",
|
|
50
|
-
"build": "bun build src/
|
|
57
|
+
"build": "bun build src/lib.ts --outfile dist/lib.js --format esm --target node && tsc -p tsconfig.build.json",
|
|
58
|
+
"prepublishOnly": "bun run build",
|
|
51
59
|
"fmt": "oxfmt",
|
|
52
60
|
"fmt:check": "oxfmt --check",
|
|
53
61
|
"lint": "oxlint",
|
|
@@ -57,16 +65,18 @@
|
|
|
57
65
|
"test:coverage": "bun test --coverage"
|
|
58
66
|
},
|
|
59
67
|
"dependencies": {
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"
|
|
64
|
-
"elysia": "latest"
|
|
68
|
+
"@elysia/cors": "^1.4.2",
|
|
69
|
+
"@elysia/openapi": "^1.4.15",
|
|
70
|
+
"@elysia/server-timing": "^1.4.1",
|
|
71
|
+
"elysia": "1.4.29"
|
|
65
72
|
},
|
|
66
73
|
"devDependencies": {
|
|
67
|
-
"@
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
|
|
74
|
+
"@tailwindcss/cli": "^4.3.3",
|
|
75
|
+
"@types/bun": "^1.4.0",
|
|
76
|
+
"oxfmt": "0.64.0",
|
|
77
|
+
"oxlint": "1.79.0",
|
|
78
|
+
"tailwindcss": "^4.3.3",
|
|
79
|
+
"typescript": "^6.0.3"
|
|
80
|
+
},
|
|
81
|
+
"packageManager": "bun@1.4.0"
|
|
72
82
|
}
|