@pixldocs/canvas-renderer 0.5.189 → 0.5.190

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.
@@ -13309,6 +13309,7 @@ function isStaticOnNewPage(node) {
13309
13309
  function cloneNodeWithNewIds(node) {
13310
13310
  const base = node.__baseNodeId;
13311
13311
  const source = node.__sourceId;
13312
+ const effectiveSource = source ?? node.id;
13312
13313
  if (isGroup(node)) {
13313
13314
  const g = node;
13314
13315
  const cloned2 = {
@@ -13317,14 +13318,14 @@ function cloneNodeWithNewIds(node) {
13317
13318
  children: (g.children ?? []).map(cloneNodeWithNewIds)
13318
13319
  };
13319
13320
  if (base != null) cloned2.__baseNodeId = base;
13320
- if (source != null) cloned2.__sourceId = source;
13321
+ cloned2.__sourceId = effectiveSource;
13321
13322
  return cloned2;
13322
13323
  }
13323
13324
  const el = node;
13324
13325
  const prefix = el.type === "text" ? "text" : el.type === "image" ? "img" : el.type === "shape" ? "shape" : "line";
13325
13326
  const cloned = { ...el, id: generateId(prefix) };
13326
13327
  if (base != null) cloned.__baseNodeId = base;
13327
- if (source != null) cloned.__sourceId = source;
13328
+ cloned.__sourceId = effectiveSource;
13328
13329
  return cloned;
13329
13330
  }
13330
13331
  function cloneNodeWithStableIds(node, baseId2, path) {
@@ -13630,7 +13631,51 @@ function applyContentBoundsPagination(config) {
13630
13631
  resultPages.push(...paginated);
13631
13632
  }
13632
13633
  if (!mutated) return config;
13633
- return { ...config, pages: resultPages };
13634
+ const next = { ...config, pages: resultPages };
13635
+ remapCloneIdMapAfterPagination(next);
13636
+ return next;
13637
+ }
13638
+ function remapCloneIdMapAfterPagination(config) {
13639
+ const cloneIdMap = config.__cloneIdMap;
13640
+ if (!cloneIdMap || typeof cloneIdMap !== "object") return;
13641
+ const allIds = /* @__PURE__ */ new Set();
13642
+ const sourceToNew = /* @__PURE__ */ new Map();
13643
+ const walk = (node) => {
13644
+ if (!node || typeof node !== "object") return;
13645
+ const n = node;
13646
+ if (typeof n.id === "string") {
13647
+ allIds.add(n.id);
13648
+ const src = n.__sourceId;
13649
+ if (typeof src === "string" && src !== n.id) {
13650
+ const arr = sourceToNew.get(src);
13651
+ if (arr) arr.push(n.id);
13652
+ else sourceToNew.set(src, [n.id]);
13653
+ }
13654
+ }
13655
+ const children = n.children;
13656
+ if (Array.isArray(children)) for (const c of children) walk(c);
13657
+ };
13658
+ for (const page of config.pages ?? []) {
13659
+ const ch = page.children;
13660
+ if (Array.isArray(ch)) for (const c of ch) walk(c);
13661
+ }
13662
+ const updated = {};
13663
+ for (const [key, val] of Object.entries(cloneIdMap)) {
13664
+ const oldIds = Array.isArray(val) ? val : [val];
13665
+ const newIds = [];
13666
+ for (const oid of oldIds) {
13667
+ if (typeof oid !== "string") continue;
13668
+ if (allIds.has(oid)) newIds.push(oid);
13669
+ const clones = sourceToNew.get(oid);
13670
+ if (clones) {
13671
+ for (const c of clones) if (allIds.has(c)) newIds.push(c);
13672
+ }
13673
+ }
13674
+ if (newIds.length === 0) continue;
13675
+ const uniq = Array.from(new Set(newIds));
13676
+ updated[key] = uniq.length === 1 ? uniq[0] : uniq;
13677
+ }
13678
+ config.__cloneIdMap = updated;
13634
13679
  }
13635
13680
  const __vite_import_meta_env__ = {};
13636
13681
  const FONT_WEIGHT_LABELS = {
@@ -16256,6 +16301,32 @@ function collectPageTreeElementIds(config, pageIndex = "all") {
16256
16301
  }
16257
16302
  return out;
16258
16303
  }
16304
+ function collectIdsBySourceMatch(config, targetIds, pageIndex = "all") {
16305
+ const targets = /* @__PURE__ */ new Set();
16306
+ for (const t of targetIds) if (typeof t === "string" && t) targets.add(t);
16307
+ if (targets.size === 0) return [];
16308
+ const pages = config == null ? void 0 : config.pages;
16309
+ if (!Array.isArray(pages)) return [];
16310
+ const visitPages = pageIndex === "all" ? pages : pages[pageIndex] != null ? [pages[pageIndex]] : [];
16311
+ const out = /* @__PURE__ */ new Set();
16312
+ const walk = (node) => {
16313
+ if (!node || typeof node !== "object") return;
16314
+ const src = typeof node.__sourceId === "string" ? node.__sourceId : void 0;
16315
+ const base = typeof node.__baseNodeId === "string" ? node.__baseNodeId : void 0;
16316
+ if (typeof node.id === "string") {
16317
+ if (targets.has(node.id)) out.add(node.id);
16318
+ else if (src && targets.has(src)) out.add(node.id);
16319
+ else if (base && targets.has(base)) out.add(node.id);
16320
+ }
16321
+ const children = node.children || node.elements;
16322
+ if (Array.isArray(children)) for (const c of children) walk(c);
16323
+ };
16324
+ for (const page of visitPages) {
16325
+ const children = (page == null ? void 0 : page.children) || (page == null ? void 0 : page.elements);
16326
+ if (Array.isArray(children)) for (const c of children) walk(c);
16327
+ }
16328
+ return Array.from(out);
16329
+ }
16259
16330
  function resolveBlurElementExactIdsFromFlatFormKeys(config, flatFormKeys, options) {
16260
16331
  const cloneIdMap = (config == null ? void 0 : config.__cloneIdMap) || {};
16261
16332
  if (!cloneIdMap || typeof cloneIdMap !== "object") return [];
@@ -16289,7 +16360,8 @@ function resolveBlurElementExactIdsFromFlatFormKeys(config, flatFormKeys, option
16289
16360
  if (treeIds.size === 0) return Array.from(out);
16290
16361
  const verified = [];
16291
16362
  for (const id of out) if (treeIds.has(id)) verified.push(id);
16292
- return verified;
16363
+ if (verified.length > 0) return verified;
16364
+ return collectIdsBySourceMatch(config, out, (options == null ? void 0 : options.pageIndex) ?? "all");
16293
16365
  }
16294
16366
  function buildTeaserBlurFlatKeys(sectionState, sections, options) {
16295
16367
  const afterRow = Math.max(0, options.afterRow | 0);
@@ -16817,9 +16889,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
16817
16889
  }
16818
16890
  return svgString;
16819
16891
  }
16820
- const resolvedPackageVersion = "0.5.189";
16892
+ const resolvedPackageVersion = "0.5.190";
16821
16893
  const PACKAGE_VERSION = resolvedPackageVersion;
16822
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.189";
16894
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.190";
16823
16895
  const roundParityValue = (value) => {
16824
16896
  if (typeof value !== "number") return value;
16825
16897
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -17327,7 +17399,7 @@ class PixldocsRenderer {
17327
17399
  await this.waitForCanvasScene(container, cloned, i);
17328
17400
  }
17329
17401
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
17330
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Ch-qwcNJ.js");
17402
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DFGqTzvI.js");
17331
17403
  const prepared = preparePagesForExport(
17332
17404
  cloned.pages,
17333
17405
  canvasWidth,
@@ -19472,7 +19544,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
19472
19544
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
19473
19545
  sanitizeSvgTreeForPdf(svgToDraw);
19474
19546
  try {
19475
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Ch-qwcNJ.js");
19547
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DFGqTzvI.js");
19476
19548
  try {
19477
19549
  await logTextMeasurementDiagnostic(svgToDraw);
19478
19550
  } catch {
@@ -19872,4 +19944,4 @@ export {
19872
19944
  buildTeaserBlurFlatKeys as y,
19873
19945
  collectFontDescriptorsFromConfig as z
19874
19946
  };
19875
- //# sourceMappingURL=index-lQXXPpb8.js.map
19947
+ //# sourceMappingURL=index-Dt4aPZtQ.js.map