@luckydye/calendar 1.3.2 → 1.4.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.
@@ -8,6 +8,7 @@ export interface LayerContext {
8
8
  width: number;
9
9
  height: number;
10
10
  scrollTop: number;
11
+ scrollLeft: number;
11
12
  dayWidth: number;
12
13
  dayHeight: number;
13
14
  leftGutterWidth: number;
@@ -1,7 +1,7 @@
1
1
  import type { CalendarEvent } from "./CalendarInternal.js";
2
2
 
3
3
  export interface SyncMetadata {
4
- lastSync: Date;
4
+ lastSync: Date;
5
5
  }
6
6
 
7
7
  /**
@@ -9,51 +9,54 @@ export interface SyncMetadata {
9
9
  * Implementations can use IndexedDB, localStorage, remote APIs, etc.
10
10
  */
11
11
  export interface CalendarStorage {
12
- /**
13
- * Loads all events from storage.
14
- * Called once on initialization.
15
- */
16
- loadEvents(): Promise<CalendarEvent[]>;
17
-
18
- /**
19
- * Queries events that overlap with the specified time range.
20
- * More efficient than loading all events when only a subset is needed.
21
- */
22
- queryEvents(start: Date, end: Date): Promise<CalendarEvent[]>;
23
-
24
- /**
25
- * Performs differential sync: adds/updates events and removes stale ones.
26
- * Stale events are those belonging to a synced source with lastSynced older than
27
- * the latest lastSynced timestamp for that source in the provided events.
28
- * Called after each sync operation.
29
- * @param events - Events to save/update
30
- * @param syncedSources - Map of source names to their latest sync timestamps (includes sources with 0 events)
31
- */
32
- sync(events: CalendarEvent[], syncedSources: Map<string, Date>): Promise<void>;
33
-
34
- /**
35
- * Clears all events from storage.
36
- * For future reset functionality.
37
- */
38
- clear(): Promise<void>;
39
-
40
- /**
41
- * Gets sync metadata for a specific source.
42
- */
43
- getSyncMetadata(sourceId: string): Promise<SyncMetadata | undefined>;
44
-
45
- /**
46
- * Sets sync metadata for a specific source.
47
- */
48
- setSyncMetadata(sourceId: string, metadata: SyncMetadata): Promise<void>;
49
-
50
- /**
51
- * Upserts a single event (e.g. to persist locally-set reminders).
52
- */
53
- putEvent(event: CalendarEvent): Promise<void>;
54
-
55
- /**
56
- * Deletes a single event by ID (e.g. for optimistic deletes).
57
- */
58
- deleteEvent(id: string): Promise<void>;
12
+ /**
13
+ * Loads all events from storage.
14
+ * Called once on initialization.
15
+ */
16
+ loadEvents(): Promise<CalendarEvent[]>;
17
+
18
+ /**
19
+ * Queries events that overlap with the specified time range.
20
+ * More efficient than loading all events when only a subset is needed.
21
+ */
22
+ queryEvents(start: Date, end: Date): Promise<CalendarEvent[]>;
23
+
24
+ /**
25
+ * Performs differential sync: adds/updates events and removes stale ones.
26
+ * Stale events are those belonging to a synced source with lastSynced older than
27
+ * the latest lastSynced timestamp for that source in the provided events.
28
+ * Called after each sync operation.
29
+ * @param events - Events to save/update
30
+ * @param syncedSources - Map of source names to their latest sync timestamps (includes sources with 0 events)
31
+ */
32
+ sync(
33
+ events: CalendarEvent[],
34
+ syncedSources: Map<string, Date>,
35
+ ): Promise<void>;
36
+
37
+ /**
38
+ * Clears all events from storage.
39
+ * For future reset functionality.
40
+ */
41
+ clear(): Promise<void>;
42
+
43
+ /**
44
+ * Gets sync metadata for a specific source.
45
+ */
46
+ getSyncMetadata(sourceId: string): Promise<SyncMetadata | undefined>;
47
+
48
+ /**
49
+ * Sets sync metadata for a specific source.
50
+ */
51
+ setSyncMetadata(sourceId: string, metadata: SyncMetadata): Promise<void>;
52
+
53
+ /**
54
+ * Upserts a single event (e.g. to persist locally-set reminders).
55
+ */
56
+ putEvent(event: CalendarEvent): Promise<void>;
57
+
58
+ /**
59
+ * Deletes a single event by ID (e.g. for optimistic deletes).
60
+ */
61
+ deleteEvent(id: string): Promise<void>;
59
62
  }