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