@forcecalendar/interface 1.0.16 → 1.0.17

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,6 +1,6 @@
1
1
  var V = Object.defineProperty;
2
2
  var P = (p, e, t) => e in p ? V(p, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[e] = t;
3
- var _ = (p, e, t) => P(p, typeof e != "symbol" ? e + "" : e, t);
3
+ var I = (p, e, t) => P(p, typeof e != "symbol" ? e + "" : e, t);
4
4
  class $ 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;
@@ -1048,14 +1048,14 @@ class M {
1048
1048
  visibility: b = "public",
1049
1049
  organizer: T = null,
1050
1050
  attendees: A = [],
1051
- reminders: I = [],
1051
+ reminders: _ = [],
1052
1052
  category: L,
1053
1053
  // Support singular category (no default)
1054
1054
  categories: F,
1055
1055
  // Support plural categories (no default)
1056
1056
  attachments: O = [],
1057
- conferenceData: R = null,
1058
- metadata: H = {},
1057
+ conferenceData: H = null,
1058
+ metadata: R = {},
1059
1059
  ...B
1060
1060
  // Capture any extra properties
1061
1061
  }) {
@@ -1079,14 +1079,14 @@ class M {
1079
1079
  visibility: b,
1080
1080
  organizer: T,
1081
1081
  attendees: A,
1082
- reminders: I,
1082
+ reminders: _,
1083
1083
  category: L,
1084
1084
  // Pass category to normalize
1085
1085
  categories: F,
1086
1086
  // Pass categories to normalize
1087
1087
  attachments: O,
1088
- conferenceData: R,
1089
- metadata: H,
1088
+ conferenceData: H,
1089
+ metadata: R,
1090
1090
  ...B
1091
1091
  // Pass any extra properties
1092
1092
  });
@@ -2228,8 +2228,8 @@ class N {
2228
2228
  if (d >= t) {
2229
2229
  const b = new Date(d), T = new Date(d.getTime() + o), A = l.getTimezoneOffset(b, c);
2230
2230
  if (A !== g) {
2231
- const I = g - A;
2232
- b.setMinutes(b.getMinutes() + I), T.setMinutes(T.getMinutes() + I);
2231
+ const _ = g - A;
2232
+ b.setMinutes(b.getMinutes() + _), T.setMinutes(T.getMinutes() + _);
2233
2233
  }
2234
2234
  g = A, this.isException(b, n, e.id) || a.push({
2235
2235
  start: b,
@@ -4959,10 +4959,39 @@ class Q {
4959
4959
  * Unsubscribe from an event
4960
4960
  */
4961
4961
  off(e, t) {
4962
+ if (e.includes("*")) {
4963
+ for (const r of this.wildcardHandlers)
4964
+ if (r.pattern === e && r.handler === t) {
4965
+ this.wildcardHandlers.delete(r);
4966
+ return;
4967
+ }
4968
+ return;
4969
+ }
4962
4970
  if (!this.events.has(e)) return;
4963
4971
  const s = this.events.get(e), i = s.findIndex((r) => r.handler === t);
4964
4972
  i > -1 && s.splice(i, 1), s.length === 0 && this.events.delete(e);
4965
4973
  }
4974
+ /**
4975
+ * Remove all wildcard handlers matching a pattern
4976
+ * @param {string} pattern - Pattern to match (e.g., 'event:*')
4977
+ */
4978
+ offWildcard(e) {
4979
+ for (const t of [...this.wildcardHandlers])
4980
+ t.pattern === e && this.wildcardHandlers.delete(t);
4981
+ }
4982
+ /**
4983
+ * Remove all handlers (regular and wildcard) for a specific handler function
4984
+ * Useful for cleanup when a component is destroyed
4985
+ * @param {Function} handler - Handler function to remove
4986
+ */
4987
+ offAll(e) {
4988
+ for (const [t, s] of this.events) {
4989
+ const i = s.findIndex((r) => r.handler === e);
4990
+ i > -1 && s.splice(i, 1), s.length === 0 && this.events.delete(t);
4991
+ }
4992
+ for (const t of [...this.wildcardHandlers])
4993
+ t.handler === e && this.wildcardHandlers.delete(t);
4994
+ }
4966
4995
  /**
4967
4996
  * Emit an event
4968
4997
  * @param {string} eventName - Event name
@@ -5022,6 +5051,21 @@ class Q {
5022
5051
  getHandlerCount(e) {
5023
5052
  return this.events.has(e) ? this.events.get(e).length : 0;
5024
5053
  }
5054
+ /**
5055
+ * Get wildcard handler count
5056
+ */
5057
+ getWildcardHandlerCount() {
5058
+ return this.wildcardHandlers.size;
5059
+ }
5060
+ /**
5061
+ * Get total handler count (for debugging/monitoring)
5062
+ */
5063
+ getTotalHandlerCount() {
5064
+ let e = this.wildcardHandlers.size;
5065
+ for (const t of this.events.values())
5066
+ e += t.length;
5067
+ return e;
5068
+ }
5025
5069
  }
5026
5070
  const y = new Q();
5027
5071
  class J {
@@ -5068,11 +5112,26 @@ class J {
5068
5112
  const { silent: s = !1 } = t, i = { ...this.state };
5069
5113
  return this.state = { ...this.state, ...e }, s || (this.notifySubscribers(i, this.state), this.emitStateChange(i, this.state)), this.state;
5070
5114
  }
5071
- subscribe(e) {
5072
- return this.subscribers.add(e), () => this.unsubscribe(e);
5115
+ subscribe(e, t = null) {
5116
+ return this.subscribers.add(e), t && (this._subscriberIds || (this._subscriberIds = /* @__PURE__ */ new Map()), this._subscriberIds.set(t, e)), () => this.unsubscribe(e, t);
5073
5117
  }
5074
- unsubscribe(e) {
5075
- this.subscribers.delete(e);
5118
+ unsubscribe(e, t = null) {
5119
+ this.subscribers.delete(e), t && this._subscriberIds && this._subscriberIds.delete(t);
5120
+ }
5121
+ /**
5122
+ * Unsubscribe by subscriber ID
5123
+ * @param {string} subscriberId - ID used when subscribing
5124
+ */
5125
+ unsubscribeById(e) {
5126
+ if (!this._subscriberIds) return !1;
5127
+ const t = this._subscriberIds.get(e);
5128
+ return t ? (this.subscribers.delete(t), this._subscriberIds.delete(e), !0) : !1;
5129
+ }
5130
+ /**
5131
+ * Get subscriber count (for debugging/monitoring)
5132
+ */
5133
+ getSubscriberCount() {
5134
+ return this.subscribers.size;
5076
5135
  }
5077
5136
  notifySubscribers(e, t) {
5078
5137
  this.subscribers.forEach((s) => {
@@ -5227,7 +5286,7 @@ class J {
5227
5286
  }
5228
5287
  // Destroy
5229
5288
  destroy() {
5230
- this.subscribers.clear(), this.state = null, this.calendar = null;
5289
+ this.subscribers.clear(), this._subscriberIds && (this._subscriberIds.clear(), this._subscriberIds = null), this.state = null, this.calendar = null;
5231
5290
  }
5232
5291
  }
5233
5292
  class x extends u {
@@ -5876,7 +5935,7 @@ class v {
5876
5935
  /**
5877
5936
  * Default theme colors
5878
5937
  */
5879
- _(v, "colors", {
5938
+ I(v, "colors", {
5880
5939
  primary: "#3B82F6",
5881
5940
  // Modern Blue
5882
5941
  secondary: "#64748B",
@@ -5909,7 +5968,7 @@ _(v, "colors", {
5909
5968
  }), /**
5910
5969
  * Common CSS variables
5911
5970
  */
5912
- _(v, "cssVariables", {
5971
+ I(v, "cssVariables", {
5913
5972
  // "Pro" Palette - Functional & Sharp
5914
5973
  "--fc-primary-color": "#2563EB",
5915
5974
  // International Blue (Focus)
@@ -5977,7 +6036,7 @@ _(v, "cssVariables", {
5977
6036
  }), /**
5978
6037
  * Get responsive breakpoints
5979
6038
  */
5980
- _(v, "breakpoints", {
6039
+ I(v, "breakpoints", {
5981
6040
  xs: "320px",
5982
6041
  sm: "576px",
5983
6042
  md: "768px",
@@ -7366,9 +7425,9 @@ class se extends $ {
7366
7425
  });
7367
7426
  }), this.addListener(this, "click", (e) => {
7368
7427
  e.target === this && this.close();
7369
- }), this._handleKeyDown && window.removeEventListener("keydown", this._handleKeyDown), this._handleKeyDown = (e) => {
7428
+ }), this._keydownListenerAdded || (this._handleKeyDown = (e) => {
7370
7429
  e.key === "Escape" && this.hasAttribute("open") && this.close();
7371
- }, window.addEventListener("keydown", this._handleKeyDown);
7430
+ }, window.addEventListener("keydown", this._handleKeyDown), this._keydownListenerAdded = !0);
7372
7431
  }
7373
7432
  updateColorSelection() {
7374
7433
  this.colorContainer.querySelectorAll(".color-btn").forEach((t) => {
@@ -7403,7 +7462,7 @@ class se extends $ {
7403
7462
  return `${s}-${i}-${r}T${n}:${a}`;
7404
7463
  }
7405
7464
  unmount() {
7406
- this._cleanupFocusTrap && this._cleanupFocusTrap(), window.removeEventListener("keydown", this._handleKeyDown);
7465
+ this._cleanupFocusTrap && this._cleanupFocusTrap(), this._handleKeyDown && (window.removeEventListener("keydown", this._handleKeyDown), this._handleKeyDown = null, this._keydownListenerAdded = !1);
7407
7466
  }
7408
7467
  }
7409
7468
  customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form", se);