@yoamigo.com/core 0.3.11 → 0.3.12

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.
Files changed (3) hide show
  1. package/dist/index.js +20 -10
  2. package/dist/lib.js +20 -10
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -697,7 +697,6 @@ var BuilderSelectionManager = class {
697
697
  // Full resolution
698
698
  logging: false,
699
699
  useCORS: true,
700
- allowTaint: true,
701
700
  backgroundColor: null,
702
701
  // No background - preserve page's actual background
703
702
  windowHeight: document.body.scrollHeight,
@@ -753,7 +752,6 @@ var BuilderSelectionManager = class {
753
752
  scale: 1,
754
753
  logging: false,
755
754
  useCORS: true,
756
- allowTaint: true,
757
755
  backgroundColor: null
758
756
  // Preserve transparency if any
759
757
  });
@@ -961,36 +959,46 @@ var BuilderSelectionManager = class {
961
959
  ;
962
960
  el.style.display = "none";
963
961
  });
962
+ const scrollHeight = document.body.scrollHeight;
963
+ console.log("[BuilderSelection] capturePageAsArrayBuffer - scrollHeight:", scrollHeight);
964
964
  const canvas = await html2canvas(document.body, {
965
965
  scale: 1,
966
966
  // Full resolution
967
- logging: false,
967
+ logging: true,
968
+ // Enable logging for debugging
968
969
  useCORS: true,
969
- allowTaint: true,
970
- backgroundColor: null,
971
- // No background - preserve page's actual background
972
- windowHeight: document.body.scrollHeight,
970
+ backgroundColor: "#ffffff",
971
+ // White background to avoid transparent canvas issues
972
+ windowHeight: scrollHeight,
973
973
  // Full page height
974
- height: document.body.scrollHeight,
974
+ height: scrollHeight,
975
975
  scrollX: 0,
976
976
  // Render from left (no visible scroll)
977
977
  scrollY: 0,
978
978
  // Render from top (no visible scroll)
979
979
  onclone: async (clonedDoc) => {
980
- clonedDoc.querySelectorAll('img[loading="lazy"]').forEach((img) => {
980
+ console.log("[BuilderSelection] onclone called");
981
+ const lazyImages = clonedDoc.querySelectorAll('img[loading="lazy"]');
982
+ console.log("[BuilderSelection] Found lazy images:", lazyImages.length);
983
+ lazyImages.forEach((img) => {
981
984
  img.removeAttribute("loading");
982
985
  });
986
+ const allImages = Array.from(clonedDoc.querySelectorAll("img"));
987
+ console.log("[BuilderSelection] Total images to wait for:", allImages.length);
983
988
  await Promise.all(
984
- Array.from(clonedDoc.querySelectorAll("img")).map(
989
+ allImages.map(
985
990
  (img) => img.complete && img.naturalHeight !== 0 ? Promise.resolve() : new Promise((r) => {
986
991
  img.onload = r;
987
992
  img.onerror = r;
988
993
  })
989
994
  )
990
995
  );
996
+ console.log("[BuilderSelection] All images loaded");
991
997
  await clonedDoc.fonts?.ready;
998
+ console.log("[BuilderSelection] Fonts ready");
992
999
  }
993
1000
  });
1001
+ console.log("[BuilderSelection] Canvas created:", canvas.width, "x", canvas.height);
994
1002
  overlays.forEach((el) => {
995
1003
  ;
996
1004
  el.style.display = "";
@@ -1002,7 +1010,9 @@ var BuilderSelectionManager = class {
1002
1010
  console.error("[BuilderSelection] Failed to create blob from canvas");
1003
1011
  return null;
1004
1012
  }
1013
+ console.log("[BuilderSelection] Blob created, size:", blob.size, "bytes");
1005
1014
  const buffer = await blob.arrayBuffer();
1015
+ console.log("[BuilderSelection] ArrayBuffer ready, size:", buffer.byteLength);
1006
1016
  return buffer;
1007
1017
  } catch (error) {
1008
1018
  console.error("[BuilderSelection] Page capture failed:", error);
package/dist/lib.js CHANGED
@@ -656,7 +656,6 @@ var BuilderSelectionManager = class {
656
656
  // Full resolution
657
657
  logging: false,
658
658
  useCORS: true,
659
- allowTaint: true,
660
659
  backgroundColor: null,
661
660
  // No background - preserve page's actual background
662
661
  windowHeight: document.body.scrollHeight,
@@ -712,7 +711,6 @@ var BuilderSelectionManager = class {
712
711
  scale: 1,
713
712
  logging: false,
714
713
  useCORS: true,
715
- allowTaint: true,
716
714
  backgroundColor: null
717
715
  // Preserve transparency if any
718
716
  });
@@ -920,36 +918,46 @@ var BuilderSelectionManager = class {
920
918
  ;
921
919
  el.style.display = "none";
922
920
  });
921
+ const scrollHeight = document.body.scrollHeight;
922
+ console.log("[BuilderSelection] capturePageAsArrayBuffer - scrollHeight:", scrollHeight);
923
923
  const canvas = await html2canvas(document.body, {
924
924
  scale: 1,
925
925
  // Full resolution
926
- logging: false,
926
+ logging: true,
927
+ // Enable logging for debugging
927
928
  useCORS: true,
928
- allowTaint: true,
929
- backgroundColor: null,
930
- // No background - preserve page's actual background
931
- windowHeight: document.body.scrollHeight,
929
+ backgroundColor: "#ffffff",
930
+ // White background to avoid transparent canvas issues
931
+ windowHeight: scrollHeight,
932
932
  // Full page height
933
- height: document.body.scrollHeight,
933
+ height: scrollHeight,
934
934
  scrollX: 0,
935
935
  // Render from left (no visible scroll)
936
936
  scrollY: 0,
937
937
  // Render from top (no visible scroll)
938
938
  onclone: async (clonedDoc) => {
939
- clonedDoc.querySelectorAll('img[loading="lazy"]').forEach((img) => {
939
+ console.log("[BuilderSelection] onclone called");
940
+ const lazyImages = clonedDoc.querySelectorAll('img[loading="lazy"]');
941
+ console.log("[BuilderSelection] Found lazy images:", lazyImages.length);
942
+ lazyImages.forEach((img) => {
940
943
  img.removeAttribute("loading");
941
944
  });
945
+ const allImages = Array.from(clonedDoc.querySelectorAll("img"));
946
+ console.log("[BuilderSelection] Total images to wait for:", allImages.length);
942
947
  await Promise.all(
943
- Array.from(clonedDoc.querySelectorAll("img")).map(
948
+ allImages.map(
944
949
  (img) => img.complete && img.naturalHeight !== 0 ? Promise.resolve() : new Promise((r) => {
945
950
  img.onload = r;
946
951
  img.onerror = r;
947
952
  })
948
953
  )
949
954
  );
955
+ console.log("[BuilderSelection] All images loaded");
950
956
  await clonedDoc.fonts?.ready;
957
+ console.log("[BuilderSelection] Fonts ready");
951
958
  }
952
959
  });
960
+ console.log("[BuilderSelection] Canvas created:", canvas.width, "x", canvas.height);
953
961
  overlays.forEach((el) => {
954
962
  ;
955
963
  el.style.display = "";
@@ -961,7 +969,9 @@ var BuilderSelectionManager = class {
961
969
  console.error("[BuilderSelection] Failed to create blob from canvas");
962
970
  return null;
963
971
  }
972
+ console.log("[BuilderSelection] Blob created, size:", blob.size, "bytes");
964
973
  const buffer = await blob.arrayBuffer();
974
+ console.log("[BuilderSelection] ArrayBuffer ready, size:", buffer.byteLength);
965
975
  return buffer;
966
976
  } catch (error) {
967
977
  console.error("[BuilderSelection] Page capture failed:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoamigo.com/core",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "Core components, router, and utilities for YoAmigo templates",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",