@rsalianto/git-heatmap-vue 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.
- package/README.md +76 -0
- package/package.json +5 -2
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @rsalianto/git-heatmap-vue
|
|
2
|
+
|
|
3
|
+
Vue 3 component and composable for displaying GitHub/GitLab contribution heatmaps.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @rsalianto/git-heatmap-vue @rsalianto/git-heatmap-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<script setup>
|
|
15
|
+
import { GitHeatmap } from "@rsalianto/git-heatmap-vue";
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<GitHeatmap api-url="/api/contributions" />
|
|
20
|
+
</template>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Pass data directly
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<script setup>
|
|
27
|
+
import { GitHeatmap } from "@rsalianto/git-heatmap-vue";
|
|
28
|
+
import { normalizeManual } from "@rsalianto/git-heatmap-core";
|
|
29
|
+
|
|
30
|
+
const data = normalizeManual([
|
|
31
|
+
{ date: "2024-06-01", count: 4 },
|
|
32
|
+
]);
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<GitHeatmap :data="data" />
|
|
37
|
+
</template>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
| Prop | Type | Default | Description |
|
|
43
|
+
|---|---|---|---|
|
|
44
|
+
| `data` | `HeatmapData` | — | Static data (skips fetching) |
|
|
45
|
+
| `apiUrl` | `string` | — | Endpoint returning `HeatmapData` JSON |
|
|
46
|
+
| `fetchData` | `() => Promise<HeatmapData>` | — | Custom fetch function |
|
|
47
|
+
| `levels` | `LevelConfig[]` | `DEFAULT_LEVELS` | Color thresholds |
|
|
48
|
+
| `cellSize` | `number` | `10` | Cell size in px |
|
|
49
|
+
| `cellGap` | `number` | `3` | Gap between cells in px |
|
|
50
|
+
| `cellRadius` | `number` | `2` | Cell border radius in px |
|
|
51
|
+
| `showTotal` | `boolean` | `true` | Show total contributions text |
|
|
52
|
+
| `showLegend` | `boolean` | `true` | Show Less/More legend |
|
|
53
|
+
| `showMonthLabels` | `boolean` | `true` | Show month labels |
|
|
54
|
+
| `showDayLabels` | `boolean` | `true` | Show Mon/Wed/Fri labels |
|
|
55
|
+
| `theme` | `Partial<HeatmapTheme>` | — | Override theme values |
|
|
56
|
+
| `label` | `string` | `"Contribution heatmap"` | Accessible label |
|
|
57
|
+
|
|
58
|
+
## Events
|
|
59
|
+
|
|
60
|
+
| Event | Payload | Description |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| `day-click` | `HeatmapDay` | Emitted when a cell is clicked |
|
|
63
|
+
|
|
64
|
+
## `useHeatmapData` composable
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { useHeatmapData } from "@rsalianto/git-heatmap-vue";
|
|
68
|
+
|
|
69
|
+
const { data, status, error } = useHeatmapData({ apiUrl: "/api/contributions" });
|
|
70
|
+
// status: Ref<"idle" | "loading" | "success" | "error">
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Related packages
|
|
74
|
+
|
|
75
|
+
- [`@rsalianto/git-heatmap-core`](https://www.npmjs.com/package/@rsalianto/git-heatmap-core) — Core utilities
|
|
76
|
+
- [`@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-vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Vue 3 component for git contribution heatmap",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"files": [
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
17
20
|
"scripts": {
|
|
18
21
|
"build": "vite build",
|
|
19
22
|
"dev": "vite build --watch",
|