@yoamigo.com/core 0.4.4 → 0.4.6

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/index.js CHANGED
@@ -226,7 +226,7 @@ var BuilderSelectionManager = class {
226
226
  }
227
227
  break;
228
228
  case "GET_SCROLL_POSITION":
229
- this.sendToParent({ type: "SCROLL_POSITION", scrollY: window.scrollY });
229
+ this.sendToParent({ type: "SCROLL_POSITION", scrollX: window.scrollX, scrollY: window.scrollY });
230
230
  break;
231
231
  case "GET_ALL_ROUTES":
232
232
  this.sendToParent({ type: "ALL_ROUTES", routes: this.getAllRoutes() });
@@ -516,6 +516,13 @@ var BuilderSelectionManager = class {
516
516
  setupScrollResizeListeners() {
517
517
  window.addEventListener("scroll", this.updateSelectionPositions, { passive: true });
518
518
  window.addEventListener("resize", this.updateSelectionPositions, { passive: true });
519
+ window.addEventListener(
520
+ "scroll",
521
+ () => {
522
+ this.sendToParent({ type: "SCROLL_POSITION", scrollX: window.scrollX, scrollY: window.scrollY });
523
+ },
524
+ { passive: true }
525
+ );
519
526
  }
520
527
  setupKeyboardListener() {
521
528
  document.addEventListener("keydown", this.handleKeyDown);
@@ -753,8 +760,30 @@ var BuilderSelectionManager = class {
753
760
  scale: 1,
754
761
  logging: false,
755
762
  useCORS: true,
756
- backgroundColor: null
763
+ backgroundColor: null,
757
764
  // Preserve transparency if any
765
+ windowHeight: document.body.scrollHeight,
766
+ // Full page height
767
+ height: document.body.scrollHeight,
768
+ // Full page height
769
+ scrollX: 0,
770
+ // Render from left (no visible scroll)
771
+ scrollY: 0,
772
+ // Render from top (no visible scroll)
773
+ onclone: async (clonedDoc) => {
774
+ clonedDoc.querySelectorAll('img[loading="lazy"]').forEach((img) => {
775
+ img.removeAttribute("loading");
776
+ });
777
+ await Promise.all(
778
+ Array.from(clonedDoc.querySelectorAll("img")).map(
779
+ (img) => img.complete && img.naturalHeight !== 0 ? Promise.resolve() : new Promise((r) => {
780
+ img.onload = r;
781
+ img.onerror = r;
782
+ })
783
+ )
784
+ );
785
+ await clonedDoc.fonts?.ready;
786
+ }
758
787
  });
759
788
  overlays.forEach((el) => {
760
789
  ;
package/dist/lib.js CHANGED
@@ -185,7 +185,7 @@ var BuilderSelectionManager = class {
185
185
  }
186
186
  break;
187
187
  case "GET_SCROLL_POSITION":
188
- this.sendToParent({ type: "SCROLL_POSITION", scrollY: window.scrollY });
188
+ this.sendToParent({ type: "SCROLL_POSITION", scrollX: window.scrollX, scrollY: window.scrollY });
189
189
  break;
190
190
  case "GET_ALL_ROUTES":
191
191
  this.sendToParent({ type: "ALL_ROUTES", routes: this.getAllRoutes() });
@@ -475,6 +475,13 @@ var BuilderSelectionManager = class {
475
475
  setupScrollResizeListeners() {
476
476
  window.addEventListener("scroll", this.updateSelectionPositions, { passive: true });
477
477
  window.addEventListener("resize", this.updateSelectionPositions, { passive: true });
478
+ window.addEventListener(
479
+ "scroll",
480
+ () => {
481
+ this.sendToParent({ type: "SCROLL_POSITION", scrollX: window.scrollX, scrollY: window.scrollY });
482
+ },
483
+ { passive: true }
484
+ );
478
485
  }
479
486
  setupKeyboardListener() {
480
487
  document.addEventListener("keydown", this.handleKeyDown);
@@ -712,8 +719,30 @@ var BuilderSelectionManager = class {
712
719
  scale: 1,
713
720
  logging: false,
714
721
  useCORS: true,
715
- backgroundColor: null
722
+ backgroundColor: null,
716
723
  // Preserve transparency if any
724
+ windowHeight: document.body.scrollHeight,
725
+ // Full page height
726
+ height: document.body.scrollHeight,
727
+ // Full page height
728
+ scrollX: 0,
729
+ // Render from left (no visible scroll)
730
+ scrollY: 0,
731
+ // Render from top (no visible scroll)
732
+ onclone: async (clonedDoc) => {
733
+ clonedDoc.querySelectorAll('img[loading="lazy"]').forEach((img) => {
734
+ img.removeAttribute("loading");
735
+ });
736
+ await Promise.all(
737
+ Array.from(clonedDoc.querySelectorAll("img")).map(
738
+ (img) => img.complete && img.naturalHeight !== 0 ? Promise.resolve() : new Promise((r) => {
739
+ img.onload = r;
740
+ img.onerror = r;
741
+ })
742
+ )
743
+ );
744
+ await clonedDoc.fonts?.ready;
745
+ }
717
746
  });
718
747
  overlays.forEach((el) => {
719
748
  ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoamigo.com/core",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Core components, router, and utilities for YoAmigo templates",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",