@forcecalendar/interface 1.0.24 → 1.0.26

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.
@@ -1046,7 +1046,7 @@ class w {
1046
1046
  // Backward-compatible alias for recurrenceRule
1047
1047
  timeZone: v = null,
1048
1048
  endTimeZone: M = null,
1049
- status: D = "confirmed",
1049
+ status: x = "confirmed",
1050
1050
  visibility: T = "public",
1051
1051
  organizer: A = null,
1052
1052
  attendees: _ = [],
@@ -1078,7 +1078,7 @@ class w {
1078
1078
  recurrence: b,
1079
1079
  timeZone: v,
1080
1080
  endTimeZone: M,
1081
- status: D,
1081
+ status: x,
1082
1082
  visibility: T,
1083
1083
  organizer: A,
1084
1084
  attendees: _,
@@ -2237,13 +2237,13 @@ class K {
2237
2237
  const v = 3;
2238
2238
  for (; h <= s && d < i; ) {
2239
2239
  if (h >= t) {
2240
- const D = new Date(h), T = new Date(h.getTime() + o), A = l.getTimezoneOffset(D, c);
2240
+ const x = new Date(h), T = new Date(h.getTime() + o), A = l.getTimezoneOffset(x, c);
2241
2241
  if (A !== p) {
2242
2242
  const _ = p - A;
2243
- D.setMinutes(D.getMinutes() + _), T.setMinutes(T.getMinutes() + _);
2243
+ x.setMinutes(x.getMinutes() + _), T.setMinutes(T.getMinutes() + _);
2244
2244
  }
2245
- p = A, this.isException(D, n, e.id) || a.push({
2246
- start: D,
2245
+ p = A, this.isException(x, n, e.id) || a.push({
2246
+ start: x,
2247
2247
  end: T,
2248
2248
  recurringEventId: e.id,
2249
2249
  timezone: c,
@@ -4749,12 +4749,12 @@ class te {
4749
4749
  days: []
4750
4750
  };
4751
4751
  for (let b = 0; b < 7; b++) {
4752
- const v = new Date(l), M = v.getMonth() === s, D = f.isToday(v), T = v.getDay() === 0 || v.getDay() === 6;
4752
+ const v = new Date(l), M = v.getMonth() === s, x = f.isToday(v), T = v.getDay() === 0 || v.getDay() === 6;
4753
4753
  p.days.push({
4754
4754
  date: v,
4755
4755
  dayOfMonth: v.getDate(),
4756
4756
  isCurrentMonth: M,
4757
- isToday: D,
4757
+ isToday: x,
4758
4758
  isWeekend: T,
4759
4759
  events: this.getEventsForDate(v)
4760
4760
  }), l = f.addDays(l, 1);
@@ -5315,7 +5315,7 @@ class ie {
5315
5315
  this.subscribers.clear(), this._subscriberIds && (this._subscriberIds.clear(), this._subscriberIds = null), this.state = null, this.calendar = null;
5316
5316
  }
5317
5317
  }
5318
- class S extends f {
5318
+ class E extends f {
5319
5319
  /**
5320
5320
  * Format date for display
5321
5321
  */
@@ -5624,7 +5624,7 @@ class F {
5624
5624
  return e.addEventListener("keydown", r), s == null || s.focus(), () => e.removeEventListener("keydown", r);
5625
5625
  }
5626
5626
  }
5627
- class x {
5627
+ class D {
5628
5628
  /**
5629
5629
  * Get CSS variable value
5630
5630
  */
@@ -5961,7 +5961,7 @@ class x {
5961
5961
  /**
5962
5962
  * Default theme colors
5963
5963
  */
5964
- I(x, "colors", {
5964
+ I(D, "colors", {
5965
5965
  primary: "#3B82F6",
5966
5966
  // Modern Blue
5967
5967
  secondary: "#64748B",
@@ -5994,7 +5994,7 @@ I(x, "colors", {
5994
5994
  }), /**
5995
5995
  * Common CSS variables
5996
5996
  */
5997
- I(x, "cssVariables", {
5997
+ I(D, "cssVariables", {
5998
5998
  // "Pro" Palette - Functional & Sharp
5999
5999
  "--fc-primary-color": "#2563EB",
6000
6000
  // International Blue (Focus)
@@ -6062,7 +6062,7 @@ I(x, "cssVariables", {
6062
6062
  }), /**
6063
6063
  * Get responsive breakpoints
6064
6064
  */
6065
- I(x, "breakpoints", {
6065
+ I(D, "breakpoints", {
6066
6066
  xs: "320px",
6067
6067
  sm: "576px",
6068
6068
  md: "768px",
@@ -6179,7 +6179,7 @@ class H {
6179
6179
  * @returns {string} HTML string
6180
6180
  */
6181
6181
  renderTimedEvent(e, t = {}) {
6182
- const { compact: s = !0 } = t, i = new Date(e.start), r = new Date(e.end), n = i.getHours() * 60 + i.getMinutes(), a = Math.max((r - i) / (1e3 * 60), s ? 20 : 30), o = e.backgroundColor || "#2563eb", c = s ? "4px 8px" : "8px 12px", l = s ? "11px" : "13px", h = s ? "2px" : "12px", d = s ? "2px" : "24px", p = s ? "4px" : "6px";
6182
+ const { compact: s = !0 } = t, i = new Date(e.start), r = new Date(e.end), n = i.getHours() * 60 + i.getMinutes(), a = Math.max((r - i) / (1e3 * 60), s ? 20 : 30), o = this.getEventColor(e), c = s ? "4px 8px" : "8px 12px", l = s ? "11px" : "13px", h = s ? "2px" : "12px", d = s ? "2px" : "24px", p = s ? "4px" : "6px";
6183
6183
  return `
6184
6184
  <div class="fc-event fc-timed-event" data-event-id="${this.escapeHTML(e.id)}"
6185
6185
  style="position: absolute; top: ${n}px; height: ${a}px;
@@ -6198,20 +6198,28 @@ class H {
6198
6198
  </div>
6199
6199
  `;
6200
6200
  }
6201
+ /**
6202
+ * Get a safe, sanitized event color value.
6203
+ * @param {Object} event
6204
+ * @returns {string}
6205
+ */
6206
+ getEventColor(e) {
6207
+ return D.sanitizeColor(e == null ? void 0 : e.backgroundColor, "#2563eb");
6208
+ }
6201
6209
  /**
6202
6210
  * Attach common event handlers for day/event clicks
6203
6211
  */
6204
6212
  attachCommonEventHandlers() {
6205
- this.container.querySelectorAll(".fc-event").forEach((e) => {
6206
- this.addListener(e, "click", (t) => {
6207
- t.stopPropagation();
6208
- const s = e.dataset.eventId, i = this.stateManager.getEvents().find((r) => r.id === s);
6209
- i && this.stateManager.selectEvent(i);
6210
- });
6213
+ this.addListener(this.container, "click", (e) => {
6214
+ const t = e.target.closest(".fc-event");
6215
+ if (!t || !this.container.contains(t)) return;
6216
+ e.stopPropagation();
6217
+ const s = t.dataset.eventId, i = this.stateManager.getEvents().find((r) => r.id === s);
6218
+ i && this.stateManager.selectEvent(i);
6211
6219
  });
6212
6220
  }
6213
6221
  }
6214
- class E extends H {
6222
+ class S extends H {
6215
6223
  constructor(e, t) {
6216
6224
  super(e, t), this.maxEventsToShow = 3;
6217
6225
  }
@@ -6269,7 +6277,7 @@ class E extends H {
6269
6277
  `;
6270
6278
  }
6271
6279
  _renderEvent(e) {
6272
- const t = e.backgroundColor || "#2563eb";
6280
+ const t = this.getEventColor(e);
6273
6281
  return `
6274
6282
  <div class="fc-event" data-event-id="${this.escapeHTML(e.id)}"
6275
6283
  style="background-color: ${t}; font-size: 11px; padding: 2px 6px; border-radius: 3px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;">
@@ -6278,12 +6286,11 @@ class E extends H {
6278
6286
  `;
6279
6287
  }
6280
6288
  _attachEventHandlers() {
6281
- this.container.querySelectorAll(".fc-month-day").forEach((e) => {
6282
- this.addListener(e, "click", (t) => {
6283
- if (t.target.closest(".fc-event")) return;
6284
- const s = new Date(e.dataset.date);
6285
- this.stateManager.selectDate(s);
6286
- });
6289
+ this.addListener(this.container, "click", (e) => {
6290
+ const t = e.target.closest(".fc-month-day");
6291
+ if (!t || !this.container.contains(t) || e.target.closest(".fc-event")) return;
6292
+ const s = new Date(t.dataset.date);
6293
+ this.stateManager.selectDate(s);
6287
6294
  }), this.attachCommonEventHandlers();
6288
6295
  }
6289
6296
  }
@@ -6350,7 +6357,7 @@ class z extends H {
6350
6357
  <div class="fc-all-day-cell" data-date="${t.date.toISOString()}" style="border-right: 1px solid #e5e7eb; padding: 4px; display: flex; flex-direction: column; gap: 2px;">
6351
6358
  ${t.allDayEvents.map((s) => `
6352
6359
  <div class="fc-event fc-all-day-event" data-event-id="${this.escapeHTML(s.id)}"
6353
- style="background-color: ${s.backgroundColor || "#2563eb"}; font-size: 10px; padding: 2px 4px; border-radius: 2px; color: white; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
6360
+ style="background-color: ${this.getEventColor(s)}; font-size: 10px; padding: 2px 4px; border-radius: 2px; color: white; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
6354
6361
  ${this.escapeHTML(s.title)}
6355
6362
  </div>
6356
6363
  `).join("")}
@@ -6395,12 +6402,11 @@ class z extends H {
6395
6402
  `;
6396
6403
  }
6397
6404
  _attachEventHandlers() {
6398
- this.container.querySelectorAll(".fc-week-day-column").forEach((e) => {
6399
- this.addListener(e, "click", (t) => {
6400
- if (t.target.closest(".fc-event")) return;
6401
- const s = new Date(e.dataset.date), i = e.getBoundingClientRect(), r = this.container.querySelector("#week-scroll-container"), n = t.clientY - i.top + (r ? r.scrollTop : 0);
6402
- s.setHours(Math.floor(n / this.hourHeight), Math.floor(n % this.hourHeight / (this.hourHeight / 60)), 0, 0), this.stateManager.selectDate(s);
6403
- });
6405
+ this.addListener(this.container, "click", (e) => {
6406
+ const t = e.target.closest(".fc-week-day-column");
6407
+ if (!t || !this.container.contains(t) || e.target.closest(".fc-event")) return;
6408
+ const s = new Date(t.dataset.date), i = t.getBoundingClientRect(), r = this.container.querySelector("#week-scroll-container"), n = e.clientY - i.top + (r ? r.scrollTop : 0);
6409
+ s.setHours(Math.floor(n / this.hourHeight), Math.floor(n % this.hourHeight / (this.hourHeight / 60)), 0, 0), this.stateManager.selectDate(s);
6404
6410
  }), this.attachCommonEventHandlers();
6405
6411
  }
6406
6412
  _scrollToCurrentTime() {
@@ -6484,7 +6490,7 @@ class L extends H {
6484
6490
  <div class="fc-all-day-cell" data-date="${t.toISOString()}" style="padding: 6px 12px; display: flex; flex-wrap: wrap; gap: 4px;">
6485
6491
  ${e.map((s) => `
6486
6492
  <div class="fc-event fc-all-day-event" data-event-id="${this.escapeHTML(s.id)}"
6487
- style="background-color: ${s.backgroundColor || "#2563eb"}; font-size: 12px; padding: 4px 8px; border-radius: 4px; color: white; cursor: pointer; font-weight: 500;">
6493
+ style="background-color: ${this.getEventColor(s)}; font-size: 12px; padding: 4px 8px; border-radius: 4px; color: white; cursor: pointer; font-weight: 500;">
6488
6494
  ${this.escapeHTML(s.title)}
6489
6495
  </div>
6490
6496
  `).join("")}
@@ -6528,12 +6534,11 @@ class L extends H {
6528
6534
  `;
6529
6535
  }
6530
6536
  _attachEventHandlers() {
6531
- this.container.querySelectorAll(".fc-day-column").forEach((e) => {
6532
- this.addListener(e, "click", (t) => {
6533
- if (t.target.closest(".fc-event")) return;
6534
- const s = new Date(e.dataset.date), i = e.getBoundingClientRect(), r = this.container.querySelector("#day-scroll-container"), n = t.clientY - i.top + (r ? r.scrollTop : 0);
6535
- s.setHours(Math.floor(n / this.hourHeight), Math.floor(n % this.hourHeight / (this.hourHeight / 60)), 0, 0), this.stateManager.selectDate(s);
6536
- });
6537
+ this.addListener(this.container, "click", (e) => {
6538
+ const t = e.target.closest(".fc-day-column");
6539
+ if (!t || !this.container.contains(t) || e.target.closest(".fc-event")) return;
6540
+ const s = new Date(t.dataset.date), i = t.getBoundingClientRect(), r = this.container.querySelector("#day-scroll-container"), n = e.clientY - i.top + (r ? r.scrollTop : 0);
6541
+ s.setHours(Math.floor(n / this.hourHeight), Math.floor(n % this.hourHeight / (this.hourHeight / 60)), 0, 0), this.stateManager.selectDate(s);
6537
6542
  }), this.attachCommonEventHandlers();
6538
6543
  }
6539
6544
  _scrollToCurrentTime() {
@@ -6572,8 +6577,8 @@ class re extends O {
6572
6577
  }
6573
6578
  getStyles() {
6574
6579
  return `
6575
- ${x.getBaseStyles()}
6576
- ${x.getButtonStyles()}
6580
+ ${D.getBaseStyles()}
6581
+ ${D.getButtonStyles()}
6577
6582
 
6578
6583
  :host {
6579
6584
  display: none;
@@ -6932,10 +6937,10 @@ class ne extends O {
6932
6937
  this._currentViewInstance && this._currentViewInstance.cleanup && this._currentViewInstance.cleanup();
6933
6938
  try {
6934
6939
  const s = {
6935
- month: E,
6940
+ month: S,
6936
6941
  week: z,
6937
6942
  day: L
6938
- }[this.currentView] || E, i = new s(e, this.stateManager);
6943
+ }[this.currentView] || S, i = new s(e, this.stateManager);
6939
6944
  i._viewType = this.currentView, this._currentViewInstance = i, i.render();
6940
6945
  } catch (t) {
6941
6946
  console.error("[ForceCalendar] Error switching view:", t);
@@ -6964,10 +6969,10 @@ class ne extends O {
6964
6969
  getStyles() {
6965
6970
  const e = this.getAttribute("height") || "800px";
6966
6971
  return `
6967
- ${x.getBaseStyles()}
6968
- ${x.getButtonStyles()}
6969
- ${x.getGridStyles()}
6970
- ${x.getAnimations()}
6972
+ ${D.getBaseStyles()}
6973
+ ${D.getButtonStyles()}
6974
+ ${D.getGridStyles()}
6975
+ ${D.getAnimations()}
6971
6976
 
6972
6977
  :host {
6973
6978
  --calendar-height: ${e};
@@ -7420,10 +7425,10 @@ class ne extends O {
7420
7425
  this._currentViewInstance && (this._currentViewInstance.cleanup && this._currentViewInstance.cleanup(), this._viewUnsubscribe && (this._viewUnsubscribe(), this._viewUnsubscribe = null));
7421
7426
  try {
7422
7427
  const r = {
7423
- month: E,
7428
+ month: S,
7424
7429
  week: z,
7425
7430
  day: L
7426
- }[this.currentView] || E, n = new r(e, this.stateManager);
7431
+ }[this.currentView] || S, n = new r(e, this.stateManager);
7427
7432
  n._viewType = this.currentView, this._currentViewInstance = n, n.render();
7428
7433
  } catch (i) {
7429
7434
  console.error("[ForceCalendar] Error creating/rendering view:", i);
@@ -7455,10 +7460,10 @@ class ne extends O {
7455
7460
  */
7456
7461
  _createViewRenderer(e) {
7457
7462
  const s = {
7458
- month: E,
7463
+ month: S,
7459
7464
  week: z,
7460
7465
  day: L
7461
- }[e] || E;
7466
+ }[e] || S;
7462
7467
  return new s(null, null);
7463
7468
  }
7464
7469
  handleNavigation(e) {
@@ -7482,14 +7487,14 @@ class ne extends O {
7482
7487
  const s = this.stateManager.state.config.locale;
7483
7488
  switch (t) {
7484
7489
  case "month":
7485
- return S.formatDate(e, "month", s);
7490
+ return E.formatDate(e, "month", s);
7486
7491
  case "week":
7487
- const i = S.startOfWeek(e), r = S.endOfWeek(e);
7488
- return S.formatDateRange(i, r, s);
7492
+ const i = E.startOfWeek(e), r = E.endOfWeek(e);
7493
+ return E.formatDateRange(i, r, s);
7489
7494
  case "day":
7490
- return S.formatDate(e, "long", s);
7495
+ return E.formatDate(e, "long", s);
7491
7496
  default:
7492
- return S.formatDate(e, "month", s);
7497
+ return E.formatDate(e, "month", s);
7493
7498
  }
7494
7499
  }
7495
7500
  getIcon(e) {
@@ -7549,13 +7554,13 @@ export {
7549
7554
  O as BaseComponent,
7550
7555
  H as BaseViewRenderer,
7551
7556
  F as DOMUtils,
7552
- S as DateUtils,
7557
+ E as DateUtils,
7553
7558
  L as DayViewRenderer,
7554
7559
  se as EventBus,
7555
7560
  ne as ForceCalendar,
7556
- E as MonthViewRenderer,
7561
+ S as MonthViewRenderer,
7557
7562
  ie as StateManager,
7558
- x as StyleUtils,
7563
+ D as StyleUtils,
7559
7564
  z as WeekViewRenderer,
7560
7565
  u as eventBus
7561
7566
  };