@pixldocs/canvas-renderer 0.5.300 → 0.5.301

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.
@@ -191,6 +191,26 @@ function removeNodeFromTree(children, id) {
191
191
  return node;
192
192
  });
193
193
  }
194
+ function pruneEmptyGroups(children) {
195
+ const prunedGroupIds = /* @__PURE__ */ new Set();
196
+ const walk = (nodes) => {
197
+ const next = [];
198
+ for (const node of nodes) {
199
+ if (isGroup(node)) {
200
+ const prunedChildren = walk(node.children);
201
+ if (prunedChildren.length === 0) {
202
+ prunedGroupIds.add(node.id);
203
+ continue;
204
+ }
205
+ next.push({ ...node, children: prunedChildren });
206
+ } else {
207
+ next.push(node);
208
+ }
209
+ }
210
+ return next;
211
+ };
212
+ return { children: walk(children), prunedGroupIds };
213
+ }
194
214
  function addNodeToTree(children, node, parentId, index) {
195
215
  if (!parentId) {
196
216
  if (index !== void 0) {
@@ -1504,8 +1524,16 @@ const useEditorStore = create((set, get) => ({
1504
1524
  if (rootLevelIds.has(id)) ;
1505
1525
  nextChildren = removeNodeFromTree(nextChildren, id);
1506
1526
  }
1527
+ const { children: prunedChildren, prunedGroupIds } = pruneEmptyGroups(nextChildren);
1528
+ nextChildren = prunedChildren;
1529
+ for (const gid of prunedGroupIds) {
1530
+ allDeletedIds.add(gid);
1531
+ if (rootLevelIds.has(gid)) ;
1532
+ }
1507
1533
  let nextCanvas = updateCurrentPageChildren(state.canvas, () => nextChildren);
1508
- nextCanvas.selectedIds = state.canvas.selectedIds.filter((id) => !ids.includes(id));
1534
+ nextCanvas.selectedIds = state.canvas.selectedIds.filter(
1535
+ (id) => !ids.includes(id) && !prunedGroupIds.has(id)
1536
+ );
1509
1537
  if (nextCanvas.themeConfig) {
1510
1538
  const remainingProps = nextCanvas.themeConfig.properties.filter((p) => !allDeletedIds.has(p.elementId));
1511
1539
  if (remainingProps.length !== nextCanvas.themeConfig.properties.length) {
@@ -23997,9 +24025,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23997
24025
  }
23998
24026
  return svgString;
23999
24027
  }
24000
- const resolvedPackageVersion = "0.5.300";
24028
+ const resolvedPackageVersion = "0.5.301";
24001
24029
  const PACKAGE_VERSION = resolvedPackageVersion;
24002
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.300";
24030
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.301";
24003
24031
  const roundParityValue = (value) => {
24004
24032
  if (typeof value !== "number") return value;
24005
24033
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24813,7 +24841,7 @@ class PixldocsRenderer {
24813
24841
  await this.waitForCanvasScene(container, cloned, i);
24814
24842
  }
24815
24843
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24816
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Bgb4ctNH.js");
24844
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-wfJpS8kd.js");
24817
24845
  const prepared = preparePagesForExport(
24818
24846
  cloned.pages,
24819
24847
  canvasWidth,
@@ -27133,7 +27161,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27133
27161
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27134
27162
  sanitizeSvgTreeForPdf(svgToDraw);
27135
27163
  try {
27136
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Bgb4ctNH.js");
27164
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-wfJpS8kd.js");
27137
27165
  try {
27138
27166
  await logTextMeasurementDiagnostic(svgToDraw);
27139
27167
  } catch {
@@ -27533,4 +27561,4 @@ export {
27533
27561
  buildTeaserBlurFlatKeys as y,
27534
27562
  collectFontDescriptorsFromConfig as z
27535
27563
  };
27536
- //# sourceMappingURL=index-DSa_E6-5.js.map
27564
+ //# sourceMappingURL=index-CUodp3G_.js.map