@saasquatch/squatch-js 2.8.2-6 → 2.8.2-8

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,51 +2464,29 @@ 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
- // }
2492
2467
  async connectedCallback() {
2493
2468
  var _a2;
2494
2469
  this.loaded = true;
2495
2470
  this.container = this.getAttribute("container");
2496
- const dynamicContent = `
2497
- <div id="dynamic-content">
2471
+ const skeletonHTML = `
2472
+ <div>
2498
2473
  <h1>Dynamic Content</h1>
2499
2474
  <p>This content was dynamically added to the widget before it loaded.</p>
2500
2475
  </div>
2501
2476
  `;
2477
+ const skeletonContainer = document.createElement("div");
2478
+ skeletonContainer.id = "loading-skeleton";
2479
+ skeletonContainer.innerHTML = skeletonHTML;
2502
2480
  if (!this.shadowRoot) {
2503
2481
  this.attachShadow({ mode: "open" });
2504
2482
  }
2505
2483
  if (this.shadowRoot) {
2506
- this.shadowRoot.innerHTML = dynamicContent;
2484
+ this.shadowRoot.innerHTML = skeletonHTML;
2507
2485
  }
2508
2486
  await this.renderWidget();
2509
- const dynamicElement = (_a2 = this.shadowRoot) == null ? void 0 : _a2.getElementById("dynamic-content");
2510
- if (dynamicElement) {
2511
- dynamicElement.remove();
2487
+ const loadingElement = (_a2 = this.shadowRoot) == null ? void 0 : _a2.getElementById("loading-skeleton");
2488
+ if (loadingElement) {
2489
+ loadingElement.remove();
2512
2490
  }
2513
2491
  if (this.getAttribute("open") !== null) this.open();
2514
2492
  }
@@ -2536,9 +2514,29 @@ class DeclarativePopupWidget extends DeclarativeWidget {
2536
2514
  }
2537
2515
  }
2538
2516
  async connectedCallback() {
2517
+ var _a2;
2539
2518
  this.loaded = true;
2540
2519
  this.container = this.getAttribute("container");
2520
+ const skeletonHTML = `
2521
+ <div>
2522
+ <h1>Dynamic Content</h1>
2523
+ <p>This content was dynamically added to the widget before it loaded.</p>
2524
+ </div>
2525
+ `;
2526
+ const skeletonContainer = document.createElement("div");
2527
+ skeletonContainer.id = "loading-skeleton";
2528
+ skeletonContainer.innerHTML = skeletonHTML;
2529
+ if (!this.shadowRoot) {
2530
+ this.attachShadow({ mode: "open" });
2531
+ }
2532
+ if (this.shadowRoot) {
2533
+ this.shadowRoot.innerHTML = skeletonHTML;
2534
+ }
2541
2535
  await this.renderWidget();
2536
+ const loadingElement = (_a2 = this.shadowRoot) == null ? void 0 : _a2.getElementById("loading-skeleton");
2537
+ if (loadingElement) {
2538
+ loadingElement.remove();
2539
+ }
2542
2540
  if (this.getAttribute("open") !== null) this.open();
2543
2541
  }
2544
2542
  }