@forcecalendar/interface 1.0.54 → 1.0.56

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
- var F = Object.defineProperty;
2
- var H = (h, t, e) => t in h ? F(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
3
- var v = (h, t, e) => H(h, typeof t != "symbol" ? t + "" : t, e);
4
- import { Calendar as I, DateUtils as L } from "@forcecalendar/core";
1
+ var H = Object.defineProperty;
2
+ var F = (h, t, e) => t in h ? H(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
3
+ var v = (h, t, e) => F(h, typeof t != "symbol" ? t + "" : t, e);
4
+ import { Calendar as L, DateUtils as I } from "@forcecalendar/core";
5
5
  class M extends HTMLElement {
6
6
  constructor() {
7
7
  super(), this.attachShadow({ mode: "open" }), this._listeners = [], this._state = null, this._props = /* @__PURE__ */ new Map(), this._initialized = !1;
@@ -252,7 +252,7 @@ class T {
252
252
  const U = new T();
253
253
  class V {
254
254
  constructor(t = {}) {
255
- this.eventBus = new T(), this.calendar = new I({
255
+ this.eventBus = new T(), this.calendar = new L({
256
256
  view: t.view || "month",
257
257
  date: t.date || /* @__PURE__ */ new Date(),
258
258
  weekStartsOn: t.weekStartsOn ?? 0,
@@ -486,7 +486,7 @@ class V {
486
486
  this.subscribers.clear(), this._subscriberIds && (this._subscriberIds.clear(), this._subscriberIds = null), this.eventBus && (this.eventBus.clear(), this.eventBus = null), this.state = null, this.calendar = null;
487
487
  }
488
488
  }
489
- class u extends L {
489
+ class u extends I {
490
490
  /**
491
491
  * Format date for display
492
492
  */
@@ -607,7 +607,7 @@ class u extends L {
607
607
  return s && (s.toLowerCase() === "pm" && n < 12 ? o = n + 12 : s.toLowerCase() === "am" && n === 12 && (o = 0)), r.setHours(o, a || 0, 0, 0), r;
608
608
  }
609
609
  }
610
- class k {
610
+ class y {
611
611
  /**
612
612
  * Create element with attributes and children
613
613
  */
@@ -1284,7 +1284,7 @@ class E {
1284
1284
  * @returns {string}
1285
1285
  */
1286
1286
  escapeHTML(t) {
1287
- return t == null ? "" : k.escapeHTML(String(t));
1287
+ return t == null ? "" : y.escapeHTML(String(t));
1288
1288
  }
1289
1289
  /**
1290
1290
  * Check if a date is today
@@ -1400,16 +1400,16 @@ class E {
1400
1400
  */
1401
1401
  renderTimedEvent(t, e = {}) {
1402
1402
  const { compact: r = !0, overlapLayout: i = null } = e, s = new Date(t.start), n = new Date(t.end), a = s.getHours() * 60 + s.getMinutes(), o = Math.max((n - s) / (1e3 * 60), r ? 20 : 30), c = this.getEventColor(t), l = this.getContrastingTextColor(c), d = r ? "4px 8px" : "8px 12px", p = r ? "11px" : "13px", g = r ? 2 : 12, b = r ? 2 : 24, S = r ? "4px" : "6px";
1403
- let y, x;
1403
+ let x, w;
1404
1404
  if (i && i.has(t.id)) {
1405
1405
  const { column: C, totalColumns: _ } = i.get(t.id), $ = `(100% - ${g + b}px)`;
1406
- y = `calc(${g}px + ${C} * ${$} / ${_})`, x = `calc(${$} / ${_})`;
1406
+ x = `calc(${g}px + ${C} * ${$} / ${_})`, w = `calc(${$} / ${_})`;
1407
1407
  } else
1408
- y = `${g}px`, x = `calc(100% - ${g + b}px)`;
1408
+ x = `${g}px`, w = `calc(100% - ${g + b}px)`;
1409
1409
  return `
1410
1410
  <div class="fc-event fc-timed-event" data-event-id="${this.escapeHTML(t.id)}"
1411
1411
  style="position: absolute; top: ${a}px; height: ${o}px;
1412
- left: ${y}; width: ${x};
1412
+ left: ${x}; width: ${w};
1413
1413
  background-color: ${c}; border-radius: ${S};
1414
1414
  padding: ${d}; font-size: ${p};
1415
1415
  font-weight: 500; color: ${l}; overflow: hidden;
@@ -1445,7 +1445,7 @@ class E {
1445
1445
  });
1446
1446
  }
1447
1447
  }
1448
- class w extends E {
1448
+ class D extends E {
1449
1449
  constructor(t, e) {
1450
1450
  super(t, e), this.maxEventsToShow = 3;
1451
1451
  }
@@ -1465,7 +1465,7 @@ class w extends E {
1465
1465
  let s = `
1466
1466
  <div class="fc-month-view" style="display: flex; flex-direction: column; height: 100%; min-height: 400px; background: var(--fc-background); border: 1px solid var(--fc-border-color);">
1467
1467
  <div class="fc-month-header" style="display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--fc-border-color); background: var(--fc-background-alt);">
1468
- ${this._getDayNames(r).map((n) => `<div class="fc-month-header-cell" style="padding: 12px 8px; text-align: center; font-size: 11px; font-weight: 600; color: var(--fc-text-light); text-transform: uppercase;">${n}</div>`).join("")}
1468
+ ${this._getDayNames(r).map((n) => `<div class="fc-month-header-cell" style="padding: 12px 8px; text-align: center; font-size: 11px; font-weight: 600; color: var(--fc-text-light); text-transform: uppercase;">${this.escapeHTML(n)}</div>`).join("")}
1469
1469
  </div>
1470
1470
  <div class="fc-month-body" style="display: flex; flex-direction: column; flex: 1;">
1471
1471
  `;
@@ -1490,10 +1490,10 @@ class w extends E {
1490
1490
  _renderDay(t) {
1491
1491
  const e = !t.isCurrentMonth, r = t.isToday, i = e ? "var(--fc-background-hover)" : "var(--fc-background)", s = e ? "var(--fc-text-light)" : "var(--fc-text-color)", n = r ? "background: var(--fc-primary-color); color: white; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;" : "", a = t.events || [], o = a.slice(0, this.maxEventsToShow), c = a.length - this.maxEventsToShow;
1492
1492
  return `
1493
- <div class="fc-month-day" data-date="${t.date}"
1493
+ <div class="fc-month-day" data-date="${this.escapeHTML(t.date)}"
1494
1494
  style="background: ${i}; border-right: 1px solid var(--fc-border-color); border-bottom: 1px solid var(--fc-border-color); padding: 4px; min-height: 80px; cursor: pointer; display: flex; flex-direction: column;">
1495
1495
  <div class="fc-day-number" style="font-size: 13px; font-weight: 500; color: ${s}; padding: 2px 4px; margin-bottom: 4px; ${n}">
1496
- ${t.dayOfMonth}
1496
+ ${this.escapeHTML(String(t.dayOfMonth))}
1497
1497
  </div>
1498
1498
  <div class="fc-day-events" style="display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: hidden;">
1499
1499
  ${o.map((l) => this._renderEvent(l)).join("")}
@@ -1564,10 +1564,10 @@ class z extends E {
1564
1564
  (e) => `
1565
1565
  <div style="padding: 12px 8px; text-align: center; border-right: 1px solid var(--fc-border-color);">
1566
1566
  <div style="font-size: 10px; font-weight: 700; color: var(--fc-text-light); text-transform: uppercase; letter-spacing: 0.1em;">
1567
- ${e.dayName}
1567
+ ${this.escapeHTML(e.dayName)}
1568
1568
  </div>
1569
1569
  <div style="font-size: 16px; font-weight: 500; margin-top: 4px; ${e.isToday ? "background: var(--fc-danger-color); color: white; border-radius: 50%; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;" : "color: var(--fc-text-color);"}">
1570
- ${e.dayOfMonth}
1570
+ ${this.escapeHTML(String(e.dayOfMonth))}
1571
1571
  </div>
1572
1572
  </div>
1573
1573
  `
@@ -1716,10 +1716,10 @@ class B extends E {
1716
1716
  <div style="border-right: 1px solid var(--fc-border-color);"></div>
1717
1717
  <div style="padding: 16px 24px;">
1718
1718
  <div style="font-size: 12px; font-weight: 700; color: var(--fc-text-light); text-transform: uppercase; letter-spacing: 0.1em;">
1719
- ${e}
1719
+ ${this.escapeHTML(e)}
1720
1720
  </div>
1721
1721
  <div style="font-size: 24px; font-weight: 600; margin-top: 4px; ${r ? "color: var(--fc-danger-color);" : "color: var(--fc-text-color);"}">
1722
- ${t.getDate()}
1722
+ ${this.escapeHTML(String(t.getDate()))}
1723
1723
  </div>
1724
1724
  </div>
1725
1725
  </div>
@@ -2081,7 +2081,7 @@ class A extends M {
2081
2081
  });
2082
2082
  }
2083
2083
  open(t = /* @__PURE__ */ new Date()) {
2084
- 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 && this._cleanupFocusTrap(), this._cleanupFocusTrap = k.trapFocus(this.modalContent));
2084
+ 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 && this._cleanupFocusTrap(), this._cleanupFocusTrap = y.trapFocus(this.modalContent));
2085
2085
  }
2086
2086
  close() {
2087
2087
  this.removeAttribute("open"), this._cleanupFocusTrap && (this._cleanupFocusTrap(), this._cleanupFocusTrap = null);
@@ -2216,7 +2216,7 @@ const m = class m extends M {
2216
2216
  if (t) {
2217
2217
  this._currentViewInstance && this._currentViewInstance.cleanup && this._currentViewInstance.cleanup();
2218
2218
  try {
2219
- const e = m.RENDERERS[this.currentView] || w, r = new e(t, this.stateManager);
2219
+ const e = m.RENDERERS[this.currentView] || D, r = new e(t, this.stateManager);
2220
2220
  r._viewType = this.currentView, this._currentViewInstance = r, r.render();
2221
2221
  } catch (e) {
2222
2222
  console.error("[ForceCalendar] Error switching view:", e);
@@ -2637,7 +2637,7 @@ const m = class m extends M {
2637
2637
  return `
2638
2638
  <div class="force-calendar">
2639
2639
  <div class="fc-error">
2640
- <p><strong>Error:</strong> ${k.escapeHTML(s.message || "An error occurred")}</p>
2640
+ <p><strong>Error:</strong> ${y.escapeHTML(s.message || "An error occurred")}</p>
2641
2641
  </div>
2642
2642
  </div>
2643
2643
  `;
@@ -2655,7 +2655,7 @@ const m = class m extends M {
2655
2655
  <button class="fc-nav-arrow" data-action="previous" title="Previous">
2656
2656
  ${this.getIcon("chevron-left")}
2657
2657
  </button>
2658
- <h2 class="fc-title">${n}</h2>
2658
+ <h2 class="fc-title">${y.escapeHTML(n)}</h2>
2659
2659
  <button class="fc-nav-arrow" data-action="next" title="Next">
2660
2660
  ${this.getIcon("chevron-right")}
2661
2661
  </button>
@@ -2700,7 +2700,7 @@ const m = class m extends M {
2700
2700
  return;
2701
2701
  this._currentViewInstance && (this._currentViewInstance.cleanup && this._currentViewInstance.cleanup(), this._viewUnsubscribe && (this._viewUnsubscribe(), this._viewUnsubscribe = null));
2702
2702
  try {
2703
- const i = m.RENDERERS[this.currentView] || w, s = new i(t, this.stateManager);
2703
+ const i = m.RENDERERS[this.currentView] || D, s = new i(t, this.stateManager);
2704
2704
  s._viewType = this.currentView, this._currentViewInstance = s, s.render();
2705
2705
  } catch (i) {
2706
2706
  console.error("[ForceCalendar] Error creating/rendering view:", i);
@@ -2811,21 +2811,21 @@ const m = class m extends M {
2811
2811
  }
2812
2812
  };
2813
2813
  v(m, "RENDERERS", {
2814
- month: w,
2814
+ month: D,
2815
2815
  week: z,
2816
2816
  day: B
2817
2817
  });
2818
- let D = m;
2819
- customElements.get("forcecal-main") || customElements.define("forcecal-main", D);
2818
+ let k = m;
2819
+ customElements.get("forcecal-main") || customElements.define("forcecal-main", k);
2820
2820
  export {
2821
2821
  M as BaseComponent,
2822
2822
  E as BaseViewRenderer,
2823
- k as DOMUtils,
2823
+ y as DOMUtils,
2824
2824
  u as DateUtils,
2825
2825
  B as DayViewRenderer,
2826
2826
  T as EventBus,
2827
- D as ForceCalendar,
2828
- w as MonthViewRenderer,
2827
+ k as ForceCalendar,
2828
+ D as MonthViewRenderer,
2829
2829
  V as StateManager,
2830
2830
  f as StyleUtils,
2831
2831
  z as WeekViewRenderer,