contrib-graphs 0.0.0-stage → 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.
@@ -0,0 +1,232 @@
1
+
2
+ /**
3
+ * `contrib-graphs`: los componentes. El build antepone "use client" a este
4
+ * archivo para que se puedan importar desde Server Components (Next.js).
5
+ * En código de servidor usa `contrib-graphs/data`.
6
+ */
7
+ import { A as ThemePalette, C as ContributionDay, D as GraphTheme, E as MonthLabel, M as themeNames, N as themeVars, O as LevelColors, P as themes, S as ColorMode, T as LevelScale, _ as formatDate, a as fromDates, b as Calendar, c as mergeSources, d as sampleProfiles, f as CalendarOptions, g as cropCalendar, h as computeStats, i as fetchGitLabContributions, j as resolveTheme, k as ThemeName, l as SampleProfile, m as buildCalendar, n as GitHubCalendarResponse, o as fromGitHub, p as GraphStats, r as fetchGitHubContributions, s as fromGitLab, t as GITHUB_CONTRIBUTIONS_QUERY, u as generateSampleData, v as makeLevelFn, w as Level, x as CalendarDay, y as BaseGraphProps } from "./data-DptvXfjH.cjs";
8
+ /** Props of `ClassicGraph` and `DotsGraph`. */
9
+ interface GridGraphProps extends BaseGraphProps {
10
+ /**
11
+ * Size of each cell in px.
12
+ * @default 11
13
+ */
14
+ cellSize?: number;
15
+ /**
16
+ * Space between cells in px.
17
+ * @default 3
18
+ */
19
+ gap?: number;
20
+ /**
21
+ * Corner radius in px; use `cellSize / 2` for circles. Classic only.
22
+ * @default 2
23
+ */
24
+ radius?: number;
25
+ /**
26
+ * Show Mon/Wed/Fri labels.
27
+ * @default true
28
+ */
29
+ showWeekdays?: boolean;
30
+ /**
31
+ * Show month labels.
32
+ * @default true
33
+ */
34
+ showMonths?: boolean;
35
+ /**
36
+ * Add a glow to the busiest days.
37
+ * @default false
38
+ */
39
+ glow?: boolean;
40
+ /**
41
+ * On narrow screens, `crop` drops the oldest weeks and `scale` shrinks the SVG.
42
+ * @default 'crop'
43
+ */
44
+ fit?: 'crop' | 'scale';
45
+ }
46
+ /** The classic weeks × days grid. */
47
+ export declare function ClassicGraph(props: GridGraphProps): import("react").JSX.Element;
48
+ /** Circles whose size also encodes intensity, so it still reads in monochrome. */
49
+ export declare function DotsGraph(props: GridGraphProps): import("react").JSX.Element;
50
+ /** Props of `IsometricGraph`. */
51
+ interface IsometricGraphProps extends BaseGraphProps {
52
+ /**
53
+ * Width of each tile in px.
54
+ * @default 12
55
+ */
56
+ tileSize?: number;
57
+ /**
58
+ * Height of the tallest column in px.
59
+ * @default 48
60
+ */
61
+ maxHeight?: number;
62
+ /**
63
+ * `count` scales columns by the actual count; `level` uses five fixed heights.
64
+ * @default 'count'
65
+ */
66
+ heightBy?: 'count' | 'level';
67
+ /**
68
+ * Show longest streak, current streak and best day in the header.
69
+ * @default true
70
+ */
71
+ showStats?: boolean;
72
+ /**
73
+ * Labels of the three stats.
74
+ * @default ['longest streak', 'current streak', 'best day']
75
+ */
76
+ statLabels?: readonly [string, string, string];
77
+ }
78
+ /** Isometric columns whose height shows each day's activity. */
79
+ export declare function IsometricGraph(props: IsometricGraphProps): import("react").JSX.Element;
80
+ /** Props of `RadialGraph`. */
81
+ interface RadialGraphProps extends BaseGraphProps {
82
+ /**
83
+ * Diameter in px.
84
+ * @default 320
85
+ */
86
+ size?: number;
87
+ /**
88
+ * Inner radius as a fraction of the outer radius.
89
+ * @default 0.38
90
+ */
91
+ innerRadius?: number;
92
+ /**
93
+ * Show month labels around the ring.
94
+ * @default true
95
+ */
96
+ showMonths?: boolean;
97
+ /**
98
+ * Show the header with the total. The total is already in the center of the ring.
99
+ * @default false
100
+ */
101
+ showTotal?: boolean;
102
+ }
103
+ /** The year as a ring: each week is a slice and each weekday a band. */
104
+ export declare function RadialGraph(props: RadialGraphProps): import("react").JSX.Element;
105
+ /** Props of `SkylineGraph`. It works by week, so it takes `onWeekClick` instead of `onDayClick`. */
106
+ interface SkylineGraphProps extends Omit<BaseGraphProps, 'onDayClick'> {
107
+ /**
108
+ * Height of the tallest building in px.
109
+ * @default 110
110
+ */
111
+ height?: number;
112
+ /**
113
+ * Width of each building in px.
114
+ * @default 9
115
+ */
116
+ barWidth?: number;
117
+ /**
118
+ * Space between buildings in px.
119
+ * @default 3
120
+ */
121
+ gap?: number;
122
+ /**
123
+ * Draw seven windows per building, lit on the days with activity.
124
+ * @default true
125
+ */
126
+ windows?: boolean;
127
+ /**
128
+ * On narrow screens, `crop` drops the oldest weeks and `scale` shrinks the SVG.
129
+ * @default 'crop'
130
+ */
131
+ fit?: 'crop' | 'scale';
132
+ /** Called when a week is clicked, or with Enter or Space while it is focused. */
133
+ onWeekClick?: (week: SkylineWeek) => void;
134
+ }
135
+ /** A week as passed to `onWeekClick`. */
136
+ interface SkylineWeek {
137
+ index: number;
138
+ days: CalendarDay[];
139
+ total: number;
140
+ activeDays: number;
141
+ level: Level;
142
+ }
143
+ /** One building per week: your year as a city skyline. */
144
+ export declare function SkylineGraph(props: SkylineGraphProps): import("react").JSX.Element;
145
+ export declare const terminalCharsets: {
146
+ readonly blocks: readonly ["··", "░░", "▒▒", "▓▓", "██"];
147
+ readonly squares: readonly ["□ ", "▪ ", "■ ", "■ ", "■ "];
148
+ readonly ascii: readonly [". ", ": ", "+ ", "# ", "@ "];
149
+ readonly dots: readonly ["· ", "• ", "• ", "● ", "● "];
150
+ };
151
+ type TerminalCharset = keyof typeof terminalCharsets;
152
+ /** Props of `TerminalGraph`. */
153
+ interface TerminalGraphProps extends BaseGraphProps {
154
+ /**
155
+ * Characters for each level: `blocks` (░▒▓█), `squares`, `ascii` or `dots`.
156
+ * @default 'blocks'
157
+ */
158
+ charset?: TerminalCharset;
159
+ /**
160
+ * Command shown in the first prompt line.
161
+ * @default "git log --since='1 year ago' | heatmap"
162
+ */
163
+ command?: string;
164
+ /**
165
+ * Text before the command.
166
+ * @default '~ $'
167
+ */
168
+ prompt?: string;
169
+ /**
170
+ * Color the characters with the theme; `false` is monochrome.
171
+ * @default true
172
+ */
173
+ colored?: boolean;
174
+ /**
175
+ * On narrow screens, `crop` drops the oldest weeks and `scale` shrinks the text (down to 6px, then crops).
176
+ * @default 'crop'
177
+ */
178
+ fit?: 'crop' | 'scale';
179
+ /**
180
+ * Labels at both ends of the legend.
181
+ * @default ['less', 'more']
182
+ */
183
+ legendLabels?: readonly [string, string];
184
+ }
185
+ /** Real monospace text, for portfolios with a terminal look. */
186
+ export declare function TerminalGraph(props: TerminalGraphProps): import("react").JSX.Element;
187
+ /** Props of `CompactGraph`. It shows days rather than weeks, so `weeks`, `weekStart` and `periodLabel` don't apply. */
188
+ interface CompactGraphProps extends Omit<BaseGraphProps, 'weeks' | 'weekStart' | 'periodLabel'> {
189
+ /**
190
+ * Number of days to show.
191
+ * @default 30
192
+ */
193
+ days?: number;
194
+ /**
195
+ * Size of each cell in px.
196
+ * @default 10
197
+ */
198
+ cellSize?: number;
199
+ /**
200
+ * Space between cells in px.
201
+ * @default 3
202
+ */
203
+ gap?: number;
204
+ /**
205
+ * Corner radius in px.
206
+ * @default 2
207
+ */
208
+ radius?: number;
209
+ /**
210
+ * Show the current streak next to the total.
211
+ * @default true
212
+ */
213
+ showStreak?: boolean;
214
+ /**
215
+ * Streak text, given the number of days.
216
+ * @default (n) => `${n} day streak`
217
+ */
218
+ streakLabel?: (n: number) => string;
219
+ /**
220
+ * Text after the total, given the number of days.
221
+ * @default (days) => `in the last ${days} days`
222
+ */
223
+ rangeLabel?: (days: number) => string;
224
+ /**
225
+ * Show the Less–More legend.
226
+ * @default false
227
+ */
228
+ showLegend?: boolean;
229
+ }
230
+ /** A single row with the last N days, for headers, cards and footers. */
231
+ export declare function CompactGraph(props: CompactGraphProps): import("react").JSX.Element;
232
+ export { type BaseGraphProps, type Calendar, type CalendarDay, type CalendarOptions, type ColorMode, type CompactGraphProps, type ContributionDay, GITHUB_CONTRIBUTIONS_QUERY, GitHubCalendarResponse, type GraphStats, type GraphTheme, type GridGraphProps, type IsometricGraphProps, type Level, type LevelColors, type LevelScale, type MonthLabel, type RadialGraphProps, type SampleProfile, type SkylineGraphProps, type SkylineWeek, type TerminalCharset, type TerminalGraphProps, type ThemeName, type ThemePalette, buildCalendar, computeStats, cropCalendar, fetchGitHubContributions, fetchGitLabContributions, formatDate, fromDates, fromGitHub, fromGitLab, generateSampleData, makeLevelFn, mergeSources, resolveTheme, sampleProfiles, themeNames, themeVars, themes };
@@ -0,0 +1,232 @@
1
+
2
+ /**
3
+ * `contrib-graphs`: los componentes. El build antepone "use client" a este
4
+ * archivo para que se puedan importar desde Server Components (Next.js).
5
+ * En código de servidor usa `contrib-graphs/data`.
6
+ */
7
+ import { A as ThemePalette, C as ContributionDay, D as GraphTheme, E as MonthLabel, M as themeNames, N as themeVars, O as LevelColors, P as themes, S as ColorMode, T as LevelScale, _ as formatDate, a as fromDates, b as Calendar, c as mergeSources, d as sampleProfiles, f as CalendarOptions, g as cropCalendar, h as computeStats, i as fetchGitLabContributions, j as resolveTheme, k as ThemeName, l as SampleProfile, m as buildCalendar, n as GitHubCalendarResponse, o as fromGitHub, p as GraphStats, r as fetchGitHubContributions, s as fromGitLab, t as GITHUB_CONTRIBUTIONS_QUERY, u as generateSampleData, v as makeLevelFn, w as Level, x as CalendarDay, y as BaseGraphProps } from "./data-DptvXfjH.js";
8
+ /** Props of `ClassicGraph` and `DotsGraph`. */
9
+ interface GridGraphProps extends BaseGraphProps {
10
+ /**
11
+ * Size of each cell in px.
12
+ * @default 11
13
+ */
14
+ cellSize?: number;
15
+ /**
16
+ * Space between cells in px.
17
+ * @default 3
18
+ */
19
+ gap?: number;
20
+ /**
21
+ * Corner radius in px; use `cellSize / 2` for circles. Classic only.
22
+ * @default 2
23
+ */
24
+ radius?: number;
25
+ /**
26
+ * Show Mon/Wed/Fri labels.
27
+ * @default true
28
+ */
29
+ showWeekdays?: boolean;
30
+ /**
31
+ * Show month labels.
32
+ * @default true
33
+ */
34
+ showMonths?: boolean;
35
+ /**
36
+ * Add a glow to the busiest days.
37
+ * @default false
38
+ */
39
+ glow?: boolean;
40
+ /**
41
+ * On narrow screens, `crop` drops the oldest weeks and `scale` shrinks the SVG.
42
+ * @default 'crop'
43
+ */
44
+ fit?: 'crop' | 'scale';
45
+ }
46
+ /** The classic weeks × days grid. */
47
+ export declare function ClassicGraph(props: GridGraphProps): import("react").JSX.Element;
48
+ /** Circles whose size also encodes intensity, so it still reads in monochrome. */
49
+ export declare function DotsGraph(props: GridGraphProps): import("react").JSX.Element;
50
+ /** Props of `IsometricGraph`. */
51
+ interface IsometricGraphProps extends BaseGraphProps {
52
+ /**
53
+ * Width of each tile in px.
54
+ * @default 12
55
+ */
56
+ tileSize?: number;
57
+ /**
58
+ * Height of the tallest column in px.
59
+ * @default 48
60
+ */
61
+ maxHeight?: number;
62
+ /**
63
+ * `count` scales columns by the actual count; `level` uses five fixed heights.
64
+ * @default 'count'
65
+ */
66
+ heightBy?: 'count' | 'level';
67
+ /**
68
+ * Show longest streak, current streak and best day in the header.
69
+ * @default true
70
+ */
71
+ showStats?: boolean;
72
+ /**
73
+ * Labels of the three stats.
74
+ * @default ['longest streak', 'current streak', 'best day']
75
+ */
76
+ statLabels?: readonly [string, string, string];
77
+ }
78
+ /** Isometric columns whose height shows each day's activity. */
79
+ export declare function IsometricGraph(props: IsometricGraphProps): import("react").JSX.Element;
80
+ /** Props of `RadialGraph`. */
81
+ interface RadialGraphProps extends BaseGraphProps {
82
+ /**
83
+ * Diameter in px.
84
+ * @default 320
85
+ */
86
+ size?: number;
87
+ /**
88
+ * Inner radius as a fraction of the outer radius.
89
+ * @default 0.38
90
+ */
91
+ innerRadius?: number;
92
+ /**
93
+ * Show month labels around the ring.
94
+ * @default true
95
+ */
96
+ showMonths?: boolean;
97
+ /**
98
+ * Show the header with the total. The total is already in the center of the ring.
99
+ * @default false
100
+ */
101
+ showTotal?: boolean;
102
+ }
103
+ /** The year as a ring: each week is a slice and each weekday a band. */
104
+ export declare function RadialGraph(props: RadialGraphProps): import("react").JSX.Element;
105
+ /** Props of `SkylineGraph`. It works by week, so it takes `onWeekClick` instead of `onDayClick`. */
106
+ interface SkylineGraphProps extends Omit<BaseGraphProps, 'onDayClick'> {
107
+ /**
108
+ * Height of the tallest building in px.
109
+ * @default 110
110
+ */
111
+ height?: number;
112
+ /**
113
+ * Width of each building in px.
114
+ * @default 9
115
+ */
116
+ barWidth?: number;
117
+ /**
118
+ * Space between buildings in px.
119
+ * @default 3
120
+ */
121
+ gap?: number;
122
+ /**
123
+ * Draw seven windows per building, lit on the days with activity.
124
+ * @default true
125
+ */
126
+ windows?: boolean;
127
+ /**
128
+ * On narrow screens, `crop` drops the oldest weeks and `scale` shrinks the SVG.
129
+ * @default 'crop'
130
+ */
131
+ fit?: 'crop' | 'scale';
132
+ /** Called when a week is clicked, or with Enter or Space while it is focused. */
133
+ onWeekClick?: (week: SkylineWeek) => void;
134
+ }
135
+ /** A week as passed to `onWeekClick`. */
136
+ interface SkylineWeek {
137
+ index: number;
138
+ days: CalendarDay[];
139
+ total: number;
140
+ activeDays: number;
141
+ level: Level;
142
+ }
143
+ /** One building per week: your year as a city skyline. */
144
+ export declare function SkylineGraph(props: SkylineGraphProps): import("react").JSX.Element;
145
+ export declare const terminalCharsets: {
146
+ readonly blocks: readonly ["··", "░░", "▒▒", "▓▓", "██"];
147
+ readonly squares: readonly ["□ ", "▪ ", "■ ", "■ ", "■ "];
148
+ readonly ascii: readonly [". ", ": ", "+ ", "# ", "@ "];
149
+ readonly dots: readonly ["· ", "• ", "• ", "● ", "● "];
150
+ };
151
+ type TerminalCharset = keyof typeof terminalCharsets;
152
+ /** Props of `TerminalGraph`. */
153
+ interface TerminalGraphProps extends BaseGraphProps {
154
+ /**
155
+ * Characters for each level: `blocks` (░▒▓█), `squares`, `ascii` or `dots`.
156
+ * @default 'blocks'
157
+ */
158
+ charset?: TerminalCharset;
159
+ /**
160
+ * Command shown in the first prompt line.
161
+ * @default "git log --since='1 year ago' | heatmap"
162
+ */
163
+ command?: string;
164
+ /**
165
+ * Text before the command.
166
+ * @default '~ $'
167
+ */
168
+ prompt?: string;
169
+ /**
170
+ * Color the characters with the theme; `false` is monochrome.
171
+ * @default true
172
+ */
173
+ colored?: boolean;
174
+ /**
175
+ * On narrow screens, `crop` drops the oldest weeks and `scale` shrinks the text (down to 6px, then crops).
176
+ * @default 'crop'
177
+ */
178
+ fit?: 'crop' | 'scale';
179
+ /**
180
+ * Labels at both ends of the legend.
181
+ * @default ['less', 'more']
182
+ */
183
+ legendLabels?: readonly [string, string];
184
+ }
185
+ /** Real monospace text, for portfolios with a terminal look. */
186
+ export declare function TerminalGraph(props: TerminalGraphProps): import("react").JSX.Element;
187
+ /** Props of `CompactGraph`. It shows days rather than weeks, so `weeks`, `weekStart` and `periodLabel` don't apply. */
188
+ interface CompactGraphProps extends Omit<BaseGraphProps, 'weeks' | 'weekStart' | 'periodLabel'> {
189
+ /**
190
+ * Number of days to show.
191
+ * @default 30
192
+ */
193
+ days?: number;
194
+ /**
195
+ * Size of each cell in px.
196
+ * @default 10
197
+ */
198
+ cellSize?: number;
199
+ /**
200
+ * Space between cells in px.
201
+ * @default 3
202
+ */
203
+ gap?: number;
204
+ /**
205
+ * Corner radius in px.
206
+ * @default 2
207
+ */
208
+ radius?: number;
209
+ /**
210
+ * Show the current streak next to the total.
211
+ * @default true
212
+ */
213
+ showStreak?: boolean;
214
+ /**
215
+ * Streak text, given the number of days.
216
+ * @default (n) => `${n} day streak`
217
+ */
218
+ streakLabel?: (n: number) => string;
219
+ /**
220
+ * Text after the total, given the number of days.
221
+ * @default (days) => `in the last ${days} days`
222
+ */
223
+ rangeLabel?: (days: number) => string;
224
+ /**
225
+ * Show the Less–More legend.
226
+ * @default false
227
+ */
228
+ showLegend?: boolean;
229
+ }
230
+ /** A single row with the last N days, for headers, cards and footers. */
231
+ export declare function CompactGraph(props: CompactGraphProps): import("react").JSX.Element;
232
+ export { type BaseGraphProps, type Calendar, type CalendarDay, type CalendarOptions, type ColorMode, type CompactGraphProps, type ContributionDay, GITHUB_CONTRIBUTIONS_QUERY, GitHubCalendarResponse, type GraphStats, type GraphTheme, type GridGraphProps, type IsometricGraphProps, type Level, type LevelColors, type LevelScale, type MonthLabel, type RadialGraphProps, type SampleProfile, type SkylineGraphProps, type SkylineWeek, type TerminalCharset, type TerminalGraphProps, type ThemeName, type ThemePalette, buildCalendar, computeStats, cropCalendar, fetchGitHubContributions, fetchGitLabContributions, formatDate, fromDates, fromGitHub, fromGitLab, generateSampleData, makeLevelFn, mergeSources, resolveTheme, sampleProfiles, themeNames, themeVars, themes };