@forcecalendar/interface 1.0.9 → 1.0.10

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.
@@ -1,5 +1,5 @@
1
- var H = Object.defineProperty;
2
- var P = (u, e, t) => e in u ? H(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
1
+ var B = Object.defineProperty;
2
+ var P = (u, e, t) => e in u ? B(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
3
3
  var M = (u, e, t) => P(u, typeof e != "symbol" ? e + "" : e, t);
4
4
  class T extends HTMLElement {
5
5
  constructor() {
@@ -708,22 +708,22 @@ class x {
708
708
  borderColor: l = null,
709
709
  textColor: d = null,
710
710
  recurring: h = !1,
711
- recurrenceRule: y = null,
711
+ recurrenceRule: m = null,
712
712
  timeZone: b = null,
713
713
  endTimeZone: D = null,
714
714
  status: k = "confirmed",
715
- visibility: E = "public",
715
+ visibility: C = "public",
716
716
  organizer: A = null,
717
717
  attendees: $ = [],
718
718
  reminders: z = [],
719
719
  category: _,
720
720
  // Support singular category (no default)
721
- categories: F,
721
+ categories: L,
722
722
  // Support plural categories (no default)
723
- attachments: L = [],
723
+ attachments: F = [],
724
724
  conferenceData: O = null,
725
725
  metadata: R = {},
726
- ...B
726
+ ...H
727
727
  // Capture any extra properties
728
728
  }) {
729
729
  const g = x.normalize({
@@ -739,22 +739,22 @@ class x {
739
739
  borderColor: l,
740
740
  textColor: d,
741
741
  recurring: h,
742
- recurrenceRule: y,
742
+ recurrenceRule: m,
743
743
  timeZone: b,
744
744
  endTimeZone: D,
745
745
  status: k,
746
- visibility: E,
746
+ visibility: C,
747
747
  organizer: A,
748
748
  attendees: $,
749
749
  reminders: z,
750
750
  category: _,
751
751
  // Pass category to normalize
752
- categories: F,
752
+ categories: L,
753
753
  // Pass categories to normalize
754
- attachments: L,
754
+ attachments: F,
755
755
  conferenceData: O,
756
756
  metadata: R,
757
- ...B
757
+ ...H
758
758
  // Pass any extra properties
759
759
  });
760
760
  x.validate(g), this.id = g.id, this.title = g.title, this._timezoneManager = new S(), this.timeZone = g.timeZone || this._timezoneManager.getSystemTimezone(), this.endTimeZone = g.endTimeZone || this.timeZone, this.start = g.start, this.end = g.end, this.startUTC = this._timezoneManager.toUTC(this.start, this.timeZone), this.endUTC = this._timezoneManager.toUTC(this.end, this.endTimeZone), this.allDay = g.allDay, this.description = g.description, this.location = g.location, this.color = g.color, this.backgroundColor = g.backgroundColor, this.borderColor = g.borderColor, this.textColor = g.textColor, this.recurring = g.recurring, this.recurrenceRule = g.recurrenceRule, this._originalTimeZone = g.timeZone || null, this.status = g.status, this.visibility = g.visibility, this.organizer = g.organizer, this.attendees = [...g.attendees], this.reminders = [...g.reminders], this.categories = g.categories ? [...g.categories] : [], this.attachments = [...g.attachments], this.conferenceData = g.conferenceData, this.metadata = { ...g.metadata }, this._cache = {}, this._validateAttendees(), this._validateReminders();
@@ -1859,7 +1859,7 @@ class Y {
1859
1859
  return e.count ? a += `, ${e.count} time${e.count > 1 ? "s" : ""}` : e.until && (a += `, until ${e.until.toLocaleDateString()}`), a;
1860
1860
  }
1861
1861
  }
1862
- class N {
1862
+ class V {
1863
1863
  /**
1864
1864
  * Expand a recurring event into individual occurrences
1865
1865
  * @param {import('./Event.js').Event} event - The recurring event
@@ -1875,15 +1875,15 @@ class N {
1875
1875
  const n = this.parseRule(e.recurrenceRule), r = [], o = e.end - e.start, c = a || e.timeZone || "UTC", l = new S();
1876
1876
  let d = new Date(e.start), h = 0;
1877
1877
  n.until && n.until < s && (s = n.until);
1878
- let y = l.getTimezoneOffset(d, c);
1878
+ let m = l.getTimezoneOffset(d, c);
1879
1879
  for (; d <= s && h < i; ) {
1880
1880
  if (d >= t) {
1881
1881
  const b = new Date(d), D = new Date(d.getTime() + o), k = l.getTimezoneOffset(b, c);
1882
- if (k !== y) {
1883
- const E = y - k;
1884
- b.setMinutes(b.getMinutes() + E), D.setMinutes(D.getMinutes() + E);
1882
+ if (k !== m) {
1883
+ const C = m - k;
1884
+ b.setMinutes(b.getMinutes() + C), D.setMinutes(D.getMinutes() + C);
1885
1885
  }
1886
- y = k, this.isException(b, n, e.id) || r.push({
1886
+ m = k, this.isException(b, n, e.id) || r.push({
1887
1887
  start: b,
1888
1888
  end: D,
1889
1889
  recurringEventId: e.id,
@@ -2176,7 +2176,7 @@ class I {
2176
2176
  return this.cache.size;
2177
2177
  }
2178
2178
  }
2179
- class V {
2179
+ class N {
2180
2180
  constructor(e = {}) {
2181
2181
  this.config = {
2182
2182
  checkInterval: 3e4,
@@ -2408,7 +2408,7 @@ class W {
2408
2408
  enableAdaptiveMemory: !0,
2409
2409
  // Enable adaptive memory management
2410
2410
  ...e
2411
- }, this.eventCache = new I(this.config.cacheCapacity), this.queryCache = new I(Math.floor(this.config.cacheCapacity / 2)), this.dateRangeCache = new I(Math.floor(this.config.cacheCapacity / 4)), this.config.enableAdaptiveMemory && (this.memoryManager = new V({
2411
+ }, this.eventCache = new I(this.config.cacheCapacity), this.queryCache = new I(Math.floor(this.config.cacheCapacity / 2)), this.dateRangeCache = new I(Math.floor(this.config.cacheCapacity / 4)), this.config.enableAdaptiveMemory && (this.memoryManager = new N({
2412
2412
  checkInterval: 3e4,
2413
2413
  memoryThreshold: 0.75,
2414
2414
  criticalThreshold: 0.9
@@ -3135,8 +3135,8 @@ class Z {
3135
3135
  for (let l = -1; l <= 1; l++) {
3136
3136
  const d = new Date(i);
3137
3137
  d.setDate(d.getDate() + l);
3138
- const h = f.getLocalDateString(d), y = this.indices.byDate.get(h);
3139
- y && y.forEach((b) => s.add(b));
3138
+ const h = f.getLocalDateString(d), m = this.indices.byDate.get(h);
3139
+ m && m.forEach((b) => s.add(b));
3140
3140
  }
3141
3141
  const a = `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`, n = this.indices.byMonth.get(a);
3142
3142
  n && n.forEach((l) => s.add(l));
@@ -3147,12 +3147,12 @@ class Z {
3147
3147
  for (const l of s) {
3148
3148
  const d = this.events.get(l);
3149
3149
  if (d) {
3150
- const h = d.getStartInTimezone(t), y = d.getEndInTimezone(t);
3151
- h <= c && y >= o && r.push(d);
3150
+ const h = d.getStartInTimezone(t), m = d.getEndInTimezone(t);
3151
+ h <= c && m >= o && r.push(d);
3152
3152
  }
3153
3153
  }
3154
3154
  return r.sort((l, d) => {
3155
- const h = l.getStartInTimezone(t), y = d.getStartInTimezone(t), b = h - y;
3155
+ const h = l.getStartInTimezone(t), m = d.getStartInTimezone(t), b = h - m;
3156
3156
  return b !== 0 ? b : d.duration - l.duration;
3157
3157
  });
3158
3158
  }
@@ -3170,8 +3170,8 @@ class Z {
3170
3170
  (this.indices.byDate.get(l) || /* @__PURE__ */ new Set()).forEach((h) => {
3171
3171
  if (!o.has(h) && h !== s) {
3172
3172
  o.add(h);
3173
- const y = this.events.get(h);
3174
- y && y.overlaps({ start: e, end: t }) && i.push(y);
3173
+ const m = this.events.get(h);
3174
+ m && m.overlaps({ start: e, end: t }) && i.push(m);
3175
3175
  }
3176
3176
  });
3177
3177
  }), i.sort((c, l) => c.start - l.start);
@@ -3281,7 +3281,7 @@ class Z {
3281
3281
  return [e];
3282
3282
  i = i || this.defaultTimezone;
3283
3283
  const a = e.timeZone || i;
3284
- return N.expandEvent(e, t, s).map((r, o) => e.clone({
3284
+ return V.expandEvent(e, t, s).map((r, o) => e.clone({
3285
3285
  id: `${e.id}_occurrence_${o}`,
3286
3286
  start: r.start,
3287
3287
  end: r.end,
@@ -4348,22 +4348,22 @@ class K {
4348
4348
  let l = new Date(o);
4349
4349
  const d = a ? 6 : Math.ceil((r.getDate() + f.getDayOfWeek(n, i)) / 7);
4350
4350
  for (let h = 0; h < d; h++) {
4351
- const y = {
4351
+ const m = {
4352
4352
  weekNumber: f.getWeekNumber(l),
4353
4353
  days: []
4354
4354
  };
4355
4355
  for (let b = 0; b < 7; b++) {
4356
- const D = new Date(l), k = D.getMonth() === s, E = f.isToday(D), A = D.getDay() === 0 || D.getDay() === 6;
4357
- y.days.push({
4356
+ const D = new Date(l), k = D.getMonth() === s, C = f.isToday(D), A = D.getDay() === 0 || D.getDay() === 6;
4357
+ m.days.push({
4358
4358
  date: D,
4359
4359
  dayOfMonth: D.getDate(),
4360
4360
  isCurrentMonth: k,
4361
- isToday: E,
4361
+ isToday: C,
4362
4362
  isWeekend: A,
4363
4363
  events: this.getEventsForDate(D)
4364
4364
  }), l = f.addDays(l, 1);
4365
4365
  }
4366
- c.push(y);
4366
+ c.push(m);
4367
4367
  }
4368
4368
  return {
4369
4369
  type: "month",
@@ -4653,7 +4653,7 @@ class G {
4653
4653
  return this.events.has(e) ? this.events.get(e).length : 0;
4654
4654
  }
4655
4655
  }
4656
- const m = new G();
4656
+ const p = new G();
4657
4657
  class Q {
4658
4658
  constructor(e = {}) {
4659
4659
  this.calendar = new K({
@@ -4702,62 +4702,62 @@ class Q {
4702
4702
  (i) => e[i] !== t[i]
4703
4703
  );
4704
4704
  s.forEach((i) => {
4705
- m.emit(`state:${i}:changed`, {
4705
+ p.emit(`state:${i}:changed`, {
4706
4706
  oldValue: e[i],
4707
4707
  newValue: t[i],
4708
4708
  state: t
4709
4709
  });
4710
- }), s.length > 0 && m.emit("state:changed", { oldState: e, newState: t, changedKeys: s });
4710
+ }), s.length > 0 && p.emit("state:changed", { oldState: e, newState: t, changedKeys: s });
4711
4711
  }
4712
4712
  // Calendar operations
4713
4713
  setView(e) {
4714
- this.calendar.setView(e), this.setState({ view: e }), m.emit("view:changed", { view: e });
4714
+ this.calendar.setView(e), this.setState({ view: e }), p.emit("view:changed", { view: e });
4715
4715
  }
4716
4716
  getView() {
4717
4717
  return this.state.view;
4718
4718
  }
4719
4719
  setDate(e) {
4720
- this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("date:changed", { date: this.state.currentDate });
4720
+ this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), p.emit("date:changed", { date: this.state.currentDate });
4721
4721
  }
4722
4722
  getCurrentDate() {
4723
4723
  return this.state.currentDate;
4724
4724
  }
4725
4725
  // Navigation
4726
4726
  next() {
4727
- this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("navigation:next", { date: this.state.currentDate });
4727
+ this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }), p.emit("navigation:next", { date: this.state.currentDate });
4728
4728
  }
4729
4729
  previous() {
4730
- this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("navigation:previous", { date: this.state.currentDate });
4730
+ this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }), p.emit("navigation:previous", { date: this.state.currentDate });
4731
4731
  }
4732
4732
  today() {
4733
- this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("navigation:today", { date: this.state.currentDate });
4733
+ this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }), p.emit("navigation:today", { date: this.state.currentDate });
4734
4734
  }
4735
4735
  goToDate(e) {
4736
- this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("navigation:goto", { date: this.state.currentDate });
4736
+ this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), p.emit("navigation:goto", { date: this.state.currentDate });
4737
4737
  }
4738
4738
  // Event management
4739
4739
  addEvent(e) {
4740
4740
  const t = this.calendar.addEvent(e);
4741
4741
  if (!t)
4742
- return console.error("Failed to add event to calendar"), m.emit("event:error", { action: "add", event: e, error: "Failed to add event" }), null;
4742
+ return console.error("Failed to add event to calendar"), p.emit("event:error", { action: "add", event: e, error: "Failed to add event" }), null;
4743
4743
  const s = [...this.state.events, t];
4744
- return this.setState({ events: s }), m.emit("event:added", { event: t }), t;
4744
+ return this.setState({ events: s }), p.emit("event:added", { event: t }), t;
4745
4745
  }
4746
4746
  updateEvent(e, t) {
4747
4747
  const s = this.calendar.updateEvent(e, t);
4748
4748
  if (!s)
4749
- return console.error(`Failed to update event: ${e}`), m.emit("event:error", { action: "update", eventId: e, updates: t, error: "Event not found in calendar" }), null;
4749
+ return console.error(`Failed to update event: ${e}`), p.emit("event:error", { action: "update", eventId: e, updates: t, error: "Event not found in calendar" }), null;
4750
4750
  const i = this.state.events.findIndex((n) => n.id === e);
4751
4751
  if (i === -1)
4752
- return console.error(`Event ${e} not found in state`), m.emit("event:error", { action: "update", eventId: e, error: "Event not found in state" }), null;
4752
+ return console.error(`Event ${e} not found in state`), p.emit("event:error", { action: "update", eventId: e, error: "Event not found in state" }), null;
4753
4753
  const a = [...this.state.events];
4754
- return a[i] = s, this.setState({ events: a }), m.emit("event:updated", { event: s }), s;
4754
+ return a[i] = s, this.setState({ events: a }), p.emit("event:updated", { event: s }), s;
4755
4755
  }
4756
4756
  deleteEvent(e) {
4757
4757
  if (!this.calendar.removeEvent(e))
4758
- return console.error(`Failed to delete event: ${e}`), m.emit("event:error", { action: "delete", eventId: e, error: "Event not found" }), !1;
4758
+ return console.error(`Failed to delete event: ${e}`), p.emit("event:error", { action: "delete", eventId: e, error: "Event not found" }), !1;
4759
4759
  const s = this.state.events.filter((i) => i.id !== e);
4760
- return this.setState({ events: s }), m.emit("event:deleted", { eventId: e }), !0;
4760
+ return this.setState({ events: s }), p.emit("event:deleted", { eventId: e }), !0;
4761
4761
  }
4762
4762
  getEvents() {
4763
4763
  return this.calendar.getEvents();
@@ -4801,20 +4801,20 @@ class Q {
4801
4801
  }
4802
4802
  // Selection management
4803
4803
  selectEvent(e) {
4804
- this.setState({ selectedEvent: e }), m.emit("event:selected", { event: e });
4804
+ this.setState({ selectedEvent: e }), p.emit("event:selected", { event: e });
4805
4805
  }
4806
4806
  selectEventById(e) {
4807
4807
  const t = this.state.events.find((s) => s.id === e);
4808
4808
  t && this.selectEvent(t);
4809
4809
  }
4810
4810
  deselectEvent() {
4811
- this.setState({ selectedEvent: null }), m.emit("event:deselected", {});
4811
+ this.setState({ selectedEvent: null }), p.emit("event:deselected", {});
4812
4812
  }
4813
4813
  selectDate(e) {
4814
- this.setState({ selectedDate: e }), m.emit("date:selected", { date: e });
4814
+ this.setState({ selectedDate: e }), p.emit("date:selected", { date: e });
4815
4815
  }
4816
4816
  deselectDate() {
4817
- this.setState({ selectedDate: null }), m.emit("date:deselected", {});
4817
+ this.setState({ selectedDate: null }), p.emit("date:deselected", {});
4818
4818
  }
4819
4819
  // Utility methods
4820
4820
  isToday(e) {
@@ -4834,7 +4834,7 @@ class Q {
4834
4834
  }
4835
4835
  // Error handling
4836
4836
  setError(e) {
4837
- this.setState({ error: e }), e && m.emit("error", { error: e });
4837
+ this.setState({ error: e }), e && p.emit("error", { error: e });
4838
4838
  }
4839
4839
  clearError() {
4840
4840
  this.setState({ error: null });
@@ -4962,7 +4962,7 @@ class v extends f {
4962
4962
  return a && (a.toLowerCase() === "pm" && n < 12 ? o = n + 12 : a.toLowerCase() === "am" && n === 12 && (o = 0)), s.setHours(o, r || 0, 0, 0), s;
4963
4963
  }
4964
4964
  }
4965
- class C {
4965
+ class E {
4966
4966
  /**
4967
4967
  * Create element with attributes and children
4968
4968
  */
@@ -5157,7 +5157,7 @@ class C {
5157
5157
  return e.addEventListener("keydown", a), s == null || s.focus(), () => e.removeEventListener("keydown", a);
5158
5158
  }
5159
5159
  }
5160
- class p {
5160
+ class y {
5161
5161
  /**
5162
5162
  * Get CSS variable value
5163
5163
  */
@@ -5494,7 +5494,7 @@ class p {
5494
5494
  /**
5495
5495
  * Default theme colors
5496
5496
  */
5497
- M(p, "colors", {
5497
+ M(y, "colors", {
5498
5498
  primary: "#3B82F6",
5499
5499
  // Modern Blue
5500
5500
  secondary: "#64748B",
@@ -5527,7 +5527,7 @@ M(p, "colors", {
5527
5527
  }), /**
5528
5528
  * Common CSS variables
5529
5529
  */
5530
- M(p, "cssVariables", {
5530
+ M(y, "cssVariables", {
5531
5531
  // "Pro" Palette - Functional & Sharp
5532
5532
  "--fc-primary-color": "#2563EB",
5533
5533
  // International Blue (Focus)
@@ -5595,7 +5595,7 @@ M(p, "cssVariables", {
5595
5595
  }), /**
5596
5596
  * Get responsive breakpoints
5597
5597
  */
5598
- M(p, "breakpoints", {
5598
+ M(y, "breakpoints", {
5599
5599
  xs: "320px",
5600
5600
  sm: "576px",
5601
5601
  md: "768px",
@@ -5983,7 +5983,7 @@ class J extends T {
5983
5983
  renderDay(e) {
5984
5984
  const { date: t, dayOfMonth: s, isOtherMonth: i, isToday: a, isSelected: n, isWeekend: r, events: o = [] } = e, c = s, l = ["month-day"];
5985
5985
  i && l.push("other-month"), a && l.push("today"), n && l.push("selected"), r && l.push("weekend");
5986
- const d = o.slice(0, this.config.maxEventsToShow), h = o.length - this.config.maxEventsToShow, y = d.map((D) => this.renderEvent(D)).join(""), b = h > 0 ? `<div class="more-events">+${h} more</div>` : "";
5986
+ const d = o.slice(0, this.config.maxEventsToShow), h = o.length - this.config.maxEventsToShow, m = d.map((D) => this.renderEvent(D)).join(""), b = h > 0 ? `<div class="more-events">+${h} more</div>` : "";
5987
5987
  return `
5988
5988
  <div class="${l.join(" ")}"
5989
5989
  data-date="${t.toISOString()}"
@@ -5992,7 +5992,7 @@ class J extends T {
5992
5992
  <span class="day-number">${c}</span>
5993
5993
  </div>
5994
5994
  <div class="day-events">
5995
- ${y}
5995
+ ${m}
5996
5996
  ${b}
5997
5997
  </div>
5998
5998
  </div>
@@ -6002,7 +6002,7 @@ class J extends T {
6002
6002
  const { title: t, start: s, allDay: i, backgroundColor: a, textColor: n } = e;
6003
6003
  let r = "";
6004
6004
  if (a) {
6005
- const l = p.sanitizeColor(a), d = p.sanitizeColor(n, "white");
6005
+ const l = y.sanitizeColor(a), d = y.sanitizeColor(n, "white");
6006
6006
  r += `background-color: ${l}; color: ${d};`;
6007
6007
  }
6008
6008
  let o = "";
@@ -6012,9 +6012,9 @@ class J extends T {
6012
6012
  <div class="${c.join(" ")}"
6013
6013
  style="${r}"
6014
6014
  data-event-id="${e.id}"
6015
- title="${C.escapeHTML(t)}">
6015
+ title="${E.escapeHTML(t)}">
6016
6016
  ${o ? `<span class="event-time">${o}</span>` : ""}
6017
- <span class="event-title">${C.escapeHTML(t)}</span>
6017
+ <span class="event-title">${E.escapeHTML(t)}</span>
6018
6018
  </div>
6019
6019
  `;
6020
6020
  }
@@ -6348,23 +6348,23 @@ class X extends T {
6348
6348
  ` : '<div class="week-view">Loading...</div>';
6349
6349
  }
6350
6350
  renderTimedEvent(e) {
6351
- const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), a = (s - t) / (1e3 * 60), n = i, r = Math.max(a, 20), o = p.sanitizeColor(e.backgroundColor), c = p.sanitizeColor(p.getContrastColor(o), "white");
6351
+ const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), a = (s - t) / (1e3 * 60), n = i, r = Math.max(a, 20), o = y.sanitizeColor(e.backgroundColor), c = y.sanitizeColor(y.getContrastColor(o), "white");
6352
6352
  return `
6353
6353
  <div class="event-container"
6354
6354
  style="top: ${n}px; height: ${r}px; background-color: ${o}; color: ${c};"
6355
6355
  data-event-id="${e.id}">
6356
- <span class="event-title">${C.escapeHTML(e.title)}</span>
6356
+ <span class="event-title">${E.escapeHTML(e.title)}</span>
6357
6357
  <span class="event-time">${v.formatTime(t)}</span>
6358
6358
  </div>
6359
6359
  `;
6360
6360
  }
6361
6361
  renderAllDayEvent(e) {
6362
- const t = p.sanitizeColor(e.backgroundColor), s = p.sanitizeColor(p.getContrastColor(t), "white");
6362
+ const t = y.sanitizeColor(e.backgroundColor), s = y.sanitizeColor(y.getContrastColor(t), "white");
6363
6363
  return `
6364
6364
  <div class="event-item"
6365
6365
  style="background-color: ${t}; color: ${s}; font-size: 10px; padding: 2px 4px; border-radius: 2px; cursor: pointer; margin-bottom: 2px;"
6366
6366
  data-event-id="${e.id}">
6367
- ${C.escapeHTML(e.title)}
6367
+ ${E.escapeHTML(e.title)}
6368
6368
  </div>
6369
6369
  `;
6370
6370
  }
@@ -6678,23 +6678,23 @@ class ee extends T {
6678
6678
  `;
6679
6679
  }
6680
6680
  renderTimedEvent(e) {
6681
- const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), a = (s - t) / (1e3 * 60), n = i, r = Math.max(a, 30), o = p.sanitizeColor(e.backgroundColor), c = p.sanitizeColor(p.getContrastColor(o), "white");
6681
+ const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), a = (s - t) / (1e3 * 60), n = i, r = Math.max(a, 30), o = y.sanitizeColor(e.backgroundColor), c = y.sanitizeColor(y.getContrastColor(o), "white");
6682
6682
  return `
6683
6683
  <div class="event-container"
6684
6684
  style="top: ${n}px; height: ${r}px; background-color: ${o}; color: ${c};"
6685
6685
  data-event-id="${e.id}">
6686
- <span class="event-title">${C.escapeHTML(e.title)}</span>
6686
+ <span class="event-title">${E.escapeHTML(e.title)}</span>
6687
6687
  <span class="event-time">${v.formatTime(t)} - ${v.formatTime(s)}</span>
6688
6688
  </div>
6689
6689
  `;
6690
6690
  }
6691
6691
  renderAllDayEvent(e) {
6692
- const t = p.sanitizeColor(e.backgroundColor), s = p.sanitizeColor(p.getContrastColor(t), "white");
6692
+ const t = y.sanitizeColor(e.backgroundColor), s = y.sanitizeColor(y.getContrastColor(t), "white");
6693
6693
  return `
6694
6694
  <div class="event-item"
6695
6695
  style="background-color: ${t}; color: ${s}; font-size: 12px; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-weight: 500; margin-bottom: 2px;"
6696
6696
  data-event-id="${e.id}">
6697
- ${C.escapeHTML(e.title)}
6697
+ ${E.escapeHTML(e.title)}
6698
6698
  </div>
6699
6699
  `;
6700
6700
  }
@@ -6751,8 +6751,8 @@ class te extends T {
6751
6751
  }
6752
6752
  getStyles() {
6753
6753
  return `
6754
- ${p.getBaseStyles()}
6755
- ${p.getButtonStyles()}
6754
+ ${y.getBaseStyles()}
6755
+ ${y.getButtonStyles()}
6756
6756
 
6757
6757
  :host {
6758
6758
  display: none;
@@ -6995,7 +6995,7 @@ class te extends T {
6995
6995
  });
6996
6996
  }
6997
6997
  open(e = /* @__PURE__ */ new Date()) {
6998
- this.hasAttribute("open") || this.setAttribute("open", ""), this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this._formData.start = e, this._formData.end = new Date(e.getTime() + this.config.defaultDuration * 60 * 1e3), this._formData.title = "", this._formData.color = this.config.colors[0].color, this.startInput && (this.titleInput.value = "", this.startInput.value = this.formatDateForInput(this._formData.start), this.endInput.value = this.formatDateForInput(this._formData.end), this.updateColorSelection(), this._cleanupFocusTrap = C.trapFocus(this.modalContent));
6998
+ this.hasAttribute("open") || this.setAttribute("open", ""), this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this._formData.start = e, this._formData.end = new Date(e.getTime() + this.config.defaultDuration * 60 * 1e3), this._formData.title = "", this._formData.color = this.config.colors[0].color, this.startInput && (this.titleInput.value = "", this.startInput.value = this.formatDateForInput(this._formData.start), this.endInput.value = this.formatDateForInput(this._formData.end), this.updateColorSelection(), this._cleanupFocusTrap = E.trapFocus(this.modalContent));
6999
6999
  }
7000
7000
  close() {
7001
7001
  this.removeAttribute("open"), this._cleanupFocusTrap && (this._cleanupFocusTrap(), this._cleanupFocusTrap = null);
@@ -7046,13 +7046,13 @@ class se extends T {
7046
7046
  this.stateManager = new Q(e), this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
7047
7047
  }
7048
7048
  setupEventListeners() {
7049
- m.on("navigation:*", (e, t) => {
7049
+ p.on("navigation:*", (e, t) => {
7050
7050
  this.emit("calendar-navigate", { action: t.split(":")[1], ...e });
7051
- }), m.on("view:changed", (e) => {
7051
+ }), p.on("view:changed", (e) => {
7052
7052
  this.emit("calendar-view-change", e);
7053
- }), m.on("event:*", (e, t) => {
7053
+ }), p.on("event:*", (e, t) => {
7054
7054
  this.emit(`calendar-event-${t.split(":")[1]}`, e);
7055
- }), m.on("date:selected", (e) => {
7055
+ }), p.on("date:selected", (e) => {
7056
7056
  this.emit("calendar-date-select", e);
7057
7057
  });
7058
7058
  }
@@ -7068,10 +7068,10 @@ class se extends T {
7068
7068
  getStyles() {
7069
7069
  const e = this.getAttribute("height") || "800px";
7070
7070
  return `
7071
- ${p.getBaseStyles()}
7072
- ${p.getButtonStyles()}
7073
- ${p.getGridStyles()}
7074
- ${p.getAnimations()}
7071
+ ${y.getBaseStyles()}
7072
+ ${y.getButtonStyles()}
7073
+ ${y.getGridStyles()}
7074
+ ${y.getAnimations()}
7075
7075
 
7076
7076
  :host {
7077
7077
  --calendar-height: ${e};
@@ -7234,10 +7234,15 @@ class se extends T {
7234
7234
  flex-direction: column;
7235
7235
  }
7236
7236
 
7237
- /* Ensure view components have proper dimensions */
7238
- forcecal-month,
7239
- forcecal-week,
7240
- forcecal-day {
7237
+ /* Ensure view container has proper dimensions */
7238
+ #calendar-view-container {
7239
+ display: block;
7240
+ width: 100%;
7241
+ height: 100%;
7242
+ flex: 1;
7243
+ }
7244
+
7245
+ #calendar-view-container > * {
7241
7246
  display: block;
7242
7247
  width: 100%;
7243
7248
  height: 100%;
@@ -7376,38 +7381,130 @@ class se extends T {
7376
7381
  `;
7377
7382
  }
7378
7383
  renderView() {
7379
- if (!this.currentView)
7380
- return "<div>Loading view...</div>";
7381
- const e = `forcecal-${this.currentView}`;
7382
- return `<${e} id="calendar-view"></${e}>`;
7384
+ return '<div id="calendar-view-container"></div>';
7383
7385
  }
7384
7386
  afterRender() {
7385
- var i;
7386
- const e = this.$("#calendar-view");
7387
- if (console.log("[ForceCalendar] afterRender - viewElement:", e), console.log("[ForceCalendar] afterRender - stateManager:", !!this.stateManager), e && this.stateManager) {
7388
- console.log("[ForceCalendar] viewElement.constructor.name:", (i = e.constructor) == null ? void 0 : i.name), console.log("[ForceCalendar] viewElement methods:", Object.getOwnPropertyNames(Object.getPrototypeOf(e))), typeof customElements < "u" && customElements.upgrade && (console.log("[ForceCalendar] Forcing custom element upgrade"), customElements.upgrade(e));
7389
- const a = this._registryId || (this._registryId = "fc-" + Math.random().toString(36).substr(2, 9));
7390
- window.__forceCalendarRegistry = window.__forceCalendarRegistry || {}, window.__forceCalendarRegistry[a] = this.stateManager, e.setAttribute("data-state-registry", a), console.log("[ForceCalendar] Set registry ID:", a), e._checkRegistry ? (console.log("[ForceCalendar] Calling _checkRegistry directly"), e._checkRegistry()) : e.setStateManager && (console.log("[ForceCalendar] Calling setStateManager directly"), e.setStateManager(this.stateManager));
7391
- } else
7392
- console.log("[ForceCalendar] Could not set stateManager - viewElement:", !!e, "stateManager:", !!this.stateManager);
7393
- this.$$("[data-action]").forEach((a) => {
7394
- this.addListener(a, "click", this.handleNavigation);
7395
- }), this.$$("[data-view]").forEach((a) => {
7396
- this.addListener(a, "click", this.handleViewChange);
7387
+ const e = this.$("#calendar-view-container");
7388
+ if (console.log("[ForceCalendar] afterRender - container:", !!e, "stateManager:", !!this.stateManager, "currentView:", this.currentView), e && this.stateManager && this.currentView) {
7389
+ this._currentViewInstance && this._currentViewInstance.cleanup && this._currentViewInstance.cleanup(), console.log("[ForceCalendar] Creating view for:", this.currentView);
7390
+ const i = this._createViewRenderer(this.currentView);
7391
+ i && (this._currentViewInstance = i, i.stateManager = this.stateManager, i.container = e, i.render(), this.stateManager.subscribe((a, n) => {
7392
+ i && i.render && i.render();
7393
+ }));
7394
+ }
7395
+ this.$$("[data-action]").forEach((i) => {
7396
+ this.addListener(i, "click", this.handleNavigation);
7397
+ }), this.$$("[data-view]").forEach((i) => {
7398
+ this.addListener(i, "click", this.handleViewChange);
7397
7399
  });
7398
7400
  const t = this.$("#event-modal"), s = this.$("#create-event-btn");
7399
7401
  s && t && this.addListener(s, "click", () => {
7400
7402
  t.open(/* @__PURE__ */ new Date());
7401
- }), this.addListener(this.shadowRoot, "day-click", (a) => {
7402
- t && t.open(a.detail.date);
7403
- }), t && this.addListener(t, "save", (a) => {
7404
- const n = a.detail, r = window.crypto && typeof window.crypto.randomUUID == "function" ? window.crypto.randomUUID() : Math.random().toString(36).substring(2, 15);
7403
+ }), this.addListener(this.shadowRoot, "day-click", (i) => {
7404
+ t && t.open(i.detail.date);
7405
+ }), t && this.addListener(t, "save", (i) => {
7406
+ const a = i.detail, n = window.crypto && typeof window.crypto.randomUUID == "function" ? window.crypto.randomUUID() : Math.random().toString(36).substring(2, 15);
7405
7407
  this.stateManager.addEvent({
7406
- id: r,
7407
- ...n
7408
+ id: n,
7409
+ ...a
7408
7410
  });
7409
7411
  });
7410
7412
  }
7413
+ _createViewRenderer(e) {
7414
+ return {
7415
+ stateManager: null,
7416
+ container: null,
7417
+ _listeners: [],
7418
+ cleanup() {
7419
+ this._listeners.forEach(({ element: t, event: s, handler: i }) => {
7420
+ t.removeEventListener(s, i);
7421
+ }), this._listeners = [];
7422
+ },
7423
+ addListener(t, s, i) {
7424
+ t.addEventListener(s, i), this._listeners.push({ element: t, event: s, handler: i });
7425
+ },
7426
+ render() {
7427
+ if (!this.container || !this.stateManager) return;
7428
+ const t = this.stateManager.getViewData();
7429
+ if (!t || !t.weeks) {
7430
+ this.container.innerHTML = '<div style="padding: 20px; text-align: center;">Loading calendar...</div>';
7431
+ return;
7432
+ }
7433
+ this.cleanup();
7434
+ const s = this.stateManager.getState().config, i = this._renderMonthView(t, s);
7435
+ this.container.innerHTML = i, this._attachEventHandlers();
7436
+ },
7437
+ _renderMonthView(t, s) {
7438
+ const i = s.weekStartsOn || 0, a = [];
7439
+ for (let r = 0; r < 7; r++) {
7440
+ const o = (i + r) % 7;
7441
+ a.push(["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][o]);
7442
+ }
7443
+ let n = `
7444
+ <style>
7445
+ .fc-month-view { display: flex; flex-direction: column; height: 100%; background: #fff; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 13px; }
7446
+ .fc-month-header { display: grid; grid-template-columns: repeat(7, 1fr); background: #fafafa; border-bottom: 1px solid #e5e7eb; }
7447
+ .fc-month-header-cell { padding: 8px; text-align: left; font-weight: 600; font-size: 10px; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; }
7448
+ .fc-month-body { flex: 1; display: flex; flex-direction: column; }
7449
+ .fc-month-week { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid #e5e7eb; }
7450
+ .fc-month-week:last-child { border-bottom: none; }
7451
+ .fc-month-day { background: #fff; padding: 4px; position: relative; border-right: 1px solid #e5e7eb; min-height: 80px; cursor: pointer; }
7452
+ .fc-month-day:last-child { border-right: none; }
7453
+ .fc-month-day:hover { background: #f9fafb; }
7454
+ .fc-month-day.other-month { background: #f9fafb; }
7455
+ .fc-month-day.other-month .fc-day-number { color: #d1d5db; }
7456
+ .fc-month-day.today .fc-day-number { background: #ef4444; color: white; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
7457
+ .fc-day-number { font-size: 12px; font-weight: 500; color: #111827; padding: 4px; }
7458
+ .fc-day-events { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
7459
+ .fc-event { font-size: 11px; padding: 2px 6px; border-radius: 2px; background: #2563eb; color: white; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
7460
+ .fc-event:hover { opacity: 0.9; }
7461
+ .fc-more-events { font-size: 10px; color: #6b7280; padding: 2px 4px; cursor: pointer; }
7462
+ .fc-more-events:hover { color: #111827; text-decoration: underline; }
7463
+ </style>
7464
+ <div class="fc-month-view">
7465
+ <div class="fc-month-header">
7466
+ ${a.map((r) => `<div class="fc-month-header-cell">${r}</div>`).join("")}
7467
+ </div>
7468
+ <div class="fc-month-body">
7469
+ `;
7470
+ return t.weeks.forEach((r) => {
7471
+ n += '<div class="fc-month-week">', r.days.forEach((o) => {
7472
+ const c = ["fc-month-day"];
7473
+ o.isCurrentMonth || c.push("other-month"), o.isToday && c.push("today");
7474
+ const l = o.events || [], d = l.slice(0, 3), h = l.length - 3;
7475
+ n += `
7476
+ <div class="${c.join(" ")}" data-date="${o.date}">
7477
+ <div class="fc-day-number">${o.dayOfMonth}</div>
7478
+ <div class="fc-day-events">
7479
+ ${d.map((m) => `
7480
+ <div class="fc-event" data-event-id="${m.id}" style="background-color: ${m.backgroundColor || "#2563eb"}">
7481
+ ${m.title}
7482
+ </div>
7483
+ `).join("")}
7484
+ ${h > 0 ? `<div class="fc-more-events">+${h} more</div>` : ""}
7485
+ </div>
7486
+ </div>
7487
+ `;
7488
+ }), n += "</div>";
7489
+ }), n += "</div></div>", n;
7490
+ },
7491
+ _attachEventHandlers() {
7492
+ const t = this.stateManager;
7493
+ this.container.querySelectorAll(".fc-month-day").forEach((s) => {
7494
+ this.addListener(s, "click", (i) => {
7495
+ const a = new Date(s.dataset.date);
7496
+ t.selectDate(a);
7497
+ });
7498
+ }), this.container.querySelectorAll(".fc-event").forEach((s) => {
7499
+ this.addListener(s, "click", (i) => {
7500
+ i.stopPropagation();
7501
+ const a = s.dataset.eventId, n = t.getEvents().find((r) => r.id === a);
7502
+ n && t.selectEvent(n);
7503
+ });
7504
+ });
7505
+ }
7506
+ };
7507
+ }
7411
7508
  handleNavigation(e) {
7412
7509
  switch (e.currentTarget.dataset.action) {
7413
7510
  case "today":
@@ -7487,22 +7584,22 @@ class se extends T {
7487
7584
  this.stateManager.today();
7488
7585
  }
7489
7586
  destroy() {
7490
- this.stateManager && this.stateManager.destroy(), m.clear(), super.cleanup();
7587
+ this.stateManager && this.stateManager.destroy(), p.clear(), super.cleanup();
7491
7588
  }
7492
7589
  }
7493
7590
  customElements.get("forcecal-main") || customElements.define("forcecal-main", se);
7494
7591
  typeof window < "u" && typeof customElements < "u" && console.log("Force Calendar Interface loading...");
7495
7592
  export {
7496
7593
  T as BaseComponent,
7497
- C as DOMUtils,
7594
+ E as DOMUtils,
7498
7595
  v as DateUtils,
7499
7596
  ee as DayView,
7500
7597
  G as EventBus,
7501
7598
  se as ForceCalendar,
7502
7599
  J as MonthView,
7503
7600
  Q as StateManager,
7504
- p as StyleUtils,
7601
+ y as StyleUtils,
7505
7602
  X as WeekView,
7506
- m as eventBus
7603
+ p as eventBus
7507
7604
  };
7508
7605
  //# sourceMappingURL=force-calendar-interface.esm.js.map