@forcecalendar/core 0.2.0 → 0.2.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/core/types.js ADDED
@@ -0,0 +1,366 @@
1
+ /**
2
+ * Type definitions for Lightning Calendar Core
3
+ * @module types
4
+ */
5
+
6
+ /**
7
+ * @typedef {Object} EventData
8
+ * @property {string} id - Unique identifier for the event
9
+ * @property {string} title - Event title
10
+ * @property {Date|string} start - Start date/time of the event
11
+ * @property {Date|string} [end] - End date/time of the event
12
+ * @property {boolean} [allDay=false] - Whether this is an all-day event
13
+ * @property {string} [description=''] - Event description
14
+ * @property {string} [location=''] - Event location
15
+ * @property {string} [color=null] - Event color (applies to all color properties if set)
16
+ * @property {string} [backgroundColor=null] - Background color for the event
17
+ * @property {string} [borderColor=null] - Border color for the event
18
+ * @property {string} [textColor=null] - Text color for the event
19
+ * @property {boolean} [recurring=false] - Whether this is a recurring event
20
+ * @property {RecurrenceRule|string} [recurrenceRule=null] - Recurrence rule (RRULE string or object)
21
+ * @property {string} [timeZone=null] - IANA timezone for the event
22
+ * @property {EventStatus} [status='confirmed'] - Event status
23
+ * @property {EventVisibility} [visibility='public'] - Event visibility
24
+ * @property {Organizer} [organizer=null] - Event organizer
25
+ * @property {Attendee[]} [attendees=[]] - Event attendees
26
+ * @property {Reminder[]} [reminders=[]] - Event reminders
27
+ * @property {string[]} [categories=[]] - Event categories/tags
28
+ * @property {Attachment[]} [attachments=[]] - Event attachments
29
+ * @property {ConferenceData} [conferenceData=null] - Virtual meeting information
30
+ * @property {Object.<string, any>} [metadata={}] - Custom metadata for extensibility
31
+ */
32
+
33
+ /**
34
+ * @typedef {('confirmed'|'tentative'|'cancelled')} EventStatus
35
+ */
36
+
37
+ /**
38
+ * @typedef {('public'|'private'|'confidential')} EventVisibility
39
+ */
40
+
41
+ /**
42
+ * @typedef {('needs-action'|'accepted'|'declined'|'tentative'|'delegated')} AttendeeResponseStatus
43
+ */
44
+
45
+ /**
46
+ * @typedef {('required'|'optional'|'resource')} AttendeeRole
47
+ */
48
+
49
+ /**
50
+ * @typedef {('email'|'popup'|'sms')} ReminderMethod
51
+ */
52
+
53
+ /**
54
+ * @typedef {Object} Organizer
55
+ * @property {string} [id] - Unique identifier for the organizer
56
+ * @property {string} name - Organizer's name
57
+ * @property {string} email - Organizer's email
58
+ * @property {string} [phoneNumber] - Organizer's phone number
59
+ * @property {string} [photoUrl] - URL to organizer's photo
60
+ */
61
+
62
+ /**
63
+ * @typedef {Object} Attendee
64
+ * @property {string} [id] - Unique identifier for the attendee
65
+ * @property {string} name - Attendee's name
66
+ * @property {string} email - Attendee's email
67
+ * @property {string} [phoneNumber] - Attendee's phone number
68
+ * @property {string} [photoUrl] - URL to attendee's photo
69
+ * @property {AttendeeResponseStatus} [responseStatus='needs-action'] - Response status
70
+ * @property {AttendeeRole} [role='required'] - Attendee role
71
+ * @property {boolean} [optional=false] - Whether attendance is optional
72
+ * @property {boolean} [resource=false] - Whether attendee is a resource (room, equipment)
73
+ * @property {string} [comment] - Attendee's comment or note
74
+ * @property {Date} [responseTime] - When the attendee responded
75
+ */
76
+
77
+ /**
78
+ * @typedef {Object} Reminder
79
+ * @property {string} [id] - Unique identifier for the reminder
80
+ * @property {ReminderMethod} method - Reminder method
81
+ * @property {number} minutesBefore - Minutes before event to trigger reminder
82
+ * @property {string} [message] - Custom reminder message
83
+ * @property {boolean} [enabled=true] - Whether reminder is active
84
+ */
85
+
86
+ /**
87
+ * @typedef {Object} Attachment
88
+ * @property {string} [id] - Unique identifier for the attachment
89
+ * @property {string} fileName - File name
90
+ * @property {string} [fileUrl] - URL to the file
91
+ * @property {string} [mimeType] - MIME type of the file
92
+ * @property {number} [size] - File size in bytes
93
+ * @property {string} [iconUrl] - URL to file type icon
94
+ */
95
+
96
+ /**
97
+ * @typedef {Object} ConferenceData
98
+ * @property {string} [id] - Unique identifier for the conference
99
+ * @property {string} [solution] - Conference solution (e.g., 'zoom', 'teams', 'meet')
100
+ * @property {string} [url] - Conference URL
101
+ * @property {string} [phone] - Conference phone number
102
+ * @property {string} [accessCode] - Access code or meeting ID
103
+ * @property {string} [password] - Meeting password
104
+ * @property {string} [notes] - Additional conference notes
105
+ */
106
+
107
+ /**
108
+ * @typedef {Object} RecurrenceRule
109
+ * @property {('DAILY'|'WEEKLY'|'MONTHLY'|'YEARLY')} freq - Frequency of recurrence
110
+ * @property {number} [interval=1] - Interval between occurrences
111
+ * @property {number} [count=null] - Number of occurrences
112
+ * @property {Date} [until=null] - End date for recurrence
113
+ * @property {string[]} [byDay=[]] - Days of week (MO, TU, WE, TH, FR, SA, SU)
114
+ * @property {number[]} [byMonthDay=[]] - Days of month (1-31)
115
+ * @property {number[]} [byMonth=[]] - Months (1-12)
116
+ * @property {number[]} [bySetPos=[]] - Position in set (-1 for last)
117
+ * @property {Date[]} [exceptions=[]] - Exception dates to exclude
118
+ */
119
+
120
+ /**
121
+ * @typedef {Object} CalendarConfig
122
+ * @property {ViewType} [view='month'] - Initial view type
123
+ * @property {Date} [date=new Date()] - Initial date to display
124
+ * @property {number} [weekStartsOn=0] - Day week starts on (0=Sunday, 6=Saturday)
125
+ * @property {string} [locale='en-US'] - Locale for formatting
126
+ * @property {string} [timeZone] - IANA timezone
127
+ * @property {boolean} [showWeekNumbers=false] - Show week numbers
128
+ * @property {boolean} [showWeekends=true] - Show weekend days
129
+ * @property {boolean} [fixedWeekCount=true] - Always show 6 weeks in month view
130
+ * @property {BusinessHours} [businessHours] - Business hours configuration
131
+ * @property {EventData[]} [events=[]] - Initial events to load
132
+ */
133
+
134
+ /**
135
+ * @typedef {('month'|'week'|'day'|'list')} ViewType
136
+ */
137
+
138
+ /**
139
+ * @typedef {Object} BusinessHours
140
+ * @property {string} start - Start time (HH:MM format)
141
+ * @property {string} end - End time (HH:MM format)
142
+ */
143
+
144
+ /**
145
+ * @typedef {Object} ViewData
146
+ * @property {ViewType} type - Type of view
147
+ * @property {Date} [startDate] - Start date of the view
148
+ * @property {Date} [endDate] - End date of the view
149
+ */
150
+
151
+ /**
152
+ * @typedef {Object} MonthViewData
153
+ * @property {ViewType} type - Always 'month'
154
+ * @property {number} year - Year being displayed
155
+ * @property {number} month - Month being displayed (0-11)
156
+ * @property {string} monthName - Localized month name
157
+ * @property {WeekData[]} weeks - Array of weeks in the month
158
+ * @property {Date} startDate - First date in the view
159
+ * @property {Date} endDate - Last date in the view
160
+ */
161
+
162
+ /**
163
+ * @typedef {Object} WeekData
164
+ * @property {number} weekNumber - Week number in the year
165
+ * @property {DayData[]} days - Array of days in the week
166
+ */
167
+
168
+ /**
169
+ * @typedef {Object} DayData
170
+ * @property {Date} date - Date object for the day
171
+ * @property {number} dayOfMonth - Day of the month (1-31)
172
+ * @property {boolean} isCurrentMonth - Whether this day is in the current month
173
+ * @property {boolean} isToday - Whether this is today
174
+ * @property {boolean} isWeekend - Whether this is a weekend day
175
+ * @property {import('./core/events/Event.js').Event[]} events - Events for this day
176
+ */
177
+
178
+ /**
179
+ * @typedef {Object} WeekViewData
180
+ * @property {ViewType} type - Always 'week'
181
+ * @property {number} weekNumber - Week number in the year
182
+ * @property {Date} startDate - First day of the week
183
+ * @property {Date} endDate - Last day of the week
184
+ * @property {WeekDayData[]} days - Array of days with detailed event data
185
+ */
186
+
187
+ /**
188
+ * @typedef {Object} WeekDayData
189
+ * @property {Date} date - Date object for the day
190
+ * @property {number} dayOfWeek - Day of week (0-6)
191
+ * @property {string} dayName - Localized day name
192
+ * @property {boolean} isToday - Whether this is today
193
+ * @property {boolean} isWeekend - Whether this is a weekend day
194
+ * @property {import('./core/events/Event.js').Event[]} events - All events for this day
195
+ * @property {Array<import('./core/events/Event.js').Event[]>} overlapGroups - Groups of overlapping events
196
+ * @property {function(import('./core/events/Event.js').Event[]): Map<string, EventPosition>} getEventPositions - Function to calculate positions
197
+ */
198
+
199
+ /**
200
+ * @typedef {Object} EventPosition
201
+ * @property {number} column - Column index for rendering
202
+ * @property {number} totalColumns - Total number of columns
203
+ */
204
+
205
+ /**
206
+ * @typedef {Object} DayViewData
207
+ * @property {ViewType} type - Always 'day'
208
+ * @property {Date} date - Date being displayed
209
+ * @property {string} dayName - Localized day name
210
+ * @property {boolean} isToday - Whether this is today
211
+ * @property {import('./core/events/Event.js').Event[]} allDayEvents - All-day events
212
+ * @property {HourSlot[]} hours - Hourly time slots
213
+ */
214
+
215
+ /**
216
+ * @typedef {Object} HourSlot
217
+ * @property {number} hour - Hour (0-23)
218
+ * @property {string} time - Formatted time string
219
+ * @property {import('./core/events/Event.js').Event[]} events - Events in this hour
220
+ */
221
+
222
+ /**
223
+ * @typedef {Object} ListViewData
224
+ * @property {ViewType} type - Always 'list'
225
+ * @property {Date} startDate - Start of the list range
226
+ * @property {Date} endDate - End of the list range
227
+ * @property {ListDayData[]} days - Days with events
228
+ * @property {number} totalEvents - Total event count
229
+ */
230
+
231
+ /**
232
+ * @typedef {Object} ListDayData
233
+ * @property {Date} date - Date object
234
+ * @property {string} dayName - Localized day name
235
+ * @property {boolean} isToday - Whether this is today
236
+ * @property {import('./core/events/Event.js').Event[]} events - Events for this day
237
+ */
238
+
239
+ /**
240
+ * @typedef {Object} CalendarState
241
+ * @property {ViewType} view - Current view type
242
+ * @property {Date} currentDate - Currently displayed date
243
+ * @property {string|null} selectedEventId - Selected event ID
244
+ * @property {Date|null} selectedDate - Selected date
245
+ * @property {string|null} hoveredEventId - Hovered event ID
246
+ * @property {Date|null} hoveredDate - Hovered date
247
+ * @property {number} weekStartsOn - Week start day
248
+ * @property {boolean} showWeekNumbers - Show week numbers
249
+ * @property {boolean} showWeekends - Show weekends
250
+ * @property {boolean} fixedWeekCount - Fixed week count in month view
251
+ * @property {string} timeZone - IANA timezone
252
+ * @property {string} locale - Locale string
253
+ * @property {('12h'|'24h')} hourFormat - Hour format
254
+ * @property {BusinessHours} businessHours - Business hours
255
+ * @property {FilterState} filters - Active filters
256
+ * @property {boolean} isDragging - Dragging state
257
+ * @property {boolean} isResizing - Resizing state
258
+ * @property {boolean} isCreating - Creating state
259
+ * @property {boolean} isLoading - Loading state
260
+ * @property {string} loadingMessage - Loading message
261
+ * @property {string|null} error - Error message
262
+ * @property {Object.<string, any>} metadata - Custom metadata
263
+ */
264
+
265
+ /**
266
+ * @typedef {Object} FilterState
267
+ * @property {string} searchTerm - Search term
268
+ * @property {string[]} categories - Selected categories
269
+ * @property {boolean} showAllDay - Show all-day events
270
+ * @property {boolean} showTimed - Show timed events
271
+ */
272
+
273
+ /**
274
+ * @typedef {Object} EventStoreChange
275
+ * @property {('add'|'update'|'remove'|'clear')} type - Type of change
276
+ * @property {import('./core/events/Event.js').Event} [event] - Affected event
277
+ * @property {import('./core/events/Event.js').Event} [oldEvent] - Previous event state (for updates)
278
+ * @property {import('./core/events/Event.js').Event[]} [oldEvents] - Previous events (for clear)
279
+ * @property {number} version - Store version number
280
+ */
281
+
282
+ /**
283
+ * @typedef {Object} QueryFilters
284
+ * @property {Date} [start] - Start date for range query
285
+ * @property {Date} [end] - End date for range query
286
+ * @property {Date} [date] - Specific date to query
287
+ * @property {number} [month] - Month (0-11)
288
+ * @property {number} [year] - Year
289
+ * @property {boolean} [allDay] - Filter by all-day events
290
+ * @property {boolean} [recurring] - Filter by recurring events
291
+ * @property {EventStatus} [status] - Filter by event status
292
+ * @property {string[]} [categories] - Filter by categories
293
+ * @property {boolean} [matchAllCategories=false] - Whether to match all categories (AND) or any (OR)
294
+ * @property {boolean} [hasAttendees] - Filter by events with/without attendees
295
+ * @property {string} [organizerEmail] - Filter by organizer email
296
+ * @property {('start'|'end'|'duration'|'title')} [sort] - Sort field
297
+ */
298
+
299
+ /**
300
+ * @typedef {Object} EventOccurrence
301
+ * @property {Date} start - Occurrence start date
302
+ * @property {Date} end - Occurrence end date
303
+ * @property {string} recurringEventId - ID of the parent recurring event
304
+ */
305
+
306
+ /**
307
+ * @typedef {Object} CalendarPlugin
308
+ * @property {function(import('./core/calendar/Calendar.js').Calendar): void} install - Installation function
309
+ * @property {function(import('./core/calendar/Calendar.js').Calendar): void} [uninstall] - Cleanup function
310
+ */
311
+
312
+ /**
313
+ * @typedef {function(any): void} EventListener
314
+ */
315
+
316
+ /**
317
+ * @typedef {function(): void} UnsubscribeFn
318
+ */
319
+
320
+ /**
321
+ * @typedef {('time'|'attendee'|'resource'|'location')} ConflictType
322
+ */
323
+
324
+ /**
325
+ * @typedef {('critical'|'high'|'medium'|'low')} ConflictSeverity
326
+ */
327
+
328
+ /**
329
+ * @typedef {Object} ConflictDetails
330
+ * @property {string} id - Unique identifier for the conflict
331
+ * @property {ConflictType} type - Type of conflict
332
+ * @property {ConflictSeverity} severity - Severity level
333
+ * @property {string} eventId - ID of the event with conflict
334
+ * @property {string} conflictingEventId - ID of the conflicting event
335
+ * @property {string} description - Human-readable description
336
+ * @property {Date} [overlapStart] - Start of overlap period
337
+ * @property {Date} [overlapEnd] - End of overlap period
338
+ * @property {number} [overlapMinutes] - Duration of overlap in minutes
339
+ * @property {string[]} [conflictingAttendees] - Email addresses of conflicting attendees
340
+ * @property {string} [conflictingResource] - Resource that has conflict
341
+ * @property {Object.<string, any>} [metadata] - Additional conflict information
342
+ */
343
+
344
+ /**
345
+ * @typedef {Object} ConflictCheckOptions
346
+ * @property {boolean} [checkAttendees=true] - Check for attendee conflicts
347
+ * @property {boolean} [checkResources=true] - Check for resource conflicts
348
+ * @property {boolean} [checkLocation=true] - Check for location conflicts
349
+ * @property {boolean} [ignoreAllDay=false] - Ignore all-day events in conflict check
350
+ * @property {string[]} [excludeEventIds=[]] - Event IDs to exclude from check
351
+ * @property {EventStatus[]} [includeStatuses=['confirmed', 'tentative']] - Event statuses to include
352
+ * @property {number} [bufferMinutes=0] - Buffer time between events in minutes
353
+ */
354
+
355
+ /**
356
+ * @typedef {Object} ConflictSummary
357
+ * @property {boolean} hasConflicts - Whether any conflicts exist
358
+ * @property {number} totalConflicts - Total number of conflicts
359
+ * @property {ConflictDetails[]} conflicts - Array of conflict details
360
+ * @property {Object.<ConflictType, number>} conflictsByType - Count by type
361
+ * @property {Object.<ConflictSeverity, number>} conflictsBySeverity - Count by severity
362
+ * @property {string[]} affectedEventIds - All event IDs involved
363
+ * @property {string[]} affectedAttendees - All attendee emails involved
364
+ */
365
+
366
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forcecalendar/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "A modern, lightweight, framework-agnostic calendar engine optimized for Salesforce",
@@ -14,13 +14,13 @@
14
14
  "test:search": "node tests/integration/test-search.js"
15
15
  },
16
16
  "exports": {
17
- ".": {
18
- "import": "./dist/index.esm.js",
19
- "require": "./dist/index.cjs.js"
20
- },
21
- "./month-view": "./dist/views/month.esm.js",
22
- "./week-view": "./dist/views/week.esm.js",
23
- "./day-view": "./dist/views/day.esm.js"
17
+ ".": "./core/index.js",
18
+ "./calendar": "./core/calendar/Calendar.js",
19
+ "./events": "./core/events/Event.js",
20
+ "./state": "./core/state/StateManager.js",
21
+ "./search": "./core/search/EventSearch.js",
22
+ "./ics": "./core/ics/ICSHandler.js",
23
+ "./types": "./core/types.js"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",
@@ -73,7 +73,9 @@
73
73
  }
74
74
  },
75
75
  "files": [
76
- "dist",
76
+ "core/**/*.js",
77
+ "!core/**/*.test.js",
78
+ "!core/**/*.spec.js",
77
79
  "README.md",
78
80
  "LICENSE"
79
81
  ]