@forcecalendar/interface 1.0.7 → 1.0.8

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
- var U = (u, t, e) => t in u ? H(u, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[t] = e;
3
- var M = (u, t, e) => U(u, typeof t != "symbol" ? t + "" : t, e);
4
- class C extends HTMLElement {
2
+ var P = (u, t, e) => t in u ? H(u, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[t] = e;
3
+ var M = (u, t, e) => P(u, typeof t != "symbol" ? t + "" : t, e);
4
+ class T 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
  }
@@ -108,7 +108,7 @@ class C extends HTMLElement {
108
108
  this.setProp(t, s), this._initialized && this.render();
109
109
  }
110
110
  }
111
- class P {
111
+ class U {
112
112
  constructor() {
113
113
  this.timezones = {
114
114
  // UTC
@@ -372,7 +372,7 @@ class P {
372
372
  }
373
373
  class S {
374
374
  constructor() {
375
- this.database = new P(), this.offsetCache = /* @__PURE__ */ new Map(), this.dstCache = /* @__PURE__ */ new Map(), this.maxCacheSize = 1e3, this.cacheHits = 0, this.cacheMisses = 0;
375
+ this.database = new U(), this.offsetCache = /* @__PURE__ */ new Map(), this.dstCache = /* @__PURE__ */ new Map(), this.maxCacheSize = 1e3, this.cacheHits = 0, this.cacheMisses = 0;
376
376
  }
377
377
  /**
378
378
  * Convert date from one timezone to another
@@ -712,10 +712,10 @@ class x {
712
712
  timeZone: b = null,
713
713
  endTimeZone: D = null,
714
714
  status: k = "confirmed",
715
- visibility: T = "public",
715
+ visibility: E = "public",
716
716
  organizer: A = null,
717
- attendees: z = [],
718
- reminders: I = [],
717
+ attendees: $ = [],
718
+ reminders: z = [],
719
719
  category: _,
720
720
  // Support singular category (no default)
721
721
  categories: L,
@@ -743,10 +743,10 @@ class x {
743
743
  timeZone: b,
744
744
  endTimeZone: D,
745
745
  status: k,
746
- visibility: T,
746
+ visibility: E,
747
747
  organizer: A,
748
- attendees: z,
749
- reminders: I,
748
+ attendees: $,
749
+ reminders: z,
750
750
  category: _,
751
751
  // Pass category to normalize
752
752
  categories: L,
@@ -1880,8 +1880,8 @@ class N {
1880
1880
  if (d >= e) {
1881
1881
  const b = new Date(d), D = new Date(d.getTime() + o), k = l.getTimezoneOffset(b, c);
1882
1882
  if (k !== y) {
1883
- const T = y - k;
1884
- b.setMinutes(b.getMinutes() + T), D.setMinutes(D.getMinutes() + T);
1883
+ const E = y - k;
1884
+ b.setMinutes(b.getMinutes() + E), D.setMinutes(D.getMinutes() + E);
1885
1885
  }
1886
1886
  y = k, this.isException(b, n, t.id) || r.push({
1887
1887
  start: b,
@@ -2089,7 +2089,7 @@ class N {
2089
2089
  return a && (n = `${a === -1 ? "Last" : ["", "1st", "2nd", "3rd", "4th", "5th"][a] || `${a}th`} ${n}`), n;
2090
2090
  }
2091
2091
  }
2092
- class $ {
2092
+ class I {
2093
2093
  /**
2094
2094
  * Create a new LRU Cache
2095
2095
  * @param {number} capacity - Maximum number of items in cache
@@ -2408,7 +2408,7 @@ class W {
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 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 V({
2412
2412
  checkInterval: 3e4,
2413
2413
  memoryThreshold: 0.75,
2414
2414
  criticalThreshold: 0.9
@@ -4353,12 +4353,12 @@ class K {
4353
4353
  days: []
4354
4354
  };
4355
4355
  for (let b = 0; b < 7; b++) {
4356
- const D = new Date(l), k = D.getMonth() === s, T = f.isToday(D), A = D.getDay() === 0 || D.getDay() === 6;
4356
+ const D = new Date(l), k = D.getMonth() === s, E = f.isToday(D), A = D.getDay() === 0 || D.getDay() === 6;
4357
4357
  y.days.push({
4358
4358
  date: D,
4359
4359
  dayOfMonth: D.getDate(),
4360
4360
  isCurrentMonth: k,
4361
- isToday: T,
4361
+ isToday: E,
4362
4362
  isWeekend: A,
4363
4363
  events: this.getEventsForDate(D)
4364
4364
  }), l = f.addDays(l, 1);
@@ -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 E {
4965
+ class C {
4966
4966
  /**
4967
4967
  * Create element with attributes and children
4968
4968
  */
@@ -5603,27 +5603,37 @@ M(p, "breakpoints", {
5603
5603
  xl: "1200px",
5604
5604
  "2xl": "1400px"
5605
5605
  });
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
- }
5606
+ class J extends T {
5611
5607
  constructor() {
5612
5608
  super(), this._stateManager = null, this.viewData = null, this.config = {
5613
5609
  maxEventsToShow: 3
5614
- };
5610
+ }, this._registryCheckInterval = null;
5615
5611
  }
5616
5612
  connectedCallback() {
5617
- super.connectedCallback(), this._checkRegistry();
5613
+ super.connectedCallback(), console.log("[MonthView] connectedCallback - starting registry polling"), this._startRegistryPolling();
5618
5614
  }
5619
- attributeChangedCallback(t, e, s) {
5620
- console.log("[MonthView] attributeChangedCallback:", t, e, "->", s), t === "data-state-registry" && s && this._checkRegistry();
5615
+ disconnectedCallback() {
5616
+ super.disconnectedCallback(), this._stopRegistryPolling();
5617
+ }
5618
+ _startRegistryPolling() {
5619
+ this._checkRegistry();
5620
+ let t = 0;
5621
+ this._registryCheckInterval = setInterval(() => {
5622
+ if (t++, this._stateManager || t > 50) {
5623
+ this._stopRegistryPolling();
5624
+ return;
5625
+ }
5626
+ this._checkRegistry();
5627
+ }, 100);
5628
+ }
5629
+ _stopRegistryPolling() {
5630
+ this._registryCheckInterval && (clearInterval(this._registryCheckInterval), this._registryCheckInterval = null);
5621
5631
  }
5622
5632
  _checkRegistry() {
5623
5633
  const t = this.getAttribute("data-state-registry");
5624
5634
  if (console.log("[MonthView] Checking registry for ID:", t), t && window.__forceCalendarRegistry && window.__forceCalendarRegistry[t]) {
5625
5635
  const e = window.__forceCalendarRegistry[t];
5626
- console.log("[MonthView] Found stateManager in registry"), this.setStateManager(e);
5636
+ console.log("[MonthView] Found stateManager in registry"), this._stopRegistryPolling(), this.setStateManager(e);
5627
5637
  }
5628
5638
  }
5629
5639
  set stateManager(t) {
@@ -6002,9 +6012,9 @@ class J extends C {
6002
6012
  <div class="${c.join(" ")}"
6003
6013
  style="${r}"
6004
6014
  data-event-id="${t.id}"
6005
- title="${E.escapeHTML(e)}">
6015
+ title="${C.escapeHTML(e)}">
6006
6016
  ${o ? `<span class="event-time">${o}</span>` : ""}
6007
- <span class="event-title">${E.escapeHTML(e)}</span>
6017
+ <span class="event-title">${C.escapeHTML(e)}</span>
6008
6018
  </div>
6009
6019
  `;
6010
6020
  }
@@ -6036,22 +6046,30 @@ class J extends C {
6036
6046
  this.unsubscribe && this.unsubscribe();
6037
6047
  }
6038
6048
  }
6039
- class X extends C {
6040
- static get observedAttributes() {
6041
- return ["data-state-registry"];
6042
- }
6049
+ class X extends T {
6043
6050
  constructor() {
6044
- super(), this._stateManager = null, this.viewData = null, this.hours = Array.from({ length: 24 }, (t, e) => e);
6051
+ super(), this._stateManager = null, this.viewData = null, this.hours = Array.from({ length: 24 }, (t, e) => e), this._registryCheckInterval = null;
6045
6052
  }
6046
6053
  connectedCallback() {
6047
- super.connectedCallback(), this._checkRegistry();
6054
+ super.connectedCallback(), this._startRegistryPolling();
6048
6055
  }
6049
- attributeChangedCallback(t, e, s) {
6050
- t === "data-state-registry" && s && this._checkRegistry();
6056
+ disconnectedCallback() {
6057
+ super.disconnectedCallback(), this._registryCheckInterval && clearInterval(this._registryCheckInterval);
6058
+ }
6059
+ _startRegistryPolling() {
6060
+ this._checkRegistry();
6061
+ let t = 0;
6062
+ this._registryCheckInterval = setInterval(() => {
6063
+ if (t++, this._stateManager || t > 50) {
6064
+ clearInterval(this._registryCheckInterval);
6065
+ return;
6066
+ }
6067
+ this._checkRegistry();
6068
+ }, 100);
6051
6069
  }
6052
6070
  _checkRegistry() {
6053
6071
  const t = this.getAttribute("data-state-registry");
6054
- t && window.__forceCalendarRegistry && window.__forceCalendarRegistry[t] && this.setStateManager(window.__forceCalendarRegistry[t]);
6072
+ t && window.__forceCalendarRegistry && window.__forceCalendarRegistry[t] && (clearInterval(this._registryCheckInterval), this.setStateManager(window.__forceCalendarRegistry[t]));
6055
6073
  }
6056
6074
  set stateManager(t) {
6057
6075
  this.setStateManager(t);
@@ -6335,7 +6353,7 @@ class X extends C {
6335
6353
  <div class="event-container"
6336
6354
  style="top: ${n}px; height: ${r}px; background-color: ${o}; color: ${c};"
6337
6355
  data-event-id="${t.id}">
6338
- <span class="event-title">${E.escapeHTML(t.title)}</span>
6356
+ <span class="event-title">${C.escapeHTML(t.title)}</span>
6339
6357
  <span class="event-time">${v.formatTime(e)}</span>
6340
6358
  </div>
6341
6359
  `;
@@ -6346,7 +6364,7 @@ class X extends C {
6346
6364
  <div class="event-item"
6347
6365
  style="background-color: ${e}; color: ${s}; font-size: 10px; padding: 2px 4px; border-radius: 2px; cursor: pointer; margin-bottom: 2px;"
6348
6366
  data-event-id="${t.id}">
6349
- ${E.escapeHTML(t.title)}
6367
+ ${C.escapeHTML(t.title)}
6350
6368
  </div>
6351
6369
  `;
6352
6370
  }
@@ -6373,22 +6391,30 @@ class X extends C {
6373
6391
  this.unsubscribe && this.unsubscribe();
6374
6392
  }
6375
6393
  }
6376
- class tt extends C {
6377
- static get observedAttributes() {
6378
- return ["data-state-registry"];
6379
- }
6394
+ class tt extends T {
6380
6395
  constructor() {
6381
- super(), this._stateManager = null, this.viewData = null, this.hours = Array.from({ length: 24 }, (t, e) => e);
6396
+ super(), this._stateManager = null, this.viewData = null, this.hours = Array.from({ length: 24 }, (t, e) => e), this._registryCheckInterval = null;
6382
6397
  }
6383
6398
  connectedCallback() {
6384
- super.connectedCallback(), this._checkRegistry();
6399
+ super.connectedCallback(), this._startRegistryPolling();
6385
6400
  }
6386
- attributeChangedCallback(t, e, s) {
6387
- t === "data-state-registry" && s && this._checkRegistry();
6401
+ disconnectedCallback() {
6402
+ super.disconnectedCallback(), this._registryCheckInterval && clearInterval(this._registryCheckInterval);
6403
+ }
6404
+ _startRegistryPolling() {
6405
+ this._checkRegistry();
6406
+ let t = 0;
6407
+ this._registryCheckInterval = setInterval(() => {
6408
+ if (t++, this._stateManager || t > 50) {
6409
+ clearInterval(this._registryCheckInterval);
6410
+ return;
6411
+ }
6412
+ this._checkRegistry();
6413
+ }, 100);
6388
6414
  }
6389
6415
  _checkRegistry() {
6390
6416
  const t = this.getAttribute("data-state-registry");
6391
- t && window.__forceCalendarRegistry && window.__forceCalendarRegistry[t] && this.setStateManager(window.__forceCalendarRegistry[t]);
6417
+ t && window.__forceCalendarRegistry && window.__forceCalendarRegistry[t] && (clearInterval(this._registryCheckInterval), this.setStateManager(window.__forceCalendarRegistry[t]));
6392
6418
  }
6393
6419
  set stateManager(t) {
6394
6420
  this.setStateManager(t);
@@ -6657,7 +6683,7 @@ class tt extends C {
6657
6683
  <div class="event-container"
6658
6684
  style="top: ${n}px; height: ${r}px; background-color: ${o}; color: ${c};"
6659
6685
  data-event-id="${t.id}">
6660
- <span class="event-title">${E.escapeHTML(t.title)}</span>
6686
+ <span class="event-title">${C.escapeHTML(t.title)}</span>
6661
6687
  <span class="event-time">${v.formatTime(e)} - ${v.formatTime(s)}</span>
6662
6688
  </div>
6663
6689
  `;
@@ -6668,7 +6694,7 @@ class tt extends C {
6668
6694
  <div class="event-item"
6669
6695
  style="background-color: ${e}; color: ${s}; font-size: 12px; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-weight: 500; margin-bottom: 2px;"
6670
6696
  data-event-id="${t.id}">
6671
- ${E.escapeHTML(t.title)}
6697
+ ${C.escapeHTML(t.title)}
6672
6698
  </div>
6673
6699
  `;
6674
6700
  }
@@ -6695,7 +6721,7 @@ class tt extends C {
6695
6721
  this.unsubscribe && this.unsubscribe();
6696
6722
  }
6697
6723
  }
6698
- class et extends C {
6724
+ class et extends T {
6699
6725
  constructor() {
6700
6726
  super(), this._isVisible = !1, this._cleanupFocusTrap = null, this.config = {
6701
6727
  title: "New Event",
@@ -6969,7 +6995,7 @@ class et extends C {
6969
6995
  });
6970
6996
  }
6971
6997
  open(t = /* @__PURE__ */ new Date()) {
6972
- this.hasAttribute("open") || this.setAttribute("open", ""), this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this._formData.start = t, this._formData.end = new Date(t.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));
6998
+ this.hasAttribute("open") || this.setAttribute("open", ""), this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this._formData.start = t, this._formData.end = new Date(t.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));
6973
6999
  }
6974
7000
  close() {
6975
7001
  this.removeAttribute("open"), this._cleanupFocusTrap && (this._cleanupFocusTrap(), this._cleanupFocusTrap = null);
@@ -7002,7 +7028,7 @@ customElements.get("forcecal-event-form") || customElements.define("forcecal-eve
7002
7028
  customElements.get("forcecal-month") || customElements.define("forcecal-month", J);
7003
7029
  customElements.get("forcecal-week") || customElements.define("forcecal-week", X);
7004
7030
  customElements.get("forcecal-day") || customElements.define("forcecal-day", tt);
7005
- class st extends C {
7031
+ class st extends T {
7006
7032
  static get observedAttributes() {
7007
7033
  return ["view", "date", "locale", "timezone", "week-starts-on", "height"];
7008
7034
  }
@@ -7465,8 +7491,8 @@ class st extends C {
7465
7491
  customElements.get("forcecal-main") || customElements.define("forcecal-main", st);
7466
7492
  typeof window < "u" && typeof customElements < "u" && console.log("Force Calendar Interface loading...");
7467
7493
  export {
7468
- C as BaseComponent,
7469
- E as DOMUtils,
7494
+ T as BaseComponent,
7495
+ C as DOMUtils,
7470
7496
  v as DateUtils,
7471
7497
  tt as DayView,
7472
7498
  G as EventBus,