calendar-heatmap-tui 0.0.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/LICENSE +21 -0
- package/README.md +276 -0
- package/dist/calendar-heatmap.d.ts +9 -0
- package/dist/calendar-heatmap.d.ts.map +1 -0
- package/dist/calendar-heatmap.js +113 -0
- package/dist/calendar-heatmap.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jeason
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# Calendar Heatmap TUI
|
|
2
|
+
|
|
3
|
+
A terminal-based calendar heatmap component inspired by GitHub's contribution graph. Displays a fixed 52-week view ending at the current date, using Unicode block characters to represent activity levels.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Fixed 52-Column Layout**: Consistent width with exactly 52 weeks displayed
|
|
8
|
+
- **Dynamic Date Range**: Automatically calculates range ending at today
|
|
9
|
+
- **Partial Last Column**: Last week ends at today (e.g., Thursday if today is Thursday)
|
|
10
|
+
- **Fixed Month Labels**: Consistent "Mar Apr May Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar" header
|
|
11
|
+
- **Unicode Visualization**: Five activity levels using Unicode block characters
|
|
12
|
+
- **Zero Dependencies**: Lightweight implementation with no runtime dependencies
|
|
13
|
+
- **TypeScript Support**: Fully typed with TypeScript definitions
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install calendar-heatmap-tui
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { renderCalendarHeatmap } from 'calendar-heatmap-tui';
|
|
25
|
+
|
|
26
|
+
const data = [
|
|
27
|
+
{ date: '2026-03-01', value: 1 },
|
|
28
|
+
{ date: '2026-03-05', value: 3 },
|
|
29
|
+
{ date: '2026-03-10', value: 4 },
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const output = renderCalendarHeatmap({ data });
|
|
33
|
+
console.log(output);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Output:**
|
|
37
|
+
```
|
|
38
|
+
Mar Apr May Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar
|
|
39
|
+
···················································
|
|
40
|
+
Mon ····················································
|
|
41
|
+
····················································
|
|
42
|
+
Wed ····················································
|
|
43
|
+
····················································
|
|
44
|
+
Fri ···················································
|
|
45
|
+
···················································
|
|
46
|
+
|
|
47
|
+
Less · ░ ▒ ▓ █ More
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## API Reference
|
|
51
|
+
|
|
52
|
+
### `renderCalendarHeatmap(options)`
|
|
53
|
+
|
|
54
|
+
Renders a calendar heatmap as a formatted string.
|
|
55
|
+
|
|
56
|
+
#### Parameters
|
|
57
|
+
|
|
58
|
+
| Parameter | Type | Description |
|
|
59
|
+
|-----------|------|-------------|
|
|
60
|
+
| `options` | `Object` | Configuration options |
|
|
61
|
+
| `options.data` | `Array<{date: string, value: number}>` | Activity data points |
|
|
62
|
+
|
|
63
|
+
#### Data Format
|
|
64
|
+
|
|
65
|
+
Each data point should have:
|
|
66
|
+
- `date`: ISO 8601 date string (`YYYY-MM-DD`)
|
|
67
|
+
- `value`: Activity level (0-4), where:
|
|
68
|
+
- `0` = Empty (·)
|
|
69
|
+
- `1` = Light (░)
|
|
70
|
+
- `2` = Medium (▒)
|
|
71
|
+
- `3` = Heavy (▓)
|
|
72
|
+
- `4` = Full (█)
|
|
73
|
+
|
|
74
|
+
#### Returns
|
|
75
|
+
|
|
76
|
+
`string` - Formatted calendar heatmap with month labels, day rows, and legend.
|
|
77
|
+
|
|
78
|
+
#### Example
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { renderCalendarHeatmap } from 'calendar-heatmap-tui';
|
|
82
|
+
|
|
83
|
+
const output = renderCalendarHeatmap({
|
|
84
|
+
data: [
|
|
85
|
+
{ date: '2026-01-15', value: 2 },
|
|
86
|
+
{ date: '2026-01-16', value: 3 },
|
|
87
|
+
{ date: '2026-01-17', value: 4 },
|
|
88
|
+
],
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
console.log(output);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Output Format
|
|
95
|
+
|
|
96
|
+
The calendar displays:
|
|
97
|
+
|
|
98
|
+
- **7 rows**: One per weekday (Sun, Mon, Tue, Wed, Thu, Fri, Sat)
|
|
99
|
+
- **52 columns**: Fixed week count
|
|
100
|
+
- **Month header**: Fixed labels "Mar Apr May Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar"
|
|
101
|
+
- **Weekday labels**: Mon, Wed, Fri shown on left side
|
|
102
|
+
- **Legend**: Activity level indicator at bottom
|
|
103
|
+
|
|
104
|
+
### Date Range Calculation
|
|
105
|
+
|
|
106
|
+
The calendar automatically calculates the display range:
|
|
107
|
+
- **End date**: Today (current date)
|
|
108
|
+
- **Start date**: 51 weeks before the Sunday of current week, plus 1 day
|
|
109
|
+
- **Result**: 52-column view where column 52 ends at today
|
|
110
|
+
|
|
111
|
+
For example, if today is Thursday, March 12, 2026:
|
|
112
|
+
- Column 52 shows Sun Mar 8 → Thu Mar 12 (today)
|
|
113
|
+
- Columns 1-51 show complete 7-day weeks
|
|
114
|
+
- Total span: March 16, 2025 to March 12, 2026
|
|
115
|
+
|
|
116
|
+
## Examples
|
|
117
|
+
|
|
118
|
+
### Basic Usage
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
node examples/basic.mjs
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### With Sample Data
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
node examples/with-data.mjs
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Random Generated Data
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
node examples/random-data.mjs
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Colored Output (with Chalk)
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
node examples/colored.mjs
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Development
|
|
143
|
+
|
|
144
|
+
### Setup
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Clone the repository
|
|
148
|
+
git clone https://github.com/jeasonstudio/calendar-heatmap-tui.git
|
|
149
|
+
cd calendar-heatmap-tui
|
|
150
|
+
|
|
151
|
+
# Install dependencies
|
|
152
|
+
npm install
|
|
153
|
+
|
|
154
|
+
# Build TypeScript
|
|
155
|
+
npx tsc
|
|
156
|
+
|
|
157
|
+
# Run tests
|
|
158
|
+
npm test
|
|
159
|
+
|
|
160
|
+
# Run tests in watch mode
|
|
161
|
+
npm run test:watch
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Project Structure
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
├── src/
|
|
168
|
+
│ ├── calendar-heatmap.ts # Main implementation
|
|
169
|
+
│ └── calendar-heatmap.test.ts # Vitest tests
|
|
170
|
+
├── examples/
|
|
171
|
+
│ ├── basic.mjs # Empty calendar example
|
|
172
|
+
│ ├── with-data.mjs # Sample data example
|
|
173
|
+
│ ├── random-data.mjs # Random data example
|
|
174
|
+
│ └── colored.mjs # Colored output with chalk
|
|
175
|
+
├── dist/ # Compiled JavaScript
|
|
176
|
+
├── CLAUDE.md # Development documentation
|
|
177
|
+
└── README.md # This file
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Testing
|
|
181
|
+
|
|
182
|
+
This project follows Test-Driven Development (TDD):
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Run all tests
|
|
186
|
+
npm test
|
|
187
|
+
|
|
188
|
+
# Run specific test file
|
|
189
|
+
npx vitest run src/calendar-heatmap.test.ts
|
|
190
|
+
|
|
191
|
+
# Run specific test
|
|
192
|
+
npx vitest run -t "should render different heat levels"
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Heat Level Mapping
|
|
196
|
+
|
|
197
|
+
| Value | Character | Visual | Description |
|
|
198
|
+
|-------|-----------|--------|-------------|
|
|
199
|
+
| 0 | `·` | Empty | No activity |
|
|
200
|
+
| 1 | `░` | Light | Low activity |
|
|
201
|
+
| 2 | `▒` | Medium | Moderate activity |
|
|
202
|
+
| 3 | `▓` | Heavy | High activity |
|
|
203
|
+
| 4 | `█` | Full | Maximum activity |
|
|
204
|
+
|
|
205
|
+
## TypeScript
|
|
206
|
+
|
|
207
|
+
The package includes TypeScript definitions:
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
import { renderCalendarHeatmap, CalendarHeatmapOptions } from 'calendar-heatmap-tui';
|
|
211
|
+
|
|
212
|
+
const options: CalendarHeatmapOptions = {
|
|
213
|
+
data: [
|
|
214
|
+
{ date: '2026-03-12', value: 3 },
|
|
215
|
+
],
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const output: string = renderCalendarHeatmap(options);
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Browser Compatibility
|
|
222
|
+
|
|
223
|
+
This package is designed for Node.js terminal output. For browser usage, you may need to:
|
|
224
|
+
|
|
225
|
+
1. Use a monospace font for proper alignment
|
|
226
|
+
2. Ensure Unicode block characters are supported
|
|
227
|
+
3. Handle line height for consistent row spacing
|
|
228
|
+
|
|
229
|
+
## Contributing
|
|
230
|
+
|
|
231
|
+
Contributions are welcome! Please follow these steps:
|
|
232
|
+
|
|
233
|
+
1. Fork the repository
|
|
234
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
235
|
+
3. Write tests for your changes
|
|
236
|
+
4. Ensure all tests pass (`npm test`)
|
|
237
|
+
5. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
238
|
+
6. Push to the branch (`git push origin feature/amazing-feature`)
|
|
239
|
+
7. Open a Pull Request
|
|
240
|
+
|
|
241
|
+
### Development Guidelines
|
|
242
|
+
|
|
243
|
+
- Follow TDD: Write tests before implementation
|
|
244
|
+
- Maintain 100% test coverage for new features
|
|
245
|
+
- Update documentation for API changes
|
|
246
|
+
- Follow existing code style and formatting
|
|
247
|
+
|
|
248
|
+
## License
|
|
249
|
+
|
|
250
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
251
|
+
|
|
252
|
+
## Changelog
|
|
253
|
+
|
|
254
|
+
### 2026-03-12
|
|
255
|
+
|
|
256
|
+
- **Breaking**: Changed to fixed 52-column layout
|
|
257
|
+
- **Breaking**: Last column now ends at today (partial week)
|
|
258
|
+
- **Breaking**: Month labels are now fixed: "Mar Apr May Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar"
|
|
259
|
+
- Added `generateFixedMonthLabels()` function
|
|
260
|
+
- Removed dynamic month label positioning
|
|
261
|
+
- Updated documentation with new behavior
|
|
262
|
+
|
|
263
|
+
## Acknowledgments
|
|
264
|
+
|
|
265
|
+
- Inspired by GitHub's contribution graph
|
|
266
|
+
- Unicode block characters for terminal visualization
|
|
267
|
+
- Built with TypeScript and Vitest
|
|
268
|
+
|
|
269
|
+
## Related Projects
|
|
270
|
+
|
|
271
|
+
- [github-contributions-canvas](https://github.com/sallar/github-contributions-canvas) - GitHub-style contribution graphs for the web
|
|
272
|
+
- [cal-heatmap](https://github.com/wa0x6e/cal-heatmap) - JavaScript date heatmap visualization
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
Made with ❤️ by [Jeason](https://github.com/jeasonstudio)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-heatmap.d.ts","sourceRoot":"","sources":["../src/calendar-heatmap.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC9C;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAoE7E"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export function renderCalendarHeatmap(options) {
|
|
2
|
+
const { data } = options;
|
|
3
|
+
// Fixed 52 columns: last column ends at today, first 51 columns are full weeks
|
|
4
|
+
const today = new Date();
|
|
5
|
+
today.setHours(0, 0, 0, 0);
|
|
6
|
+
// End at today (not Sunday)
|
|
7
|
+
const endDate = new Date(today);
|
|
8
|
+
endDate.setDate(today.getDate() + 1); // Exclusive end date
|
|
9
|
+
// Calculate start date so that week 51 (the 52nd week) contains today
|
|
10
|
+
// Week 51 starts on: today - today.getDay() (the Sunday of this week)
|
|
11
|
+
// Week 0 starts on: (today - today.getDay()) - 51 * 7
|
|
12
|
+
// Start date should be within week 0
|
|
13
|
+
const lastWeekSunday = new Date(today);
|
|
14
|
+
lastWeekSunday.setDate(today.getDate() - today.getDay());
|
|
15
|
+
const firstWeekSunday = new Date(lastWeekSunday);
|
|
16
|
+
firstWeekSunday.setDate(lastWeekSunday.getDate() - 51 * 7);
|
|
17
|
+
const startDate = new Date(firstWeekSunday);
|
|
18
|
+
// Start from the day after the first Sunday (Monday) to ensure exactly 52 weeks
|
|
19
|
+
startDate.setDate(firstWeekSunday.getDate() + 1);
|
|
20
|
+
// Build a map of date -> value from the data
|
|
21
|
+
const dataMap = new Map();
|
|
22
|
+
for (const item of data) {
|
|
23
|
+
dataMap.set(item.date, item.value);
|
|
24
|
+
}
|
|
25
|
+
// Generate the calendar grid for rolling view
|
|
26
|
+
const weeks = generateWeeksRolling(startDate, endDate, dataMap);
|
|
27
|
+
const monthLabels = generateFixedMonthLabels();
|
|
28
|
+
// Build output
|
|
29
|
+
const lines = [];
|
|
30
|
+
// Month header row - align with data columns
|
|
31
|
+
// Data rows have 4 char prefix, add one more space for visual alignment
|
|
32
|
+
lines.push(' ' + monthLabels);
|
|
33
|
+
// Day rows (7 rows, one per weekday: Sun, Mon, Tue, Wed, Thu, Fri, Sat)
|
|
34
|
+
for (let row = 0; row < 7; row++) {
|
|
35
|
+
let line = '';
|
|
36
|
+
// Add weekday label for Mon, Wed, Fri
|
|
37
|
+
if (row === 1)
|
|
38
|
+
line += 'Mon ';
|
|
39
|
+
else if (row === 3)
|
|
40
|
+
line += 'Wed ';
|
|
41
|
+
else if (row === 5)
|
|
42
|
+
line += 'Fri ';
|
|
43
|
+
else
|
|
44
|
+
line += ' ';
|
|
45
|
+
// Add day cells for this row across all weeks
|
|
46
|
+
for (let week = 0; week < weeks.length; week++) {
|
|
47
|
+
const day = weeks[week][row];
|
|
48
|
+
if (day === null) {
|
|
49
|
+
line += ' ';
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
line += getHeatChar(day.value);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
lines.push(line);
|
|
56
|
+
}
|
|
57
|
+
// Add legend
|
|
58
|
+
lines.push('');
|
|
59
|
+
lines.push(' Less · ░ ▒ ▓ █ More');
|
|
60
|
+
return lines.join('\n');
|
|
61
|
+
}
|
|
62
|
+
function generateWeeksRolling(startDate, endDate, dataMap) {
|
|
63
|
+
const weeks = [];
|
|
64
|
+
// Find the first Sunday on or before startDate
|
|
65
|
+
const firstSunday = new Date(startDate);
|
|
66
|
+
firstSunday.setDate(firstSunday.getDate() - firstSunday.getDay());
|
|
67
|
+
// Generate exactly 52 weeks
|
|
68
|
+
for (let week = 0; week < 52; week++) {
|
|
69
|
+
const weekDays = [];
|
|
70
|
+
for (let day = 0; day < 7; day++) {
|
|
71
|
+
const currentDate = new Date(firstSunday);
|
|
72
|
+
currentDate.setDate(firstSunday.getDate() + week * 7 + day);
|
|
73
|
+
// Check if this date is within our range
|
|
74
|
+
if (currentDate >= startDate && currentDate < endDate) {
|
|
75
|
+
const dateStr = formatDate(currentDate);
|
|
76
|
+
const value = dataMap.get(dateStr) || 0;
|
|
77
|
+
weekDays.push({ date: currentDate, value });
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
weekDays.push(null);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
weeks.push(weekDays);
|
|
84
|
+
}
|
|
85
|
+
return weeks;
|
|
86
|
+
}
|
|
87
|
+
function generateFixedMonthLabels() {
|
|
88
|
+
// Fixed 13 month labels for 52 columns (4 columns per month)
|
|
89
|
+
// Position each month label at the start of its 4-column block
|
|
90
|
+
const months = ['Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar'];
|
|
91
|
+
const result = [];
|
|
92
|
+
for (let i = 0; i < months.length; i++) {
|
|
93
|
+
// Add the month name
|
|
94
|
+
result.push(months[i]);
|
|
95
|
+
// Add a single space after each month name (except the last one)
|
|
96
|
+
if (i < months.length - 1) {
|
|
97
|
+
result.push(' ');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return result.join('');
|
|
101
|
+
}
|
|
102
|
+
function formatDate(date) {
|
|
103
|
+
const year = date.getFullYear();
|
|
104
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
105
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
106
|
+
return `${year}-${month}-${day}`;
|
|
107
|
+
}
|
|
108
|
+
function getHeatChar(value) {
|
|
109
|
+
// Value 0 = empty, 1-4 = different heat levels
|
|
110
|
+
const chars = ['·', '░', '▒', '▓', '█'];
|
|
111
|
+
return chars[Math.min(value, 4)];
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=calendar-heatmap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-heatmap.js","sourceRoot":"","sources":["../src/calendar-heatmap.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,qBAAqB,CAAC,OAA+B;IACnE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAEzB,+EAA+E;IAC/E,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IACzB,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3B,4BAA4B;IAC5B,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,qBAAqB;IAE3D,sEAAsE;IACtE,sEAAsE;IACtE,sDAAsD;IACtD,qCAAqC;IACrC,MAAM,cAAc,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,cAAc,CAAC,OAAO,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ED,SAAS,UAAU,CAAC,IAAU;IAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3D,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACpD,OAAO,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;AACnC,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,+CAA+C;IAC/C,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "calendar-heatmap-tui",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A beautiful calendar heatmap component for terminal",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"dev": "tsc --watch",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"test:watch": "vitest",
|
|
23
|
+
"lint": "eslint src --ext .ts",
|
|
24
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
25
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
26
|
+
"prepare": "npm run build"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"terminal",
|
|
30
|
+
"tui",
|
|
31
|
+
"calendar",
|
|
32
|
+
"heatmap",
|
|
33
|
+
"cli"
|
|
34
|
+
],
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^20.11.0",
|
|
38
|
+
"tsx": "^4.21.0",
|
|
39
|
+
"typescript": "^5.3.3",
|
|
40
|
+
"vitest": "^1.2.0"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"chalk": "^5.3.0"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18.0.0"
|
|
47
|
+
}
|
|
48
|
+
}
|