@forcecalendar/interface 1.0.31 → 1.0.33

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.
@@ -5176,14 +5176,22 @@ class ie {
5176
5176
  }
5177
5177
  /**
5178
5178
  * Sync state.events from Core calendar (single source of truth)
5179
- * This ensures state.events always matches Core's event store
5179
+ * This ensures state.events always matches Core's event store.
5180
+ *
5181
+ * @param {object} options
5182
+ * @param {boolean} options.silent - suppress subscriber notifications
5183
+ * @param {boolean} options.force - always update even when IDs match
5184
+ * (required after updateEvent where IDs
5185
+ * are unchanged but content has changed)
5180
5186
  */
5181
5187
  _syncEventsFromCore(e = {}) {
5182
- const t = this.calendar.getEvents() || [];
5183
- return (this.state.events.length !== t.length || !this._eventsMatch(this.state.events, t)) && this.setState({ events: [...t] }, e), t;
5188
+ const { force: t = !1 } = e, s = this.calendar.getEvents() || [];
5189
+ return (t || this.state.events.length !== s.length || !this._eventsMatch(this.state.events, s)) && this.setState({ events: [...s] }, e), s;
5184
5190
  }
5185
5191
  /**
5186
- * Check if two event arrays have the same events (by id)
5192
+ * Check if two event arrays have the same events by id.
5193
+ * Only used for add/delete guards — updateEvent must pass force:true
5194
+ * to bypass this check because IDs are unchanged after an update.
5187
5195
  */
5188
5196
  _eventsMatch(e, t) {
5189
5197
  if (e.length !== t.length) return !1;
@@ -5276,7 +5284,7 @@ class ie {
5276
5284
  updateEvent(e, t) {
5277
5285
  this._syncEventsFromCore({ silent: !0 });
5278
5286
  const s = this.calendar.updateEvent(e, t);
5279
- return s ? (this._syncEventsFromCore(), u.emit("event:update", { event: s }), u.emit("event:updated", { event: s }), s) : (console.error(`Failed to update event: ${e}`), u.emit("event:error", {
5287
+ return s ? (this._syncEventsFromCore({ force: !0 }), u.emit("event:update", { event: s }), u.emit("event:updated", { event: s }), s) : (console.error(`Failed to update event: ${e}`), u.emit("event:error", {
5280
5288
  action: "update",
5281
5289
  eventId: e,
5282
5290
  updates: t,
@@ -6990,15 +6998,15 @@ class ne extends O {
6990
6998
  })
6991
6999
  ), this._busUnsubscribers.push(
6992
7000
  u.on("event:added", (t) => {
6993
- e("add", t), this.emit("calendar-event-added", t);
7001
+ this.emit("calendar-event-added", t);
6994
7002
  })
6995
7003
  ), this._busUnsubscribers.push(
6996
7004
  u.on("event:updated", (t) => {
6997
- e("update", t), this.emit("calendar-event-updated", t);
7005
+ this.emit("calendar-event-updated", t);
6998
7006
  })
6999
7007
  ), this._busUnsubscribers.push(
7000
7008
  u.on("event:deleted", (t) => {
7001
- e("remove", t), this.emit("calendar-event-deleted", t);
7009
+ this.emit("calendar-event-deleted", t);
7002
7010
  })
7003
7011
  ), this._busUnsubscribers.push(
7004
7012
  u.on("date:selected", (t) => {