@pixldocs/canvas-renderer 0.5.231 → 0.5.232

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.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-BbgFuxwu.cjs");
3
+ const index = require("./index-BqnHjSp9.cjs");
4
4
  exports.DEPLOYMENT_VERSION_MARKER = index.DEPLOYMENT_VERSION_MARKER;
5
5
  exports.FONT_FALLBACK_DEVANAGARI = index.FONT_FALLBACK_DEVANAGARI;
6
6
  exports.FONT_FALLBACK_MATH = index.FONT_FALLBACK_MATH;
@@ -37,6 +37,7 @@ exports.loadGoogleFontCSS = index.loadGoogleFontCSS;
37
37
  exports.normalizeFontFamily = index.normalizeFontFamily;
38
38
  exports.resolveBlurElementExactIdsFromFlatFormKeys = index.resolveBlurElementExactIdsFromFlatFormKeys;
39
39
  exports.resolveFontWeight = index.resolveFontWeight;
40
+ exports.resolveForRender = index.resolveForRender;
40
41
  exports.resolveFromForm = index.resolveFromForm;
41
42
  exports.resolveTemplateData = index.resolveTemplateData;
42
43
  exports.rewriteSvgFontsForJsPDF = index.rewriteSvgFontsForJsPDF;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -821,6 +821,56 @@ export declare interface ResolvedTemplate {
821
821
 
822
822
  export declare function resolveFontWeight(weight: number): number;
823
823
 
824
+ /**
825
+ * Single source of truth for "input → resolved TemplateConfig".
826
+ *
827
+ * Strategy (matches the harness branches it replaces, in priority order):
828
+ * 1. `templateConfig` present → use it verbatim.
829
+ * 2. `formSchemaId` OR non-empty `sectionState` → V2 `resolveFromForm`.
830
+ * 3. `prefetched.templateRow.config` present → V2 `resolveFromForm`
831
+ * (sectionState forwarded only when truly populated — avoids the
832
+ * flatFormData-as-sectionState bug that left dynamic text stale).
833
+ * 4. Otherwise → legacy flat `resolveTemplateData`.
834
+ *
835
+ * Returns a fully resolved `TemplateConfig` ready to hand to
836
+ * `PixldocsRenderer.renderAllPages` / `renderPdf` / `PixldocsPreview`.
837
+ */
838
+ export declare function resolveForRender(input: ResolveForRenderInput): Promise<{
839
+ config: TemplateConfig;
840
+ templateName: string;
841
+ templateId?: string;
842
+ price?: number;
843
+ }>;
844
+
845
+ /**
846
+ * `ResolveForRenderInput` — superset of every input variant the renderer
847
+ * accepts. The EC2 harness, local PixldocsPreview, and any external embedder
848
+ * all build one of these and call `resolveForRender`. Branch selection lives
849
+ * here (and ONLY here) — no caller should ever pick between
850
+ * `resolveTemplateData` / `resolveFromForm` / `renderById` again.
851
+ */
852
+ export declare interface ResolveForRenderInput {
853
+ /** Pre-resolved config (no resolution needed). Highest priority. */
854
+ templateConfig?: TemplateConfig;
855
+ /** Template row id (required when `templateConfig` is not provided). */
856
+ templateId?: string;
857
+ /** Optional saved form schema id (V2 path). */
858
+ formSchemaId?: string;
859
+ /** V2 nested section state, keyed by section id. */
860
+ sectionState?: SectionFormState;
861
+ /** Flat field map (`field_key → value`) — legacy/manual-fields path. */
862
+ flatFormData?: Record<string, any>;
863
+ /** Optional theme to apply post-resolve. */
864
+ themeId?: string;
865
+ /** Optional watermark passthrough (V2 form path). */
866
+ watermark?: ResolveFromFormOptions['watermark'];
867
+ /** Optional prefetched template/form/theme rows (skips Supabase reads). */
868
+ prefetched?: ResolveFromFormOptions['prefetched'];
869
+ /** Supabase config — required for any path that fetches rows. */
870
+ supabaseUrl?: string;
871
+ supabaseAnonKey?: string;
872
+ }
873
+
824
874
  /**
825
875
  * Resolve a template using the V2 sectionState format.
826
876
  * This is the primary API for external consumers and matches the server's /render-from-form pipeline.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, M, b, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5 } from "./index-YHIa8GZv.js";
1
+ import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, M, b, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6 } from "./index-DlrTh8y7.js";
2
2
  export {
3
3
  D as DEPLOYMENT_VERSION_MARKER,
4
4
  F as FONT_FALLBACK_DEVANAGARI,
@@ -36,12 +36,13 @@ export {
36
36
  Y as normalizeFontFamily,
37
37
  Z as resolveBlurElementExactIdsFromFlatFormKeys,
38
38
  _ as resolveFontWeight,
39
- $ as resolveFromForm,
40
- a0 as resolveTemplateData,
41
- a1 as rewriteSvgFontsForJsPDF,
42
- a2 as setAutoShrinkDebug,
43
- a3 as setBundledAssetPrefixes,
44
- a4 as warmResolvedTemplateForPreview,
45
- a5 as warmTemplateFromForm
39
+ $ as resolveForRender,
40
+ a0 as resolveFromForm,
41
+ a1 as resolveTemplateData,
42
+ a2 as rewriteSvgFontsForJsPDF,
43
+ a3 as setAutoShrinkDebug,
44
+ a4 as setBundledAssetPrefixes,
45
+ a5 as warmResolvedTemplateForPreview,
46
+ a6 as warmTemplateFromForm
46
47
  };
47
48
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import { jsPDF, ShadingPattern } from "jspdf";
2
2
  import { svg2pdf } from "svg2pdf.js";
3
3
  import * as fabric from "fabric";
4
- import { p as parseTextMarkdown, r as renderSmartElementToSvg, g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, b as getProxiedImageUrl, d as getImageProxyFetchOptions, A as API_URL, n as normalizeShapeType, i as isElement, e as isGroup, h as buildRoundedTrianglePath, j as hasEdgeFade, k as bakeEdgeFade, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-YHIa8GZv.js";
4
+ import { p as parseTextMarkdown, r as renderSmartElementToSvg, g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, b as getProxiedImageUrl, d as getImageProxyFetchOptions, A as API_URL, n as normalizeShapeType, i as isElement, e as isGroup, h as buildRoundedTrianglePath, j as hasEdgeFade, k as bakeEdgeFade, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-DlrTh8y7.js";
5
5
  import { resetPdfFontRegistry, FONT_FALLBACK_SYMBOLS, FONT_FALLBACK_MATH, FONT_FALLBACK_DEVANAGARI, embedFontWithGoogleFallback, getEmbeddedVariantsList, isFontAvailable, isFamilyEmbedded, resolveBestRegisteredVariant, getEmbeddedJsPDFFontName, resolveFontWeight, doesVariantSupportChar } from "./pdfFonts-DhEaMTZl.js";
6
6
  async function embedFontsForSvg(pdf, svgStr) {
7
7
  var _a;
@@ -3252,7 +3252,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
3252
3252
  async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
3253
3253
  if (!colorMap || Object.keys(colorMap).length === 0) return null;
3254
3254
  try {
3255
- const { getNormalizedSvgUrl } = await import("./index-YHIa8GZv.js").then((n) => n.a6);
3255
+ const { getNormalizedSvgUrl } = await import("./index-DlrTh8y7.js").then((n) => n.a7);
3256
3256
  return await getNormalizedSvgUrl(imageUrl, colorMap);
3257
3257
  } catch {
3258
3258
  return null;
@@ -4061,7 +4061,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
4061
4061
  }
4062
4062
  let fetchUrl = imageUrl;
4063
4063
  if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
4064
- const { isPrivateUrl } = await import("./index-YHIa8GZv.js").then((n) => n.a6);
4064
+ const { isPrivateUrl } = await import("./index-DlrTh8y7.js").then((n) => n.a7);
4065
4065
  if (isPrivateUrl(imageUrl)) return null;
4066
4066
  const proxyUrl = new URL(`${API_URL}/image-proxy`);
4067
4067
  proxyUrl.searchParams.set("url", imageUrl);
@@ -6175,4 +6175,4 @@ export {
6175
6175
  preparePagesForExport,
6176
6176
  rewriteSvgFontsForJsPDFWithSourceMeta
6177
6177
  };
6178
- //# sourceMappingURL=vectorPdfExport-ByHidrM_.js.map
6178
+ //# sourceMappingURL=vectorPdfExport-BcNEn5nI.js.map