@saasquatch/squatch-js 2.8.2-3 → 2.8.2-5

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.
@@ -2464,13 +2464,47 @@ class DeclarativeEmbedWidget extends DeclarativeWidget {
2464
2464
  break;
2465
2465
  }
2466
2466
  }
2467
+ // async connectedCallback() {
2468
+ // this.loaded = true;
2469
+ // this.container = this.getAttribute("container");
2470
+ // // Dynamically assign arbitrary HTML content before rendering the widget
2471
+ // const dynamicContent = `
2472
+ // <div>
2473
+ // <h1>Dynamic Content</h1>
2474
+ // <p>This content was dynamically added to the widget before it loaded.</p>
2475
+ // </div>
2476
+ // `;
2477
+ // if (this.container) {
2478
+ // const containerElement = document.querySelector(this.container);
2479
+ // if (containerElement) {
2480
+ // containerElement.innerHTML = dynamicContent;
2481
+ // }
2482
+ // }
2483
+ // // Render the widget after setting the dynamic content
2484
+ // await this.renderWidget();
2485
+ // const slot = (
2486
+ // this.shadowRoot && Array.from(this.shadowRoot.children)
2487
+ // )?.find((c) => c.tagName === "SLOT") as Node;
2488
+ // if (slot) this.shadowRoot?.removeChild(slot);
2489
+ // if (this.getAttribute("open") !== null) this.open();
2490
+ // }
2491
+ // }
2467
2492
  async connectedCallback() {
2468
- var _a2, _b;
2469
2493
  this.loaded = true;
2470
2494
  this.container = this.getAttribute("container");
2495
+ const dynamicContent = `
2496
+ <div>
2497
+ <h1>Dynamic Content</h1>
2498
+ <p>This content was dynamically added to the widget before it loaded.</p>
2499
+ </div>
2500
+ `;
2501
+ if (!this.shadowRoot) {
2502
+ this.attachShadow({ mode: "open" });
2503
+ }
2504
+ if (this.shadowRoot) {
2505
+ this.shadowRoot.innerHTML = dynamicContent;
2506
+ }
2471
2507
  await this.renderWidget();
2472
- const slot = (_a2 = this.shadowRoot && Array.from(this.shadowRoot.children)) == null ? void 0 : _a2.find((c) => c.tagName === "SLOT");
2473
- if (slot) (_b = this.shadowRoot) == null ? void 0 : _b.removeChild(slot);
2474
2508
  if (this.getAttribute("open") !== null) this.open();
2475
2509
  }
2476
2510
  }