panelset 1.0.0 → 1.0.4

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,55 @@
1
+ # Changelog
2
+
3
+ ## [1.0.4] - 2026-02-18
4
+
5
+ ### Added
6
+ - Added automatic `aria-selected` management for tab interfaces
7
+ - Automatically sets `aria-selected="true"` on active tabs with `role="tab"`
8
+ - Automatically sets `aria-selected="false"` on all other tabs in the same tablist
9
+ - Syncs on both `show()` calls and during initialization
10
+ - No configuration needed - activates automatically when `role="tab"` is detected
11
+
12
+
13
+ ## [1.0.3] - 2026-02-16
14
+
15
+ ### Changed
16
+ - Changed API to make it more flexible.
17
+
18
+
19
+ ## [1.0.1] - 2026-02-16
20
+
21
+ ### Changed
22
+ - Changed API to include event.
23
+
24
+
25
+ ## [1.0.0] - 2026-02-13
26
+
27
+ ### Changed
28
+ - Stable version 1. Docs will still follow.
29
+
30
+ ### Added
31
+ - Added autofocus
32
+
33
+
34
+ ## [0.5.4] - 2026-02-11
35
+
36
+ ### Changed
37
+ - Added warning if no panels found
38
+
39
+
40
+ ## [0.5.3] - 2026-02-08
41
+
42
+ ### Added
43
+ - Added height tracking
44
+
45
+
46
+ ## [0.5.2] - 2026-01-06
47
+
48
+ ### Changed
49
+ - Added default export
50
+ - Added warning if selector does not have the data-tabs attribute
51
+ - Wrote more docs (will follow)
52
+
53
+
54
+ ## [0.5.0] - 2026-01-04
55
+ - First commit
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export declare interface ActivationAbortedEventDetail {
2
2
  panelId: string;
3
- trigger: string | null;
3
+ trigger: HTMLElement | null;
4
4
  }
5
5
 
6
6
  export declare interface ActivationEventDetail {
7
7
  panelId: string;
8
- trigger: string | null;
8
+ trigger: HTMLElement | null;
9
9
  }
10
10
 
11
11
  export declare type AsyncContentHandler = (targetPanel: HTMLElement, signal: AbortSignal) => Promise<void> | void;
@@ -54,6 +54,7 @@ declare class PanelSet {
54
54
  private _cleanupPanels;
55
55
  private _waitForTransition;
56
56
  private _handleAutoFocus;
57
+ private _syncAriaWithActivePanel;
57
58
  private _animateOpenClose;
58
59
  /**
59
60
  * Get the ID of the currently active panel
@@ -62,19 +63,19 @@ declare class PanelSet {
62
63
  getActive(): string | null;
63
64
  /**
64
65
  * Open a closable panelset
65
- * @param withTransition - Whether to animate
66
+ * @param options - Configuration options
66
67
  */
67
- open(withTransition?: boolean): void;
68
+ open(options?: ShowOptions): void;
68
69
  /**
69
70
  * Close a closable panelset
70
- * @param withTransition - Whether to animate
71
+ * @param options - Configuration options
71
72
  */
72
- close(withTransition?: boolean): void;
73
+ close(options?: ShowOptions): void;
73
74
  /**
74
75
  * Toggle a closable panelset between open and closed
75
- * @param withTransition - Whether to animate
76
+ * @param options - Configuration options
76
77
  */
77
- toggle(withTransition?: boolean): void;
78
+ toggle(options?: ShowOptions): void;
78
79
  /**
79
80
  * Register a handler for async content loading
80
81
  * @param handler - Async content handler function
@@ -84,10 +85,9 @@ declare class PanelSet {
84
85
  /**
85
86
  * Show a panel by ID
86
87
  * @param panelId - ID of the panel to show
87
- * @param withTransition - Whether to animate the transition
88
- * @param options - Additional options (trigger name)
88
+ * @param options - Configuration options for this activation
89
89
  */
90
- show(panelId: string, withTransition?: boolean, options?: ShowOptions): Promise<void>;
90
+ show(panelId: string, options?: ShowOptions): Promise<void>;
91
91
  }
92
92
  export { PanelSet }
93
93
  export default PanelSet;
@@ -111,7 +111,8 @@ export declare interface ReadyEventDetail {
111
111
  }
112
112
 
113
113
  export declare interface ShowOptions {
114
- trigger?: string;
114
+ event?: Event;
115
+ transition?: boolean;
115
116
  autoFocus?: boolean | 'heading' | 'first' | ((panel: HTMLElement) => void);
116
117
  }
117
118
 
package/dist/panelset.js CHANGED
@@ -1,36 +1,36 @@
1
1
  const d = class d {
2
- constructor(e, s = {}) {
2
+ constructor(t, i = {}) {
3
3
  this._openCloseGeneration = 0, this._isLoadingAsync = !1;
4
- let t;
5
- if (typeof e == "string") {
6
- if (t = document.querySelector(e), !t)
7
- throw new Error(`PanelSet: No element found for selector "${e}"`);
4
+ let e;
5
+ if (typeof t == "string") {
6
+ if (e = document.querySelector(t), !e)
7
+ throw new Error(`PanelSet: No element found for selector "${t}"`);
8
8
  } else
9
- t = e;
10
- if (this.element = t, d._validateElement(t), t.panelSet || t.dataset.panelset === "true")
11
- return console.warn("PanelSet: Element already initialized, returning existing instance"), t.panelSet;
12
- t.panelSet = this;
13
- const i = d._getDataConfig(t);
9
+ e = t;
10
+ if (this.element = e, d._validateElement(e), e.panelSet || e.dataset.panelset === "true")
11
+ return console.warn("PanelSet: Element already initialized, returning existing instance"), e.panelSet;
12
+ e.panelSet = this;
13
+ const n = d._getDataConfig(e);
14
14
  if (this.config = d._mergeConfig(
15
15
  d.defaults,
16
- i,
17
- s
18
- ), this.panels = Array.from(t.querySelectorAll('[role="tabpanel"]')), this.panels.length === 0) {
19
- const a = `<${t.tagName.toLowerCase()}${t.id ? ` id="${t.id}"` : ""}${t.className ? ` class="${t.className}"` : ""}>`;
16
+ n,
17
+ i
18
+ ), this.panels = Array.from(e.querySelectorAll('[role="tabpanel"]')), this.panels.length === 0) {
19
+ const a = `<${e.tagName.toLowerCase()}${e.id ? ` id="${e.id}"` : ""}${e.className ? ` class="${e.className}"` : ""}>`;
20
20
  console.error(`PanelSet: No panels with [role="tabpanel"] found inside ${a}. Make sure panel elements are children of the [data-panelset] element.`), this.panels = [], this.activePanel = null, this.panelWrapper = null, this.pendingPanel = null;
21
21
  return;
22
22
  }
23
- this.activePanel = this.panels.find((a) => a.classList.contains("active")) || this.panels[0], this.panelWrapper = this.element.querySelector(".panel-wrapper") || this._autoWrapPanels(), this.pendingPanel = this.activePanel, this.element.dataset.panelset = "true", this._log(`Initialized (${this.panels.length} panels)`), this._dispatch("ps:ready", { container: this.element, instance: this }), this._internalInit();
24
- let n;
23
+ this.activePanel = this.panels.find((a) => a.classList.contains("active")) || this.panels[0], this.panelWrapper = this.element.querySelector(".panel-wrapper") || this._autoWrapPanels(), this.pendingPanel = this.activePanel, this.element.dataset.panelset = "true", this._log(`Initialized (${this.panels.length} panels)`), this._dispatch("ps:ready", { container: this.element, instance: this }), this._internalInit(), this._syncAriaWithActivePanel();
24
+ let o;
25
25
  window.addEventListener("resize", () => {
26
- clearTimeout(n), n = setTimeout(() => {
26
+ clearTimeout(o), o = setTimeout(() => {
27
27
  this._updateHighestPanel();
28
28
  }, 250);
29
29
  });
30
30
  }
31
31
  // Parse data attributes from element
32
- static _getDataConfig(e) {
33
- const s = e.dataset, t = {}, i = {
32
+ static _getDataConfig(t) {
33
+ const i = t.dataset, e = {}, n = {
34
34
  transitions: "json",
35
35
  closable: "boolean",
36
36
  emptyPanelHeight: "number",
@@ -38,34 +38,34 @@ const d = class d {
38
38
  // We do not support autofocus here. I do not think it is needed per whole PanelSet.
39
39
  debug: "boolean"
40
40
  };
41
- for (const [n, a] of Object.entries(i)) {
42
- if (!(n in s)) continue;
43
- const o = s[n];
44
- if (o !== void 0)
41
+ for (const [o, a] of Object.entries(n)) {
42
+ if (!(o in i)) continue;
43
+ const s = i[o];
44
+ if (s !== void 0)
45
45
  switch (a) {
46
46
  case "boolean":
47
- t[n] = o !== "false";
47
+ e[o] = s !== "false";
48
48
  break;
49
49
  case "number":
50
- t[n] = parseInt(o, 10);
50
+ e[o] = parseInt(s, 10);
51
51
  break;
52
52
  case "json":
53
53
  try {
54
- t[n] = JSON.parse(o);
54
+ e[o] = JSON.parse(s);
55
55
  } catch {
56
- t[n] = o !== "false";
56
+ e[o] = s !== "false";
57
57
  }
58
58
  break;
59
59
  }
60
60
  }
61
- return t;
61
+ return e;
62
62
  }
63
63
  // Merge configurations
64
- static _mergeConfig(e, s, t) {
64
+ static _mergeConfig(t, i, e) {
65
65
  return {
66
- ...e,
67
- ...s,
68
- ...t
66
+ ...t,
67
+ ...i,
68
+ ...e
69
69
  };
70
70
  }
71
71
  /**
@@ -74,131 +74,147 @@ const d = class d {
74
74
  * @param options - Additional config options (when first param is selector)
75
75
  * @returns Array of PanelSet instances
76
76
  */
77
- static init(e = {}, s = {}) {
78
- let t, i;
79
- typeof e == "string" ? (t = e, i = s) : (i = e, t = i.selector || "[data-panelset]");
80
- const n = document.querySelectorAll(t), a = [];
81
- return n.forEach((o) => {
77
+ static init(t = {}, i = {}) {
78
+ let e, n;
79
+ typeof t == "string" ? (e = t, n = i) : (n = t, e = n.selector || "[data-panelset]");
80
+ const o = document.querySelectorAll(e), a = [];
81
+ return o.forEach((s) => {
82
82
  try {
83
- d._validateElement(o);
83
+ d._validateElement(s);
84
84
  } catch (c) {
85
85
  console.error(c.message);
86
86
  return;
87
87
  }
88
- if (o.panelSet || o.dataset.panelset === "true") {
89
- o.panelSet && a.push(o.panelSet);
88
+ if (s.panelSet || s.dataset.panelset === "true") {
89
+ s.panelSet && a.push(s.panelSet);
90
90
  return;
91
91
  }
92
- const l = new d(o, i);
92
+ const l = new d(s, n);
93
93
  a.push(l);
94
94
  }), a;
95
95
  }
96
96
  // Debug logging helper
97
- _log(e) {
97
+ _log(t) {
98
98
  if (!this.config.debug) return;
99
- const s = this.element.id || "no id";
100
- console.log(`[PanelSet] - "${s}" -`, e);
99
+ const i = this.element.id || "no id";
100
+ console.log(`[PanelSet] - "${i}" -`, t);
101
101
  }
102
- static _validateElement(e) {
103
- if (!e.hasAttribute("data-panelset")) {
104
- const s = `<${e.tagName.toLowerCase()}${e.id ? ` id="${e.id}"` : ""}${e.className ? ` class="${e.className}"` : ""}>`;
105
- throw new Error(`PanelSet: Element is missing required data-panelset attribute. Element: ${s}`);
102
+ static _validateElement(t) {
103
+ if (!t.hasAttribute("data-panelset")) {
104
+ const i = `<${t.tagName.toLowerCase()}${t.id ? ` id="${t.id}"` : ""}${t.className ? ` class="${t.className}"` : ""}>`;
105
+ throw new Error(`PanelSet: Element is missing required data-panelset attribute. Element: ${i}`);
106
106
  }
107
107
  }
108
108
  _autoWrapPanels() {
109
- const e = document.createElement("div");
110
- return e.className = "panel-wrapper", this.panels.forEach((s) => e.appendChild(s)), this.element.appendChild(e), e;
109
+ const t = document.createElement("div");
110
+ return t.className = "panel-wrapper", this.panels.forEach((i) => t.appendChild(i)), this.element.appendChild(t), t;
111
111
  }
112
112
  _internalInit() {
113
- this.panels.forEach((e) => {
114
- e.classList.remove("fade", "incoming"), e !== this.activePanel ? (e.hidden = !0, e.classList.remove("active")) : (e.hidden = !1, e.classList.add("active"));
113
+ this.panels.forEach((t) => {
114
+ t.classList.remove("fade", "incoming"), t !== this.activePanel ? (t.hidden = !0, t.classList.remove("active")) : (t.hidden = !1, t.classList.add("active"));
115
115
  }), this.element.style.height = "", this._updateHighestPanel();
116
116
  }
117
117
  // Dispatch custom event helper
118
- _dispatch(e, s) {
118
+ _dispatch(t, i) {
119
119
  this.element.dispatchEvent(
120
- new CustomEvent(e, {
121
- detail: s,
120
+ new CustomEvent(t, {
121
+ detail: i,
122
122
  bubbles: !0,
123
123
  cancelable: !1
124
124
  })
125
125
  );
126
126
  }
127
127
  /* --- Modular helpers --- */
128
- _getVerticalMetrics(e) {
129
- if (!e) return 0;
130
- const s = getComputedStyle(e);
131
- return ["paddingTop", "paddingBottom", "borderTopWidth", "borderBottomWidth"].reduce((t, i) => t + (parseFloat(s[i]) || 0), 0);
128
+ _getVerticalMetrics(t) {
129
+ if (!t) return 0;
130
+ const i = getComputedStyle(t);
131
+ return ["paddingTop", "paddingBottom", "borderTopWidth", "borderBottomWidth"].reduce((e, n) => e + (parseFloat(i[n]) || 0), 0);
132
132
  }
133
- _measureHeight(e) {
134
- let s = e.offsetHeight;
135
- return s += this._getVerticalMetrics(this.panelWrapper), s += this._getVerticalMetrics(this.element), s;
133
+ _measureHeight(t) {
134
+ let i = t.offsetHeight;
135
+ return i += this._getVerticalMetrics(this.panelWrapper), i += this._getVerticalMetrics(this.element), i;
136
136
  }
137
137
  _updateHighestPanel() {
138
138
  if (this.element.hasAttribute("data-ps-track-height")) {
139
139
  console.warn("PanelSet: data-ps-track-height should be placed on a parent element, not on [data-panelset] itself. Height tracking skipped.");
140
140
  return;
141
141
  }
142
- const e = this.element.closest("[data-ps-track-height]");
143
- if (!e) return;
144
- let s = 0;
145
- this.panels.forEach((t) => {
146
- const i = t.hidden, n = t.classList.contains("active");
147
- this.panels.forEach((o) => {
148
- o.hidden = !0, o.classList.remove("active");
149
- }), t.hidden = !1, t.classList.add("active"), t.style.visibility = "hidden", this.element.offsetHeight;
142
+ const t = this.element.closest("[data-ps-track-height]");
143
+ if (!t) return;
144
+ let i = 0;
145
+ this.panels.forEach((e) => {
146
+ const n = e.hidden, o = e.classList.contains("active");
147
+ this.panels.forEach((s) => {
148
+ s.hidden = !0, s.classList.remove("active");
149
+ }), e.hidden = !1, e.classList.add("active"), e.style.visibility = "hidden", this.element.offsetHeight;
150
150
  const a = this.element.offsetHeight;
151
- a > s && (s = a), t.hidden = i, n || t.classList.remove("active"), t.style.visibility = "";
152
- }), this.activePanel && (this.activePanel.hidden = !1, this.activePanel.classList.add("active")), this.panels.forEach((t) => {
153
- t !== this.activePanel && (t.hidden = !0, t.classList.remove("active"));
154
- }), e.style.setProperty("--ps-max-height", `${s}px`), this._log(`Max container height: ${s}px (set on tracking parent)`);
151
+ a > i && (i = a), e.hidden = n, o || e.classList.remove("active"), e.style.visibility = "";
152
+ }), this.activePanel && (this.activePanel.hidden = !1, this.activePanel.classList.add("active")), this.panels.forEach((e) => {
153
+ e !== this.activePanel && (e.hidden = !0, e.classList.remove("active"));
154
+ }), t.style.setProperty("--ps-max-height", `${i}px`), this._log(`Max container height: ${i}px (set on tracking parent)`);
155
155
  }
156
- _cleanupPanels(e) {
157
- this.panels.forEach((s) => {
158
- s.classList.remove("fade", "incoming"), s !== e ? (s.classList.remove("active"), s.hidden = !0) : (s.classList.add("active"), s.hidden = !1);
159
- }), this.element.style.height = "", this.element.classList.remove("is-transitioning"), this.activePanel = e;
156
+ _cleanupPanels(t) {
157
+ this.panels.forEach((i) => {
158
+ i.classList.remove("fade", "incoming"), i !== t ? (i.classList.remove("active"), i.hidden = !0) : (i.classList.add("active"), i.hidden = !1);
159
+ }), this.element.style.height = "", this.element.classList.remove("is-transitioning"), this.activePanel = t;
160
160
  }
161
- _waitForTransition(e) {
162
- return new Promise((s) => {
163
- const t = getComputedStyle(e), i = parseFloat(t.transitionDuration) || 0, n = parseFloat(t.transitionDelay) || 0;
164
- if (i + n === 0) {
165
- s();
161
+ _waitForTransition(t) {
162
+ return new Promise((i) => {
163
+ const e = getComputedStyle(t), n = parseFloat(e.transitionDuration) || 0, o = parseFloat(e.transitionDelay) || 0;
164
+ if (n + o === 0) {
165
+ i();
166
166
  return;
167
167
  }
168
- const a = (o) => {
169
- o.target === e && (e.removeEventListener("transitionend", a), s());
168
+ const a = (s) => {
169
+ s.target === t && (t.removeEventListener("transitionend", a), i());
170
170
  };
171
- e.addEventListener("transitionend", a);
171
+ t.addEventListener("transitionend", a);
172
172
  });
173
173
  }
174
- _handleAutoFocus(e, s) {
175
- if (s === !0)
176
- e.hasAttribute("tabindex") || e.setAttribute("tabindex", "-1"), e.focus(), this._log(`Auto-focused panel: ${e.id}`);
177
- else if (s === "heading") {
178
- const t = e.querySelector("h1, h2, h3, h4, h5, h6");
179
- t && (t.hasAttribute("tabindex") || t.setAttribute("tabindex", "-1"), t.focus(), this._log(`Auto-focused heading in: ${e.id}`));
180
- } else if (s === "first") {
181
- const t = e.querySelector('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])');
182
- t && (t.focus(), this._log(`Auto-focused first element in: ${e.id}`));
183
- } else typeof s == "function" && (s(e), this._log(`Auto-focused (custom) in: ${e.id}`));
174
+ _handleAutoFocus(t, i, e) {
175
+ if (this._log(`AutoFocus called with event: ${e ? e.type : "none"}`), i && e && !(e.type.startsWith("key") || e instanceof MouseEvent && e.detail === 0)) {
176
+ this._log("Skipping autofocus (touch/mouse interaction)");
177
+ return;
178
+ }
179
+ if (i === !0)
180
+ t.hasAttribute("tabindex") || t.setAttribute("tabindex", "-1"), t.focus(), this._log(`Auto-focused panel: ${t.id}`);
181
+ else if (i === "heading") {
182
+ const n = t.querySelector("h1, h2, h3, h4, h5, h6");
183
+ n && (n.hasAttribute("tabindex") || n.setAttribute("tabindex", "-1"), n.focus(), this._log(`Auto-focused heading in: ${t.id}`));
184
+ } else if (i === "first") {
185
+ const n = t.querySelector('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])');
186
+ n && (n.focus(), this._log(`Auto-focused first element in: ${t.id}`));
187
+ } else typeof i == "function" && (i(t), this._log(`Auto-focused (custom) in: ${t.id}`));
188
+ }
189
+ _syncAriaWithActivePanel() {
190
+ if (!this.activePanel?.id) return;
191
+ const t = document.querySelector(
192
+ `[role="tab"][aria-controls="${this.activePanel.id}"]`
193
+ );
194
+ if (!t)
195
+ return;
196
+ const i = t.closest('[role="tablist"]');
197
+ i && (i.querySelectorAll('[role="tab"]').forEach((n) => {
198
+ n.setAttribute("aria-selected", "false");
199
+ }), t.setAttribute("aria-selected", "true"));
184
200
  }
185
201
  // Shared helper for open/close
186
- _animateOpenClose(e, s) {
187
- const t = e ? "opening" : "closing", n = `is-${e ? "closing" : "opening"}`, a = `is-${t}`;
188
- this._log(e ? "Opening" : "Closing"), this._openCloseGeneration++;
189
- const o = this._openCloseGeneration;
190
- this.element.classList.contains(n) && this.element.classList.remove(n);
191
- const l = e ? this._measureHeight(this.pendingPanel) : 0;
192
- if (s && this.config.transitions) {
202
+ _animateOpenClose(t, i) {
203
+ const e = t ? "opening" : "closing", o = `is-${t ? "closing" : "opening"}`, a = `is-${e}`;
204
+ this._log(t ? "Opening" : "Closing"), this._openCloseGeneration++;
205
+ const s = this._openCloseGeneration;
206
+ this.element.classList.contains(o) && this.element.classList.remove(o);
207
+ const l = t ? this._measureHeight(this.pendingPanel) : 0;
208
+ if (i && this.config.transitions) {
193
209
  this.element.classList.add(a);
194
210
  const c = this.element.offsetHeight;
195
- this.element.style.height = `${c}px`, e && this.element.classList.remove("is-closed"), requestAnimationFrame(() => {
211
+ this.element.style.height = `${c}px`, t && this.element.classList.remove("is-closed"), requestAnimationFrame(() => {
196
212
  this.element.style.height = `${l}px`, this._waitForTransition(this.element).then(() => {
197
- this._openCloseGeneration === o && (this.element.style.height = "", this.element.classList.remove(a), e || this.element.classList.add("is-closed"));
213
+ this._openCloseGeneration === s && (this.element.style.height = "", this.element.classList.remove(a), t || this.element.classList.add("is-closed"));
198
214
  });
199
215
  });
200
216
  } else
201
- e ? this.element.classList.remove("is-closed") : this.element.classList.add("is-closed"), this.element.style.height = "";
217
+ t ? this.element.classList.remove("is-closed") : this.element.classList.add("is-closed"), this.element.style.height = "";
202
218
  }
203
219
  /**
204
220
  * Get the ID of the currently active panel
@@ -209,52 +225,69 @@ const d = class d {
209
225
  }
210
226
  /**
211
227
  * Open a closable panelset
212
- * @param withTransition - Whether to animate
228
+ * @param options - Configuration options
213
229
  */
214
- open(e = !0) {
230
+ open(t) {
231
+ const {
232
+ event: i,
233
+ transition: e = !0,
234
+ autoFocus: n
235
+ } = t || {};
215
236
  if (!this.config.closable) {
216
237
  this._log("Cannot open: closable is false");
217
238
  return;
218
239
  }
219
- const s = this.element.classList.contains("is-closed"), t = this.element.classList.contains("is-closing");
220
- !s && !t || this._animateOpenClose(!0, e);
240
+ const o = this.element.classList.contains("is-closed"), a = this.element.classList.contains("is-closing");
241
+ if (!o && !a) return;
242
+ this._animateOpenClose(!0, e);
243
+ const s = n ?? this.config.autoFocus;
244
+ s !== !1 && s !== void 0 && this.pendingPanel && (e && this.config.transitions ? this._waitForTransition(this.element).then(() => {
245
+ this._handleAutoFocus(this.pendingPanel, s, i);
246
+ }) : this._handleAutoFocus(this.pendingPanel, s, i));
221
247
  }
222
248
  /**
223
249
  * Close a closable panelset
224
- * @param withTransition - Whether to animate
250
+ * @param options - Configuration options
225
251
  */
226
- close(e = !0) {
252
+ close(t) {
253
+ const {
254
+ transition: i = !0
255
+ } = t || {};
227
256
  if (!this.config.closable) {
228
257
  this._log("Cannot close: closable is false");
229
258
  return;
230
259
  }
231
- const s = this.element.classList.contains("is-closed"), t = this.element.classList.contains("is-opening");
232
- s && !t || this._animateOpenClose(!1, e);
260
+ const e = this.element.classList.contains("is-closed"), n = this.element.classList.contains("is-opening");
261
+ e && !n || this._animateOpenClose(!1, i);
233
262
  }
234
263
  /**
235
264
  * Toggle a closable panelset between open and closed
236
- * @param withTransition - Whether to animate
265
+ * @param options - Configuration options
237
266
  */
238
- toggle(e = !0) {
239
- const s = this.element.classList.contains("is-closed"), t = this.element.classList.contains("is-closing");
240
- s || t ? this.open(e) : this.close(e);
267
+ toggle(t) {
268
+ const {
269
+ event: i,
270
+ transition: e = !0,
271
+ autoFocus: n
272
+ } = t || {}, o = this.element.classList.contains("is-closed"), a = this.element.classList.contains("is-closing");
273
+ o || a ? this.open({ event: i, transition: e, autoFocus: n }) : this.close({ transition: e });
241
274
  }
242
275
  /**
243
276
  * Register a handler for async content loading
244
277
  * @param handler - Async content handler function
245
278
  * @param options - Handler options (once: whether to load only once)
246
279
  */
247
- onBeforeActivate(e, s = {}) {
248
- const t = s.once === !0;
249
- this.element.addEventListener("ps:beforeactivate", (i) => {
250
- const n = i, { targetPanel: a, signal: o } = n.detail;
251
- if (t && a.dataset.loaded === "true") {
280
+ onBeforeActivate(t, i = {}) {
281
+ const e = i.once === !0;
282
+ this.element.addEventListener("ps:beforeactivate", (n) => {
283
+ const o = n, { targetPanel: a, signal: s } = o.detail;
284
+ if (e && a.dataset.loaded === "true") {
252
285
  this.config.debug && this._log(`Skipping ${a.id} (already loaded)`);
253
286
  return;
254
287
  }
255
- const l = e(a, o);
256
- l && typeof l.then == "function" && (n.detail.promise = l.then(() => {
257
- t && (a.dataset.loaded = "true");
288
+ const l = t(a, s);
289
+ l && typeof l.then == "function" && (o.detail.promise = l.then(() => {
290
+ e && (a.dataset.loaded = "true");
258
291
  }).catch((c) => {
259
292
  throw c.name === "AbortError" ? (this.config.debug && this._log(`Load aborted: ${a.id}`), c) : (this._log(`Load failed: ${c.message}`), c);
260
293
  }));
@@ -264,59 +297,69 @@ const d = class d {
264
297
  /**
265
298
  * Show a panel by ID
266
299
  * @param panelId - ID of the panel to show
267
- * @param withTransition - Whether to animate the transition
268
- * @param options - Additional options (trigger name)
300
+ * @param options - Configuration options for this activation
269
301
  */
270
- async show(e, s = !0, t = {}) {
271
- const i = this.panels.find((r) => r.id === e);
272
- if (!i) {
273
- this._log(`Panel not found: ${e}`);
302
+ async show(t, i) {
303
+ const {
304
+ event: e,
305
+ transition: n = !0,
306
+ autoFocus: o
307
+ } = i || {}, a = e?.target instanceof HTMLElement ? e.target.closest('button, a, [role="tab"]') ?? e.target : null;
308
+ if (a?.getAttribute("role") === "tab") {
309
+ const r = a.closest('[role="tablist"]');
310
+ r && (r.querySelectorAll('[role="tab"]').forEach((g) => {
311
+ g.setAttribute("aria-selected", "false");
312
+ }), a.setAttribute("aria-selected", "true"));
313
+ }
314
+ const s = this.panels.find((r) => r.id === t);
315
+ if (!s) {
316
+ this._log(`Panel not found: ${t}`);
274
317
  return;
275
318
  }
276
- if (i === this.pendingPanel) return;
277
- const n = this.pendingPanel, a = n?.id;
278
- this.pendingPanel = i, this.element.classList.remove("is-loading"), n && n !== this.activePanel && n !== i && (n.classList.remove("incoming"), n.hidden || n.classList.remove("active"));
279
- const o = this._isLoadingAsync;
280
- this._currentAbortController && (this._currentAbortController.abort(), o && a && a !== e && this._dispatch("ps:activationaborted", {
281
- panelId: a,
282
- trigger: null
319
+ if (s === this.pendingPanel) return;
320
+ const l = this.pendingPanel, c = l?.id;
321
+ this.pendingPanel = s, this.element.classList.remove("is-loading"), l && l !== this.activePanel && l !== s && (l.classList.remove("incoming"), l.hidden || l.classList.remove("active"));
322
+ const $ = this._isLoadingAsync;
323
+ this._currentAbortController && (this._currentAbortController.abort(), $ && c && c !== t && this._dispatch("ps:activationaborted", {
324
+ panelId: c,
325
+ trigger: a
283
326
  }));
284
- const l = new AbortController();
285
- this._currentAbortController = l, this._isLoadingAsync = !1, this._log(`${n?.id || "none"} → ${e}`);
286
- const c = {
287
- panelId: e,
288
- targetPanel: i,
289
- outgoingPanel: n,
290
- signal: l.signal,
327
+ const p = new AbortController();
328
+ this._currentAbortController = p, this._isLoadingAsync = !1, this._log(`${l?.id || "none"} → ${t}`);
329
+ const y = {
330
+ panelId: t,
331
+ targetPanel: s,
332
+ outgoingPanel: l,
333
+ signal: p.signal,
291
334
  promise: null
292
- }, P = new CustomEvent("ps:beforeactivate", {
293
- detail: c,
335
+ }, C = new CustomEvent("ps:beforeactivate", {
336
+ detail: y,
294
337
  bubbles: !0,
295
338
  cancelable: !1
296
339
  });
297
- this.element.dispatchEvent(P);
298
- const _ = c.promise;
299
- if (_) {
340
+ this.element.dispatchEvent(C);
341
+ const P = y.promise;
342
+ if (P) {
300
343
  this._isLoadingAsync = !0, this._log("Waiting for content...");
301
344
  let r, f = !1;
302
345
  if (this.config.loadingDelay > 0 ? r = setTimeout(() => {
303
346
  this.element.classList.add("is-loading"), f = !0;
304
- }, this.config.loadingDelay) : (this.element.classList.add("is-loading"), f = !0), !(this.activePanel && this.activePanel !== i)) {
305
- const h = s !== !1 && this.config.transitions !== !1;
347
+ }, this.config.loadingDelay) : (this.element.classList.add("is-loading"), f = !0), !(this.activePanel && this.activePanel !== s)) {
348
+ const h = n !== !1 && this.config.transitions !== !1;
306
349
  let m = h;
307
350
  if (typeof this.config.transitions == "object" && (m = h && this.config.transitions.height !== !1), m) {
308
- const $ = this.element.offsetHeight;
309
- this.element.style.height = `${$}px`, requestAnimationFrame(() => {
351
+ const w = this.element.offsetHeight;
352
+ this.element.style.height = `${w}px`, requestAnimationFrame(() => {
310
353
  this.element.style.height = `${this.config.emptyPanelHeight}px`;
311
354
  });
312
355
  }
313
356
  }
314
357
  try {
315
- if (await _, r && clearTimeout(r), l.signal.aborted) {
316
- this._log(`Aborted during load: ${e}`), f && this.element.classList.remove("is-loading");
358
+ if (await P, r && clearTimeout(r), p.signal.aborted) {
359
+ this._log(`Aborted during load: ${t}`), f && this.element.classList.remove("is-loading");
317
360
  return;
318
361
  }
319
- this._log("Content loaded"), i.dataset.loaded === "true" && this._updateHighestPanel();
362
+ this._log("Content loaded"), s.dataset.loaded === "true" && this._updateHighestPanel();
320
363
  } catch (h) {
321
364
  r && clearTimeout(r);
322
365
  const m = h;
@@ -325,35 +368,35 @@ const d = class d {
325
368
  }
326
369
  f && this.element.classList.remove("is-loading");
327
370
  }
328
- if (l.signal.aborted) {
329
- this._log(`Aborted: ${e}`);
371
+ if (p.signal.aborted) {
372
+ this._log(`Aborted: ${t}`);
330
373
  return;
331
374
  }
332
375
  this._dispatch("ps:activationstart", {
333
- panelId: e,
334
- trigger: t.trigger || null
376
+ panelId: t,
377
+ trigger: a
335
378
  });
336
- const p = s !== !1 && this.config.transitions !== !1;
337
- let v = p, b = p;
338
- typeof this.config.transitions == "object" && (v = p && this.config.transitions.panels !== !1, b = p && this.config.transitions.height !== !1), this.panels.forEach((r) => r.classList.toggle("fade", v));
339
- const y = this.element.offsetHeight;
340
- b && (this.element.style.height = `${y}px`);
341
- const g = this.activePanel;
342
- i.hidden = !1, i.classList.add("incoming"), v && this.element.classList.add("is-transitioning"), g && g !== i && (g.classList.remove("active", "incoming"), g.hidden = !1), requestAnimationFrame(() => {
343
- i.classList.add("active"), g && g !== i && g.classList.remove("incoming");
344
- const r = this._measureHeight(i), f = y !== r;
345
- b && (this.element.style.height = `${r}px`);
346
- const u = [];
347
- v && u.push(this._waitForTransition(i)), b && f && u.push(this._waitForTransition(this.element)), u.length || u.push(Promise.resolve()), Promise.all(u).then(() => {
348
- if (this.pendingPanel !== i) {
349
- this._log(`Interrupted: ${e}`);
379
+ const b = n !== !1 && this.config.transitions !== !1;
380
+ let v = b, _ = b;
381
+ typeof this.config.transitions == "object" && (v = b && this.config.transitions.panels !== !1, _ = b && this.config.transitions.height !== !1), this.panels.forEach((r) => r.classList.toggle("fade", v));
382
+ const L = this.element.offsetHeight;
383
+ _ && (this.element.style.height = `${L}px`);
384
+ const u = this.activePanel;
385
+ s.hidden = !1, s.classList.add("incoming"), v && this.element.classList.add("is-transitioning"), u && u !== s && (u.classList.remove("active", "incoming"), u.hidden = !1), requestAnimationFrame(() => {
386
+ s.classList.add("active"), u && u !== s && u.classList.remove("incoming");
387
+ const r = this._measureHeight(s), f = L !== r;
388
+ _ && (this.element.style.height = `${r}px`);
389
+ const g = [];
390
+ v && g.push(this._waitForTransition(s)), _ && f && g.push(this._waitForTransition(this.element)), g.length || g.push(Promise.resolve()), Promise.all(g).then(() => {
391
+ if (this.pendingPanel !== s) {
392
+ this._log(`Interrupted: ${t}`);
350
393
  return;
351
394
  }
352
- this._cleanupPanels(i), this._log(`✓ ${e}`);
353
- const h = t.autoFocus ?? this.config.autoFocus;
354
- h !== !1 && h !== void 0 && this._handleAutoFocus(i, h), this._dispatch("ps:activationcomplete", {
355
- panelId: e,
356
- trigger: t.trigger || null
395
+ this._cleanupPanels(s), this._log(`✓ ${t}`);
396
+ const h = o ?? this.config.autoFocus;
397
+ h !== !1 && h !== void 0 && this._handleAutoFocus(s, h, e), this._dispatch("ps:activationcomplete", {
398
+ panelId: t,
399
+ trigger: a
357
400
  });
358
401
  });
359
402
  });
@@ -367,9 +410,9 @@ d.defaults = {
367
410
  autoFocus: !0,
368
411
  debug: !1
369
412
  };
370
- let L = d;
413
+ let A = d;
371
414
  export {
372
- L as PanelSet,
373
- L as default
415
+ A as PanelSet,
416
+ A as default
374
417
  };
375
418
  //# sourceMappingURL=panelset.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"panelset.js","sources":["../src/lib/index.ts"],"sourcesContent":["import './styles/panelset.scss';\n\n// Configuration types\nexport interface PanelSetConfig {\n\tselector?: string;\n\ttransitions?: boolean | {\n\t\tpanels?: boolean;\n\t\theight?: boolean;\n\t};\n\tclosable?: boolean;\n\temptyPanelHeight?: number;\n\tloadingDelay?: number;\n\tautoFocus?: boolean | 'heading' | 'first';\n\tdebug?: boolean;\n}\n\n// Event detail types\nexport interface ReadyEventDetail {\n\tcontainer: HTMLElement;\n\tinstance: PanelSet;\n}\n\nexport interface BeforeActivateEventDetail {\n\tpanelId: string;\n\ttargetPanel: HTMLElement;\n\toutgoingPanel: HTMLElement | null;\n\tsignal: AbortSignal;\n\tpromise: Promise<void> | null;\n}\n\nexport interface ActivationEventDetail {\n\tpanelId: string;\n\ttrigger: string | null;\n}\n\nexport interface ActivationAbortedEventDetail {\n\tpanelId: string;\n\ttrigger: string | null;\n}\n\n// Handler options\nexport interface HandlerOptions {\n\tonce?: boolean;\n}\n\n// Show options\nexport interface ShowOptions {\n\ttrigger?: string;\n\tautoFocus?: boolean | 'heading' | 'first' | ((panel: HTMLElement) => void); // Add this\n}\n\n// Async content handler type\nexport type AsyncContentHandler = (\n\ttargetPanel: HTMLElement,\n\tsignal: AbortSignal\n) => Promise<void> | void;\n\n// Extend HTMLElement to include panelSet property\ndeclare global {\n\tinterface HTMLElement {\n\t\tpanelSet?: PanelSet;\n\t}\n}\n\nexport class PanelSet {\n\t// Default configuration\n\tstatic defaults: Required<Omit<PanelSetConfig, 'selector'>> = {\n\t\ttransitions: true,\n\t\tclosable: false,\n\t\temptyPanelHeight: 200,\n\t\tloadingDelay: 300,\n\t\tautoFocus: true,\n\t\tdebug: false\n\t};\n\n\t// Instance properties\n\telement!: HTMLElement;\n\tconfig!: Required<Omit<PanelSetConfig, 'selector'>>;\n\tpanels!: HTMLElement[];\n\tactivePanel!: HTMLElement;\n\tpanelWrapper!: HTMLElement;\n\tpendingPanel!: HTMLElement;\n\n\tprivate _openCloseGeneration: number = 0;\n\tprivate _isLoadingAsync: boolean = false;\n\tprivate _currentAbortController?: AbortController;\n\n\t// Parse data attributes from element\n\tstatic _getDataConfig(element: HTMLElement): Partial<PanelSetConfig> {\n\t\tconst data = element.dataset;\n\t\tconst config: Partial<PanelSetConfig> = {};\n\n\t\t// Define attribute types\n\t\tconst attrs: Record<string, 'json' | 'boolean' | 'number'> = {\n\t\t\ttransitions: 'json',\n\t\t\tclosable: 'boolean',\n\t\t\temptyPanelHeight: 'number',\n\t\t\tloadingDelay: 'number',\n\t\t\t// We do not support autofocus here. I do not think it is needed per whole PanelSet.\n\t\t\tdebug: 'boolean'\n\t\t};\n\n\t\t// Parse each attribute\n\t\tfor (const [key, type] of Object.entries(attrs)) {\n\t\t\tif (!(key in data)) continue;\n\n\t\t\tconst value = data[key];\n\t\t\tif (value === undefined) continue;\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'boolean':\n\t\t\t\t\t(config as any)[key] = value !== 'false';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'number':\n\t\t\t\t\t(config as any)[key] = parseInt(value, 10);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'json':\n\t\t\t\t\ttry {\n\t\t\t\t\t\t(config as any)[key] = JSON.parse(value);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Fall back to boolean parsing\n\t\t\t\t\t\t(config as any)[key] = value !== 'false';\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn config;\n\t}\n\n\t// Merge configurations\n\tstatic _mergeConfig(\n\t\tdefaults: Required<Omit<PanelSetConfig, 'selector'>>,\n\t\tdataConfig: Partial<PanelSetConfig>,\n\t\toptions: Partial<PanelSetConfig>\n\t): Required<Omit<PanelSetConfig, 'selector'>> {\n\t\treturn {\n\t\t\t...defaults,\n\t\t\t...dataConfig,\n\t\t\t...options\n\t\t} as Required<Omit<PanelSetConfig, 'selector'>>;\n\t}\n\n\t/**\n\t * Initialize PanelSet instances\n\t * @param selectorOrOptions - CSS selector string or config object\n\t * @param options - Additional config options (when first param is selector)\n\t * @returns Array of PanelSet instances\n\t */\n\tstatic init(selectorOrOptions: string | PanelSetConfig = {}, options: PanelSetConfig = {}): PanelSet[] {\n\t\t// Handle different call signatures\n\t\tlet selector: string;\n\t\tlet config: PanelSetConfig;\n\n\t\tif (typeof selectorOrOptions === 'string') {\n\t\t\t// init('#demo') or init('#demo', {debug: true})\n\t\t\tselector = selectorOrOptions;\n\t\t\tconfig = options;\n\t\t} else {\n\t\t\t// init() or init({selector: '#demo', debug: true})\n\t\t\tconfig = selectorOrOptions;\n\t\t\tselector = config.selector || '[data-panelset]';\n\t\t}\n\n\t\tconst elements = document.querySelectorAll<HTMLElement>(selector);\n\t\tconst instances: PanelSet[] = [];\n\n\t\telements.forEach(el => {\n\n\t\t\ttry {\n\t\t\t\tPanelSet._validateElement(el);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error((error as Error).message);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip if already initialized\n\t\t\tif (el.panelSet || el.dataset.panelset === 'true') {\n\t\t\t\tif (el.panelSet) instances.push(el.panelSet);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst instance = new PanelSet(el, config);\n\t\t\tinstances.push(instance);\n\t\t});\n\n\t\treturn instances;\n\t}\n\n\tconstructor(elementOrSelector: HTMLElement | string, options: PanelSetConfig = {}) {\n\t\t// Handle both element and selector\n\t\tlet element: HTMLElement | null;\n\t\tif (typeof elementOrSelector === 'string') {\n\t\t\telement = document.querySelector<HTMLElement>(elementOrSelector);\n\t\t\tif (!element) {\n\t\t\t\tthrow new Error(`PanelSet: No element found for selector \"${elementOrSelector}\"`);\n\t\t\t}\n\t\t} else {\n\t\t\telement = elementOrSelector;\n\t\t}\n\n\t\tthis.element = element;\n\n\t\t// Validate element\n\t\tPanelSet._validateElement(element);\n\n\t\t// Check if already initialized\n\t\tif (element.panelSet || element.dataset.panelset === 'true') {\n\t\t\tconsole.warn('PanelSet: Element already initialized, returning existing instance');\n\t\t\treturn element.panelSet!;\n\t\t}\n\n\t\t// Store instance on element\n\t\telement.panelSet = this;\n\n\t\tconst dataConfig = PanelSet._getDataConfig(element);\n\t\tthis.config = PanelSet._mergeConfig(\n\t\t\tPanelSet.defaults,\n\t\t\tdataConfig,\n\t\t\toptions\n\t\t);\n\n\t\tthis.panels = Array.from(element.querySelectorAll<HTMLElement>('[role=\"tabpanel\"]'));\n\n\t\tif (this.panels.length === 0) {\n\t\t\tconst elementDesc = `<${element.tagName.toLowerCase()}${element.id ? ` id=\"${element.id}\"` : ''}${element.className ? ` class=\"${element.className}\"` : ''}>`;\n\t\t\tconsole.error(`PanelSet: No panels with [role=\"tabpanel\"] found inside ${elementDesc}. Make sure panel elements are children of the [data-panelset] element.`);\n\t\t\t// Set safe defaults and bail\n\t\t\tthis.panels = [];\n\t\t\tthis.activePanel = null as any;\n\t\t\tthis.panelWrapper = null as any;\n\t\t\tthis.pendingPanel = null as any;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.activePanel =\n\t\t\tthis.panels.find(p => p.classList.contains('active')) || this.panels[0];\n\t\tthis.panelWrapper =\n\t\t\tthis.element.querySelector<HTMLElement>('.panel-wrapper') || this._autoWrapPanels();\n\n\t\tthis.pendingPanel = this.activePanel;\n\n\n\n\n\t\tthis.element.dataset.panelset = 'true';\n\n\t\tthis._log(`Initialized (${this.panels.length} panels)`);\n\t\tthis._dispatch<ReadyEventDetail>('ps:ready', { container: this.element, instance: this });\n\n\t\tthis._internalInit();\n\n\t\tlet resizeTimeout: ReturnType<typeof setTimeout>;\n\t\twindow.addEventListener('resize', () => {\n\t\t\tclearTimeout(resizeTimeout);\n\t\t\tresizeTimeout = setTimeout(() => {\n\t\t\t\tthis._updateHighestPanel();\n\t\t\t}, 250);\n\t\t});\n\n\t}\n\n\t// Debug logging helper\n\tprivate _log(message: string): void {\n\t\tif (!this.config.debug) return;\n\t\tconst id = this.element.id || 'no id';\n\t\tconsole.log(`[PanelSet] - \"${id}\" -`, message);\n\t}\n\n\tprivate static _validateElement(element: HTMLElement): void {\n\t\tif (!element.hasAttribute('data-panelset')) {\n\t\t\tconst elementDesc = `<${element.tagName.toLowerCase()}${element.id ? ` id=\"${element.id}\"` : ''}${element.className ? ` class=\"${element.className}\"` : ''}>`;\n\t\t\tthrow new Error(`PanelSet: Element is missing required data-panelset attribute. Element: ${elementDesc}`);\n\t\t}\n\t}\n\n\tprivate _autoWrapPanels(): HTMLElement {\n\t\tconst wrapper = document.createElement('div');\n\t\twrapper.className = 'panel-wrapper';\n\t\tthis.panels.forEach(panel => wrapper.appendChild(panel));\n\t\tthis.element.appendChild(wrapper);\n\t\treturn wrapper;\n\t}\n\n\tprivate _internalInit(): void {\n\t\tthis.panels.forEach(panel => {\n\t\t\tpanel.classList.remove('fade', 'incoming');\n\t\t\tif (panel !== this.activePanel) {\n\t\t\t\tpanel.hidden = true;\n\t\t\t\tpanel.classList.remove('active');\n\t\t\t} else {\n\t\t\t\tpanel.hidden = false;\n\t\t\t\tpanel.classList.add('active');\n\t\t\t}\n\t\t});\n\t\tthis.element.style.height = '';\n\t\tthis._updateHighestPanel();\n\t}\n\n\t// Dispatch custom event helper\n\tprivate _dispatch<T = unknown>(eventName: string, detail: T): void {\n\t\tthis.element.dispatchEvent(\n\t\t\tnew CustomEvent(eventName, {\n\t\t\t\tdetail,\n\t\t\t\tbubbles: true,\n\t\t\t\tcancelable: false\n\t\t\t})\n\t\t);\n\t}\n\n\t/* --- Modular helpers --- */\n\n\tprivate _getVerticalMetrics(el: HTMLElement | null): number {\n\t\tif (!el) return 0;\n\t\tconst s = getComputedStyle(el);\n\t\treturn ['paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth']\n\t\t\t.reduce((sum, prop) => sum + (parseFloat(s[prop as keyof CSSStyleDeclaration] as string) || 0), 0);\n\t}\n\n\tprivate _measureHeight(panel: HTMLElement): number {\n\t\tlet total = panel.offsetHeight;\n\t\ttotal += this._getVerticalMetrics(this.panelWrapper);\n\t\ttotal += this._getVerticalMetrics(this.element);\n\t\treturn total;\n\t}\n\n\tprivate _updateHighestPanel(): void {\n\n\t\t// Warn if user tries self-tracking\n\t\tif (this.element.hasAttribute('data-ps-track-height')) {\n\t\t\tconsole.warn('PanelSet: data-ps-track-height should be placed on a parent element, not on [data-panelset] itself. Height tracking skipped.');\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t// Look for parent with tracking attribute\n\t\tconst trackingParent = this.element.closest('[data-ps-track-height]');\n\t\tif (!trackingParent) return; // Skip if no tracking parent found\n\t\t\n\t\tlet maxContainerHeight = 0;\n\t\t\n\t\t// Measure each panel as if it were active\n\t\tthis.panels.forEach(panel => {\n\t\t\t// Save state\n\t\t\tconst wasHidden = panel.hidden;\n\t\t\tconst wasActive = panel.classList.contains('active');\n\t\t\t\n\t\t\t// Make this panel active temporarily\n\t\t\tthis.panels.forEach(p => {\n\t\t\t\tp.hidden = true;\n\t\t\t\tp.classList.remove('active');\n\t\t\t});\n\t\t\t\n\t\t\tpanel.hidden = false;\n\t\t\tpanel.classList.add('active');\n\t\t\tpanel.style.visibility = 'hidden';\n\t\t\t\n\t\t\t// Force reflow\n\t\t\tthis.element.offsetHeight;\n\t\t\t\n\t\t\t// Measure the CONTAINER height (includes padding and borders)\n\t\t\tconst containerHeight = this.element.offsetHeight;\n\t\t\tif (containerHeight > maxContainerHeight) {\n\t\t\t\tmaxContainerHeight = containerHeight;\n\t\t\t}\n\t\t\t\n\t\t\t// Restore state\n\t\t\tpanel.hidden = wasHidden;\n\t\t\tif (!wasActive) panel.classList.remove('active');\n\t\t\tpanel.style.visibility = '';\n\t\t});\n\n\t\tif (this.activePanel) {\n\t\t\tthis.activePanel.hidden = false;\n\t\t\tthis.activePanel.classList.add('active');\n\t\t}\n\t\tthis.panels.forEach(p => {\n\t\t\tif (p !== this.activePanel) {\n\t\t\t\tp.hidden = true;\n\t\t\t\tp.classList.remove('active');\n\t\t\t}\n\t\t});\n\t\t\n\t\t// Set CSS variable on the tracking parent\n\t\t(trackingParent as HTMLElement).style.setProperty('--ps-max-height', `${maxContainerHeight}px`);\n\t\tthis._log(`Max container height: ${maxContainerHeight}px (set on tracking parent)`);\n\t}\n\n\tprivate _cleanupPanels(newPanel: HTMLElement): void {\n\t\tthis.panels.forEach(panel => {\n\t\t\tpanel.classList.remove('fade', 'incoming');\n\t\t\tif (panel !== newPanel) {\n\t\t\t\tpanel.classList.remove('active');\n\t\t\t\tpanel.hidden = true;\n\t\t\t} else {\n\t\t\t\tpanel.classList.add('active');\n\t\t\t\tpanel.hidden = false;\n\t\t\t}\n\t\t});\n\t\tthis.element.style.height = '';\n\t\tthis.element.classList.remove('is-transitioning');\n\t\tthis.activePanel = newPanel;\n\t}\n\n\tprivate _waitForTransition(element: HTMLElement): Promise<void> {\n\t\treturn new Promise(resolve => {\n\t\t\tconst styles = getComputedStyle(element);\n\t\t\tconst duration = parseFloat(styles.transitionDuration) || 0;\n\t\t\tconst delay = parseFloat(styles.transitionDelay) || 0;\n\t\t\tif (duration + delay === 0) {\n\t\t\t\tresolve();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst handler = (e: TransitionEvent) => {\n\t\t\t\tif (e.target !== element) return;\n\t\t\t\telement.removeEventListener('transitionend', handler);\n\t\t\t\tresolve();\n\t\t\t};\n\t\t\telement.addEventListener('transitionend', handler);\n\t\t});\n\t}\n\n\tprivate _handleAutoFocus(panel: HTMLElement, autoFocus: boolean | 'heading' | 'first' | ((panel: HTMLElement) => void)): void {\n\t\tif (autoFocus === true) {\n\t\t\t// Focus the panel itself\n\t\t\tif (!panel.hasAttribute('tabindex')) {\n\t\t\t\tpanel.setAttribute('tabindex', '-1');\n\t\t\t}\n\t\t\tpanel.focus();\n\t\t\tthis._log(`Auto-focused panel: ${panel.id}`);\n\t\t} else if (autoFocus === 'heading') {\n\t\t\t// Focus first heading\n\t\t\tconst heading = panel.querySelector<HTMLElement>('h1, h2, h3, h4, h5, h6');\n\t\t\tif (heading) {\n\t\t\t\tif (!heading.hasAttribute('tabindex')) {\n\t\t\t\t\theading.setAttribute('tabindex', '-1');\n\t\t\t\t}\n\t\t\t\theading.focus();\n\t\t\t\tthis._log(`Auto-focused heading in: ${panel.id}`);\n\t\t\t}\n\t\t} else if (autoFocus === 'first') {\n\t\t\t// Focus first focusable element\n\t\t\tconst focusable = panel.querySelector<HTMLElement>('a, button, input, select, textarea, [tabindex]:not([tabindex=\"-1\"])');\n\t\t\tif (focusable) {\n\t\t\t\tfocusable.focus();\n\t\t\t\tthis._log(`Auto-focused first element in: ${panel.id}`);\n\t\t\t}\n\t\t} else if (typeof autoFocus === 'function') {\n\t\t\t// Custom function\n\t\t\tautoFocus(panel);\n\t\t\tthis._log(`Auto-focused (custom) in: ${panel.id}`);\n\t\t}\n\t}\n\n\t// Shared helper for open/close\n\tprivate _animateOpenClose(isOpening: boolean, withTransition: boolean): void {\n\t\tconst action = isOpening ? 'opening' : 'closing';\n\t\tconst oppositeAction = isOpening ? 'closing' : 'opening';\n\t\tconst oppositeClass = `is-${oppositeAction}`;\n\t\tconst actionClass = `is-${action}`;\n\n\t\tthis._log(isOpening ? 'Opening' : 'Closing');\n\n\t\tthis._openCloseGeneration++;\n\t\tconst myGeneration = this._openCloseGeneration;\n\n\t\t// Remove opposite state if interrupting\n\t\tif (this.element.classList.contains(oppositeClass)) {\n\t\t\tthis.element.classList.remove(oppositeClass);\n\t\t}\n\n\t\tconst targetHeight = isOpening ? this._measureHeight(this.pendingPanel) : 0;\n\n\t\tif (withTransition && this.config.transitions) {\n\t\t\tthis.element.classList.add(actionClass);\n\n\t\t\tconst currentHeight = this.element.offsetHeight;\n\t\t\tthis.element.style.height = `${currentHeight}px`;\n\n\t\t\tif (isOpening) this.element.classList.remove('is-closed');\n\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tthis.element.style.height = `${targetHeight}px`;\n\n\t\t\t\tthis._waitForTransition(this.element).then(() => {\n\t\t\t\t\tif (this._openCloseGeneration === myGeneration) {\n\t\t\t\t\t\tthis.element.style.height = '';\n\t\t\t\t\t\tthis.element.classList.remove(actionClass);\n\t\t\t\t\t\tif (!isOpening) this.element.classList.add('is-closed');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t} else {\n\t\t\tif (isOpening) {\n\t\t\t\tthis.element.classList.remove('is-closed');\n\t\t\t} else {\n\t\t\t\tthis.element.classList.add('is-closed');\n\t\t\t}\n\t\t\tthis.element.style.height = '';\n\t\t}\n\t}\n\n\t/**\n\t * Get the ID of the currently active panel\n\t * @returns Panel ID or null if no panel is active\n\t */\n\tgetActive(): string | null {\n\t\treturn this.pendingPanel?.id || null;\n\t}\n\n\t/**\n\t * Open a closable panelset\n\t * @param withTransition - Whether to animate\n\t */\n\topen(withTransition: boolean = true): void {\n\t\tif (!this.config.closable) {\n\t\t\tthis._log('Cannot open: closable is false');\n\t\t\treturn;\n\t\t}\n\n\t\tconst isClosed = this.element.classList.contains('is-closed');\n\t\tconst isClosing = this.element.classList.contains('is-closing');\n\n\t\tif (!isClosed && !isClosing) return;\n\n\t\tthis._animateOpenClose(true, withTransition);\n\t}\n\n\t/**\n\t * Close a closable panelset\n\t * @param withTransition - Whether to animate\n\t */\n\tclose(withTransition: boolean = true): void {\n\t\tif (!this.config.closable) {\n\t\t\tthis._log('Cannot close: closable is false');\n\t\t\treturn;\n\t\t}\n\n\t\tconst isClosed = this.element.classList.contains('is-closed');\n\t\tconst isOpening = this.element.classList.contains('is-opening');\n\n\t\tif (isClosed && !isOpening) return;\n\n\t\tthis._animateOpenClose(false, withTransition);\n\t}\n\n\t/**\n\t * Toggle a closable panelset between open and closed\n\t * @param withTransition - Whether to animate\n\t */\n\ttoggle(withTransition: boolean = true): void {\n\t\tconst isClosed = this.element.classList.contains('is-closed');\n\t\tconst isClosing = this.element.classList.contains('is-closing');\n\n\t\t// If closed or closing, open it\n\t\tif (isClosed || isClosing) {\n\t\t\tthis.open(withTransition);\n\t\t} else {\n\t\t\tthis.close(withTransition);\n\t\t}\n\t}\n\n\t/**\n\t * Register a handler for async content loading\n\t * @param handler - Async content handler function\n\t * @param options - Handler options (once: whether to load only once)\n\t */\n\tonBeforeActivate(handler: AsyncContentHandler, options: HandlerOptions = {}): void {\n\t\tconst once = options.once === true; // Default: false (always reload)\n\n\t\tthis.element.addEventListener('ps:beforeactivate', (e) => {\n\t\t\tconst event = e as CustomEvent<BeforeActivateEventDetail>;\n\t\t\tconst { targetPanel, signal } = event.detail;\n\n\t\t\t// Skip if already loaded and once=true\n\t\t\tif (once && targetPanel.dataset.loaded === 'true') {\n\t\t\t\tif (this.config.debug) {\n\t\t\t\t\tthis._log(`Skipping ${targetPanel.id} (already loaded)`);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Call user handler\n\t\t\tconst result = handler(targetPanel, signal);\n\n\t\t\t// If handler returns a promise, attach it to the event\n\t\t\tif (result && typeof result.then === 'function') {\n\t\t\t\tevent.detail.promise = result\n\t\t\t\t\t.then(() => {\n\t\t\t\t\t\t// Auto-mark as loaded on success if once=true\n\t\t\t\t\t\tif (once) {\n\t\t\t\t\t\t\ttargetPanel.dataset.loaded = 'true';\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.catch(error => {\n\t\t\t\t\t\tif (error.name === 'AbortError') {\n\t\t\t\t\t\t\tif (this.config.debug) {\n\t\t\t\t\t\t\t\tthis._log(`Load aborted: ${targetPanel.id}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis._log(`Load failed: ${error.message}`);\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\t/* --- Main logic --- */\n\n\t/**\n\t * Show a panel by ID\n\t * @param panelId - ID of the panel to show\n\t * @param withTransition - Whether to animate the transition\n\t * @param options - Additional options (trigger name)\n\t */\n\tasync show(panelId: string, withTransition: boolean = true, options: ShowOptions = {}): Promise<void> {\n\t\tconst newPanel = this.panels.find(p => p.id === panelId);\n\n\t\tif (!newPanel) {\n\t\t\tthis._log(`Panel not found: ${panelId}`);\n\t\t\treturn;\n\t\t}\n\n\t\tif (newPanel === this.pendingPanel) return;\n\n\t\tconst prevPanel = this.pendingPanel;\n\t\tconst prevPanelId = prevPanel?.id;\n\t\tthis.pendingPanel = newPanel;\n\n\t\tthis.element.classList.remove('is-loading');\n\n\t\tif (prevPanel && prevPanel !== this.activePanel && prevPanel !== newPanel) {\n\t\t\tprevPanel.classList.remove('incoming');\n\t\t\tif (prevPanel.hidden) {\n\t\t\t\t// Was never visible, keep hidden\n\t\t\t} else {\n\t\t\t\tprevPanel.classList.remove('active');\n\t\t\t}\n\t\t}\n\n\t\tconst wasLoadingAsync = this._isLoadingAsync;\n\n\t\tif (this._currentAbortController) {\n\t\t\tthis._currentAbortController.abort();\n\n\t\t\t// Only fire abort if we're cancelling an async operation\n\t\t\tif (wasLoadingAsync && prevPanelId && prevPanelId !== panelId) {\n\t\t\t\tthis._dispatch<ActivationAbortedEventDetail>('ps:activationaborted', {\n\t\t\t\t\tpanelId: prevPanelId,\n\t\t\t\t\ttrigger: null\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tconst abortController = new AbortController();\n\t\tthis._currentAbortController = abortController;\n\t\tthis._isLoadingAsync = false;\n\n\t\tthis._log(`${prevPanel?.id || 'none'} → ${panelId}`);\n\n\t\tconst beforeActivateDetail: BeforeActivateEventDetail = {\n\t\t\tpanelId,\n\t\t\ttargetPanel: newPanel,\n\t\t\toutgoingPanel: prevPanel,\n\t\t\tsignal: abortController.signal,\n\t\t\tpromise: null\n\t\t};\n\n\t\tconst beforeActivateEvent = new CustomEvent('ps:beforeactivate', {\n\t\t\tdetail: beforeActivateDetail,\n\t\t\tbubbles: true,\n\t\t\tcancelable: false\n\t\t});\n\n\t\tthis.element.dispatchEvent(beforeActivateEvent);\n\n\t\tconst userPromise = beforeActivateDetail.promise;\n\n\t\tif (userPromise) {\n\t\t\tthis._isLoadingAsync = true;\n\t\t\tthis._log('Waiting for content...');\n\n\t\t\tlet spinnerTimeout: ReturnType<typeof setTimeout> | undefined;\n\t\t\tlet loadingShown = false;\n\n\t\t\tif (this.config.loadingDelay > 0) {\n\t\t\t\tspinnerTimeout = setTimeout(() => {\n\t\t\t\t\tthis.element.classList.add('is-loading');\n\t\t\t\t\tloadingShown = true;\n\t\t\t\t}, this.config.loadingDelay);\n\t\t\t} else {\n\t\t\t\tthis.element.classList.add('is-loading');\n\t\t\t\tloadingShown = true;\n\t\t\t}\n\n\t\t\tconst hasPreviousPanel = this.activePanel && this.activePanel !== newPanel;\n\n\t\t\tif (!hasPreviousPanel) {\n\t\t\t\tconst shouldTransition = withTransition !== false && this.config.transitions !== false;\n\t\t\t\tlet heightTransition = shouldTransition;\n\t\t\t\tif (typeof this.config.transitions === 'object') {\n\t\t\t\t\theightTransition = shouldTransition && this.config.transitions.height !== false;\n\t\t\t\t}\n\n\t\t\t\tif (heightTransition) {\n\t\t\t\t\tconst currentHeight = this.element.offsetHeight;\n\t\t\t\t\tthis.element.style.height = `${currentHeight}px`;\n\n\t\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\t\tthis.element.style.height = `${this.config.emptyPanelHeight}px`;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait userPromise;\n\n\t\t\t\tif (spinnerTimeout) clearTimeout(spinnerTimeout);\n\n\t\t\t\tif (abortController.signal.aborted) {\n\t\t\t\t\tthis._log(`Aborted during load: ${panelId}`);\n\t\t\t\t\tif (loadingShown) this.element.classList.remove('is-loading');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis._log('Content loaded');\n\n\t\t\t\tif (newPanel.dataset.loaded === 'true') {\n\t\t\t\t\tthis._updateHighestPanel();\n\t\t\t\t}\n\n\n\t\t\t} catch (error) {\n\t\t\t\tif (spinnerTimeout) clearTimeout(spinnerTimeout);\n\n\t\t\t\tconst err = error as Error;\n\t\t\t\tthis._log(`Load failed: ${err.message}`);\n\t\t\t\tif (loadingShown) this.element.classList.remove('is-loading');\n\n\t\t\t\tif (err.name !== 'AbortError') {\n\t\t\t\t\tconsole.error('Panel load error:', error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (loadingShown) this.element.classList.remove('is-loading');\n\t\t}\n\n\t\tif (abortController.signal.aborted) {\n\t\t\tthis._log(`Aborted: ${panelId}`);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._dispatch<ActivationEventDetail>('ps:activationstart', {\n\t\t\tpanelId,\n\t\t\ttrigger: options.trigger || null\n\t\t});\n\n\t\tconst shouldTransition = withTransition !== false && this.config.transitions !== false;\n\n\t\tlet panelTransition = shouldTransition;\n\t\tlet heightTransition = shouldTransition;\n\n\n\t\tif (typeof this.config.transitions === 'object') {\n\t\t\tpanelTransition = shouldTransition && this.config.transitions.panels !== false;\n\t\t\theightTransition = shouldTransition && this.config.transitions.height !== false;\n\t\t}\n\n\t\tthis.panels.forEach(panel => panel.classList.toggle('fade', panelTransition));\n\n\t\tconst startHeight = this.element.offsetHeight;\n\t\tif (heightTransition) {\n\t\t\tthis.element.style.height = `${startHeight}px`;\n\t\t}\n\n\t\tconst outgoingPanel = this.activePanel;\n\n\t\tnewPanel.hidden = false;\n\t\tnewPanel.classList.add('incoming');\n\t\tif (panelTransition) {\n\t\t\t// Apply general transitioning class for overflow: hidden\n\t\t\tthis.element.classList.add('is-transitioning');\n\t\t}\n\t\tif (outgoingPanel && outgoingPanel !== newPanel) {\n\t\t\toutgoingPanel.classList.remove('active', 'incoming');\n\t\t\toutgoingPanel.hidden = false;\n\t\t}\n\n\t\trequestAnimationFrame(() => {\n\t\t\tnewPanel.classList.add('active');\n\t\t\tif (outgoingPanel && outgoingPanel !== newPanel) {\n\t\t\t\toutgoingPanel.classList.remove('incoming');\n\t\t\t}\n\n\t\t\tconst targetHeight = this._measureHeight(newPanel);\n\t\t\tconst heightChanged = startHeight !== targetHeight;\n\n\t\t\tif (heightTransition) {\n\t\t\t\tthis.element.style.height = `${targetHeight}px`;\n\t\t\t}\n\n\t\t\tconst promises: Promise<void>[] = [];\n\t\t\tif (panelTransition) {\n\t\t\t\tpromises.push(this._waitForTransition(newPanel));\n\t\t\t}\n\t\t\tif (heightTransition && heightChanged) {\n\t\t\t\tpromises.push(this._waitForTransition(this.element));\n\t\t\t}\n\t\t\tif (!promises.length) promises.push(Promise.resolve());\n\n\t\t\tPromise.all(promises).then(() => {\n\t\t\t\t// Check if interrupted by another activation\n\t\t\t\tif (this.pendingPanel !== newPanel) {\n\t\t\t\t\tthis._log(`Interrupted: ${panelId}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis._cleanupPanels(newPanel);\n\t\t\t\tthis._log(`✓ ${panelId}`);\n\t\t\t\t\n\t\t\t\t// Handle auto-focus\n\t\t\t\tconst autoFocus = options.autoFocus ?? this.config.autoFocus;\n\t\t\t\tif (autoFocus !== false && autoFocus !== undefined) {\n\t\t\t\t\tthis._handleAutoFocus(newPanel, autoFocus);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tthis._dispatch<ActivationEventDetail>('ps:activationcomplete', {\n\t\t\t\t\tpanelId,\n\t\t\t\t\ttrigger: options.trigger || null\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t}\n}\n\nexport default PanelSet;"],"names":["_PanelSet","elementOrSelector","options","element","dataConfig","elementDesc","p","resizeTimeout","data","config","attrs","key","type","value","defaults","selectorOrOptions","selector","elements","instances","el","error","instance","message","id","wrapper","panel","eventName","detail","sum","prop","total","trackingParent","maxContainerHeight","wasHidden","wasActive","containerHeight","newPanel","resolve","styles","duration","delay","handler","e","autoFocus","heading","focusable","isOpening","withTransition","action","oppositeClass","actionClass","myGeneration","targetHeight","currentHeight","isClosed","isClosing","once","event","targetPanel","signal","result","panelId","prevPanel","prevPanelId","wasLoadingAsync","abortController","beforeActivateDetail","beforeActivateEvent","userPromise","spinnerTimeout","loadingShown","shouldTransition","heightTransition","err","panelTransition","startHeight","outgoingPanel","heightChanged","promises","PanelSet"],"mappings":"AAgEO,MAAMA,IAAN,MAAMA,EAAS;AAAA,EA6HrB,YAAYC,GAAyCC,IAA0B,IAAI;AA1GnF,SAAQ,uBAA+B,GACvC,KAAQ,kBAA2B;A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K,KAAK,gBAAgByB,CAAO,EAAE;AACnC;AAAA,QACD;AAEA,aAAK,eAAezB,CAAQ,GAC5B,KAAK,KAAK,KAAKyB,CAAO,EAAE;AAGxB,cAAMlB,IAAYzC,EAAQ,aAAa,KAAK,OAAO;AACnD,QAAIyC,MAAc,MAASA,MAAc,UACxC,KAAK,iBAAiBP,GAAUO,CAAS,GAG1C,KAAK,UAAiC,yBAAyB;AAAA,UAC9D,SAAAkB;AAAA,UACA,SAAS3D,EAAQ,WAAW;AAAA,QAAA,CAC5B;AAAA,MACF,CAAC;AAAA,IACF,CAAC;AAAA,EAEF;AACD;AAnwBCF,EAAO,WAAuD;AAAA,EAC7D,aAAa;AAAA,EACb,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,WAAW;AAAA,EACX,OAAO;AAAA;AARF,IAAM+E,IAAN/E;"}
1
+ {"version":3,"file":"panelset.js","sources":["../src/lib/index.ts"],"sourcesContent":["import './styles/panelset.scss';\n\n// Configuration types\nexport interface PanelSetConfig {\n\tselector?: string;\n\ttransitions?: boolean | {\n\t\tpanels?: boolean;\n\t\theight?: boolean;\n\t};\n\tclosable?: boolean;\n\temptyPanelHeight?: number;\n\tloadingDelay?: number;\n\tautoFocus?: boolean | 'heading' | 'first';\n\tdebug?: boolean;\n}\n\n// Event detail types\nexport interface ReadyEventDetail {\n\tcontainer: HTMLElement;\n\tinstance: PanelSet;\n}\n\nexport interface BeforeActivateEventDetail {\n\tpanelId: string;\n\ttargetPanel: HTMLElement;\n\toutgoingPanel: HTMLElement | null;\n\tsignal: AbortSignal;\n\tpromise: Promise<void> | null;\n}\n\nexport interface ActivationEventDetail {\n\tpanelId: string;\n\ttrigger: HTMLElement | null;\n}\n\nexport interface ActivationAbortedEventDetail {\n\tpanelId: string;\n\ttrigger: HTMLElement | null;\n}\n\n// Handler options\nexport interface HandlerOptions {\n\tonce?: boolean;\n}\n\n// Show options\nexport interface ShowOptions {\n\tevent?: Event;\n\ttransition?: boolean;\n\tautoFocus?: boolean | 'heading' | 'first' | ((panel: HTMLElement) => void);\n}\n\n// Async content handler type\nexport type AsyncContentHandler = (\n\ttargetPanel: HTMLElement,\n\tsignal: AbortSignal\n) => Promise<void> | void;\n\ndeclare global {\n\tinterface HTMLElement {\n\t\tpanelSet?: PanelSet;\n\t}\n}\n\nexport class PanelSet {\n\t// Default configuration\n\tstatic defaults: Required<Omit<PanelSetConfig, 'selector'>> = {\n\t\ttransitions: true,\n\t\tclosable: false,\n\t\temptyPanelHeight: 200,\n\t\tloadingDelay: 300,\n\t\tautoFocus: true,\n\t\tdebug: false\n\t};\n\n\t// Instance properties\n\telement!: HTMLElement;\n\tconfig!: Required<Omit<PanelSetConfig, 'selector'>>;\n\tpanels!: HTMLElement[];\n\tactivePanel!: HTMLElement;\n\tpanelWrapper!: HTMLElement;\n\tpendingPanel!: HTMLElement;\n\n\tprivate _openCloseGeneration: number = 0;\n\tprivate _isLoadingAsync: boolean = false;\n\tprivate _currentAbortController?: AbortController;\n\n\t// Parse data attributes from element\n\tstatic _getDataConfig(element: HTMLElement): Partial<PanelSetConfig> {\n\t\tconst data = element.dataset;\n\t\tconst config: Partial<PanelSetConfig> = {};\n\n\t\t// Define attribute types\n\t\tconst attrs: Record<string, 'json' | 'boolean' | 'number'> = {\n\t\t\ttransitions: 'json',\n\t\t\tclosable: 'boolean',\n\t\t\temptyPanelHeight: 'number',\n\t\t\tloadingDelay: 'number',\n\t\t\t// We do not support autofocus here. I do not think it is needed per whole PanelSet.\n\t\t\tdebug: 'boolean'\n\t\t};\n\n\t\t// Parse each attribute\n\t\tfor (const [key, type] of Object.entries(attrs)) {\n\t\t\tif (!(key in data)) continue;\n\n\t\t\tconst value = data[key];\n\t\t\tif (value === undefined) continue;\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'boolean':\n\t\t\t\t\t(config as any)[key] = value !== 'false';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'number':\n\t\t\t\t\t(config as any)[key] = parseInt(value, 10);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'json':\n\t\t\t\t\ttry {\n\t\t\t\t\t\t(config as any)[key] = JSON.parse(value);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Fall back to boolean parsing\n\t\t\t\t\t\t(config as any)[key] = value !== 'false';\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn config;\n\t}\n\n\t// Merge configurations\n\tstatic _mergeConfig(\n\t\tdefaults: Required<Omit<PanelSetConfig, 'selector'>>,\n\t\tdataConfig: Partial<PanelSetConfig>,\n\t\toptions: Partial<PanelSetConfig>\n\t): Required<Omit<PanelSetConfig, 'selector'>> {\n\t\treturn {\n\t\t\t...defaults,\n\t\t\t...dataConfig,\n\t\t\t...options\n\t\t} as Required<Omit<PanelSetConfig, 'selector'>>;\n\t}\n\n\t/**\n\t * Initialize PanelSet instances\n\t * @param selectorOrOptions - CSS selector string or config object\n\t * @param options - Additional config options (when first param is selector)\n\t * @returns Array of PanelSet instances\n\t */\n\tstatic init(selectorOrOptions: string | PanelSetConfig = {}, options: PanelSetConfig = {}): PanelSet[] {\n\t\t// Handle different call signatures\n\t\tlet selector: string;\n\t\tlet config: PanelSetConfig;\n\n\t\tif (typeof selectorOrOptions === 'string') {\n\t\t\t// init('#demo') or init('#demo', {debug: true})\n\t\t\tselector = selectorOrOptions;\n\t\t\tconfig = options;\n\t\t} else {\n\t\t\t// init() or init({selector: '#demo', debug: true})\n\t\t\tconfig = selectorOrOptions;\n\t\t\tselector = config.selector || '[data-panelset]';\n\t\t}\n\n\t\tconst elements = document.querySelectorAll<HTMLElement>(selector);\n\t\tconst instances: PanelSet[] = [];\n\n\t\telements.forEach(el => {\n\n\t\t\ttry {\n\t\t\t\tPanelSet._validateElement(el);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error((error as Error).message);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip if already initialized\n\t\t\tif (el.panelSet || el.dataset.panelset === 'true') {\n\t\t\t\tif (el.panelSet) instances.push(el.panelSet);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst instance = new PanelSet(el, config);\n\t\t\tinstances.push(instance);\n\t\t});\n\n\t\treturn instances;\n\t}\n\n\tconstructor(elementOrSelector: HTMLElement | string, options: PanelSetConfig = {}) {\n\t\t// Handle both element and selector\n\t\tlet element: HTMLElement | null;\n\t\tif (typeof elementOrSelector === 'string') {\n\t\t\telement = document.querySelector<HTMLElement>(elementOrSelector);\n\t\t\tif (!element) {\n\t\t\t\tthrow new Error(`PanelSet: No element found for selector \"${elementOrSelector}\"`);\n\t\t\t}\n\t\t} else {\n\t\t\telement = elementOrSelector;\n\t\t}\n\n\t\tthis.element = element;\n\n\t\t// Validate element\n\t\tPanelSet._validateElement(element);\n\n\t\t// Check if already initialized\n\t\tif (element.panelSet || element.dataset.panelset === 'true') {\n\t\t\tconsole.warn('PanelSet: Element already initialized, returning existing instance');\n\t\t\treturn element.panelSet!;\n\t\t}\n\n\t\t// Store instance on element\n\t\telement.panelSet = this;\n\n\t\tconst dataConfig = PanelSet._getDataConfig(element);\n\t\tthis.config = PanelSet._mergeConfig(\n\t\t\tPanelSet.defaults,\n\t\t\tdataConfig,\n\t\t\toptions\n\t\t);\n\n\t\tthis.panels = Array.from(element.querySelectorAll<HTMLElement>('[role=\"tabpanel\"]'));\n\n\t\tif (this.panels.length === 0) {\n\t\t\tconst elementDesc = `<${element.tagName.toLowerCase()}${element.id ? ` id=\"${element.id}\"` : ''}${element.className ? ` class=\"${element.className}\"` : ''}>`;\n\t\t\tconsole.error(`PanelSet: No panels with [role=\"tabpanel\"] found inside ${elementDesc}. Make sure panel elements are children of the [data-panelset] element.`);\n\t\t\t// Set safe defaults and bail\n\t\t\tthis.panels = [];\n\t\t\tthis.activePanel = null as any;\n\t\t\tthis.panelWrapper = null as any;\n\t\t\tthis.pendingPanel = null as any;\n\t\t\treturn;\n\t\t}\n\n\n\t\tthis.activePanel =\n\t\t\tthis.panels.find(p => p.classList.contains('active')) || this.panels[0];\n\t\tthis.panelWrapper =\n\t\t\tthis.element.querySelector<HTMLElement>('.panel-wrapper') || this._autoWrapPanels();\n\n\t\tthis.pendingPanel = this.activePanel;\n\n\n\n\n\t\tthis.element.dataset.panelset = 'true';\n\n\t\tthis._log(`Initialized (${this.panels.length} panels)`);\n\t\tthis._dispatch<ReadyEventDetail>('ps:ready', { container: this.element, instance: this });\n\n\t\tthis._internalInit();\n\n\t\tthis._syncAriaWithActivePanel();\n\n\t\tlet resizeTimeout: ReturnType<typeof setTimeout>;\n\t\twindow.addEventListener('resize', () => {\n\t\t\tclearTimeout(resizeTimeout);\n\t\t\tresizeTimeout = setTimeout(() => {\n\t\t\t\tthis._updateHighestPanel();\n\t\t\t}, 250);\n\t\t});\n\n\t}\n\n\t// Debug logging helper\n\tprivate _log(message: string): void {\n\t\tif (!this.config.debug) return;\n\t\tconst id = this.element.id || 'no id';\n\t\tconsole.log(`[PanelSet] - \"${id}\" -`, message);\n\t}\n\n\tprivate static _validateElement(element: HTMLElement): void {\n\t\tif (!element.hasAttribute('data-panelset')) {\n\t\t\tconst elementDesc = `<${element.tagName.toLowerCase()}${element.id ? ` id=\"${element.id}\"` : ''}${element.className ? ` class=\"${element.className}\"` : ''}>`;\n\t\t\tthrow new Error(`PanelSet: Element is missing required data-panelset attribute. Element: ${elementDesc}`);\n\t\t}\n\t}\n\n\tprivate _autoWrapPanels(): HTMLElement {\n\t\tconst wrapper = document.createElement('div');\n\t\twrapper.className = 'panel-wrapper';\n\t\tthis.panels.forEach(panel => wrapper.appendChild(panel));\n\t\tthis.element.appendChild(wrapper);\n\t\treturn wrapper;\n\t}\n\n\tprivate _internalInit(): void {\n\t\tthis.panels.forEach(panel => {\n\t\t\tpanel.classList.remove('fade', 'incoming');\n\t\t\tif (panel !== this.activePanel) {\n\t\t\t\tpanel.hidden = true;\n\t\t\t\tpanel.classList.remove('active');\n\t\t\t} else {\n\t\t\t\tpanel.hidden = false;\n\t\t\t\tpanel.classList.add('active');\n\t\t\t}\n\t\t});\n\t\tthis.element.style.height = '';\n\t\tthis._updateHighestPanel();\n\t}\n\t\n\n\t// Dispatch custom event helper\n\tprivate _dispatch<T = unknown>(eventName: string, detail: T): void {\n\t\tthis.element.dispatchEvent(\n\t\t\tnew CustomEvent(eventName, {\n\t\t\t\tdetail,\n\t\t\t\tbubbles: true,\n\t\t\t\tcancelable: false\n\t\t\t})\n\t\t);\n\t}\n\n\t/* --- Modular helpers --- */\n\n\tprivate _getVerticalMetrics(el: HTMLElement | null): number {\n\t\tif (!el) return 0;\n\t\tconst s = getComputedStyle(el);\n\t\treturn ['paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth']\n\t\t\t.reduce((sum, prop) => sum + (parseFloat(s[prop as keyof CSSStyleDeclaration] as string) || 0), 0);\n\t}\n\n\tprivate _measureHeight(panel: HTMLElement): number {\n\t\tlet total = panel.offsetHeight;\n\t\ttotal += this._getVerticalMetrics(this.panelWrapper);\n\t\ttotal += this._getVerticalMetrics(this.element);\n\t\treturn total;\n\t}\n\n\tprivate _updateHighestPanel(): void {\n\n\t\t// Warn if user tries self-tracking\n\t\tif (this.element.hasAttribute('data-ps-track-height')) {\n\t\t\tconsole.warn('PanelSet: data-ps-track-height should be placed on a parent element, not on [data-panelset] itself. Height tracking skipped.');\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t// Look for parent with tracking attribute\n\t\tconst trackingParent = this.element.closest('[data-ps-track-height]');\n\t\tif (!trackingParent) return; // Skip if no tracking parent found\n\t\t\n\t\tlet maxContainerHeight = 0;\n\t\t\n\t\t// Measure each panel as if it were active\n\t\tthis.panels.forEach(panel => {\n\t\t\t// Save state\n\t\t\tconst wasHidden = panel.hidden;\n\t\t\tconst wasActive = panel.classList.contains('active');\n\t\t\t\n\t\t\t// Make this panel active temporarily\n\t\t\tthis.panels.forEach(p => {\n\t\t\t\tp.hidden = true;\n\t\t\t\tp.classList.remove('active');\n\t\t\t});\n\t\t\t\n\t\t\tpanel.hidden = false;\n\t\t\tpanel.classList.add('active');\n\t\t\tpanel.style.visibility = 'hidden';\n\t\t\t\n\t\t\t// Force reflow\n\t\t\tthis.element.offsetHeight;\n\t\t\t\n\t\t\t// Measure the CONTAINER height (includes padding and borders)\n\t\t\tconst containerHeight = this.element.offsetHeight;\n\t\t\tif (containerHeight > maxContainerHeight) {\n\t\t\t\tmaxContainerHeight = containerHeight;\n\t\t\t}\n\t\t\t\n\t\t\t// Restore state\n\t\t\tpanel.hidden = wasHidden;\n\t\t\tif (!wasActive) panel.classList.remove('active');\n\t\t\tpanel.style.visibility = '';\n\t\t});\n\n\t\tif (this.activePanel) {\n\t\t\tthis.activePanel.hidden = false;\n\t\t\tthis.activePanel.classList.add('active');\n\t\t}\n\t\tthis.panels.forEach(p => {\n\t\t\tif (p !== this.activePanel) {\n\t\t\t\tp.hidden = true;\n\t\t\t\tp.classList.remove('active');\n\t\t\t}\n\t\t});\n\t\t\n\t\t// Set CSS variable on the tracking parent\n\t\t(trackingParent as HTMLElement).style.setProperty('--ps-max-height', `${maxContainerHeight}px`);\n\t\tthis._log(`Max container height: ${maxContainerHeight}px (set on tracking parent)`);\n\t}\n\n\tprivate _cleanupPanels(newPanel: HTMLElement): void {\n\t\tthis.panels.forEach(panel => {\n\t\t\tpanel.classList.remove('fade', 'incoming');\n\t\t\tif (panel !== newPanel) {\n\t\t\t\tpanel.classList.remove('active');\n\t\t\t\tpanel.hidden = true;\n\t\t\t} else {\n\t\t\t\tpanel.classList.add('active');\n\t\t\t\tpanel.hidden = false;\n\t\t\t}\n\t\t});\n\t\tthis.element.style.height = '';\n\t\tthis.element.classList.remove('is-transitioning');\n\t\tthis.activePanel = newPanel;\n\t}\n\n\tprivate _waitForTransition(element: HTMLElement): Promise<void> {\n\t\treturn new Promise(resolve => {\n\t\t\tconst styles = getComputedStyle(element);\n\t\t\tconst duration = parseFloat(styles.transitionDuration) || 0;\n\t\t\tconst delay = parseFloat(styles.transitionDelay) || 0;\n\t\t\tif (duration + delay === 0) {\n\t\t\t\tresolve();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst handler = (e: TransitionEvent) => {\n\t\t\t\tif (e.target !== element) return;\n\t\t\t\telement.removeEventListener('transitionend', handler);\n\t\t\t\tresolve();\n\t\t\t};\n\t\t\telement.addEventListener('transitionend', handler);\n\t\t});\n\t}\n\n\tprivate _handleAutoFocus(panel: HTMLElement, autoFocus: boolean | 'heading' | 'first' | ((panel: HTMLElement) => void), event?: Event): void {\n\n\t\tthis._log(`AutoFocus called with event: ${event ? event.type : 'none'}`);\n\n\t\tif (autoFocus && event) {\n\t\t\tconst isKeyboardEvent = \n\t\t\t\tevent.type.startsWith('key') || \n\t\t\t\t(event instanceof MouseEvent && event.detail === 0);\n\t\t\t\n\t\t\t// If touch/mouse, skip autofocus\n\t\t\tif (!isKeyboardEvent) {\n\t\t\t\tthis._log('Skipping autofocus (touch/mouse interaction)');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (autoFocus === true) {\n\t\t\t// Focus the panel itself\n\t\t\tif (!panel.hasAttribute('tabindex')) {\n\t\t\t\tpanel.setAttribute('tabindex', '-1');\n\t\t\t}\n\t\t\tpanel.focus();\n\t\t\tthis._log(`Auto-focused panel: ${panel.id}`);\n\t\t} else if (autoFocus === 'heading') {\n\t\t\t// Focus first heading\n\t\t\tconst heading = panel.querySelector<HTMLElement>('h1, h2, h3, h4, h5, h6');\n\t\t\tif (heading) {\n\t\t\t\tif (!heading.hasAttribute('tabindex')) {\n\t\t\t\t\theading.setAttribute('tabindex', '-1');\n\t\t\t\t}\n\t\t\t\theading.focus();\n\t\t\t\tthis._log(`Auto-focused heading in: ${panel.id}`);\n\t\t\t}\n\t\t} else if (autoFocus === 'first') {\n\t\t\t// Focus first focusable element\n\t\t\tconst focusable = panel.querySelector<HTMLElement>('a, button, input, select, textarea, [tabindex]:not([tabindex=\"-1\"])');\n\t\t\tif (focusable) {\n\t\t\t\tfocusable.focus();\n\t\t\t\tthis._log(`Auto-focused first element in: ${panel.id}`);\n\t\t\t}\n\t\t} else if (typeof autoFocus === 'function') {\n\t\t\t// Custom function\n\t\t\tautoFocus(panel);\n\t\t\tthis._log(`Auto-focused (custom) in: ${panel.id}`);\n\t\t}\n\t}\n\n\n\tprivate _syncAriaWithActivePanel(): void {\n\t\tif (!this.activePanel?.id) return;\n\t\t\n\t\t// Find tab that controls the active panel\n\t\tconst controllingTab = document.querySelector(\n\t\t\t`[role=\"tab\"][aria-controls=\"${this.activePanel.id}\"]`\n\t\t) as HTMLElement;\n\t\t\n\t\tif (!controllingTab) {\n\t\t\t// No tab found for active panel - might be a sub-panel\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t// Update all tabs in the tablist\n\t\tconst tablist = controllingTab.closest('[role=\"tablist\"]');\n\t\tif (tablist) {\n\t\t\tconst allTabs = tablist.querySelectorAll('[role=\"tab\"]');\n\t\t\tallTabs.forEach(tab => {\n\t\t\t\ttab.setAttribute('aria-selected', 'false');\n\t\t\t});\n\t\t\tcontrollingTab.setAttribute('aria-selected', 'true');\n\t\t}\n\t}\n\n\n\n\t// Shared helper for open/close\n\tprivate _animateOpenClose(isOpening: boolean, withTransition: boolean): void {\n\t\tconst action = isOpening ? 'opening' : 'closing';\n\t\tconst oppositeAction = isOpening ? 'closing' : 'opening';\n\t\tconst oppositeClass = `is-${oppositeAction}`;\n\t\tconst actionClass = `is-${action}`;\n\n\t\tthis._log(isOpening ? 'Opening' : 'Closing');\n\n\t\tthis._openCloseGeneration++;\n\t\tconst myGeneration = this._openCloseGeneration;\n\n\t\t// Remove opposite state if interrupting\n\t\tif (this.element.classList.contains(oppositeClass)) {\n\t\t\tthis.element.classList.remove(oppositeClass);\n\t\t}\n\n\t\tconst targetHeight = isOpening ? this._measureHeight(this.pendingPanel) : 0;\n\n\t\tif (withTransition && this.config.transitions) {\n\t\t\tthis.element.classList.add(actionClass);\n\n\t\t\tconst currentHeight = this.element.offsetHeight;\n\t\t\tthis.element.style.height = `${currentHeight}px`;\n\n\t\t\tif (isOpening) this.element.classList.remove('is-closed');\n\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tthis.element.style.height = `${targetHeight}px`;\n\n\t\t\t\tthis._waitForTransition(this.element).then(() => {\n\t\t\t\t\tif (this._openCloseGeneration === myGeneration) {\n\t\t\t\t\t\tthis.element.style.height = '';\n\t\t\t\t\t\tthis.element.classList.remove(actionClass);\n\t\t\t\t\t\tif (!isOpening) this.element.classList.add('is-closed');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t} else {\n\t\t\tif (isOpening) {\n\t\t\t\tthis.element.classList.remove('is-closed');\n\t\t\t} else {\n\t\t\t\tthis.element.classList.add('is-closed');\n\t\t\t}\n\t\t\tthis.element.style.height = '';\n\t\t}\n\t}\n\n\t/**\n\t * Get the ID of the currently active panel\n\t * @returns Panel ID or null if no panel is active\n\t */\n\tgetActive(): string | null {\n\t\treturn this.pendingPanel?.id || null;\n\t}\n\n\n\t/**\n\t * Open a closable panelset\n\t * @param options - Configuration options\n\t */\n\topen(options?: ShowOptions): void {\n\t\tconst {\n\t\t\tevent,\n\t\t\ttransition = true,\n\t\t\tautoFocus\n\t\t} = options || {};\n\n\t\tif (!this.config.closable) {\n\t\t\tthis._log('Cannot open: closable is false');\n\t\t\treturn;\n\t\t}\n\n\t\tconst isClosed = this.element.classList.contains('is-closed');\n\t\tconst isClosing = this.element.classList.contains('is-closing');\n\n\t\tif (!isClosed && !isClosing) return;\n\n\t\tthis._animateOpenClose(true, transition);\n\t\t\n\t\t// Handle autofocus after opening\n\t\tconst finalAutoFocus = autoFocus ?? this.config.autoFocus;\n\t\tif (finalAutoFocus !== false && finalAutoFocus !== undefined && this.pendingPanel) {\n\t\t\tif (transition && this.config.transitions) {\n\t\t\t\tthis._waitForTransition(this.element).then(() => {\n\t\t\t\t\tthis._handleAutoFocus(this.pendingPanel, finalAutoFocus, event);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis._handleAutoFocus(this.pendingPanel, finalAutoFocus, event);\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/**\n\t * Close a closable panelset\n\t * @param options - Configuration options\n\t */\n\tclose(options?: ShowOptions): void {\n\t\tconst {\n\t\t\ttransition = true\n\t\t} = options || {};\n\n\t\tif (!this.config.closable) {\n\t\t\tthis._log('Cannot close: closable is false');\n\t\t\treturn;\n\t\t}\n\n\t\tconst isClosed = this.element.classList.contains('is-closed');\n\t\tconst isOpening = this.element.classList.contains('is-opening');\n\n\t\tif (isClosed && !isOpening) return;\n\n\t\tthis._animateOpenClose(false, transition);\n\t}\n\n\n\t/**\n\t * Toggle a closable panelset between open and closed\n\t * @param options - Configuration options\n\t */\n\ttoggle(options?: ShowOptions): void {\n\t\tconst {\n\t\t\tevent,\n\t\t\ttransition = true,\n\t\t\tautoFocus\n\t\t} = options || {};\n\n\t\tconst isClosed = this.element.classList.contains('is-closed');\n\t\tconst isClosing = this.element.classList.contains('is-closing');\n\n\t\t// If closed or closing, open it\n\t\tif (isClosed || isClosing) {\n\t\t\tthis.open({ event, transition, autoFocus });\n\t\t} else {\n\t\t\tthis.close({ transition });\n\t\t}\n\t}\n\n\t/**\n\t * Register a handler for async content loading\n\t * @param handler - Async content handler function\n\t * @param options - Handler options (once: whether to load only once)\n\t */\n\tonBeforeActivate(handler: AsyncContentHandler, options: HandlerOptions = {}): void {\n\t\tconst once = options.once === true; // Default: false (always reload)\n\n\t\tthis.element.addEventListener('ps:beforeactivate', (e) => {\n\t\t\tconst event = e as CustomEvent<BeforeActivateEventDetail>;\n\t\t\tconst { targetPanel, signal } = event.detail;\n\n\t\t\t// Skip if already loaded and once=true\n\t\t\tif (once && targetPanel.dataset.loaded === 'true') {\n\t\t\t\tif (this.config.debug) {\n\t\t\t\t\tthis._log(`Skipping ${targetPanel.id} (already loaded)`);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Call user handler\n\t\t\tconst result = handler(targetPanel, signal);\n\n\t\t\t// If handler returns a promise, attach it to the event\n\t\t\tif (result && typeof result.then === 'function') {\n\t\t\t\tevent.detail.promise = result\n\t\t\t\t\t.then(() => {\n\t\t\t\t\t\t// Auto-mark as loaded on success if once=true\n\t\t\t\t\t\tif (once) {\n\t\t\t\t\t\t\ttargetPanel.dataset.loaded = 'true';\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.catch(error => {\n\t\t\t\t\t\tif (error.name === 'AbortError') {\n\t\t\t\t\t\t\tif (this.config.debug) {\n\t\t\t\t\t\t\t\tthis._log(`Load aborted: ${targetPanel.id}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis._log(`Load failed: ${error.message}`);\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\t/* --- Main logic --- */\n\n\n\t/**\n\t * Show a panel by ID\n\t * @param panelId - ID of the panel to show\n\t * @param options - Configuration options for this activation\n\t */\n\tasync show(panelId: string, options?: ShowOptions): Promise<void> {\n\t\tconst {\n\t\t\tevent,\n\t\t\ttransition = true,\n\t\t\tautoFocus\n\t\t} = options || {};\n\n\t\t// Always derive trigger from event\n\t\tconst resolvedTrigger = event?.target instanceof HTMLElement \n\t\t\t? (event.target.closest('button, a, [role=\"tab\"]') as HTMLElement) ?? event.target\n\t\t\t: null;\n\n\t\t// Update ARIA attributes immediately (before transitions) if trigger is a tab\n\t\tif (resolvedTrigger?.getAttribute('role') === 'tab') {\n\t\t\tconst tablist = resolvedTrigger.closest('[role=\"tablist\"]');\n\t\t\tif (tablist) {\n\t\t\t\tconst allTabs = tablist.querySelectorAll('[role=\"tab\"]');\n\t\t\t\tallTabs.forEach(tab => {\n\t\t\t\t\ttab.setAttribute('aria-selected', 'false');\n\t\t\t\t});\n\t\t\t\tresolvedTrigger.setAttribute('aria-selected', 'true');\n\t\t\t}\n\t\t}\n\n\t\tconst newPanel = this.panels.find(p => p.id === panelId);\n\n\t\tif (!newPanel) {\n\t\t\tthis._log(`Panel not found: ${panelId}`);\n\t\t\treturn;\n\t\t}\n\n\t\tif (newPanel === this.pendingPanel) return;\n\n\t\tconst prevPanel = this.pendingPanel;\n\t\tconst prevPanelId = prevPanel?.id;\n\t\tthis.pendingPanel = newPanel;\n\n\t\tthis.element.classList.remove('is-loading');\n\n\t\tif (prevPanel && prevPanel !== this.activePanel && prevPanel !== newPanel) {\n\t\t\tprevPanel.classList.remove('incoming');\n\t\t\tif (prevPanel.hidden) {\n\t\t\t\t// Was never visible, keep hidden\n\t\t\t} else {\n\t\t\t\tprevPanel.classList.remove('active');\n\t\t\t}\n\t\t}\n\n\t\tconst wasLoadingAsync = this._isLoadingAsync;\n\n\t\tif (this._currentAbortController) {\n\t\t\tthis._currentAbortController.abort();\n\n\t\t\tif (wasLoadingAsync && prevPanelId && prevPanelId !== panelId) {\n\t\t\t\tthis._dispatch<ActivationAbortedEventDetail>('ps:activationaborted', {\n\t\t\t\t\tpanelId: prevPanelId,\n\t\t\t\t\ttrigger: resolvedTrigger\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tconst abortController = new AbortController();\n\t\tthis._currentAbortController = abortController;\n\t\tthis._isLoadingAsync = false;\n\n\t\tthis._log(`${prevPanel?.id || 'none'} → ${panelId}`);\n\n\t\tconst beforeActivateDetail: BeforeActivateEventDetail = {\n\t\t\tpanelId,\n\t\t\ttargetPanel: newPanel,\n\t\t\toutgoingPanel: prevPanel,\n\t\t\tsignal: abortController.signal,\n\t\t\tpromise: null\n\t\t};\n\n\t\tconst beforeActivateEvent = new CustomEvent('ps:beforeactivate', {\n\t\t\tdetail: beforeActivateDetail,\n\t\t\tbubbles: true,\n\t\t\tcancelable: false\n\t\t});\n\n\t\tthis.element.dispatchEvent(beforeActivateEvent);\n\n\t\tconst userPromise = beforeActivateDetail.promise;\n\n\t\tif (userPromise) {\n\t\t\tthis._isLoadingAsync = true;\n\t\t\tthis._log('Waiting for content...');\n\n\t\t\tlet spinnerTimeout: ReturnType<typeof setTimeout> | undefined;\n\t\t\tlet loadingShown = false;\n\n\t\t\tif (this.config.loadingDelay > 0) {\n\t\t\t\tspinnerTimeout = setTimeout(() => {\n\t\t\t\t\tthis.element.classList.add('is-loading');\n\t\t\t\t\tloadingShown = true;\n\t\t\t\t}, this.config.loadingDelay);\n\t\t\t} else {\n\t\t\t\tthis.element.classList.add('is-loading');\n\t\t\t\tloadingShown = true;\n\t\t\t}\n\n\t\t\tconst hasPreviousPanel = this.activePanel && this.activePanel !== newPanel;\n\n\t\t\tif (!hasPreviousPanel) {\n\t\t\t\tconst shouldTransition = transition !== false && this.config.transitions !== false;\n\t\t\t\tlet heightTransition = shouldTransition;\n\t\t\t\tif (typeof this.config.transitions === 'object') {\n\t\t\t\t\theightTransition = shouldTransition && this.config.transitions.height !== false;\n\t\t\t\t}\n\n\t\t\t\tif (heightTransition) {\n\t\t\t\t\tconst currentHeight = this.element.offsetHeight;\n\t\t\t\t\tthis.element.style.height = `${currentHeight}px`;\n\n\t\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\t\tthis.element.style.height = `${this.config.emptyPanelHeight}px`;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait userPromise;\n\n\t\t\t\tif (spinnerTimeout) clearTimeout(spinnerTimeout);\n\n\t\t\t\tif (abortController.signal.aborted) {\n\t\t\t\t\tthis._log(`Aborted during load: ${panelId}`);\n\t\t\t\t\tif (loadingShown) this.element.classList.remove('is-loading');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis._log('Content loaded');\n\n\t\t\t\tif (newPanel.dataset.loaded === 'true') {\n\t\t\t\t\tthis._updateHighestPanel();\n\t\t\t\t}\n\n\t\t\t} catch (error) {\n\t\t\t\tif (spinnerTimeout) clearTimeout(spinnerTimeout);\n\n\t\t\t\tconst err = error as Error;\n\t\t\t\tthis._log(`Load failed: ${err.message}`);\n\t\t\t\tif (loadingShown) this.element.classList.remove('is-loading');\n\n\t\t\t\tif (err.name !== 'AbortError') {\n\t\t\t\t\tconsole.error('Panel load error:', error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (loadingShown) this.element.classList.remove('is-loading');\n\t\t}\n\n\t\tif (abortController.signal.aborted) {\n\t\t\tthis._log(`Aborted: ${panelId}`);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._dispatch<ActivationEventDetail>('ps:activationstart', {\n\t\t\tpanelId,\n\t\t\ttrigger: resolvedTrigger\n\t\t});\n\n\t\tconst shouldTransition = transition !== false && this.config.transitions !== false;\n\n\t\tlet panelTransition = shouldTransition;\n\t\tlet heightTransition = shouldTransition;\n\n\t\tif (typeof this.config.transitions === 'object') {\n\t\t\tpanelTransition = shouldTransition && this.config.transitions.panels !== false;\n\t\t\theightTransition = shouldTransition && this.config.transitions.height !== false;\n\t\t}\n\n\t\tthis.panels.forEach(panel => panel.classList.toggle('fade', panelTransition));\n\n\t\tconst startHeight = this.element.offsetHeight;\n\t\tif (heightTransition) {\n\t\t\tthis.element.style.height = `${startHeight}px`;\n\t\t}\n\n\t\tconst outgoingPanel = this.activePanel;\n\n\t\tnewPanel.hidden = false;\n\t\tnewPanel.classList.add('incoming');\n\t\tif (panelTransition) {\n\t\t\tthis.element.classList.add('is-transitioning');\n\t\t}\n\t\tif (outgoingPanel && outgoingPanel !== newPanel) {\n\t\t\toutgoingPanel.classList.remove('active', 'incoming');\n\t\t\toutgoingPanel.hidden = false;\n\t\t}\n\n\t\trequestAnimationFrame(() => {\n\t\t\tnewPanel.classList.add('active');\n\t\t\tif (outgoingPanel && outgoingPanel !== newPanel) {\n\t\t\t\toutgoingPanel.classList.remove('incoming');\n\t\t\t}\n\n\t\t\tconst targetHeight = this._measureHeight(newPanel);\n\t\t\tconst heightChanged = startHeight !== targetHeight;\n\n\t\t\tif (heightTransition) {\n\t\t\t\tthis.element.style.height = `${targetHeight}px`;\n\t\t\t}\n\n\t\t\tconst promises: Promise<void>[] = [];\n\t\t\tif (panelTransition) {\n\t\t\t\tpromises.push(this._waitForTransition(newPanel));\n\t\t\t}\n\t\t\tif (heightTransition && heightChanged) {\n\t\t\t\tpromises.push(this._waitForTransition(this.element));\n\t\t\t}\n\t\t\tif (!promises.length) promises.push(Promise.resolve());\n\n\t\t\tPromise.all(promises).then(() => {\n\t\t\t\tif (this.pendingPanel !== newPanel) {\n\t\t\t\t\tthis._log(`Interrupted: ${panelId}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis._cleanupPanels(newPanel);\n\t\t\t\tthis._log(`✓ ${panelId}`);\n\n\t\t\t\t// Handle auto-focus\n\t\t\t\tconst finalAutoFocus = autoFocus ?? this.config.autoFocus;\n\t\t\t\tif (finalAutoFocus !== false && finalAutoFocus !== undefined) {\n\t\t\t\t\tthis._handleAutoFocus(newPanel, finalAutoFocus, event);\n\t\t\t\t}\n\n\t\t\t\tthis._dispatch<ActivationEventDetail>('ps:activationcomplete', {\n\t\t\t\t\tpanelId,\n\t\t\t\t\ttrigger: resolvedTrigger\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\n}\n\nexport default PanelSet;"],"names":["_PanelSet","elementOrSelector","options","element","dataConfig","elementDesc","p","resizeTimeout","data","config","attrs","key","type","value","defaults","selectorOrOptions","selector","elements","instances","el","error","instance","message","id","wrapper","panel","eventName","detail","s","sum","prop","total","trackingParent","maxContainerHeight","wasHidden","wasActive","containerHeight","newPanel","resolve","styles","duration","delay","handler","e","autoFocus","event","heading","focusable","controllingTab","tablist","tab","isOpening","withTransition","action","oppositeClass","actionClass","myGeneration","targetHeight","currentHeight","transition","isClosed","isClosing","finalAutoFocus","once","targetPanel","signal","result","panelId","resolvedTrigger","prevPanel","prevPanelId","wasLoadingAsync","abortController","beforeActivateDetail","beforeActivateEvent","userPromise","spinnerTimeout","loadingShown","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,UAAU,UAAU,GACnDA,EAAc,SAAS,KAGxB,sBAAsB,MAAM;AAC3B,MAAA9C,EAAS,UAAU,IAAI,QAAQ,GAC3B8C,KAAiBA,MAAkB9C,KACtC8C,EAAc,UAAU,OAAO,UAAU;AAG1C,YAAM1B,IAAe,KAAK,eAAepB,CAAQ,GAC3C+C,IAAgBF,MAAgBzB;AAEtC,MAAIsB,MACH,KAAK,QAAQ,MAAM,SAAS,GAAGtB,CAAY;AAG5C,YAAM4B,IAA4B,CAAA;AAClC,MAAIJ,KACHI,EAAS,KAAK,KAAK,mBAAmBhD,CAAQ,CAAC,GAE5C0C,KAAoBK,KACvBC,EAAS,KAAK,KAAK,mBAAmB,KAAK,OAAO,CAAC,GAE/CA,EAAS,YAAiB,KAAK,QAAQ,SAAS,GAErD,QAAQ,IAAIA,CAAQ,EAAE,KAAK,MAAM;AAChC,YAAI,KAAK,iBAAiBhD,GAAU;AACnC,eAAK,KAAK,gBAAgB8B,CAAO,EAAE;AACnC;AAAA,QACD;AAEA,aAAK,eAAe9B,CAAQ,GAC5B,KAAK,KAAK,KAAK8B,CAAO,EAAE;AAGxB,cAAML,IAAiBlB,KAAa,KAAK,OAAO;AAChD,QAAIkB,MAAmB,MAASA,MAAmB,UAClD,KAAK,iBAAiBzB,GAAUyB,GAAgBjB,CAAK,GAGtD,KAAK,UAAiC,yBAAyB;AAAA,UAC9D,SAAAsB;AAAA,UACA,SAASC;AAAA,QAAA,CACT;AAAA,MACF,CAAC;AAAA,IACF,CAAC;AAAA,EACF;AAGD;AAn2BCpE,EAAO,WAAuD;AAAA,EAC7D,aAAa;AAAA,EACb,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,WAAW;AAAA,EACX,OAAO;AAAA;AARF,IAAMsF,IAANtF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "panelset",
3
- "version": "1.0.0",
3
+ "version": "1.0.4",
4
4
  "description": "Flexible panel management with smooth transitions",
5
5
  "type": "module",
6
6
  "main": "./dist/panelset.js",
@@ -14,7 +14,8 @@
14
14
  },
15
15
  "files": [
16
16
  "dist",
17
- "README.md"
17
+ "README.md",
18
+ "CHANGELOG.md"
18
19
  ],
19
20
  "scripts": {
20
21
  "start": "npm run dev",