@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.
@@ -209,6 +209,26 @@ function removeNodeFromTree(children, id) {
209
209
  return node;
210
210
  });
211
211
  }
212
+ function pruneEmptyGroups(children) {
213
+ const prunedGroupIds = /* @__PURE__ */ new Set();
214
+ const walk = (nodes) => {
215
+ const next = [];
216
+ for (const node of nodes) {
217
+ if (isGroup(node)) {
218
+ const prunedChildren = walk(node.children);
219
+ if (prunedChildren.length === 0) {
220
+ prunedGroupIds.add(node.id);
221
+ continue;
222
+ }
223
+ next.push({ ...node, children: prunedChildren });
224
+ } else {
225
+ next.push(node);
226
+ }
227
+ }
228
+ return next;
229
+ };
230
+ return { children: walk(children), prunedGroupIds };
231
+ }
212
232
  function addNodeToTree(children, node, parentId, index) {
213
233
  if (!parentId) {
214
234
  if (index !== void 0) {
@@ -1522,8 +1542,16 @@ const useEditorStore = zustand.create((set, get) => ({
1522
1542
  if (rootLevelIds.has(id)) ;
1523
1543
  nextChildren = removeNodeFromTree(nextChildren, id);
1524
1544
  }
1545
+ const { children: prunedChildren, prunedGroupIds } = pruneEmptyGroups(nextChildren);
1546
+ nextChildren = prunedChildren;
1547
+ for (const gid of prunedGroupIds) {
1548
+ allDeletedIds.add(gid);
1549
+ if (rootLevelIds.has(gid)) ;
1550
+ }
1525
1551
  let nextCanvas = updateCurrentPageChildren(state.canvas, () => nextChildren);
1526
- nextCanvas.selectedIds = state.canvas.selectedIds.filter((id) => !ids.includes(id));
1552
+ nextCanvas.selectedIds = state.canvas.selectedIds.filter(
1553
+ (id) => !ids.includes(id) && !prunedGroupIds.has(id)
1554
+ );
1527
1555
  if (nextCanvas.themeConfig) {
1528
1556
  const remainingProps = nextCanvas.themeConfig.properties.filter((p) => !allDeletedIds.has(p.elementId));
1529
1557
  if (remainingProps.length !== nextCanvas.themeConfig.properties.length) {
@@ -24015,9 +24043,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24015
24043
  }
24016
24044
  return svgString;
24017
24045
  }
24018
- const resolvedPackageVersion = "0.5.300";
24046
+ const resolvedPackageVersion = "0.5.301";
24019
24047
  const PACKAGE_VERSION = resolvedPackageVersion;
24020
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.300";
24048
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.301";
24021
24049
  const roundParityValue = (value) => {
24022
24050
  if (typeof value !== "number") return value;
24023
24051
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24831,7 +24859,7 @@ class PixldocsRenderer {
24831
24859
  await this.waitForCanvasScene(container, cloned, i);
24832
24860
  }
24833
24861
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24834
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BVHpWHXp.cjs"));
24862
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-hHMDys-j.cjs"));
24835
24863
  const prepared = preparePagesForExport(
24836
24864
  cloned.pages,
24837
24865
  canvasWidth,
@@ -27151,7 +27179,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27151
27179
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27152
27180
  sanitizeSvgTreeForPdf(svgToDraw);
27153
27181
  try {
27154
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BVHpWHXp.cjs"));
27182
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-hHMDys-j.cjs"));
27155
27183
  try {
27156
27184
  await logTextMeasurementDiagnostic(svgToDraw);
27157
27185
  } catch {
@@ -27548,4 +27576,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
27548
27576
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
27549
27577
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
27550
27578
  exports.warmTemplateFromForm = warmTemplateFromForm;
27551
- //# sourceMappingURL=index-eWyfu-3k.cjs.map
27579
+ //# sourceMappingURL=index-BUG1_dx7.cjs.map