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