@forcecalendar/interface 1.0.5 → 1.0.7

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,7 +1,7 @@
1
1
  var H = Object.defineProperty;
2
2
  var U = (u, t, e) => t in u ? H(u, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[t] = e;
3
- var C = (u, t, e) => U(u, typeof t != "symbol" ? t + "" : t, e);
4
- class S extends HTMLElement {
3
+ var M = (u, t, e) => U(u, typeof t != "symbol" ? t + "" : t, e);
4
+ class C extends HTMLElement {
5
5
  constructor() {
6
6
  super(), this.attachShadow({ mode: "open" }), this._listeners = [], this._state = null, this._props = /* @__PURE__ */ new Map(), this._initialized = !1;
7
7
  }
@@ -370,7 +370,7 @@ class P {
370
370
  };
371
371
  }
372
372
  }
373
- class M {
373
+ class S {
374
374
  constructor() {
375
375
  this.database = new P(), this.offsetCache = /* @__PURE__ */ new Map(), this.dstCache = /* @__PURE__ */ new Map(), this.maxCacheSize = 1e3, this.cacheHits = 0, this.cacheMisses = 0;
376
376
  }
@@ -716,17 +716,17 @@ class x {
716
716
  organizer: A = null,
717
717
  attendees: z = [],
718
718
  reminders: I = [],
719
- category: L,
719
+ category: _,
720
720
  // Support singular category (no default)
721
- categories: F,
721
+ categories: L,
722
722
  // Support plural categories (no default)
723
- attachments: O = [],
724
- conferenceData: _ = null,
723
+ attachments: F = [],
724
+ conferenceData: O = null,
725
725
  metadata: R = {},
726
726
  ...B
727
727
  // Capture any extra properties
728
728
  }) {
729
- const m = x.normalize({
729
+ const g = x.normalize({
730
730
  id: t,
731
731
  title: e,
732
732
  start: s,
@@ -747,17 +747,17 @@ class x {
747
747
  organizer: A,
748
748
  attendees: z,
749
749
  reminders: I,
750
- category: L,
750
+ category: _,
751
751
  // Pass category to normalize
752
- categories: F,
752
+ categories: L,
753
753
  // Pass categories to normalize
754
- attachments: O,
755
- conferenceData: _,
754
+ attachments: F,
755
+ conferenceData: O,
756
756
  metadata: R,
757
757
  ...B
758
758
  // Pass any extra properties
759
759
  });
760
- x.validate(m), this.id = m.id, this.title = m.title, this._timezoneManager = new M(), this.timeZone = m.timeZone || this._timezoneManager.getSystemTimezone(), this.endTimeZone = m.endTimeZone || this.timeZone, this.start = m.start, this.end = m.end, this.startUTC = this._timezoneManager.toUTC(this.start, this.timeZone), this.endUTC = this._timezoneManager.toUTC(this.end, this.endTimeZone), this.allDay = m.allDay, this.description = m.description, this.location = m.location, this.color = m.color, this.backgroundColor = m.backgroundColor, this.borderColor = m.borderColor, this.textColor = m.textColor, this.recurring = m.recurring, this.recurrenceRule = m.recurrenceRule, this._originalTimeZone = m.timeZone || null, this.status = m.status, this.visibility = m.visibility, this.organizer = m.organizer, this.attendees = [...m.attendees], this.reminders = [...m.reminders], this.categories = m.categories ? [...m.categories] : [], this.attachments = [...m.attachments], this.conferenceData = m.conferenceData, this.metadata = { ...m.metadata }, this._cache = {}, this._validateAttendees(), this._validateReminders();
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();
761
761
  }
762
762
  /**
763
763
  * Get event duration in milliseconds
@@ -1872,7 +1872,7 @@ class N {
1872
1872
  static expandEvent(t, e, s, i = 365, a = null) {
1873
1873
  if (!t.recurring || !t.recurrenceRule)
1874
1874
  return [{ start: t.start, end: t.end, timezone: t.timeZone }];
1875
- const n = this.parseRule(t.recurrenceRule), r = [], o = t.end - t.start, c = a || t.timeZone || "UTC", l = new M();
1875
+ const n = this.parseRule(t.recurrenceRule), r = [], o = t.end - t.start, c = a || t.timeZone || "UTC", l = new S();
1876
1876
  let d = new Date(t.start), h = 0;
1877
1877
  n.until && n.until < s && (s = n.until);
1878
1878
  let y = l.getTimezoneOffset(d, c);
@@ -2176,7 +2176,7 @@ class $ {
2176
2176
  return this.cache.size;
2177
2177
  }
2178
2178
  }
2179
- class W {
2179
+ class V {
2180
2180
  constructor(t = {}) {
2181
2181
  this.config = {
2182
2182
  checkInterval: 3e4,
@@ -2393,7 +2393,7 @@ class W {
2393
2393
  this.stopMonitoring(), this.caches.clear();
2394
2394
  }
2395
2395
  }
2396
- class V {
2396
+ class W {
2397
2397
  constructor(t = {}) {
2398
2398
  this.config = {
2399
2399
  enableCache: !0,
@@ -2408,7 +2408,7 @@ class V {
2408
2408
  enableAdaptiveMemory: !0,
2409
2409
  // Enable adaptive memory management
2410
2410
  ...t
2411
- }, this.eventCache = new $(this.config.cacheCapacity), this.queryCache = new $(Math.floor(this.config.cacheCapacity / 2)), this.dateRangeCache = new $(Math.floor(this.config.cacheCapacity / 4)), this.config.enableAdaptiveMemory && (this.memoryManager = new W({
2411
+ }, this.eventCache = new $(this.config.cacheCapacity), this.queryCache = new $(Math.floor(this.config.cacheCapacity / 2)), this.dateRangeCache = new $(Math.floor(this.config.cacheCapacity / 4)), this.config.enableAdaptiveMemory && (this.memoryManager = new V({
2412
2412
  checkInterval: 3e4,
2413
2413
  memoryThreshold: 0.75,
2414
2414
  criticalThreshold: 0.9
@@ -3010,7 +3010,7 @@ class Z {
3010
3010
  byCategory: /* @__PURE__ */ new Map(),
3011
3011
  /** @type {Map<string, Set<string>>} Status -> Set of event IDs */
3012
3012
  byStatus: /* @__PURE__ */ new Map()
3013
- }, this.timezoneManager = new M(), this.defaultTimezone = t.timezone || this.timezoneManager.getSystemTimezone(), this.optimizer = new V(t.performance), this.conflictDetector = new j(this), this.isBatchMode = !1, this.batchNotifications = [], this.batchBackup = null, this.version = 0, this.listeners = /* @__PURE__ */ new Set();
3013
+ }, this.timezoneManager = new S(), this.defaultTimezone = t.timezone || this.timezoneManager.getSystemTimezone(), this.optimizer = new W(t.performance), this.conflictDetector = new j(this), this.isBatchMode = !1, this.batchNotifications = [], this.batchBackup = null, this.version = 0, this.listeners = /* @__PURE__ */ new Set();
3014
3014
  }
3015
3015
  /**
3016
3016
  * Add an event to the store
@@ -4036,7 +4036,7 @@ class K {
4036
4036
  * @param {import('../../types.js').CalendarConfig} [config={}] - Configuration options
4037
4037
  */
4038
4038
  constructor(t = {}) {
4039
- this.timezoneManager = new M(), this.config = {
4039
+ this.timezoneManager = new S(), this.config = {
4040
4040
  view: "month",
4041
4041
  date: /* @__PURE__ */ new Date(),
4042
4042
  weekStartsOn: 0,
@@ -4653,7 +4653,7 @@ class G {
4653
4653
  return this.events.has(t) ? this.events.get(t).length : 0;
4654
4654
  }
4655
4655
  }
4656
- const g = new G();
4656
+ const m = new G();
4657
4657
  class Q {
4658
4658
  constructor(t = {}) {
4659
4659
  this.calendar = new K({
@@ -4702,62 +4702,62 @@ class Q {
4702
4702
  (i) => t[i] !== e[i]
4703
4703
  );
4704
4704
  s.forEach((i) => {
4705
- g.emit(`state:${i}:changed`, {
4705
+ m.emit(`state:${i}:changed`, {
4706
4706
  oldValue: t[i],
4707
4707
  newValue: e[i],
4708
4708
  state: e
4709
4709
  });
4710
- }), s.length > 0 && g.emit("state:changed", { oldState: t, newState: e, changedKeys: s });
4710
+ }), s.length > 0 && m.emit("state:changed", { oldState: t, newState: e, changedKeys: s });
4711
4711
  }
4712
4712
  // Calendar operations
4713
4713
  setView(t) {
4714
- this.calendar.setView(t), this.setState({ view: t }), g.emit("view:changed", { view: t });
4714
+ this.calendar.setView(t), this.setState({ view: t }), m.emit("view:changed", { view: t });
4715
4715
  }
4716
4716
  getView() {
4717
4717
  return this.state.view;
4718
4718
  }
4719
4719
  setDate(t) {
4720
- this.calendar.goToDate(t), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("date:changed", { date: this.state.currentDate });
4720
+ this.calendar.goToDate(t), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.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() }), g.emit("navigation:next", { date: this.state.currentDate });
4727
+ this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("navigation:next", { date: this.state.currentDate });
4728
4728
  }
4729
4729
  previous() {
4730
- this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("navigation:previous", { date: this.state.currentDate });
4730
+ this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("navigation:previous", { date: this.state.currentDate });
4731
4731
  }
4732
4732
  today() {
4733
- this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("navigation:today", { date: this.state.currentDate });
4733
+ this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("navigation:today", { date: this.state.currentDate });
4734
4734
  }
4735
4735
  goToDate(t) {
4736
- this.calendar.goToDate(t), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("navigation:goto", { date: this.state.currentDate });
4736
+ this.calendar.goToDate(t), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("navigation:goto", { date: this.state.currentDate });
4737
4737
  }
4738
4738
  // Event management
4739
4739
  addEvent(t) {
4740
4740
  const e = this.calendar.addEvent(t);
4741
4741
  if (!e)
4742
- return console.error("Failed to add event to calendar"), g.emit("event:error", { action: "add", event: t, error: "Failed to add event" }), null;
4742
+ return console.error("Failed to add event to calendar"), m.emit("event:error", { action: "add", event: t, error: "Failed to add event" }), null;
4743
4743
  const s = [...this.state.events, e];
4744
- return this.setState({ events: s }), g.emit("event:added", { event: e }), e;
4744
+ return this.setState({ events: s }), m.emit("event:added", { event: e }), e;
4745
4745
  }
4746
4746
  updateEvent(t, e) {
4747
4747
  const s = this.calendar.updateEvent(t, e);
4748
4748
  if (!s)
4749
- return console.error(`Failed to update event: ${t}`), g.emit("event:error", { action: "update", eventId: t, updates: e, error: "Event not found in calendar" }), null;
4749
+ return console.error(`Failed to update event: ${t}`), m.emit("event:error", { action: "update", eventId: t, updates: e, error: "Event not found in calendar" }), null;
4750
4750
  const i = this.state.events.findIndex((n) => n.id === t);
4751
4751
  if (i === -1)
4752
- return console.error(`Event ${t} not found in state`), g.emit("event:error", { action: "update", eventId: t, error: "Event not found in state" }), null;
4752
+ return console.error(`Event ${t} not found in state`), m.emit("event:error", { action: "update", eventId: t, error: "Event not found in state" }), null;
4753
4753
  const a = [...this.state.events];
4754
- return a[i] = s, this.setState({ events: a }), g.emit("event:updated", { event: s }), s;
4754
+ return a[i] = s, this.setState({ events: a }), m.emit("event:updated", { event: s }), s;
4755
4755
  }
4756
4756
  deleteEvent(t) {
4757
4757
  if (!this.calendar.removeEvent(t))
4758
- return console.error(`Failed to delete event: ${t}`), g.emit("event:error", { action: "delete", eventId: t, error: "Event not found" }), !1;
4758
+ return console.error(`Failed to delete event: ${t}`), m.emit("event:error", { action: "delete", eventId: t, error: "Event not found" }), !1;
4759
4759
  const s = this.state.events.filter((i) => i.id !== t);
4760
- return this.setState({ events: s }), g.emit("event:deleted", { eventId: t }), !0;
4760
+ return this.setState({ events: s }), m.emit("event:deleted", { eventId: t }), !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(t) {
4804
- this.setState({ selectedEvent: t }), g.emit("event:selected", { event: t });
4804
+ this.setState({ selectedEvent: t }), m.emit("event:selected", { event: t });
4805
4805
  }
4806
4806
  selectEventById(t) {
4807
4807
  const e = this.state.events.find((s) => s.id === t);
4808
4808
  e && this.selectEvent(e);
4809
4809
  }
4810
4810
  deselectEvent() {
4811
- this.setState({ selectedEvent: null }), g.emit("event:deselected", {});
4811
+ this.setState({ selectedEvent: null }), m.emit("event:deselected", {});
4812
4812
  }
4813
4813
  selectDate(t) {
4814
- this.setState({ selectedDate: t }), g.emit("date:selected", { date: t });
4814
+ this.setState({ selectedDate: t }), m.emit("date:selected", { date: t });
4815
4815
  }
4816
4816
  deselectDate() {
4817
- this.setState({ selectedDate: null }), g.emit("date:deselected", {});
4817
+ this.setState({ selectedDate: null }), m.emit("date:deselected", {});
4818
4818
  }
4819
4819
  // Utility methods
4820
4820
  isToday(t) {
@@ -4834,7 +4834,7 @@ class Q {
4834
4834
  }
4835
4835
  // Error handling
4836
4836
  setError(t) {
4837
- this.setState({ error: t }), t && g.emit("error", { error: t });
4837
+ this.setState({ error: t }), t && m.emit("error", { error: t });
4838
4838
  }
4839
4839
  clearError() {
4840
4840
  this.setState({ error: null });
@@ -5494,7 +5494,7 @@ class p {
5494
5494
  /**
5495
5495
  * Default theme colors
5496
5496
  */
5497
- C(p, "colors", {
5497
+ M(p, "colors", {
5498
5498
  primary: "#3B82F6",
5499
5499
  // Modern Blue
5500
5500
  secondary: "#64748B",
@@ -5527,7 +5527,7 @@ C(p, "colors", {
5527
5527
  }), /**
5528
5528
  * Common CSS variables
5529
5529
  */
5530
- C(p, "cssVariables", {
5530
+ M(p, "cssVariables", {
5531
5531
  // "Pro" Palette - Functional & Sharp
5532
5532
  "--fc-primary-color": "#2563EB",
5533
5533
  // International Blue (Focus)
@@ -5595,7 +5595,7 @@ C(p, "cssVariables", {
5595
5595
  }), /**
5596
5596
  * Get responsive breakpoints
5597
5597
  */
5598
- C(p, "breakpoints", {
5598
+ M(p, "breakpoints", {
5599
5599
  xs: "320px",
5600
5600
  sm: "576px",
5601
5601
  md: "768px",
@@ -5603,14 +5603,39 @@ C(p, "breakpoints", {
5603
5603
  xl: "1200px",
5604
5604
  "2xl": "1400px"
5605
5605
  });
5606
- class J extends S {
5606
+ class J extends C {
5607
+ // Observe data-state-registry attribute for Locker Service compatibility
5608
+ static get observedAttributes() {
5609
+ return ["data-state-registry"];
5610
+ }
5607
5611
  constructor() {
5608
5612
  super(), this._stateManager = null, this.viewData = null, this.config = {
5609
5613
  maxEventsToShow: 3
5610
5614
  };
5611
5615
  }
5616
+ connectedCallback() {
5617
+ super.connectedCallback(), this._checkRegistry();
5618
+ }
5619
+ attributeChangedCallback(t, e, s) {
5620
+ console.log("[MonthView] attributeChangedCallback:", t, e, "->", s), t === "data-state-registry" && s && this._checkRegistry();
5621
+ }
5622
+ _checkRegistry() {
5623
+ const t = this.getAttribute("data-state-registry");
5624
+ if (console.log("[MonthView] Checking registry for ID:", t), t && window.__forceCalendarRegistry && window.__forceCalendarRegistry[t]) {
5625
+ const e = window.__forceCalendarRegistry[t];
5626
+ console.log("[MonthView] Found stateManager in registry"), this.setStateManager(e);
5627
+ }
5628
+ }
5612
5629
  set stateManager(t) {
5613
- this._stateManager = t, t && (this.unsubscribe = t.subscribe(this.handleStateUpdate.bind(this)), this.loadViewData());
5630
+ console.log("[MonthView] stateManager setter called with:", !!t), this.setStateManager(t);
5631
+ }
5632
+ // Method alternative for Salesforce Locker Service compatibility
5633
+ setStateManager(t) {
5634
+ if (console.log("[MonthView] setStateManager method called with:", !!t), this._stateManager === t) {
5635
+ console.log("[MonthView] stateManager already set, skipping");
5636
+ return;
5637
+ }
5638
+ this._stateManager = t, t && (console.log("[MonthView] Subscribing to state changes and loading view data"), this.unsubscribe = t.subscribe(this.handleStateUpdate.bind(this)), this.loadViewData());
5614
5639
  }
5615
5640
  get stateManager() {
5616
5641
  return this._stateManager;
@@ -5636,9 +5661,9 @@ class J extends S {
5636
5661
  }
5637
5662
  }
5638
5663
  loadViewData() {
5639
- if (!this.stateManager) return;
5664
+ if (console.log("[MonthView] loadViewData called, stateManager:", !!this.stateManager), !this.stateManager) return;
5640
5665
  const t = this.stateManager.getViewData();
5641
- this.viewData = this.processViewData(t), this.render();
5666
+ console.log("[MonthView] viewData from stateManager:", t), this.viewData = this.processViewData(t), console.log("[MonthView] processed viewData:", this.viewData), this.render(), console.log("[MonthView] render completed");
5642
5667
  }
5643
5668
  processViewData(t) {
5644
5669
  var i, a;
@@ -6011,12 +6036,28 @@ class J extends S {
6011
6036
  this.unsubscribe && this.unsubscribe();
6012
6037
  }
6013
6038
  }
6014
- class X extends S {
6039
+ class X extends C {
6040
+ static get observedAttributes() {
6041
+ return ["data-state-registry"];
6042
+ }
6015
6043
  constructor() {
6016
6044
  super(), this._stateManager = null, this.viewData = null, this.hours = Array.from({ length: 24 }, (t, e) => e);
6017
6045
  }
6046
+ connectedCallback() {
6047
+ super.connectedCallback(), this._checkRegistry();
6048
+ }
6049
+ attributeChangedCallback(t, e, s) {
6050
+ t === "data-state-registry" && s && this._checkRegistry();
6051
+ }
6052
+ _checkRegistry() {
6053
+ const t = this.getAttribute("data-state-registry");
6054
+ t && window.__forceCalendarRegistry && window.__forceCalendarRegistry[t] && this.setStateManager(window.__forceCalendarRegistry[t]);
6055
+ }
6018
6056
  set stateManager(t) {
6019
- this._stateManager = t, t && (this.unsubscribe = t.subscribe(this.handleStateUpdate.bind(this)), this.loadViewData());
6057
+ this.setStateManager(t);
6058
+ }
6059
+ setStateManager(t) {
6060
+ this._stateManager !== t && (this._stateManager = t, t && (this.unsubscribe = t.subscribe(this.handleStateUpdate.bind(this)), this.loadViewData()));
6020
6061
  }
6021
6062
  get stateManager() {
6022
6063
  return this._stateManager;
@@ -6332,12 +6373,28 @@ class X extends S {
6332
6373
  this.unsubscribe && this.unsubscribe();
6333
6374
  }
6334
6375
  }
6335
- class tt extends S {
6376
+ class tt extends C {
6377
+ static get observedAttributes() {
6378
+ return ["data-state-registry"];
6379
+ }
6336
6380
  constructor() {
6337
6381
  super(), this._stateManager = null, this.viewData = null, this.hours = Array.from({ length: 24 }, (t, e) => e);
6338
6382
  }
6383
+ connectedCallback() {
6384
+ super.connectedCallback(), this._checkRegistry();
6385
+ }
6386
+ attributeChangedCallback(t, e, s) {
6387
+ t === "data-state-registry" && s && this._checkRegistry();
6388
+ }
6389
+ _checkRegistry() {
6390
+ const t = this.getAttribute("data-state-registry");
6391
+ t && window.__forceCalendarRegistry && window.__forceCalendarRegistry[t] && this.setStateManager(window.__forceCalendarRegistry[t]);
6392
+ }
6339
6393
  set stateManager(t) {
6340
- this._stateManager = t, t && (this.unsubscribe = t.subscribe(this.handleStateUpdate.bind(this)), this.loadViewData());
6394
+ this.setStateManager(t);
6395
+ }
6396
+ setStateManager(t) {
6397
+ this._stateManager !== t && (this._stateManager = t, t && (this.unsubscribe = t.subscribe(this.handleStateUpdate.bind(this)), this.loadViewData()));
6341
6398
  }
6342
6399
  get stateManager() {
6343
6400
  return this._stateManager;
@@ -6638,7 +6695,7 @@ class tt extends S {
6638
6695
  this.unsubscribe && this.unsubscribe();
6639
6696
  }
6640
6697
  }
6641
- class et extends S {
6698
+ class et extends C {
6642
6699
  constructor() {
6643
6700
  super(), this._isVisible = !1, this._cleanupFocusTrap = null, this.config = {
6644
6701
  title: "New Event",
@@ -6945,7 +7002,7 @@ customElements.get("forcecal-event-form") || customElements.define("forcecal-eve
6945
7002
  customElements.get("forcecal-month") || customElements.define("forcecal-month", J);
6946
7003
  customElements.get("forcecal-week") || customElements.define("forcecal-week", X);
6947
7004
  customElements.get("forcecal-day") || customElements.define("forcecal-day", tt);
6948
- class st extends S {
7005
+ class st extends C {
6949
7006
  static get observedAttributes() {
6950
7007
  return ["view", "date", "locale", "timezone", "week-starts-on", "height"];
6951
7008
  }
@@ -6963,13 +7020,13 @@ class st extends S {
6963
7020
  this.stateManager = new Q(t), this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
6964
7021
  }
6965
7022
  setupEventListeners() {
6966
- g.on("navigation:*", (t, e) => {
7023
+ m.on("navigation:*", (t, e) => {
6967
7024
  this.emit("calendar-navigate", { action: e.split(":")[1], ...t });
6968
- }), g.on("view:changed", (t) => {
7025
+ }), m.on("view:changed", (t) => {
6969
7026
  this.emit("calendar-view-change", t);
6970
- }), g.on("event:*", (t, e) => {
7027
+ }), m.on("event:*", (t, e) => {
6971
7028
  this.emit(`calendar-event-${e.split(":")[1]}`, t);
6972
- }), g.on("date:selected", (t) => {
7029
+ }), m.on("date:selected", (t) => {
6973
7030
  this.emit("calendar-date-select", t);
6974
7031
  });
6975
7032
  }
@@ -7300,7 +7357,12 @@ class st extends S {
7300
7357
  }
7301
7358
  afterRender() {
7302
7359
  const t = this.$("#calendar-view");
7303
- t && this.stateManager && (t.stateManager = this.stateManager), this.$$("[data-action]").forEach((i) => {
7360
+ if (console.log("[ForceCalendar] afterRender - viewElement:", t), console.log("[ForceCalendar] afterRender - stateManager:", !!this.stateManager), t && this.stateManager) {
7361
+ const i = this._registryId || (this._registryId = "fc-" + Math.random().toString(36).substr(2, 9));
7362
+ window.__forceCalendarRegistry = window.__forceCalendarRegistry || {}, window.__forceCalendarRegistry[i] = this.stateManager, t.setAttribute("data-state-registry", i), console.log("[ForceCalendar] Set registry ID:", i);
7363
+ } else
7364
+ console.log("[ForceCalendar] Could not set stateManager - viewElement:", !!t, "stateManager:", !!this.stateManager);
7365
+ this.$$("[data-action]").forEach((i) => {
7304
7366
  this.addListener(i, "click", this.handleNavigation);
7305
7367
  }), this.$$("[data-view]").forEach((i) => {
7306
7368
  this.addListener(i, "click", this.handleViewChange);
@@ -7397,13 +7459,13 @@ class st extends S {
7397
7459
  this.stateManager.today();
7398
7460
  }
7399
7461
  destroy() {
7400
- this.stateManager && this.stateManager.destroy(), g.clear(), super.cleanup();
7462
+ this.stateManager && this.stateManager.destroy(), m.clear(), super.cleanup();
7401
7463
  }
7402
7464
  }
7403
7465
  customElements.get("forcecal-main") || customElements.define("forcecal-main", st);
7404
7466
  typeof window < "u" && typeof customElements < "u" && console.log("Force Calendar Interface loading...");
7405
7467
  export {
7406
- S as BaseComponent,
7468
+ C as BaseComponent,
7407
7469
  E as DOMUtils,
7408
7470
  v as DateUtils,
7409
7471
  tt as DayView,
@@ -7413,6 +7475,6 @@ export {
7413
7475
  Q as StateManager,
7414
7476
  p as StyleUtils,
7415
7477
  X as WeekView,
7416
- g as eventBus
7478
+ m as eventBus
7417
7479
  };
7418
7480
  //# sourceMappingURL=force-calendar-interface.esm.js.map