@pixldocs/canvas-renderer 0.5.165 → 0.5.167

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.
@@ -16036,9 +16036,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
16036
16036
  }
16037
16037
  return svgString;
16038
16038
  }
16039
- const resolvedPackageVersion = "0.5.165";
16039
+ const resolvedPackageVersion = "0.5.167";
16040
16040
  const PACKAGE_VERSION = resolvedPackageVersion;
16041
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.165";
16041
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.167";
16042
16042
  const roundParityValue = (value) => {
16043
16043
  if (typeof value !== "number") return value;
16044
16044
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -16473,7 +16473,7 @@ class PixldocsRenderer {
16473
16473
  await this.waitForCanvasScene(container, cloned, i);
16474
16474
  }
16475
16475
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
16476
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-aWseupbk.cjs"));
16476
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BayOs-9z.cjs"));
16477
16477
  const prepared = preparePagesForExport(
16478
16478
  cloned.pages,
16479
16479
  canvasWidth,
@@ -18575,7 +18575,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
18575
18575
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
18576
18576
  sanitizeSvgTreeForPdf(svgToDraw);
18577
18577
  try {
18578
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-aWseupbk.cjs"));
18578
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BayOs-9z.cjs"));
18579
18579
  try {
18580
18580
  await logTextMeasurementDiagnostic(svgToDraw);
18581
18581
  } catch {
@@ -18781,6 +18781,56 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
18781
18781
  pages: svgResults.map((p) => ({ width: p.width, height: p.height }))
18782
18782
  };
18783
18783
  }
18784
+ const SELECT_COLUMNS = "id,name,description,category,thumbnail_url,preview_images,price,download_count,workspace_id,sort_order,created_at,updated_at";
18785
+ async function listPublishedTemplates(options) {
18786
+ const { workspaceId, supabaseUrl, supabaseAnonKey, category, limit = 200, offset = 0 } = options;
18787
+ if (!workspaceId) throw new Error("listPublishedTemplates: workspaceId is required");
18788
+ if (!supabaseUrl || !supabaseAnonKey) {
18789
+ throw new Error("listPublishedTemplates: supabaseUrl and supabaseAnonKey are required");
18790
+ }
18791
+ const params = new URLSearchParams({
18792
+ select: SELECT_COLUMNS,
18793
+ workspace_id: `eq.${workspaceId}`,
18794
+ status: "eq.published",
18795
+ order: "sort_order.asc,updated_at.desc",
18796
+ limit: String(limit),
18797
+ offset: String(offset)
18798
+ });
18799
+ if (category) params.set("category", `eq.${category}`);
18800
+ const url = `${supabaseUrl.replace(/\/$/, "")}/rest/v1/templates?${params.toString()}`;
18801
+ const res = await fetch(url, {
18802
+ headers: {
18803
+ apikey: supabaseAnonKey,
18804
+ Authorization: `Bearer ${supabaseAnonKey}`,
18805
+ Accept: "application/json"
18806
+ }
18807
+ });
18808
+ if (!res.ok) {
18809
+ const text = await res.text().catch(() => "");
18810
+ throw new Error(`listPublishedTemplates failed: ${res.status} ${text}`);
18811
+ }
18812
+ return await res.json();
18813
+ }
18814
+ async function getPublishedTemplate(options) {
18815
+ const { templateId, supabaseUrl, supabaseAnonKey } = options;
18816
+ const params = new URLSearchParams({
18817
+ select: SELECT_COLUMNS,
18818
+ id: `eq.${templateId}`,
18819
+ status: "eq.published",
18820
+ limit: "1"
18821
+ });
18822
+ const url = `${supabaseUrl.replace(/\/$/, "")}/rest/v1/templates?${params.toString()}`;
18823
+ const res = await fetch(url, {
18824
+ headers: {
18825
+ apikey: supabaseAnonKey,
18826
+ Authorization: `Bearer ${supabaseAnonKey}`,
18827
+ Accept: "application/json"
18828
+ }
18829
+ });
18830
+ if (!res.ok) return null;
18831
+ const rows = await res.json();
18832
+ return rows[0] ?? null;
18833
+ }
18784
18834
  function collectImageUrls(config) {
18785
18835
  const urls = [];
18786
18836
  const walk = (nodes) => {
@@ -18901,6 +18951,7 @@ exports.getCanvasForPage = getCanvasForPage;
18901
18951
  exports.getEmbeddedJsPDFFontName = getEmbeddedJsPDFFontName;
18902
18952
  exports.getImageProxyFetchOptions = getImageProxyFetchOptions;
18903
18953
  exports.getProxiedImageUrl = getProxiedImageUrl;
18954
+ exports.getPublishedTemplate = getPublishedTemplate;
18904
18955
  exports.getRoundedRectRadii = getRoundedRectRadii;
18905
18956
  exports.getTrianglePoints = getTrianglePoints;
18906
18957
  exports.hasEdgeFade = hasEdgeFade;
@@ -18909,6 +18960,7 @@ exports.isElement = isElement;
18909
18960
  exports.isFontAvailable = isFontAvailable;
18910
18961
  exports.isGroup = isGroup;
18911
18962
  exports.isPrivateUrl = isPrivateUrl;
18963
+ exports.listPublishedTemplates = listPublishedTemplates;
18912
18964
  exports.loadGoogleFontCSS = loadGoogleFontCSS;
18913
18965
  exports.normalizeFontFamily = normalizeFontFamily;
18914
18966
  exports.normalizeShapeType = normalizeShapeType;
@@ -18922,4 +18974,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
18922
18974
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
18923
18975
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
18924
18976
  exports.warmTemplateFromForm = warmTemplateFromForm;
18925
- //# sourceMappingURL=index-B8sm4VZ8.cjs.map
18977
+ //# sourceMappingURL=index-CQEAcApH.cjs.map