kalendly 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.
- package/LICENSE +21 -0
- package/README.md +492 -0
- package/dist/core/index.d.mts +181 -0
- package/dist/core/index.d.ts +181 -0
- package/dist/core/index.js +349 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/index.mjs +309 -0
- package/dist/core/index.mjs.map +1 -0
- package/dist/index.d.mts +623 -0
- package/dist/index.d.ts +623 -0
- package/dist/index.js +1445 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1403 -0
- package/dist/index.mjs.map +1 -0
- package/dist/react/index.d.mts +208 -0
- package/dist/react/index.d.ts +208 -0
- package/dist/react/index.js +558 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/index.mjs +516 -0
- package/dist/react/index.mjs.map +1 -0
- package/dist/react-native/index.d.mts +465 -0
- package/dist/react-native/index.d.ts +465 -0
- package/dist/react-native/index.js +894 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/index.mjs +851 -0
- package/dist/react-native/index.mjs.map +1 -0
- package/dist/styles/calendar.css +500 -0
- package/dist/vanilla/index.d.mts +214 -0
- package/dist/vanilla/index.d.ts +214 -0
- package/dist/vanilla/index.js +621 -0
- package/dist/vanilla/index.js.map +1 -0
- package/dist/vanilla/index.mjs +579 -0
- package/dist/vanilla/index.mjs.map +1 -0
- package/dist/vanilla/index.umd.js +604 -0
- package/dist/vanilla/index.umd.js.map +1 -0
- package/dist/vue/index.js +1 -0
- package/dist/vue/index.mjs +439 -0
- package/package.json +161 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
// src/core/utils.ts
|
|
2
|
+
var MONTHS = [
|
|
3
|
+
"Jan",
|
|
4
|
+
"Feb",
|
|
5
|
+
"Mar",
|
|
6
|
+
"Apr",
|
|
7
|
+
"May",
|
|
8
|
+
"Jun",
|
|
9
|
+
"Jul",
|
|
10
|
+
"Aug",
|
|
11
|
+
"Sep",
|
|
12
|
+
"Oct",
|
|
13
|
+
"Nov",
|
|
14
|
+
"Dec"
|
|
15
|
+
];
|
|
16
|
+
var DAYS = [
|
|
17
|
+
"Sunday",
|
|
18
|
+
"Monday",
|
|
19
|
+
"Tuesday",
|
|
20
|
+
"Wednesday",
|
|
21
|
+
"Thursday",
|
|
22
|
+
"Friday",
|
|
23
|
+
"Saturday"
|
|
24
|
+
];
|
|
25
|
+
function normalizeDate(date) {
|
|
26
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
|
|
27
|
+
}
|
|
28
|
+
function isSameDay(date1, date2) {
|
|
29
|
+
return normalizeDate(date1).getTime() === normalizeDate(date2).getTime();
|
|
30
|
+
}
|
|
31
|
+
function isToday(date) {
|
|
32
|
+
return isSameDay(date, /* @__PURE__ */ new Date());
|
|
33
|
+
}
|
|
34
|
+
function generateYears(minYear, maxYear) {
|
|
35
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
36
|
+
const min = minYear ?? currentYear - 30;
|
|
37
|
+
const max = maxYear ?? currentYear + 10;
|
|
38
|
+
return Array.from({ length: max - min + 1 }, (_, i) => min + i);
|
|
39
|
+
}
|
|
40
|
+
function getEventsForDate(events, date) {
|
|
41
|
+
const normalizedTargetDate = normalizeDate(date);
|
|
42
|
+
return events.filter((event) => {
|
|
43
|
+
const eventDate = normalizeDate(new Date(event.date));
|
|
44
|
+
return eventDate.getTime() === normalizedTargetDate.getTime();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function hasEvents(events, date) {
|
|
48
|
+
return getEventsForDate(events, date).length > 0;
|
|
49
|
+
}
|
|
50
|
+
function generateCalendarDates(year, month, events = [], weekStartsOn = 0) {
|
|
51
|
+
const firstDay = new Date(year, month, 1);
|
|
52
|
+
const lastDay = new Date(year, month + 1, 0);
|
|
53
|
+
const daysInMonth = lastDay.getDate();
|
|
54
|
+
let firstDayOfWeek = firstDay.getDay();
|
|
55
|
+
if (weekStartsOn === 1) {
|
|
56
|
+
firstDayOfWeek = firstDayOfWeek === 0 ? 6 : firstDayOfWeek - 1;
|
|
57
|
+
}
|
|
58
|
+
const dates = [];
|
|
59
|
+
let day = 1;
|
|
60
|
+
for (let week = 0; week < 6; week++) {
|
|
61
|
+
const weekDates = [];
|
|
62
|
+
for (let dayOfWeek = 0; dayOfWeek < 7; dayOfWeek++) {
|
|
63
|
+
if (week === 0 && dayOfWeek < firstDayOfWeek) {
|
|
64
|
+
weekDates.push(null);
|
|
65
|
+
} else if (day > daysInMonth) {
|
|
66
|
+
weekDates.push(null);
|
|
67
|
+
} else {
|
|
68
|
+
const currentDate = new Date(year, month, day);
|
|
69
|
+
const dateEvents = getEventsForDate(events, currentDate);
|
|
70
|
+
weekDates.push({
|
|
71
|
+
date: currentDate,
|
|
72
|
+
isCurrentMonth: true,
|
|
73
|
+
isToday: isToday(currentDate),
|
|
74
|
+
hasEvents: dateEvents.length > 0,
|
|
75
|
+
events: dateEvents
|
|
76
|
+
});
|
|
77
|
+
day++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
dates.push(weekDates);
|
|
81
|
+
if (day > daysInMonth && weekDates.every((date) => date === null)) {
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return dates;
|
|
86
|
+
}
|
|
87
|
+
function getPopupPositionClass(selectedDayIndex) {
|
|
88
|
+
if (selectedDayIndex === null) return "popup-center-bottom";
|
|
89
|
+
if (selectedDayIndex < 3) {
|
|
90
|
+
return "popup-right";
|
|
91
|
+
} else if (selectedDayIndex > 4) {
|
|
92
|
+
return "popup-left";
|
|
93
|
+
} else {
|
|
94
|
+
return "popup-center-bottom";
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function getCellClasses(calendarDate) {
|
|
98
|
+
if (!calendarDate) return [];
|
|
99
|
+
const classes = [];
|
|
100
|
+
if (calendarDate.isToday) {
|
|
101
|
+
classes.push("schedule--current--exam");
|
|
102
|
+
}
|
|
103
|
+
if (calendarDate.hasEvents) {
|
|
104
|
+
classes.push("has--event");
|
|
105
|
+
}
|
|
106
|
+
return classes;
|
|
107
|
+
}
|
|
108
|
+
function formatDateForDisplay(date) {
|
|
109
|
+
return `${DAYS[date.getDay()]} ${date.getDate()}`;
|
|
110
|
+
}
|
|
111
|
+
function getMonthYearText(year, month) {
|
|
112
|
+
return `${MONTHS[month]} ${year}`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// src/core/calendar-engine.ts
|
|
116
|
+
var CalendarEngine = class {
|
|
117
|
+
constructor(config) {
|
|
118
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
119
|
+
this.config = config;
|
|
120
|
+
const initialDate = config.initialDate || /* @__PURE__ */ new Date();
|
|
121
|
+
this.state = {
|
|
122
|
+
currentYear: initialDate.getFullYear(),
|
|
123
|
+
currentMonth: initialDate.getMonth(),
|
|
124
|
+
currentDate: initialDate.getDate(),
|
|
125
|
+
selectedDate: null,
|
|
126
|
+
selectedDayIndex: null,
|
|
127
|
+
tasks: []
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Subscribe to state changes
|
|
132
|
+
*/
|
|
133
|
+
subscribe(listener) {
|
|
134
|
+
this.listeners.add(listener);
|
|
135
|
+
return () => this.listeners.delete(listener);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Notify all listeners of state changes
|
|
139
|
+
*/
|
|
140
|
+
notify() {
|
|
141
|
+
this.listeners.forEach((listener) => listener());
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get current state
|
|
145
|
+
*/
|
|
146
|
+
getState() {
|
|
147
|
+
return { ...this.state };
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get view model with computed properties
|
|
151
|
+
*/
|
|
152
|
+
getViewModel() {
|
|
153
|
+
const calendarDates = generateCalendarDates(
|
|
154
|
+
this.state.currentYear,
|
|
155
|
+
this.state.currentMonth,
|
|
156
|
+
this.config.events,
|
|
157
|
+
this.config.weekStartsOn
|
|
158
|
+
);
|
|
159
|
+
return {
|
|
160
|
+
...this.state,
|
|
161
|
+
months: MONTHS,
|
|
162
|
+
days: DAYS,
|
|
163
|
+
years: generateYears(this.config.minYear, this.config.maxYear),
|
|
164
|
+
monthAndYearText: getMonthYearText(
|
|
165
|
+
this.state.currentYear,
|
|
166
|
+
this.state.currentMonth
|
|
167
|
+
),
|
|
168
|
+
scheduleDay: this.state.selectedDate ? formatDateForDisplay(this.state.selectedDate) : "",
|
|
169
|
+
calendarDates,
|
|
170
|
+
popupPositionClass: getPopupPositionClass(this.state.selectedDayIndex)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Get actions object
|
|
175
|
+
*/
|
|
176
|
+
getActions() {
|
|
177
|
+
return {
|
|
178
|
+
next: this.next.bind(this),
|
|
179
|
+
previous: this.previous.bind(this),
|
|
180
|
+
jump: this.jump.bind(this),
|
|
181
|
+
selectDate: this.selectDate.bind(this),
|
|
182
|
+
updateTasks: this.updateTasks.bind(this)
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Navigate to next month
|
|
187
|
+
*/
|
|
188
|
+
next() {
|
|
189
|
+
if (this.state.currentMonth === 11) {
|
|
190
|
+
this.state.currentMonth = 0;
|
|
191
|
+
this.state.currentYear++;
|
|
192
|
+
} else {
|
|
193
|
+
this.state.currentMonth++;
|
|
194
|
+
}
|
|
195
|
+
this.state.selectedDate = null;
|
|
196
|
+
this.state.selectedDayIndex = null;
|
|
197
|
+
this.updateTasks();
|
|
198
|
+
this.notify();
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Navigate to previous month
|
|
202
|
+
*/
|
|
203
|
+
previous() {
|
|
204
|
+
if (this.state.currentMonth === 0) {
|
|
205
|
+
this.state.currentMonth = 11;
|
|
206
|
+
this.state.currentYear--;
|
|
207
|
+
} else {
|
|
208
|
+
this.state.currentMonth--;
|
|
209
|
+
}
|
|
210
|
+
this.state.selectedDate = null;
|
|
211
|
+
this.state.selectedDayIndex = null;
|
|
212
|
+
this.updateTasks();
|
|
213
|
+
this.notify();
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Jump to specific month and year
|
|
217
|
+
*/
|
|
218
|
+
jump(year, month) {
|
|
219
|
+
this.state.currentYear = year;
|
|
220
|
+
this.state.currentMonth = month;
|
|
221
|
+
this.state.selectedDate = null;
|
|
222
|
+
this.state.selectedDayIndex = null;
|
|
223
|
+
this.updateTasks();
|
|
224
|
+
this.notify();
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Select a specific date
|
|
228
|
+
*/
|
|
229
|
+
selectDate(date, dayIndex) {
|
|
230
|
+
this.state.selectedDate = date;
|
|
231
|
+
this.state.selectedDayIndex = dayIndex ?? null;
|
|
232
|
+
this.state.currentDate = date.getDate();
|
|
233
|
+
this.state.currentMonth = date.getMonth();
|
|
234
|
+
this.state.currentYear = date.getFullYear();
|
|
235
|
+
this.updateTasks();
|
|
236
|
+
this.notify();
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Update tasks for the currently selected date
|
|
240
|
+
*/
|
|
241
|
+
updateTasks() {
|
|
242
|
+
if (!this.state.selectedDate) {
|
|
243
|
+
this.state.tasks = [];
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
this.state.tasks = getEventsForDate(
|
|
247
|
+
this.config.events,
|
|
248
|
+
this.state.selectedDate
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Update events configuration
|
|
253
|
+
*/
|
|
254
|
+
updateEvents(events) {
|
|
255
|
+
this.config.events = events;
|
|
256
|
+
this.updateTasks();
|
|
257
|
+
this.notify();
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Handle date cell click
|
|
261
|
+
*/
|
|
262
|
+
handleDateClick(date, dayIndex) {
|
|
263
|
+
this.selectDate(date, dayIndex);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Check if date has events
|
|
267
|
+
*/
|
|
268
|
+
hasEventsForDate(date) {
|
|
269
|
+
return getEventsForDate(this.config.events, date).length > 0;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Get events for a specific date
|
|
273
|
+
*/
|
|
274
|
+
getEventsForDate(date) {
|
|
275
|
+
return getEventsForDate(this.config.events, date);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Clear selected date
|
|
279
|
+
*/
|
|
280
|
+
clearSelection() {
|
|
281
|
+
this.state.selectedDate = null;
|
|
282
|
+
this.state.selectedDayIndex = null;
|
|
283
|
+
this.state.tasks = [];
|
|
284
|
+
this.notify();
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Destroy the engine and cleanup listeners
|
|
288
|
+
*/
|
|
289
|
+
destroy() {
|
|
290
|
+
this.listeners.clear();
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
export {
|
|
294
|
+
CalendarEngine,
|
|
295
|
+
DAYS,
|
|
296
|
+
MONTHS,
|
|
297
|
+
formatDateForDisplay,
|
|
298
|
+
generateCalendarDates,
|
|
299
|
+
generateYears,
|
|
300
|
+
getCellClasses,
|
|
301
|
+
getEventsForDate,
|
|
302
|
+
getMonthYearText,
|
|
303
|
+
getPopupPositionClass,
|
|
304
|
+
hasEvents,
|
|
305
|
+
isSameDay,
|
|
306
|
+
isToday,
|
|
307
|
+
normalizeDate
|
|
308
|
+
};
|
|
309
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/utils.ts","../../src/core/calendar-engine.ts"],"sourcesContent":["import { CalendarEvent, CalendarDate } from './types';\n\nexport const MONTHS = [\n 'Jan',\n 'Feb',\n 'Mar',\n 'Apr',\n 'May',\n 'Jun',\n 'Jul',\n 'Aug',\n 'Sep',\n 'Oct',\n 'Nov',\n 'Dec',\n];\n\nexport const DAYS = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n];\n\n/**\n * Normalizes a date to midnight (00:00:00) for comparison purposes\n */\nexport function normalizeDate(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);\n}\n\n/**\n * Checks if two dates are the same day\n */\nexport function isSameDay(date1: Date, date2: Date): boolean {\n return normalizeDate(date1).getTime() === normalizeDate(date2).getTime();\n}\n\n/**\n * Checks if a date is today\n */\nexport function isToday(date: Date): boolean {\n return isSameDay(date, new Date());\n}\n\n/**\n * Generates an array of years for the year selector\n */\nexport function generateYears(minYear?: number, maxYear?: number): number[] {\n const currentYear = new Date().getFullYear();\n const min = minYear ?? currentYear - 30;\n const max = maxYear ?? currentYear + 10;\n\n return Array.from({ length: max - min + 1 }, (_, i) => min + i);\n}\n\n/**\n * Gets events for a specific date\n */\nexport function getEventsForDate(\n events: CalendarEvent[],\n date: Date\n): CalendarEvent[] {\n const normalizedTargetDate = normalizeDate(date);\n\n return events.filter(event => {\n const eventDate = normalizeDate(new Date(event.date));\n return eventDate.getTime() === normalizedTargetDate.getTime();\n });\n}\n\n/**\n * Checks if a date has any events\n */\nexport function hasEvents(events: CalendarEvent[], date: Date): boolean {\n return getEventsForDate(events, date).length > 0;\n}\n\n/**\n * Generates calendar dates for a given month and year\n */\nexport function generateCalendarDates(\n year: number,\n month: number,\n events: CalendarEvent[] = [],\n weekStartsOn: 0 | 1 = 0\n): (CalendarDate | null)[][] {\n const firstDay = new Date(year, month, 1);\n const lastDay = new Date(year, month + 1, 0);\n const daysInMonth = lastDay.getDate();\n\n // Adjust first day based on week start preference\n let firstDayOfWeek = firstDay.getDay();\n if (weekStartsOn === 1) {\n firstDayOfWeek = firstDayOfWeek === 0 ? 6 : firstDayOfWeek - 1;\n }\n\n const dates: (CalendarDate | null)[][] = [];\n let day = 1;\n\n for (let week = 0; week < 6; week++) {\n const weekDates: (CalendarDate | null)[] = [];\n\n for (let dayOfWeek = 0; dayOfWeek < 7; dayOfWeek++) {\n if (week === 0 && dayOfWeek < firstDayOfWeek) {\n weekDates.push(null);\n } else if (day > daysInMonth) {\n weekDates.push(null);\n } else {\n const currentDate = new Date(year, month, day);\n const dateEvents = getEventsForDate(events, currentDate);\n\n weekDates.push({\n date: currentDate,\n isCurrentMonth: true,\n isToday: isToday(currentDate),\n hasEvents: dateEvents.length > 0,\n events: dateEvents,\n });\n day++;\n }\n }\n\n dates.push(weekDates);\n\n // Break early if we've filled all days and the rest of the row is empty\n if (day > daysInMonth && weekDates.every(date => date === null)) {\n break;\n }\n }\n\n return dates;\n}\n\n/**\n * Gets the popup position class based on the selected day index\n */\nexport function getPopupPositionClass(selectedDayIndex: number | null): string {\n if (selectedDayIndex === null) return 'popup-center-bottom';\n\n if (selectedDayIndex < 3) {\n return 'popup-right';\n } else if (selectedDayIndex > 4) {\n return 'popup-left';\n } else {\n return 'popup-center-bottom';\n }\n}\n\n/**\n * Gets CSS classes for a calendar cell\n */\nexport function getCellClasses(calendarDate: CalendarDate | null): string[] {\n if (!calendarDate) return [];\n\n const classes: string[] = [];\n\n if (calendarDate.isToday) {\n classes.push('schedule--current--exam');\n }\n\n if (calendarDate.hasEvents) {\n classes.push('has--event');\n }\n\n return classes;\n}\n\n/**\n * Formats a date for display\n */\nexport function formatDateForDisplay(date: Date): string {\n return `${DAYS[date.getDay()]} ${date.getDate()}`;\n}\n\n/**\n * Gets month and year text for display\n */\nexport function getMonthYearText(year: number, month: number): string {\n return `${MONTHS[month]} ${year}`;\n}\n","import {\n CalendarEvent,\n CalendarState,\n CalendarConfig,\n CalendarActions,\n CalendarViewModel,\n} from './types';\nimport {\n generateCalendarDates,\n getEventsForDate,\n generateYears,\n getPopupPositionClass,\n getMonthYearText,\n formatDateForDisplay,\n MONTHS,\n DAYS,\n} from './utils';\n\nexport class CalendarEngine {\n private state: CalendarState;\n private config: CalendarConfig;\n private listeners: Set<() => void> = new Set();\n\n constructor(config: CalendarConfig) {\n this.config = config;\n\n const initialDate = config.initialDate || new Date();\n this.state = {\n currentYear: initialDate.getFullYear(),\n currentMonth: initialDate.getMonth(),\n currentDate: initialDate.getDate(),\n selectedDate: null,\n selectedDayIndex: null,\n tasks: [],\n };\n }\n\n /**\n * Subscribe to state changes\n */\n subscribe(listener: () => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n /**\n * Notify all listeners of state changes\n */\n private notify(): void {\n this.listeners.forEach(listener => listener());\n }\n\n /**\n * Get current state\n */\n getState(): CalendarState {\n return { ...this.state };\n }\n\n /**\n * Get view model with computed properties\n */\n getViewModel(): CalendarViewModel {\n const calendarDates = generateCalendarDates(\n this.state.currentYear,\n this.state.currentMonth,\n this.config.events,\n this.config.weekStartsOn\n );\n\n return {\n ...this.state,\n months: MONTHS,\n days: DAYS,\n years: generateYears(this.config.minYear, this.config.maxYear),\n monthAndYearText: getMonthYearText(\n this.state.currentYear,\n this.state.currentMonth\n ),\n scheduleDay: this.state.selectedDate\n ? formatDateForDisplay(this.state.selectedDate)\n : '',\n calendarDates,\n popupPositionClass: getPopupPositionClass(this.state.selectedDayIndex),\n };\n }\n\n /**\n * Get actions object\n */\n getActions(): CalendarActions {\n return {\n next: this.next.bind(this),\n previous: this.previous.bind(this),\n jump: this.jump.bind(this),\n selectDate: this.selectDate.bind(this),\n updateTasks: this.updateTasks.bind(this),\n };\n }\n\n /**\n * Navigate to next month\n */\n private next(): void {\n if (this.state.currentMonth === 11) {\n this.state.currentMonth = 0;\n this.state.currentYear++;\n } else {\n this.state.currentMonth++;\n }\n\n this.state.selectedDate = null;\n this.state.selectedDayIndex = null;\n this.updateTasks();\n this.notify();\n }\n\n /**\n * Navigate to previous month\n */\n private previous(): void {\n if (this.state.currentMonth === 0) {\n this.state.currentMonth = 11;\n this.state.currentYear--;\n } else {\n this.state.currentMonth--;\n }\n\n this.state.selectedDate = null;\n this.state.selectedDayIndex = null;\n this.updateTasks();\n this.notify();\n }\n\n /**\n * Jump to specific month and year\n */\n private jump(year: number, month: number): void {\n this.state.currentYear = year;\n this.state.currentMonth = month;\n this.state.selectedDate = null;\n this.state.selectedDayIndex = null;\n this.updateTasks();\n this.notify();\n }\n\n /**\n * Select a specific date\n */\n private selectDate(date: Date, dayIndex?: number): void {\n this.state.selectedDate = date;\n this.state.selectedDayIndex = dayIndex ?? null;\n this.state.currentDate = date.getDate();\n this.state.currentMonth = date.getMonth();\n this.state.currentYear = date.getFullYear();\n this.updateTasks();\n this.notify();\n }\n\n /**\n * Update tasks for the currently selected date\n */\n private updateTasks(): void {\n if (!this.state.selectedDate) {\n this.state.tasks = [];\n return;\n }\n\n this.state.tasks = getEventsForDate(\n this.config.events,\n this.state.selectedDate\n );\n }\n\n /**\n * Update events configuration\n */\n updateEvents(events: CalendarEvent[]): void {\n this.config.events = events;\n this.updateTasks();\n this.notify();\n }\n\n /**\n * Handle date cell click\n */\n handleDateClick(date: Date, dayIndex?: number): void {\n this.selectDate(date, dayIndex);\n }\n\n /**\n * Check if date has events\n */\n hasEventsForDate(date: Date): boolean {\n return getEventsForDate(this.config.events, date).length > 0;\n }\n\n /**\n * Get events for a specific date\n */\n getEventsForDate(date: Date): CalendarEvent[] {\n return getEventsForDate(this.config.events, date);\n }\n\n /**\n * Clear selected date\n */\n clearSelection(): void {\n this.state.selectedDate = null;\n this.state.selectedDayIndex = null;\n this.state.tasks = [];\n this.notify();\n }\n\n /**\n * Destroy the engine and cleanup listeners\n */\n destroy(): void {\n this.listeners.clear();\n }\n}\n"],"mappings":";AAEO,IAAM,SAAS;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,OAAO;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;A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