@rsalianto/git-heatmap-angular 0.1.0 → 0.1.1

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 (2) hide show
  1. package/README.md +90 -0
  2. package/package.json +5 -2
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # @rsalianto/git-heatmap-angular
2
+
3
+ Angular standalone component for displaying GitHub/GitLab contribution heatmaps.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @rsalianto/git-heatmap-angular @rsalianto/git-heatmap-core
9
+ ```
10
+
11
+ Requires Angular 16+.
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { Component } from "@angular/core";
17
+ import { GitHeatmapComponent } from "@rsalianto/git-heatmap-angular";
18
+
19
+ @Component({
20
+ standalone: true,
21
+ imports: [GitHeatmapComponent],
22
+ template: `<git-heatmap apiUrl="/api/contributions" />`,
23
+ })
24
+ export class MyComponent {}
25
+ ```
26
+
27
+ ### Pass data directly
28
+
29
+ ```ts
30
+ import { normalizeManual } from "@rsalianto/git-heatmap-core";
31
+
32
+ @Component({
33
+ standalone: true,
34
+ imports: [GitHeatmapComponent],
35
+ template: `<git-heatmap [data]="data" />`,
36
+ })
37
+ export class MyComponent {
38
+ data = normalizeManual([
39
+ { date: "2024-06-01", count: 4 },
40
+ { date: "2024-06-02", count: 0 },
41
+ ]);
42
+ }
43
+ ```
44
+
45
+ ## Inputs
46
+
47
+ | Input | Type | Default | Description |
48
+ |---|---|---|---|
49
+ | `data` | `HeatmapData` | — | Static data (skips fetching) |
50
+ | `apiUrl` | `string` | — | Endpoint returning `HeatmapData` JSON |
51
+ | `fetchData` | `() => Promise<HeatmapData>` | — | Custom fetch function |
52
+ | `levels` | `LevelConfig[]` | `DEFAULT_LEVELS` | Color thresholds |
53
+ | `cellSize` | `number` | `10` | Cell size in px |
54
+ | `cellGap` | `number` | `3` | Gap between cells in px |
55
+ | `cellRadius` | `number` | `2` | Cell border radius in px |
56
+ | `showTotal` | `boolean` | `true` | Show total contributions |
57
+ | `showLegend` | `boolean` | `true` | Show Less/More legend |
58
+ | `showMonthLabels` | `boolean` | `true` | Show month labels |
59
+ | `showDayLabels` | `boolean` | `true` | Show Mon/Wed/Fri labels |
60
+ | `theme` | `Partial<HeatmapTheme>` | — | Override theme values |
61
+ | `label` | `string` | `"Contribution heatmap"` | Accessible label |
62
+
63
+ ## Outputs
64
+
65
+ | Output | Payload | Description |
66
+ |---|---|---|
67
+ | `dayClick` | `HeatmapDay` | Emitted when a cell is clicked |
68
+
69
+ ```ts
70
+ <git-heatmap apiUrl="/api/contributions" (dayClick)="onDayClick($event)" />
71
+ ```
72
+
73
+ ## Theming
74
+
75
+ Override via `theme` input or CSS variables on the host element:
76
+
77
+ ```css
78
+ git-heatmap {
79
+ --ghm-color-l0: #161b22;
80
+ --ghm-color-l1: #0e4429;
81
+ --ghm-color-l2: #006d32;
82
+ --ghm-color-l3: #26a641;
83
+ --ghm-color-l4: #39d353;
84
+ }
85
+ ```
86
+
87
+ ## Related packages
88
+
89
+ - [`@rsalianto/git-heatmap-core`](https://www.npmjs.com/package/@rsalianto/git-heatmap-core) — Core utilities
90
+ - [`@rsalianto/git-heatmap-react`](https://www.npmjs.com/package/@rsalianto/git-heatmap-react) — React component
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsalianto/git-heatmap-angular",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Angular component for git contribution heatmap",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
@@ -13,7 +13,10 @@
13
13
  "require": "./dist/index.js"
14
14
  }
15
15
  },
16
- "files": ["dist", "README.md"],
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
17
20
  "scripts": {
18
21
  "build": "tsup",
19
22
  "dev": "tsup --watch",