juxscript 1.1.215 → 1.1.217

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.
@@ -111,6 +111,7 @@ export class Tabs extends BaseComponent {
111
111
  tabPanel.innerHTML = tab.content;
112
112
  }
113
113
  else if (tab.content instanceof BaseComponent) {
114
+ // Now panel exists in DOM, so render() can find it
114
115
  tab.content.render(`#${tabPanel.id}`);
115
116
  }
116
117
  });
@@ -164,8 +165,7 @@ export class Tabs extends BaseComponent {
164
165
  return this;
165
166
  }
166
167
  /**
167
- * NEW: Append content to a specific tab
168
- * Accepts single item or array of strings/BaseComponents
168
+ * Add content to a specific tab panel
169
169
  */
170
170
  addTabContent(tabId, content) {
171
171
  const panel = document.getElementById(`${this._id}-${tabId}-panel`);
@@ -173,20 +173,17 @@ export class Tabs extends BaseComponent {
173
173
  console.warn(`[Tabs] Panel not found for tab: ${tabId}`);
174
174
  return this;
175
175
  }
176
- // Normalize to array
177
- const items = Array.isArray(content) ? content : [content];
178
- items.forEach(item => {
176
+ content.forEach(item => {
179
177
  if (typeof item === 'string') {
180
- // Append HTML string
181
178
  const tempDiv = document.createElement('div');
182
179
  tempDiv.innerHTML = item;
183
180
  while (tempDiv.firstChild) {
184
181
  panel.appendChild(tempDiv.firstChild);
185
182
  }
186
183
  }
187
- else if (item instanceof BaseComponent) {
188
- // Render component into panel
189
- item.render(`#${panel.id}`);
184
+ else if (item && typeof item.render === 'function') {
185
+ // Render the component into the panel
186
+ item.render(panel);
190
187
  }
191
188
  });
192
189
  return this;
@@ -154,6 +154,7 @@ export class Tabs extends BaseComponent<TabsState> {
154
154
  if (typeof tab.content === 'string') {
155
155
  tabPanel.innerHTML = tab.content;
156
156
  } else if (tab.content instanceof BaseComponent) {
157
+ // Now panel exists in DOM, so render() can find it
157
158
  tab.content.render(`#${tabPanel.id}`);
158
159
  }
159
160
  });
@@ -219,30 +220,25 @@ export class Tabs extends BaseComponent<TabsState> {
219
220
  }
220
221
 
221
222
  /**
222
- * NEW: Append content to a specific tab
223
- * Accepts single item or array of strings/BaseComponents
223
+ * Add content to a specific tab panel
224
224
  */
225
- addTabContent(tabId: string, content: string | BaseComponent<any> | Array<string | BaseComponent<any>>): this {
225
+ addTabContent(tabId: string, content: (string | BaseComponent<any>)[]): this {
226
226
  const panel = document.getElementById(`${this._id}-${tabId}-panel`);
227
227
  if (!panel) {
228
228
  console.warn(`[Tabs] Panel not found for tab: ${tabId}`);
229
229
  return this;
230
230
  }
231
231
 
232
- // Normalize to array
233
- const items = Array.isArray(content) ? content : [content];
234
-
235
- items.forEach(item => {
232
+ content.forEach(item => {
236
233
  if (typeof item === 'string') {
237
- // Append HTML string
238
234
  const tempDiv = document.createElement('div');
239
235
  tempDiv.innerHTML = item;
240
236
  while (tempDiv.firstChild) {
241
237
  panel.appendChild(tempDiv.firstChild);
242
238
  }
243
- } else if (item instanceof BaseComponent) {
244
- // Render component into panel
245
- item.render(`#${panel.id}`);
239
+ } else if (item && typeof item.render === 'function') {
240
+ // Render the component into the panel
241
+ item.render(panel);
246
242
  }
247
243
  });
248
244
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.1.215",
3
+ "version": "1.1.217",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "index.js",