@pixldocs/canvas-renderer 0.5.188 → 0.5.189

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.
@@ -16239,6 +16239,23 @@ function addAllToSet(val, out) {
16239
16239
  out.add(val);
16240
16240
  return true;
16241
16241
  }
16242
+ function collectPageTreeElementIds(config, pageIndex = "all") {
16243
+ const out = /* @__PURE__ */ new Set();
16244
+ const pages = config == null ? void 0 : config.pages;
16245
+ if (!Array.isArray(pages)) return out;
16246
+ const targets = pageIndex === "all" ? pages : pages[pageIndex] != null ? [pages[pageIndex]] : [];
16247
+ const walk = (node) => {
16248
+ if (!node || typeof node !== "object") return;
16249
+ if (typeof node.id === "string") out.add(node.id);
16250
+ const children = node.children || node.elements;
16251
+ if (Array.isArray(children)) for (const c of children) walk(c);
16252
+ };
16253
+ for (const page of targets) {
16254
+ const children = (page == null ? void 0 : page.children) || (page == null ? void 0 : page.elements);
16255
+ if (Array.isArray(children)) for (const c of children) walk(c);
16256
+ }
16257
+ return out;
16258
+ }
16242
16259
  function resolveBlurElementExactIdsFromFlatFormKeys(config, flatFormKeys, options) {
16243
16260
  const cloneIdMap = (config == null ? void 0 : config.__cloneIdMap) || {};
16244
16261
  if (!cloneIdMap || typeof cloneIdMap !== "object") return [];
@@ -16263,10 +16280,59 @@ function resolveBlurElementExactIdsFromFlatFormKeys(config, flatFormKeys, option
16263
16280
  }
16264
16281
  }
16265
16282
  }
16266
- return Array.from(out);
16283
+ if (out.size === 0) return [];
16284
+ if (options == null ? void 0 : options.skipTreeVerification) return Array.from(out);
16285
+ const treeIds = collectPageTreeElementIds(
16286
+ config,
16287
+ (options == null ? void 0 : options.pageIndex) ?? "all"
16288
+ );
16289
+ if (treeIds.size === 0) return Array.from(out);
16290
+ const verified = [];
16291
+ for (const id of out) if (treeIds.has(id)) verified.push(id);
16292
+ return verified;
16293
+ }
16294
+ function buildTeaserBlurFlatKeys(sectionState, sections, options) {
16295
+ const afterRow = Math.max(0, options.afterRow | 0);
16296
+ const bindings = options.bindings ?? "value";
16297
+ const out = [];
16298
+ if (!sectionState || !Array.isArray(sections)) return out;
16299
+ const repeatables = sections.filter((s) => (s == null ? void 0 : s.type) === "repeatable");
16300
+ const childrenByParent = /* @__PURE__ */ new Map();
16301
+ for (const r of repeatables) {
16302
+ if (!r.parentId) continue;
16303
+ const arr = childrenByParent.get(r.parentId) || [];
16304
+ arr.push(r);
16305
+ childrenByParent.set(r.parentId, arr);
16306
+ }
16307
+ const emitForEntryFields = (section, keyPrefix, entryIdx1) => {
16308
+ const fields = section.entryFields || [];
16309
+ for (const f of fields) {
16310
+ if (!(f == null ? void 0 : f.key)) continue;
16311
+ if (bindings === "value" && f.key !== "value") continue;
16312
+ out.push(`${keyPrefix}_${f.key}`);
16313
+ }
16314
+ };
16315
+ const walkRepeatable = (section, parentKeyPrefix) => {
16316
+ const entries = sectionState == null ? void 0 : sectionState[section.id];
16317
+ if (!Array.isArray(entries)) return;
16318
+ for (let i = 0; i < entries.length; i++) {
16319
+ const entryIdx1 = i + 1;
16320
+ const isBlurred = entryIdx1 > afterRow;
16321
+ const keyPrefix = parentKeyPrefix ? `${parentKeyPrefix}_field_${section.id}_${entryIdx1}` : `field_${section.id}_${entryIdx1}`;
16322
+ if (isBlurred) emitForEntryFields(section, keyPrefix);
16323
+ const children = childrenByParent.get(section.id) || [];
16324
+ for (const child of children) walkRepeatable(child, keyPrefix);
16325
+ }
16326
+ };
16327
+ for (const r of repeatables) {
16328
+ if (r.parentId) continue;
16329
+ walkRepeatable(r, "");
16330
+ }
16331
+ return out;
16267
16332
  }
16268
16333
  const previewBlur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
16269
16334
  __proto__: null,
16335
+ buildTeaserBlurFlatKeys,
16270
16336
  hasAnyPreviewBlur,
16271
16337
  injectPreviewBlur,
16272
16338
  resolveBlurElementExactIdsFromFlatFormKeys
@@ -16751,9 +16817,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
16751
16817
  }
16752
16818
  return svgString;
16753
16819
  }
16754
- const resolvedPackageVersion = "0.5.188";
16820
+ const resolvedPackageVersion = "0.5.189";
16755
16821
  const PACKAGE_VERSION = resolvedPackageVersion;
16756
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.188";
16822
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.189";
16757
16823
  const roundParityValue = (value) => {
16758
16824
  if (typeof value !== "number") return value;
16759
16825
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -17261,7 +17327,7 @@ class PixldocsRenderer {
17261
17327
  await this.waitForCanvasScene(container, cloned, i);
17262
17328
  }
17263
17329
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
17264
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CSh0zFox.js");
17330
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Ch-qwcNJ.js");
17265
17331
  const prepared = preparePagesForExport(
17266
17332
  cloned.pages,
17267
17333
  canvasWidth,
@@ -19406,7 +19472,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
19406
19472
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
19407
19473
  sanitizeSvgTreeForPdf(svgToDraw);
19408
19474
  try {
19409
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CSh0zFox.js");
19475
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Ch-qwcNJ.js");
19410
19476
  try {
19411
19477
  await logTextMeasurementDiagnostic(svgToDraw);
19412
19478
  } catch {
@@ -19744,41 +19810,42 @@ function setAutoShrinkDebug(enabled) {
19744
19810
  }
19745
19811
  }
19746
19812
  export {
19747
- resolveTemplateData as $,
19813
+ resolveFromForm as $,
19748
19814
  API_URL as A,
19749
- collectImageUrls as B,
19750
- configHasAutoShrinkText$1 as C,
19815
+ collectFontsFromConfig as B,
19816
+ collectImageUrls as C,
19751
19817
  DEPLOYMENT_VERSION_MARKER as D,
19752
- dumpSvgTextDiagnostics as E,
19818
+ configHasAutoShrinkText$1 as E,
19753
19819
  FONT_FALLBACK_DEVANAGARI as F,
19754
- embedFont as G,
19755
- embedFontsForConfig as H,
19756
- embedFontsInPdf as I,
19757
- ensureFontsForResolvedConfig as J,
19758
- extractFontFamiliesFromSvgs as K,
19759
- getEmbeddedJsPDFFontName as L,
19760
- getPublishedTemplate as M,
19761
- getTemplateForm as N,
19762
- hasAnyPreviewBlur as O,
19820
+ dumpSvgTextDiagnostics as G,
19821
+ embedFont as H,
19822
+ embedFontsForConfig as I,
19823
+ embedFontsInPdf as J,
19824
+ ensureFontsForResolvedConfig as K,
19825
+ extractFontFamiliesFromSvgs as L,
19826
+ getEmbeddedJsPDFFontName as M,
19827
+ getPublishedTemplate as N,
19828
+ getTemplateForm as O,
19763
19829
  PACKAGE_VERSION as P,
19764
- injectPreviewBlur as Q,
19765
- isBundledAssetUrl as R,
19766
- isFontAvailable as S,
19830
+ hasAnyPreviewBlur as Q,
19831
+ injectPreviewBlur as R,
19832
+ isBundledAssetUrl as S,
19767
19833
  TRIANGLE_STROKE_MITER_LIMIT as T,
19768
- isPrivateUrl as U,
19769
- listPublishedTemplates as V,
19770
- loadGoogleFontCSS as W,
19771
- normalizeFontFamily as X,
19772
- resolveBlurElementExactIdsFromFlatFormKeys as Y,
19773
- resolveFontWeight as Z,
19774
- resolveFromForm as _,
19834
+ isFontAvailable as U,
19835
+ isPrivateUrl as V,
19836
+ listPublishedTemplates as W,
19837
+ loadGoogleFontCSS as X,
19838
+ normalizeFontFamily as Y,
19839
+ resolveBlurElementExactIdsFromFlatFormKeys as Z,
19840
+ resolveFontWeight as _,
19775
19841
  getAbsoluteBounds as a,
19776
- rewriteSvgFontsForJsPDF as a0,
19777
- setAutoShrinkDebug as a1,
19778
- setBundledAssetPrefixes as a2,
19779
- warmResolvedTemplateForPreview as a3,
19780
- warmTemplateFromForm as a4,
19781
- canvasImageLoader as a5,
19842
+ resolveTemplateData as a0,
19843
+ rewriteSvgFontsForJsPDF as a1,
19844
+ setAutoShrinkDebug as a2,
19845
+ setBundledAssetPrefixes as a3,
19846
+ warmResolvedTemplateForPreview as a4,
19847
+ warmTemplateFromForm as a5,
19848
+ canvasImageLoader as a6,
19782
19849
  getProxiedImageUrl as b,
19783
19850
  captureFabricCanvasSvgForPdf as c,
19784
19851
  bakeEdgeFade as d,
@@ -19802,7 +19869,7 @@ export {
19802
19869
  applyThemeToConfig as v,
19803
19870
  assemblePdfFromSvgs as w,
19804
19871
  awaitFontsForConfig as x,
19805
- collectFontDescriptorsFromConfig as y,
19806
- collectFontsFromConfig as z
19872
+ buildTeaserBlurFlatKeys as y,
19873
+ collectFontDescriptorsFromConfig as z
19807
19874
  };
19808
- //# sourceMappingURL=index-CjZZhQH6.js.map
19875
+ //# sourceMappingURL=index-lQXXPpb8.js.map