@fuzdev/fuz_ui 0.207.0 → 0.209.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.
Files changed (55) hide show
  1. package/README.md +1 -1
  2. package/dist/ApiIndex.svelte +9 -9
  3. package/dist/ApiModule.svelte +4 -4
  4. package/dist/DeclarationDetail.svelte +26 -5
  5. package/dist/DeclarationDetail.svelte.d.ts +1 -1
  6. package/dist/DeclarationDetail.svelte.d.ts.map +1 -1
  7. package/dist/EcosystemLinks.svelte +2 -2
  8. package/dist/ProjectLinks.svelte +3 -31
  9. package/dist/ProjectLinks.svelte.d.ts.map +1 -1
  10. package/dist/TypeLink.svelte +11 -0
  11. package/dist/TypeLink.svelte.d.ts +9 -0
  12. package/dist/TypeLink.svelte.d.ts.map +1 -1
  13. package/dist/api_search.svelte.d.ts +17 -20
  14. package/dist/api_search.svelte.d.ts.map +1 -1
  15. package/dist/api_search.svelte.js +32 -63
  16. package/dist/csp.d.ts +19 -1
  17. package/dist/csp.d.ts.map +1 -1
  18. package/dist/csp.js +26 -1
  19. package/dist/declaration.svelte.d.ts +25 -1
  20. package/dist/declaration.svelte.d.ts.map +1 -1
  21. package/dist/declaration.svelte.js +43 -3
  22. package/dist/logos.d.ts +1 -1
  23. package/dist/logos.d.ts.map +1 -1
  24. package/dist/logos.js +1 -1
  25. package/dist/projects.d.ts +0 -3
  26. package/dist/projects.d.ts.map +1 -1
  27. package/dist/projects.js +3 -3
  28. package/dist/sparkline.d.ts +1 -1
  29. package/dist/sparkline.js +1 -1
  30. package/package.json +7 -7
  31. package/src/lib/api_search.svelte.ts +34 -82
  32. package/src/lib/csp.ts +27 -1
  33. package/src/lib/declaration.svelte.ts +49 -3
  34. package/src/lib/logos.ts +1 -1
  35. package/src/lib/projects.ts +3 -6
  36. package/src/lib/sparkline.ts +1 -1
  37. package/dist/ProjectActivityChart.svelte +0 -137
  38. package/dist/ProjectActivityChart.svelte.d.ts +0 -30
  39. package/dist/ProjectActivityChart.svelte.d.ts.map +0 -1
  40. package/dist/project_stats.d.ts +0 -121
  41. package/dist/project_stats.d.ts.map +0 -1
  42. package/dist/project_stats.js +0 -153
  43. package/dist/project_stats_data.d.ts +0 -3
  44. package/dist/project_stats_data.d.ts.map +0 -1
  45. package/dist/project_stats_data.js +0 -469
  46. package/dist/project_stats_update.task.d.ts +0 -4
  47. package/dist/project_stats_update.task.d.ts.map +0 -1
  48. package/dist/project_stats_update.task.js +0 -50
  49. package/dist/publish.task.d.ts +0 -3
  50. package/dist/publish.task.d.ts.map +0 -1
  51. package/dist/publish.task.js +0 -23
  52. package/src/lib/project_stats.ts +0 -220
  53. package/src/lib/project_stats_data.ts +0 -472
  54. package/src/lib/project_stats_update.task.ts +0 -53
  55. package/src/lib/publish.task.ts +0 -22
@@ -1,137 +0,0 @@
1
- <script lang="ts">
2
- import type { OmitStrict } from '@fuzdev/fuz_util/types.ts';
3
- import type { SvelteHTMLElements } from 'svelte/elements';
4
-
5
- import { project_items } from './projects.js';
6
- import { project_stats_data } from './project_stats_data.js';
7
- import { project_stats_label, project_stats_to_weekly_series } from './project_stats.js';
8
- import { sparkline_geometry, type SparklineScale } from './sparkline.js';
9
-
10
- /**
11
- * A large line chart of weekly commit activity with every fuz.dev project
12
- * drawn over one another, sharing one time window and one scale.
13
- *
14
- * Each project's line uses its `color_class` from `project_items` (the
15
- * `ProjectLinks` grid doubles as the legend), with the same per-point alpha
16
- * fade and end dot as `Sparkline`. Hovering a line shows the project's
17
- * stats via a native `title`. The svg scales to its container's width.
18
- *
19
- * The background is a light wash of `currentColor` (the inherited text
20
- * color), overridable with the `--sparkline_bg` custom property.
21
- *
22
- * @module
23
- */
24
-
25
- const {
26
- width = 800,
27
- height = 160,
28
- scale = 1 / 3,
29
- stroke_width = 2,
30
- alpha_floor = 0.4,
31
- label = 'weekly commit activity for all projects, drawn over one another at a shared scale',
32
- ...rest
33
- }: OmitStrict<SvelteHTMLElements['svg'], 'width' | 'height' | 'scale'> & {
34
- /**
35
- * Width of the svg's coordinate space in px; rendering stretches to the container.
36
- */
37
- width?: number;
38
- /**
39
- * Height of the svg's coordinate space in px.
40
- */
41
- height?: number;
42
- /**
43
- * Vertical scale for the lines' geometry — see `SparklineScale`.
44
- */
45
- scale?: SparklineScale;
46
- stroke_width?: number;
47
- /**
48
- * Stroke alpha at a value of 0, scaling linearly to 1 at the shared max.
49
- */
50
- alpha_floor?: number;
51
- /**
52
- * Accessible label for the chart.
53
- */
54
- label?: string;
55
- } = $props();
56
-
57
- const chart_id = $props.id();
58
-
59
- const { series, max } = project_stats_to_weekly_series(project_stats_data);
60
- const color_class_by_name = new Map(project_items.map((p) => [p.name, p.color_class]));
61
- const label_by_name = new Map(
62
- project_stats_data.projects.map((p) => [p.name, project_stats_label(p)])
63
- );
64
-
65
- const lines = $derived(
66
- series.flatMap(({ name, counts }) => {
67
- const geometry = sparkline_geometry(counts, {
68
- width,
69
- height,
70
- max,
71
- scale,
72
- stroke_width,
73
- alpha_floor,
74
- end_dot: true
75
- });
76
- return geometry
77
- ? [
78
- {
79
- name,
80
- geometry,
81
- color_class: color_class_by_name.get(name),
82
- title: label_by_name.get(name)
83
- }
84
- ]
85
- : [];
86
- })
87
- );
88
- </script>
89
-
90
- <svg {...rest} viewBox="0 0 {width} {height}" role="img" aria-label={label}>
91
- <defs>
92
- {#each lines as line, index (line.name)}
93
- <linearGradient
94
- id="{chart_id}-{index}"
95
- class={line.color_class}
96
- gradientUnits="userSpaceOnUse"
97
- x1="0"
98
- y1="0"
99
- x2={width}
100
- y2="0"
101
- >
102
- {#each line.geometry.stops as stop, stop_index (stop_index)}
103
- <stop offset={stop.offset} stop-color="currentColor" stop-opacity={stop.opacity} />
104
- {/each}
105
- </linearGradient>
106
- {/each}
107
- </defs>
108
- {#each lines as line, index (line.name)}
109
- <g class={line.color_class}>
110
- <title>{line.title}</title>
111
- <polyline
112
- points={line.geometry.points}
113
- fill="none"
114
- stroke="url(#{chart_id}-{index})"
115
- stroke-width={stroke_width}
116
- stroke-linejoin="round"
117
- stroke-linecap="round"
118
- />
119
- <circle
120
- cx={line.geometry.end_x}
121
- cy={line.geometry.end_y}
122
- r={line.geometry.dot_radius}
123
- fill="currentColor"
124
- fill-opacity={line.geometry.end_alpha}
125
- />
126
- </g>
127
- {/each}
128
- </svg>
129
-
130
- <style>
131
- svg {
132
- width: 100%;
133
- height: auto;
134
- background: var(--sparkline_bg, color-mix(in hsl, currentColor 8%, transparent));
135
- border-radius: var(--border_radius_xs);
136
- }
137
- </style>
@@ -1,30 +0,0 @@
1
- import type { OmitStrict } from '@fuzdev/fuz_util/types.ts';
2
- import type { SvelteHTMLElements } from 'svelte/elements';
3
- import { type SparklineScale } from './sparkline.js';
4
- type $$ComponentProps = OmitStrict<SvelteHTMLElements['svg'], 'width' | 'height' | 'scale'> & {
5
- /**
6
- * Width of the svg's coordinate space in px; rendering stretches to the container.
7
- */
8
- width?: number;
9
- /**
10
- * Height of the svg's coordinate space in px.
11
- */
12
- height?: number;
13
- /**
14
- * Vertical scale for the lines' geometry — see `SparklineScale`.
15
- */
16
- scale?: SparklineScale;
17
- stroke_width?: number;
18
- /**
19
- * Stroke alpha at a value of 0, scaling linearly to 1 at the shared max.
20
- */
21
- alpha_floor?: number;
22
- /**
23
- * Accessible label for the chart.
24
- */
25
- label?: string;
26
- };
27
- declare const ProjectActivityChart: import("svelte").Component<$$ComponentProps, {}, "">;
28
- type ProjectActivityChart = ReturnType<typeof ProjectActivityChart>;
29
- export default ProjectActivityChart;
30
- //# sourceMappingURL=ProjectActivityChart.svelte.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProjectActivityChart.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ProjectActivityChart.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAK1D,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE,KAAK,gBAAgB,GAAI,UAAU,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,GAAG;IAC9F;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AA2FH,QAAA,MAAM,oBAAoB,sDAAwC,CAAC;AACnE,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,eAAe,oBAAoB,CAAC"}
@@ -1,121 +0,0 @@
1
- /**
2
- * Types and pure helpers for project commit-activity stats.
3
- *
4
- * The committed dataset (`project_stats_data.ts`, written by the
5
- * `project_stats_update` task) stores daily commit counts per project as the
6
- * master granularity; coarser scopes like monthly are derived at runtime by
7
- * rebucketing. All date handling is UTC — `YYYY-MM-DD` strings and "epoch
8
- * days" (days since the Unix epoch) — so results are deterministic across
9
- * machines.
10
- *
11
- * @module
12
- */
13
- /**
14
- * Daily commit counts for one project.
15
- */
16
- export interface ProjectCommitStats {
17
- /**
18
- * Project name, matching `project_items`.
19
- */
20
- name: string;
21
- /**
22
- * UTC date (`YYYY-MM-DD`) of the first day bucket, the day of the first commit.
23
- */
24
- start_date: string;
25
- /**
26
- * Commits per UTC day from `start_date` through the snapshot's `end_date`, inclusive.
27
- */
28
- daily_counts: Array<number>;
29
- }
30
- /**
31
- * A snapshot of commit stats across projects, sharing a single `end_date`.
32
- */
33
- export interface ProjectStatsSnapshot {
34
- /**
35
- * ISO datetime when the snapshot was collected.
36
- */
37
- generated_at: string;
38
- /**
39
- * UTC date (`YYYY-MM-DD`) of the final day bucket, shared by every project.
40
- */
41
- end_date: string;
42
- projects: Array<ProjectCommitStats>;
43
- }
44
- /**
45
- * A derived series of bucketed counts for one project.
46
- */
47
- export interface ProjectStatsSeries {
48
- name: string;
49
- counts: Array<number>;
50
- }
51
- /**
52
- * Converts a UTC `YYYY-MM-DD` date to days since the Unix epoch.
53
- */
54
- export declare const epoch_day_from_date: (date: string) => number;
55
- /**
56
- * Converts days since the Unix epoch to a UTC `YYYY-MM-DD` date.
57
- */
58
- export declare const date_from_epoch_day: (epoch_day: number) => string;
59
- /**
60
- * Buckets commit timestamps into daily counts from the earliest commit's UTC
61
- * day through `end_date`, inclusive.
62
- *
63
- * @param timestamps - commit times as Unix epoch seconds
64
- * @param end_date - UTC date (`YYYY-MM-DD`) of the final bucket; later timestamps clamp into it
65
- * @returns the start date and daily counts, or `null` if `timestamps` is empty
66
- */
67
- export declare const daily_counts_from_timestamps: (timestamps: Array<number>, end_date: string) => {
68
- start_date: string;
69
- daily_counts: Array<number>;
70
- } | null;
71
- /**
72
- * Pads `daily_counts` with leading zeros so the series starts at
73
- * `padded_start_date` instead of `start_date`.
74
- *
75
- * Returns the input array unchanged when `padded_start_date` is not earlier
76
- * than `start_date`.
77
- */
78
- export declare const daily_counts_pad_start: (daily_counts: Array<number>, start_date: string, padded_start_date: string) => Array<number>;
79
- /**
80
- * Rebuckets daily counts into calendar-month (UTC) counts.
81
- *
82
- * The first and last buckets may cover partial months.
83
- */
84
- export declare const monthly_counts_from_daily: (daily_counts: Array<number>, start_date: string) => Array<number>;
85
- /**
86
- * Rebuckets daily counts into 7-day counts, anchored at the end of the series
87
- * so the newest bucket always covers a full 7 days.
88
- *
89
- * The first bucket may cover fewer days when the length isn't a multiple of 7.
90
- */
91
- export declare const weekly_counts_from_daily: (daily_counts: Array<number>) => Array<number>;
92
- /**
93
- * Derives aligned monthly series for every project in `snapshot`, sharing one
94
- * time window and one scale.
95
- *
96
- * Each series spans from the earliest project's `start_date` through the
97
- * snapshot's `end_date` (younger projects are zero-padded at the front), so
98
- * all series have the same length and bucket boundaries. `max` is the largest
99
- * monthly count across all projects, for rendering every series at the same
100
- * vertical scale.
101
- */
102
- export declare const project_stats_to_monthly_series: (snapshot: ProjectStatsSnapshot) => {
103
- series: Array<ProjectStatsSeries>;
104
- max: number;
105
- };
106
- /**
107
- * Derives aligned weekly series for every project in `snapshot`, sharing one
108
- * time window and one scale — the weekly sibling of
109
- * `project_stats_to_monthly_series`.
110
- */
111
- export declare const project_stats_to_weekly_series: (snapshot: ProjectStatsSnapshot) => {
112
- series: Array<ProjectStatsSeries>;
113
- max: number;
114
- };
115
- /**
116
- * Formats a one-line human-readable summary of a project's commit stats,
117
- * e.g. `"gro — 2,386 commits since August 7, 2019"`. Used for accessible
118
- * labels and tooltips.
119
- */
120
- export declare const project_stats_label: (project: ProjectCommitStats) => string;
121
- //# sourceMappingURL=project_stats.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"project_stats.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/project_stats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,KAAG,MAGlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,WAAW,MAAM,KAAG,MACA,CAAC;AAEzD;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,GACxC,YAAY,KAAK,CAAC,MAAM,CAAC,EACzB,UAAU,MAAM,KACd;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAE,GAAG,IAaxD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GAClC,cAAc,KAAK,CAAC,MAAM,CAAC,EAC3B,YAAY,MAAM,EAClB,mBAAmB,MAAM,KACvB,KAAK,CAAC,MAAM,CAId,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GACrC,cAAc,KAAK,CAAC,MAAM,CAAC,EAC3B,YAAY,MAAM,KAChB,KAAK,CAAC,MAAM,CAcd,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,cAAc,KAAK,CAAC,MAAM,CAAC,KAAG,KAAK,CAAC,MAAM,CAUlF,CAAC;AAuBF;;;;;;;;;GASG;AACH,eAAO,MAAM,+BAA+B,GAC3C,UAAU,oBAAoB,KAC5B;IAAE,MAAM,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CACI,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,GAC1C,UAAU,oBAAoB,KAC5B;IAAE,MAAM,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CACG,CAAC;AASvD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,kBAAkB,KAAG,MAMjE,CAAC"}
@@ -1,153 +0,0 @@
1
- /**
2
- * Types and pure helpers for project commit-activity stats.
3
- *
4
- * The committed dataset (`project_stats_data.ts`, written by the
5
- * `project_stats_update` task) stores daily commit counts per project as the
6
- * master granularity; coarser scopes like monthly are derived at runtime by
7
- * rebucketing. All date handling is UTC — `YYYY-MM-DD` strings and "epoch
8
- * days" (days since the Unix epoch) — so results are deterministic across
9
- * machines.
10
- *
11
- * @module
12
- */
13
- const DAY_MS = 86_400_000;
14
- /**
15
- * Converts a UTC `YYYY-MM-DD` date to days since the Unix epoch.
16
- */
17
- export const epoch_day_from_date = (date) => {
18
- const [year, month, day] = date.split('-').map(Number);
19
- return Date.UTC(year, month - 1, day) / DAY_MS;
20
- };
21
- /**
22
- * Converts days since the Unix epoch to a UTC `YYYY-MM-DD` date.
23
- */
24
- export const date_from_epoch_day = (epoch_day) => new Date(epoch_day * DAY_MS).toISOString().slice(0, 10);
25
- /**
26
- * Buckets commit timestamps into daily counts from the earliest commit's UTC
27
- * day through `end_date`, inclusive.
28
- *
29
- * @param timestamps - commit times as Unix epoch seconds
30
- * @param end_date - UTC date (`YYYY-MM-DD`) of the final bucket; later timestamps clamp into it
31
- * @returns the start date and daily counts, or `null` if `timestamps` is empty
32
- */
33
- export const daily_counts_from_timestamps = (timestamps, end_date) => {
34
- if (timestamps.length === 0)
35
- return null;
36
- const days = timestamps.map((t) => Math.floor((t * 1000) / DAY_MS));
37
- const end_day = epoch_day_from_date(end_date);
38
- let start_day = end_day;
39
- for (const day of days) {
40
- if (day < start_day)
41
- start_day = day;
42
- }
43
- const daily_counts = new Array(end_day - start_day + 1).fill(0);
44
- for (const day of days) {
45
- daily_counts[Math.min(day, end_day) - start_day] += 1;
46
- }
47
- return { start_date: date_from_epoch_day(start_day), daily_counts };
48
- };
49
- /**
50
- * Pads `daily_counts` with leading zeros so the series starts at
51
- * `padded_start_date` instead of `start_date`.
52
- *
53
- * Returns the input array unchanged when `padded_start_date` is not earlier
54
- * than `start_date`.
55
- */
56
- export const daily_counts_pad_start = (daily_counts, start_date, padded_start_date) => {
57
- const pad = epoch_day_from_date(start_date) - epoch_day_from_date(padded_start_date);
58
- if (pad <= 0)
59
- return daily_counts;
60
- return new Array(pad).fill(0).concat(daily_counts);
61
- };
62
- /**
63
- * Rebuckets daily counts into calendar-month (UTC) counts.
64
- *
65
- * The first and last buckets may cover partial months.
66
- */
67
- export const monthly_counts_from_daily = (daily_counts, start_date) => {
68
- const start_day = epoch_day_from_date(start_date);
69
- const counts = [];
70
- let current_month_key = null;
71
- for (let i = 0; i < daily_counts.length; i++) {
72
- const date = new Date((start_day + i) * DAY_MS);
73
- const month_key = date.getUTCFullYear() * 12 + date.getUTCMonth();
74
- if (month_key !== current_month_key) {
75
- current_month_key = month_key;
76
- counts.push(0);
77
- }
78
- counts[counts.length - 1] += daily_counts[i];
79
- }
80
- return counts;
81
- };
82
- /**
83
- * Rebuckets daily counts into 7-day counts, anchored at the end of the series
84
- * so the newest bucket always covers a full 7 days.
85
- *
86
- * The first bucket may cover fewer days when the length isn't a multiple of 7.
87
- */
88
- export const weekly_counts_from_daily = (daily_counts) => {
89
- const counts = [];
90
- for (let end = daily_counts.length; end > 0; end -= 7) {
91
- let sum = 0;
92
- for (let i = Math.max(0, end - 7); i < end; i++) {
93
- sum += daily_counts[i];
94
- }
95
- counts.push(sum);
96
- }
97
- return counts.reverse();
98
- };
99
- const to_aligned_series = (snapshot, rebucket) => {
100
- if (snapshot.projects.length === 0)
101
- return { series: [], max: 0 };
102
- let shared_start = snapshot.projects[0].start_date;
103
- for (const project of snapshot.projects) {
104
- if (project.start_date < shared_start)
105
- shared_start = project.start_date;
106
- }
107
- let max = 0;
108
- const series = snapshot.projects.map((project) => {
109
- const daily = daily_counts_pad_start(project.daily_counts, project.start_date, shared_start);
110
- const counts = rebucket(daily, shared_start);
111
- for (const count of counts) {
112
- if (count > max)
113
- max = count;
114
- }
115
- return { name: project.name, counts };
116
- });
117
- return { series, max };
118
- };
119
- /**
120
- * Derives aligned monthly series for every project in `snapshot`, sharing one
121
- * time window and one scale.
122
- *
123
- * Each series spans from the earliest project's `start_date` through the
124
- * snapshot's `end_date` (younger projects are zero-padded at the front), so
125
- * all series have the same length and bucket boundaries. `max` is the largest
126
- * monthly count across all projects, for rendering every series at the same
127
- * vertical scale.
128
- */
129
- export const project_stats_to_monthly_series = (snapshot) => to_aligned_series(snapshot, monthly_counts_from_daily);
130
- /**
131
- * Derives aligned weekly series for every project in `snapshot`, sharing one
132
- * time window and one scale — the weekly sibling of
133
- * `project_stats_to_monthly_series`.
134
- */
135
- export const project_stats_to_weekly_series = (snapshot) => to_aligned_series(snapshot, weekly_counts_from_daily);
136
- const start_date_formatter = new Intl.DateTimeFormat('en-US', {
137
- month: 'long',
138
- day: 'numeric',
139
- year: 'numeric',
140
- timeZone: 'UTC'
141
- });
142
- /**
143
- * Formats a one-line human-readable summary of a project's commit stats,
144
- * e.g. `"gro — 2,386 commits since August 7, 2019"`. Used for accessible
145
- * labels and tooltips.
146
- */
147
- export const project_stats_label = (project) => {
148
- let total = 0;
149
- for (const count of project.daily_counts) {
150
- total += count;
151
- }
152
- return `${project.name} — ${total.toLocaleString('en-US')} commits since ${start_date_formatter.format(new Date(project.start_date))}`;
153
- };
@@ -1,3 +0,0 @@
1
- import type { ProjectStatsSnapshot } from './project_stats.js';
2
- export declare const project_stats_data: ProjectStatsSnapshot;
3
- //# sourceMappingURL=project_stats_data.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"project_stats_data.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/project_stats_data.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,eAAO,MAAM,kBAAkB,EAAE,oBAmdhC,CAAC"}