@saasquatch/squatch-js 2.8.2-7 → 2.8.2-9

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.
package/dist/squatch.js CHANGED
@@ -2466,31 +2466,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2466
2466
  break;
2467
2467
  }
2468
2468
  }
2469
- // async connectedCallback() {
2470
- // this.loaded = true;
2471
- // this.container = this.getAttribute("container");
2472
- // // Dynamically assign arbitrary HTML content before rendering the widget
2473
- // const dynamicContent = `
2474
- // <div>
2475
- // <h1>Dynamic Content</h1>
2476
- // <p>This content was dynamically added to the widget before it loaded.</p>
2477
- // </div>
2478
- // `;
2479
- // if (this.container) {
2480
- // const containerElement = document.querySelector(this.container);
2481
- // if (containerElement) {
2482
- // containerElement.innerHTML = dynamicContent;
2483
- // }
2484
- // }
2485
- // // Render the widget after setting the dynamic content
2486
- // await this.renderWidget();
2487
- // const slot = (
2488
- // this.shadowRoot && Array.from(this.shadowRoot.children)
2489
- // )?.find((c) => c.tagName === "SLOT") as Node;
2490
- // if (slot) this.shadowRoot?.removeChild(slot);
2491
- // if (this.getAttribute("open") !== null) this.open();
2492
- // }
2493
- // }
2494
2469
  async connectedCallback() {
2495
2470
  var _a2;
2496
2471
  this.loaded = true;
@@ -2499,6 +2474,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2499
2474
  <div>
2500
2475
  <h1>Dynamic Content</h1>
2501
2476
  <p>This content was dynamically added to the widget before it loaded.</p>
2477
+ <p>This content comes from the embeded widget class</p>
2502
2478
  </div>
2503
2479
  `;
2504
2480
  const skeletonContainer = document.createElement("div");
@@ -2543,7 +2519,27 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2543
2519
  async connectedCallback() {
2544
2520
  this.loaded = true;
2545
2521
  this.container = this.getAttribute("container");
2522
+ const skeletonHTML = `
2523
+ <div>
2524
+ <h1>Dynamic Content</h1>
2525
+ <p>This content was dynamically added to the widget before it loaded.</p>
2526
+ <p>This content comes from the embedded widget class</p>
2527
+ </div>
2528
+ `;
2529
+ const skeletonContainer = document.createElement("div");
2530
+ skeletonContainer.id = "loading-skeleton";
2531
+ skeletonContainer.innerHTML = skeletonHTML;
2532
+ const root = this.shadowRoot || this.attachShadow({ mode: "open" });
2533
+ root.innerHTML = "";
2534
+ root.appendChild(skeletonContainer);
2546
2535
  await this.renderWidget();
2536
+ const loadingElement = root.getElementById("loading-skeleton");
2537
+ if (loadingElement) {
2538
+ loadingElement.remove();
2539
+ console.log("Skeleton removed successfully");
2540
+ } else {
2541
+ console.warn("Could not find skeleton to remove");
2542
+ }
2547
2543
  if (this.getAttribute("open") !== null) this.open();
2548
2544
  }
2549
2545
  }